@finos/legend-query-builder 0.4.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. package/lib/components/QueryBuilder.d.ts +1 -0
  2. package/lib/components/QueryBuilder.d.ts.map +1 -1
  3. package/lib/components/QueryBuilder.js +11 -2
  4. package/lib/components/QueryBuilder.js.map +1 -1
  5. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts +23 -0
  6. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -0
  7. package/lib/components/QueryBuilderConstantExpressionPanel.js +105 -0
  8. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -0
  9. package/lib/components/QueryBuilderDiffPanel.d.ts +1 -0
  10. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderDiffPanel.js +1 -2
  12. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderParametersPanel.d.ts +1 -9
  14. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  15. package/lib/components/QueryBuilderParametersPanel.js +10 -27
  16. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  17. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +1 -0
  18. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  19. package/lib/components/QueryBuilderPropertyExpressionEditor.js +60 -12
  20. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  21. package/lib/components/QueryBuilderResultPanel.d.ts +1 -0
  22. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  23. package/lib/components/QueryBuilderSideBar.d.ts +3 -1
  24. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  25. package/lib/components/QueryBuilderSideBar.js +6 -14
  26. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  27. package/lib/components/QueryBuilderTextEditor.d.ts +1 -0
  28. package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
  29. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +1 -0
  30. package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
  31. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +1 -0
  32. package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
  33. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +1 -0
  34. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  35. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +12 -18
  36. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  37. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +1 -0
  38. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
  39. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +1 -0
  40. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
  41. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +1 -0
  42. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  43. package/lib/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.d.ts → QueryBuilderOLAPGroupByPanel.d.ts} +3 -2
  44. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel.d.ts.map +1 -0
  45. package/lib/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.js → QueryBuilderOLAPGroupByPanel.js} +2 -2
  46. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel.js.map +1 -0
  47. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +1 -0
  48. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  49. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +9 -11
  50. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  51. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +1 -0
  52. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -1
  53. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js +1 -1
  54. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js.map +1 -1
  55. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +1 -0
  56. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  57. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +1 -0
  58. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  59. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +4 -4
  60. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  61. package/lib/components/filter/QueryBuilderFilterPanel.d.ts +1 -0
  62. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  63. package/lib/components/filter/QueryBuilderFilterPanel.js +8 -9
  64. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  65. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +12 -1
  66. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  67. package/lib/components/shared/BasicValueSpecificationEditor.js +11 -7
  68. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  69. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  70. package/lib/components/shared/CustomDatePicker.js +3 -3
  71. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  72. package/lib/components/shared/LambdaEditor.d.ts +1 -0
  73. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  74. package/lib/components/shared/LambdaEditor.js +1 -15
  75. package/lib/components/shared/LambdaEditor.js.map +1 -1
  76. package/lib/components/shared/LambdaParameterValuesEditor.d.ts +1 -0
  77. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  78. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +37 -0
  79. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -0
  80. package/lib/components/shared/QueryBuilderVariableSelector.js +53 -0
  81. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -0
  82. package/lib/components/watermark/QueryBuilderWatermark.d.ts +1 -0
  83. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  84. package/lib/components/watermark/QueryBuilderWatermark.js +9 -11
  85. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
  86. package/lib/graphManager/QueryBuilderHashUtils.d.ts +2 -0
  87. package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
  88. package/lib/graphManager/QueryBuilderHashUtils.js +2 -0
  89. package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
  90. package/lib/index.css +1 -17
  91. package/lib/index.css.map +1 -1
  92. package/lib/package.json +6 -6
  93. package/lib/stores/QueryBuilderConfig.d.ts +1 -0
  94. package/lib/stores/QueryBuilderConfig.d.ts.map +1 -1
  95. package/lib/stores/QueryBuilderConfig.js +1 -0
  96. package/lib/stores/QueryBuilderConfig.js.map +1 -1
  97. package/lib/stores/QueryBuilderConstantsState.d.ts +43 -0
  98. package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -0
  99. package/lib/stores/QueryBuilderConstantsState.js +116 -0
  100. package/lib/stores/QueryBuilderConstantsState.js.map +1 -0
  101. package/lib/stores/QueryBuilderParametersState.d.ts +0 -4
  102. package/lib/stores/QueryBuilderParametersState.d.ts.map +1 -1
  103. package/lib/stores/QueryBuilderParametersState.js +0 -1
  104. package/lib/stores/QueryBuilderParametersState.js.map +1 -1
  105. package/lib/stores/QueryBuilderPropertyEditorState.d.ts +3 -10
  106. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  107. package/lib/stores/QueryBuilderPropertyEditorState.js +6 -140
  108. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  109. package/lib/stores/QueryBuilderState.d.ts +10 -3
  110. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  111. package/lib/stores/QueryBuilderState.js +27 -4
  112. package/lib/stores/QueryBuilderState.js.map +1 -1
  113. package/lib/stores/QueryBuilderStateBuilder.d.ts +4 -3
  114. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  115. package/lib/stores/QueryBuilderStateBuilder.js +50 -42
  116. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  117. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  118. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +23 -25
  119. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  120. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
  121. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +14 -78
  122. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
  123. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +2 -1
  124. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  125. package/lib/stores/QueryBuilderValueSpecificationHelper.js +13 -20
  126. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  127. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +2 -1
  128. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  129. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  130. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +2 -1
  131. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  132. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +4 -0
  133. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  134. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts +3 -3
  135. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -1
  136. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +4 -4
  137. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -1
  138. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +3 -2
  139. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  140. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +15 -2
  141. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  142. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts +3 -3
  143. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -1
  144. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js +6 -6
  145. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -1
  146. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.d.ts → QueryBuilderOLAPGroupByOperatorLoader.d.ts} +1 -1
  147. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.d.ts.map +1 -0
  148. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.js → QueryBuilderOLAPGroupByOperatorLoader.js} +1 -1
  149. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.js.map +1 -0
  150. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.d.ts → QueryBuilderOLAPGroupByState.d.ts} +1 -1
  151. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.d.ts.map +1 -0
  152. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.js → QueryBuilderOLAPGroupByState.js} +1 -1
  153. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.js.map +1 -0
  154. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.d.ts → QueryBuilderOLAPGroupByStateBuilder.d.ts} +3 -3
  155. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.d.ts.map +1 -0
  156. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.js → QueryBuilderOLAPGroupByStateBuilder.js} +4 -4
  157. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.js.map +1 -0
  158. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.d.ts → QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts} +2 -2
  159. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts.map +1 -0
  160. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.js → QueryBuilderOLAPGroupByValueSpecificationBuilder.js} +2 -2
  161. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.js.map +1 -0
  162. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +2 -1
  163. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  164. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +9 -1
  165. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  166. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +1 -1
  167. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  168. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +2 -1
  169. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  170. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +4 -0
  171. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  172. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +5 -5
  173. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  174. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +10 -10
  175. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  176. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +1 -1
  177. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  178. package/lib/stores/filter/QueryBuilderFilterState.d.ts +2 -1
  179. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  180. package/lib/stores/filter/QueryBuilderFilterState.js +9 -1
  181. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  182. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts +2 -2
  183. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -1
  184. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js +6 -4
  185. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -1
  186. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +27 -0
  187. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -0
  188. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +93 -0
  189. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -0
  190. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +26 -0
  191. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -0
  192. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +60 -0
  193. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -0
  194. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts +70 -0
  195. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -0
  196. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +199 -0
  197. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -0
  198. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +49 -0
  199. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -0
  200. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js +24 -0
  201. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -0
  202. package/lib/stores/{QueryBuilderMilestoningState.d.ts → milestoning/QueryBuilderMilestoningState.d.ts} +7 -2
  203. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -0
  204. package/lib/stores/{QueryBuilderMilestoningState.js → milestoning/QueryBuilderMilestoningState.js} +30 -20
  205. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -0
  206. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +26 -0
  207. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -0
  208. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +55 -0
  209. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -0
  210. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +3 -1
  211. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  212. package/lib/stores/shared/ValueSpecificationEditorHelper.js +58 -2
  213. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  214. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts +2 -1
  215. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
  216. package/lib/stores/watermark/QueryBuilderWatermarkState.js +6 -0
  217. package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
  218. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts +2 -2
  219. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts.map +1 -1
  220. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js +2 -2
  221. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js.map +1 -1
  222. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts +2 -2
  223. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts.map +1 -1
  224. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js +7 -4
  225. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js.map +1 -1
  226. package/lib/stores/workflows/ServiceQueryBuilderState.js +1 -1
  227. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  228. package/package.json +13 -13
  229. package/src/components/QueryBuilder.tsx +38 -0
  230. package/src/components/QueryBuilderConstantExpressionPanel.tsx +291 -0
  231. package/src/components/QueryBuilderDiffPanel.tsx +0 -2
  232. package/src/components/QueryBuilderParametersPanel.tsx +29 -103
  233. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +119 -36
  234. package/src/components/QueryBuilderSideBar.tsx +5 -22
  235. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +29 -39
  236. package/src/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.tsx → QueryBuilderOLAPGroupByPanel.tsx} +1 -1
  237. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +18 -19
  238. package/src/components/fetch-structure/QueryBuilderPostTDSPanel.tsx +1 -1
  239. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +9 -9
  240. package/src/components/filter/QueryBuilderFilterPanel.tsx +16 -17
  241. package/src/components/shared/BasicValueSpecificationEditor.tsx +47 -22
  242. package/src/components/shared/CustomDatePicker.tsx +3 -2
  243. package/src/components/shared/LambdaEditor.tsx +0 -15
  244. package/src/components/shared/QueryBuilderVariableSelector.tsx +193 -0
  245. package/src/components/watermark/QueryBuilderWatermark.tsx +19 -31
  246. package/src/graphManager/QueryBuilderHashUtils.ts +2 -0
  247. package/src/stores/QueryBuilderConfig.ts +1 -0
  248. package/src/stores/QueryBuilderConstantsState.ts +173 -0
  249. package/src/stores/QueryBuilderParametersState.ts +0 -6
  250. package/src/stores/QueryBuilderPropertyEditorState.ts +6 -235
  251. package/src/stores/QueryBuilderState.ts +36 -4
  252. package/src/stores/QueryBuilderStateBuilder.ts +111 -52
  253. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +34 -51
  254. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +16 -105
  255. package/src/stores/QueryBuilderValueSpecificationHelper.ts +23 -29
  256. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +2 -0
  257. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +14 -2
  258. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +5 -0
  259. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +21 -4
  260. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.ts +7 -0
  261. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.ts → QueryBuilderOLAPGroupByOperatorLoader.ts} +0 -0
  262. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.ts → QueryBuilderOLAPGroupByState.ts} +0 -0
  263. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.ts → QueryBuilderOLAPGroupByStateBuilder.ts} +3 -1
  264. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.ts → QueryBuilderOLAPGroupByValueSpecificationBuilder.ts} +1 -1
  265. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +13 -0
  266. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +1 -1
  267. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +12 -0
  268. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +11 -0
  269. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +1 -1
  270. package/src/stores/filter/QueryBuilderFilterState.ts +13 -0
  271. package/src/stores/filter/QueryBuilderFilterValueSpecificationBuilder.ts +10 -5
  272. package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +165 -0
  273. package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +96 -0
  274. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +311 -0
  275. package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +77 -0
  276. package/src/stores/{QueryBuilderMilestoningState.ts → milestoning/QueryBuilderMilestoningState.ts} +66 -39
  277. package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +88 -0
  278. package/src/stores/shared/ValueSpecificationEditorHelper.ts +84 -2
  279. package/src/stores/watermark/QueryBuilderWatermarkState.ts +8 -0
  280. package/src/stores/watermark/QueryBuilderWatermarkStateBuilder.ts +3 -0
  281. package/src/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.ts +11 -5
  282. package/src/stores/workflows/ServiceQueryBuilderState.ts +1 -1
  283. package/tsconfig.json +14 -6
  284. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.d.ts.map +0 -1
  285. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.js.map +0 -1
  286. package/lib/stores/QueryBuilderMilestoningState.d.ts.map +0 -1
  287. package/lib/stores/QueryBuilderMilestoningState.js.map +0 -1
  288. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader_.d.ts.map +0 -1
  289. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader_.js.map +0 -1
  290. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder_.d.ts.map +0 -1
  291. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder_.js.map +0 -1
  292. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState_.d.ts.map +0 -1
  293. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState_.js.map +0 -1
  294. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder_.d.ts.map +0 -1
  295. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder_.js.map +0 -1
@@ -0,0 +1,165 @@
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
+ type ValueSpecification,
19
+ PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
20
+ BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
21
+ type SimpleFunctionExpression,
22
+ AbstractPropertyExpression,
23
+ MILESTONING_STEREOTYPE,
24
+ INTERNAL__PropagatedValue,
25
+ } from '@finos/legend-graph';
26
+ import {
27
+ assertTrue,
28
+ guaranteeNonNullable,
29
+ guaranteeType,
30
+ } from '@finos/legend-shared';
31
+ import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
32
+ import type { QueryBuilderDerivedPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
33
+ import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
34
+
35
+ export class QueryBuilderBitemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
36
+ getMilestoningDate(index?: number): ValueSpecification | undefined {
37
+ if (index === 0) {
38
+ return this.milestoningState.processingDate;
39
+ } else {
40
+ return this.milestoningState.businessDate;
41
+ }
42
+ }
43
+
44
+ getMilestoningToolTipText(): string {
45
+ return `Processing Date: ${getParameterValue(
46
+ this.getMilestoningDate(0),
47
+ )}, Business Date: ${getParameterValue(this.getMilestoningDate(1))}`;
48
+ }
49
+
50
+ initializeMilestoningParameters(force?: boolean): void {
51
+ if (!this.milestoningState.processingDate || force) {
52
+ this.milestoningState.setProcessingDate(
53
+ this.milestoningState.buildMilestoningParameter(
54
+ PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
55
+ ),
56
+ );
57
+ }
58
+ if (!this.milestoningState.businessDate || force) {
59
+ this.milestoningState.setBusinessDate(
60
+ this.milestoningState.buildMilestoningParameter(
61
+ BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
62
+ ),
63
+ );
64
+ }
65
+ }
66
+
67
+ processGetAllParamaters(parameterValues: ValueSpecification[]): void {
68
+ assertTrue(
69
+ parameterValues.length === 3,
70
+ `Can't process getAll() expression: when used with a bitemporal milestoned class getAll() expects two parameters`,
71
+ );
72
+ this.milestoningState.setProcessingDate(parameterValues[1]);
73
+ this.milestoningState.setBusinessDate(parameterValues[2]);
74
+ }
75
+
76
+ buildGetAllParameters(getAllFunction: SimpleFunctionExpression): void {
77
+ getAllFunction.parametersValues.push(
78
+ guaranteeNonNullable(
79
+ this.getMilestoningDate(0),
80
+ `Milestoning class should have a parameter of type 'Date'`,
81
+ ),
82
+ );
83
+ getAllFunction.parametersValues.push(
84
+ guaranteeNonNullable(
85
+ this.getMilestoningDate(1),
86
+ `Milestoning class should have a parameter of type 'Date'`,
87
+ ),
88
+ );
89
+ }
90
+
91
+ generateMilestoningDate(
92
+ isDatePropagationSupported: boolean,
93
+ hasDefaultMilestoningDate: boolean,
94
+ prevPropertyExpression: AbstractPropertyExpression | undefined,
95
+ temporalSource: MILESTONING_STEREOTYPE | undefined,
96
+ idx?: number,
97
+ derivedPropertyExpressionState?: QueryBuilderDerivedPropertyExpressionState,
98
+ ): ValueSpecification {
99
+ this.initializeMilestoningParameters();
100
+ if (idx === 0) {
101
+ if (
102
+ temporalSource === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL &&
103
+ derivedPropertyExpressionState?.parameterValues.length === 1
104
+ ) {
105
+ return new INTERNAL__PropagatedValue(() =>
106
+ guaranteeNonNullable(
107
+ guaranteeType(prevPropertyExpression, AbstractPropertyExpression)
108
+ .parametersValues[1],
109
+ ),
110
+ );
111
+ }
112
+ let parameter;
113
+ if (
114
+ isDatePropagationSupported &&
115
+ prevPropertyExpression &&
116
+ !hasDefaultMilestoningDate
117
+ ) {
118
+ parameter = new INTERNAL__PropagatedValue(() =>
119
+ guaranteeNonNullable(prevPropertyExpression.parametersValues[1]),
120
+ );
121
+ } else {
122
+ parameter = new INTERNAL__PropagatedValue(() =>
123
+ guaranteeNonNullable(this.getMilestoningDate(idx)),
124
+ );
125
+ parameter.isPropagatedValue = hasDefaultMilestoningDate
126
+ ? false
127
+ : isDatePropagationSupported;
128
+ }
129
+ return parameter;
130
+ } else {
131
+ if (
132
+ temporalSource === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL &&
133
+ derivedPropertyExpressionState?.parameterValues.length === 1
134
+ ) {
135
+ return new INTERNAL__PropagatedValue(() =>
136
+ guaranteeNonNullable(
137
+ guaranteeType(
138
+ derivedPropertyExpressionState.propertyExpression
139
+ .parametersValues[0],
140
+ AbstractPropertyExpression,
141
+ ).parametersValues[1],
142
+ ),
143
+ );
144
+ }
145
+ let parameter;
146
+ if (
147
+ isDatePropagationSupported &&
148
+ prevPropertyExpression &&
149
+ !hasDefaultMilestoningDate
150
+ ) {
151
+ parameter = new INTERNAL__PropagatedValue(() =>
152
+ guaranteeNonNullable(prevPropertyExpression.parametersValues[2]),
153
+ );
154
+ } else {
155
+ parameter = new INTERNAL__PropagatedValue(() =>
156
+ guaranteeNonNullable(this.getMilestoningDate(idx)),
157
+ );
158
+ parameter.isPropagatedValue = hasDefaultMilestoningDate
159
+ ? false
160
+ : isDatePropagationSupported;
161
+ }
162
+ return parameter;
163
+ }
164
+ }
165
+ }
@@ -0,0 +1,96 @@
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
+ type ValueSpecification,
19
+ BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
20
+ type SimpleFunctionExpression,
21
+ type AbstractPropertyExpression,
22
+ MILESTONING_STEREOTYPE,
23
+ INTERNAL__PropagatedValue,
24
+ } from '@finos/legend-graph';
25
+ import { assertTrue, guaranteeNonNullable } from '@finos/legend-shared';
26
+ import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
27
+ import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
28
+
29
+ export class QueryBuilderBusinessTemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
30
+ getMilestoningDate(): ValueSpecification | undefined {
31
+ return this.milestoningState.businessDate;
32
+ }
33
+
34
+ getMilestoningToolTipText(): string {
35
+ return `Business Date: ${getParameterValue(this.getMilestoningDate())}`;
36
+ }
37
+
38
+ initializeMilestoningParameters(force?: boolean): void {
39
+ if (!this.milestoningState.businessDate || force) {
40
+ this.milestoningState.setBusinessDate(
41
+ this.milestoningState.buildMilestoningParameter(
42
+ BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
43
+ ),
44
+ );
45
+ }
46
+ }
47
+
48
+ processGetAllParamaters(parameterValues: ValueSpecification[]): void {
49
+ assertTrue(
50
+ parameterValues.length === 2,
51
+ `Can't process getAll() expression: when used with a milestoned class getAll() expects a parameter`,
52
+ );
53
+ this.milestoningState.setBusinessDate(parameterValues[1]);
54
+ }
55
+
56
+ buildGetAllParameters(getAllFunction: SimpleFunctionExpression): void {
57
+ getAllFunction.parametersValues.push(
58
+ guaranteeNonNullable(
59
+ this.getMilestoningDate(),
60
+ `Milestoning class should have a parameter of type 'Date'`,
61
+ ),
62
+ );
63
+ }
64
+
65
+ generateMilestoningDate(
66
+ isDatePropagationSupported: boolean,
67
+ hasDefaultMilestoningDate: boolean,
68
+ prevPropertyExpression: AbstractPropertyExpression | undefined,
69
+ temporalSource: MILESTONING_STEREOTYPE | undefined,
70
+ ): ValueSpecification {
71
+ this.initializeMilestoningParameters();
72
+ if (
73
+ isDatePropagationSupported &&
74
+ prevPropertyExpression &&
75
+ !hasDefaultMilestoningDate
76
+ ) {
77
+ if (temporalSource === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL) {
78
+ return new INTERNAL__PropagatedValue(() =>
79
+ guaranteeNonNullable(prevPropertyExpression.parametersValues[1]),
80
+ );
81
+ } else {
82
+ return new INTERNAL__PropagatedValue(() =>
83
+ guaranteeNonNullable(prevPropertyExpression.parametersValues[2]),
84
+ );
85
+ }
86
+ } else {
87
+ const milestoningDate = new INTERNAL__PropagatedValue(() =>
88
+ guaranteeNonNullable(this.getMilestoningDate()),
89
+ );
90
+ milestoningDate.isPropagatedValue = hasDefaultMilestoningDate
91
+ ? false
92
+ : isDatePropagationSupported;
93
+ return milestoningDate;
94
+ }
95
+ }
96
+ }
@@ -0,0 +1,311 @@
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
+ AbstractPropertyExpression,
19
+ DerivedProperty,
20
+ Class,
21
+ MILESTONING_STEREOTYPE,
22
+ getMilestoneTemporalStereotype,
23
+ type ValueSpecification,
24
+ Association,
25
+ getGeneratedMilestonedPropertiesForAssociation,
26
+ PrimitiveInstanceValue,
27
+ PRIMITIVE_TYPE,
28
+ type PureModel,
29
+ VariableExpression,
30
+ } from '@finos/legend-graph';
31
+ import {
32
+ guaranteeNonNullable,
33
+ guaranteeType,
34
+ UnsupportedOperationError,
35
+ } from '@finos/legend-shared';
36
+ import type { QueryBuilderMilestoningState } from './QueryBuilderMilestoningState.js';
37
+ import type { QueryBuilderDerivedPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
38
+ import type { QueryBuilderState } from '../QueryBuilderState.js';
39
+
40
+ export const getDerivedPropertyMilestoningSteoreotype = (
41
+ property: DerivedProperty,
42
+ graph: PureModel,
43
+ ): MILESTONING_STEREOTYPE | undefined => {
44
+ const owner = property._OWNER;
45
+ if (owner instanceof Class) {
46
+ return getMilestoneTemporalStereotype(owner, graph);
47
+ } else if (owner instanceof Association) {
48
+ const generatedMilestonedProperties =
49
+ getGeneratedMilestonedPropertiesForAssociation(owner, property);
50
+ if (generatedMilestonedProperties.length) {
51
+ const ownerClass =
52
+ generatedMilestonedProperties[0]?.genericType.value.rawType;
53
+ return getMilestoneTemporalStereotype(
54
+ guaranteeType(ownerClass, Class),
55
+ graph,
56
+ );
57
+ }
58
+ }
59
+ return undefined;
60
+ };
61
+
62
+ /**
63
+ * Checks if the provided property expression match the criteria for default
64
+ * date propagation so we know whether we need to fill in values for the parameter
65
+ * or just propgate values from the parent's expression
66
+ *
67
+ * NOTE: this takes date propgation into account. See the table below for all
68
+ * the combination:
69
+ *
70
+ * | [source] | | | | |
71
+ * ----------------------------------------------------------------------
72
+ * [target] | | NONE | PR_TMP | BI_TMP | BU_TMP |
73
+ * ----------------------------------------------------------------------
74
+ * | NONE | N.A. | PRD | PRD,BUD | BUD |
75
+ * ----------------------------------------------------------------------
76
+ * | PR_TMP | N.A. | X | PRD,BUD | BUD |
77
+ * ----------------------------------------------------------------------
78
+ * | BI_TMP | N.A. | X | X | X |
79
+ * ----------------------------------------------------------------------
80
+ * | BU_TMP | N.A. | PRD | PRD,BUD | X |
81
+ * ----------------------------------------------------------------------
82
+ *
83
+ * Annotations:
84
+ *
85
+ * [source]: source temporal type
86
+ * [target]: target temporal type
87
+ *
88
+ * PR_TMP : processing temporal
89
+ * BI_TMP : bitemporal
90
+ * BU_TMP : business temporal
91
+ *
92
+ * X : no default date propagated
93
+ * PRD : default processing date is propagated
94
+ * BUD : default business date is propgated
95
+ */
96
+ export const isDefaultDatePropagationSupported = (
97
+ currentPropertyExpression: AbstractPropertyExpression,
98
+ queryBuilderState: QueryBuilderState,
99
+ prevPropertyExpression?: AbstractPropertyExpression | undefined,
100
+ ): boolean => {
101
+ const property = currentPropertyExpression.func.value;
102
+ const graph = queryBuilderState.graphManagerState.graph;
103
+ // Default date propagation is not supported for current expression when the previous property expression is a derived property.
104
+ if (
105
+ prevPropertyExpression &&
106
+ prevPropertyExpression.func.value instanceof DerivedProperty &&
107
+ prevPropertyExpression.func.value._OWNER.derivedProperties.includes(
108
+ prevPropertyExpression.func.value,
109
+ )
110
+ ) {
111
+ return false;
112
+ }
113
+ if (property.genericType.value.rawType instanceof Class) {
114
+ // the stereotype of source class of current property expression.
115
+ const sourceStereotype =
116
+ property instanceof DerivedProperty
117
+ ? getDerivedPropertyMilestoningSteoreotype(property, graph)
118
+ : undefined;
119
+ // Default date propagation is always supported if the source is `bitemporal`
120
+ if (sourceStereotype === MILESTONING_STEREOTYPE.BITEMPORAL) {
121
+ return true;
122
+ }
123
+ // the stereotype (if exists) of the generic type of current property expression.
124
+ const targetStereotype = getMilestoneTemporalStereotype(
125
+ property.genericType.value.rawType,
126
+ graph,
127
+ );
128
+ // Default date propagation is supported when stereotype of both source and target matches
129
+ if (sourceStereotype && targetStereotype) {
130
+ return sourceStereotype === targetStereotype;
131
+ }
132
+ }
133
+ return false;
134
+ };
135
+
136
+ /**
137
+ * Check if the parameter value of the milestoned property is
138
+ * the same as those specified in global scope, so that we can
139
+ * potentially replace them with propgated value.
140
+ */
141
+ export const matchMilestoningParameterValue = (
142
+ stereotype: MILESTONING_STEREOTYPE,
143
+ idx: number,
144
+ parameterValue: ValueSpecification,
145
+ milestoningDate: QueryBuilderMilestoningState,
146
+ ): boolean => {
147
+ const checkIfEquivalent = (
148
+ param1: ValueSpecification | undefined,
149
+ param2: ValueSpecification | undefined,
150
+ ): boolean => {
151
+ if (
152
+ param1 instanceof VariableExpression &&
153
+ param2 instanceof VariableExpression
154
+ ) {
155
+ return param1.name === param2.name;
156
+ } else if (
157
+ param1 instanceof PrimitiveInstanceValue &&
158
+ param2 instanceof PrimitiveInstanceValue
159
+ ) {
160
+ if (
161
+ param1.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE &&
162
+ param2.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE
163
+ ) {
164
+ return true;
165
+ }
166
+ return (
167
+ param1.genericType.value.rawType.name ===
168
+ param2.genericType.value.rawType.name &&
169
+ param1.values[0] === param2.values[0]
170
+ );
171
+ }
172
+ return false;
173
+ };
174
+ switch (stereotype) {
175
+ case MILESTONING_STEREOTYPE.BITEMPORAL:
176
+ return (
177
+ (idx === 0 &&
178
+ checkIfEquivalent(parameterValue, milestoningDate.processingDate)) ||
179
+ (idx === 1 &&
180
+ checkIfEquivalent(parameterValue, milestoningDate.businessDate))
181
+ );
182
+ case MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL:
183
+ return checkIfEquivalent(parameterValue, milestoningDate.processingDate);
184
+ case MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL:
185
+ return checkIfEquivalent(parameterValue, milestoningDate.businessDate);
186
+ default:
187
+ }
188
+ return false;
189
+ };
190
+
191
+ /**
192
+ * Generate a parameter value for the derived property given the index if the property is milestoned.
193
+ *
194
+ * This method considers different scenarios for milestoning and take into account date propagation
195
+ * See https://github.com/finos/legend-studio/pull/891
196
+ */
197
+ export const generateMilestonedPropertyParameterValue = (
198
+ derivedPropertyExpressionState: QueryBuilderDerivedPropertyExpressionState,
199
+ idx: number,
200
+ ): ValueSpecification | undefined => {
201
+ // Milestoning transformations should not be done on actual derived properties.
202
+ if (
203
+ derivedPropertyExpressionState.derivedProperty._OWNER.derivedProperties.includes(
204
+ derivedPropertyExpressionState.derivedProperty,
205
+ )
206
+ ) {
207
+ return undefined;
208
+ }
209
+ const prevPropertyExpression =
210
+ derivedPropertyExpressionState.propertyExpression
211
+ .parametersValues[0] instanceof AbstractPropertyExpression
212
+ ? derivedPropertyExpressionState.propertyExpression.parametersValues[0]
213
+ : undefined;
214
+ const milestoningState =
215
+ derivedPropertyExpressionState.queryBuilderState.milestoningState;
216
+ const temporalSource = getDerivedPropertyMilestoningSteoreotype(
217
+ derivedPropertyExpressionState.derivedProperty,
218
+ derivedPropertyExpressionState.queryBuilderState.graphManagerState.graph,
219
+ );
220
+ const temporalTarget =
221
+ derivedPropertyExpressionState.propertyExpression.func.value.genericType
222
+ .value.rawType instanceof Class &&
223
+ derivedPropertyExpressionState.propertyExpression.func.value._OWNER
224
+ ._generatedMilestonedProperties.length !== 0
225
+ ? getMilestoneTemporalStereotype(
226
+ derivedPropertyExpressionState.propertyExpression.func.value
227
+ .genericType.value.rawType,
228
+ derivedPropertyExpressionState.queryBuilderState.graphManagerState
229
+ .graph,
230
+ )
231
+ : undefined;
232
+ const hasDefaultMilestoningDate =
233
+ temporalTarget &&
234
+ idx < derivedPropertyExpressionState.parameterValues.length &&
235
+ matchMilestoningParameterValue(
236
+ temporalTarget,
237
+ idx,
238
+ guaranteeNonNullable(derivedPropertyExpressionState.parameterValues[idx]),
239
+ milestoningState,
240
+ );
241
+ const shouldReturnMilestoningParameter =
242
+ temporalTarget &&
243
+ ((idx < derivedPropertyExpressionState.parameterValues.length &&
244
+ (hasDefaultMilestoningDate ||
245
+ /**
246
+ * Checks if the given milestoning needs to be overwritten or not.
247
+ * Specially, we would need to rewrite the query if the user passes a single parameter
248
+ * to the `bitemporal` property expression with `processing temporal` source.
249
+ */
250
+ (getDerivedPropertyMilestoningSteoreotype(
251
+ derivedPropertyExpressionState.derivedProperty,
252
+ derivedPropertyExpressionState.queryBuilderState.graphManagerState
253
+ .graph,
254
+ ) === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL &&
255
+ temporalTarget === MILESTONING_STEREOTYPE.BITEMPORAL &&
256
+ derivedPropertyExpressionState.parameterValues.length === 1))) ||
257
+ idx >= derivedPropertyExpressionState.parameterValues.length);
258
+
259
+ if (!shouldReturnMilestoningParameter) {
260
+ return undefined;
261
+ }
262
+ const isDatePropagationSupported = isDefaultDatePropagationSupported(
263
+ derivedPropertyExpressionState.propertyExpression,
264
+ derivedPropertyExpressionState.queryBuilderState,
265
+ prevPropertyExpression,
266
+ );
267
+ return milestoningState
268
+ .getMilestoningImplementation(temporalTarget)
269
+ .generateMilestoningDate(
270
+ isDatePropagationSupported,
271
+ hasDefaultMilestoningDate ?? false,
272
+ prevPropertyExpression,
273
+ temporalSource,
274
+ idx,
275
+ derivedPropertyExpressionState,
276
+ );
277
+ };
278
+
279
+ export const validateMilestoningPropertyExpressionChain = (
280
+ sourceStereotype: MILESTONING_STEREOTYPE | undefined,
281
+ targetStereotype: MILESTONING_STEREOTYPE,
282
+ propertyExpression: AbstractPropertyExpression,
283
+ ): void => {
284
+ if (
285
+ sourceStereotype !== MILESTONING_STEREOTYPE.BITEMPORAL &&
286
+ targetStereotype !== sourceStereotype
287
+ ) {
288
+ if (targetStereotype === MILESTONING_STEREOTYPE.BITEMPORAL) {
289
+ if (
290
+ propertyExpression.parametersValues.length !== 3 &&
291
+ !sourceStereotype
292
+ ) {
293
+ throw new UnsupportedOperationError(
294
+ `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should have exactly two parameters`,
295
+ );
296
+ } else if (propertyExpression.parametersValues.length < 2) {
297
+ throw new UnsupportedOperationError(
298
+ `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should have at least one parameter`,
299
+ );
300
+ } else if (propertyExpression.parametersValues.length > 3) {
301
+ throw new UnsupportedOperationError(
302
+ `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should not have more than two parameters`,
303
+ );
304
+ }
305
+ } else if (propertyExpression.parametersValues.length !== 2) {
306
+ throw new UnsupportedOperationError(
307
+ `Property of milestoning sterotype '${targetStereotype}' should have exactly one parameter`,
308
+ );
309
+ }
310
+ }
311
+ };
@@ -0,0 +1,77 @@
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 {
18
+ ValueSpecification,
19
+ SimpleFunctionExpression,
20
+ AbstractPropertyExpression,
21
+ MILESTONING_STEREOTYPE,
22
+ } from '@finos/legend-graph';
23
+ import type { QueryBuilderDerivedPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
24
+ import type { QueryBuilderMilestoningState } from './QueryBuilderMilestoningState.js';
25
+
26
+ export abstract class QueryBuilderMilestoningImplementation {
27
+ milestoningState: QueryBuilderMilestoningState;
28
+ readonly stereotype: MILESTONING_STEREOTYPE;
29
+
30
+ constructor(
31
+ queryBuilderMilestoningState: QueryBuilderMilestoningState,
32
+ stereotype: MILESTONING_STEREOTYPE,
33
+ ) {
34
+ this.milestoningState = queryBuilderMilestoningState;
35
+ this.stereotype = stereotype;
36
+ }
37
+
38
+ /**
39
+ * Gets the milestoning date associated with the given stereotype
40
+ */
41
+ abstract getMilestoningDate(index?: number): ValueSpecification | undefined;
42
+
43
+ /**
44
+ * Gets the tooltip text for given stereotype
45
+ */
46
+ abstract getMilestoningToolTipText(): string;
47
+
48
+ /**
49
+ * Initializes milestoning parameters when they are not defined.
50
+ * We need to force initialize when we change class as we don't reset the whole milestoning state here.
51
+ */
52
+ abstract initializeMilestoningParameters(force?: boolean): void;
53
+
54
+ /**
55
+ * Checks whether the getAll function has the no of parameters as expected for a given stereotype and sets the corresponding milestoning dates.
56
+ */
57
+ abstract processGetAllParamaters(parameterValues: ValueSpecification[]): void;
58
+
59
+ /**
60
+ * Builds parameters for getAll() function with milestoned class
61
+ */
62
+ abstract buildGetAllParameters(
63
+ getAllFunction: SimpleFunctionExpression,
64
+ ): void;
65
+
66
+ /**
67
+ * Generates milestoning date for a propertyexpression based on its source and target stereotype
68
+ */
69
+ abstract generateMilestoningDate(
70
+ isDatePropagationSupported: boolean,
71
+ hasDefaultMilestoningDate: boolean,
72
+ prevPropertyExpression: AbstractPropertyExpression | undefined,
73
+ temporalSource: MILESTONING_STEREOTYPE | undefined,
74
+ idx?: number,
75
+ derivedPropertyExpressionState?: QueryBuilderDerivedPropertyExpressionState,
76
+ ): ValueSpecification;
77
+ }