@finos/legend-query-builder 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. package/lib/components/QueryBuilder.d.ts +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 +104 -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 +8 -26
  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/LambdaEditor.d.ts +1 -0
  70. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  71. package/lib/components/shared/LambdaEditor.js +1 -15
  72. package/lib/components/shared/LambdaEditor.js.map +1 -1
  73. package/lib/components/shared/LambdaParameterValuesEditor.d.ts +1 -0
  74. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
  75. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +36 -0
  76. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -0
  77. package/lib/components/shared/QueryBuilderVariableSelector.js +50 -0
  78. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -0
  79. package/lib/components/watermark/QueryBuilderWatermark.d.ts +1 -0
  80. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  81. package/lib/components/watermark/QueryBuilderWatermark.js +9 -11
  82. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
  83. package/lib/graphManager/QueryBuilderHashUtils.d.ts +2 -0
  84. package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
  85. package/lib/graphManager/QueryBuilderHashUtils.js +2 -0
  86. package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
  87. package/lib/index.css +2 -2
  88. package/lib/index.css.map +1 -1
  89. package/lib/package.json +6 -6
  90. package/lib/stores/QueryBuilderConfig.d.ts +1 -0
  91. package/lib/stores/QueryBuilderConfig.d.ts.map +1 -1
  92. package/lib/stores/QueryBuilderConfig.js +1 -0
  93. package/lib/stores/QueryBuilderConfig.js.map +1 -1
  94. package/lib/stores/QueryBuilderConstantsState.d.ts +43 -0
  95. package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -0
  96. package/lib/stores/QueryBuilderConstantsState.js +116 -0
  97. package/lib/stores/QueryBuilderConstantsState.js.map +1 -0
  98. package/lib/stores/QueryBuilderParametersState.d.ts +0 -4
  99. package/lib/stores/QueryBuilderParametersState.d.ts.map +1 -1
  100. package/lib/stores/QueryBuilderParametersState.js +0 -1
  101. package/lib/stores/QueryBuilderParametersState.js.map +1 -1
  102. package/lib/stores/QueryBuilderPropertyEditorState.d.ts +3 -10
  103. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  104. package/lib/stores/QueryBuilderPropertyEditorState.js +6 -140
  105. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  106. package/lib/stores/QueryBuilderState.d.ts +9 -3
  107. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  108. package/lib/stores/QueryBuilderState.js +19 -4
  109. package/lib/stores/QueryBuilderState.js.map +1 -1
  110. package/lib/stores/QueryBuilderStateBuilder.d.ts +4 -3
  111. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  112. package/lib/stores/QueryBuilderStateBuilder.js +50 -42
  113. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  114. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  115. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +23 -25
  116. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  117. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
  118. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +14 -78
  119. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
  120. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  121. package/lib/stores/QueryBuilderValueSpecificationHelper.js +4 -20
  122. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  123. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts +3 -3
  124. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -1
  125. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +4 -4
  126. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -1
  127. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +1 -1
  128. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  129. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +2 -2
  130. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  131. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts +3 -3
  132. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -1
  133. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js +6 -6
  134. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -1
  135. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.d.ts → QueryBuilderOLAPGroupByOperatorLoader.d.ts} +1 -1
  136. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.d.ts.map +1 -0
  137. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.js → QueryBuilderOLAPGroupByOperatorLoader.js} +1 -1
  138. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.js.map +1 -0
  139. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.d.ts → QueryBuilderOLAPGroupByState.d.ts} +1 -1
  140. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.d.ts.map +1 -0
  141. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.js → QueryBuilderOLAPGroupByState.js} +1 -1
  142. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.js.map +1 -0
  143. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.d.ts → QueryBuilderOLAPGroupByStateBuilder.d.ts} +3 -3
  144. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.d.ts.map +1 -0
  145. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.js → QueryBuilderOLAPGroupByStateBuilder.js} +4 -4
  146. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.js.map +1 -0
  147. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.d.ts → QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts} +2 -2
  148. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts.map +1 -0
  149. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.js → QueryBuilderOLAPGroupByValueSpecificationBuilder.js} +2 -2
  150. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.js.map +1 -0
  151. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +1 -1
  152. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  153. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +5 -5
  154. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  155. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +10 -10
  156. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  157. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +1 -1
  158. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  159. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts +2 -2
  160. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -1
  161. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js +6 -4
  162. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -1
  163. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +27 -0
  164. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -0
  165. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +93 -0
  166. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -0
  167. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +26 -0
  168. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -0
  169. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +60 -0
  170. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -0
  171. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts +70 -0
  172. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -0
  173. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +199 -0
  174. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -0
  175. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +49 -0
  176. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -0
  177. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js +24 -0
  178. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -0
  179. package/lib/stores/{QueryBuilderMilestoningState.d.ts → milestoning/QueryBuilderMilestoningState.d.ts} +6 -2
  180. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -0
  181. package/lib/stores/{QueryBuilderMilestoningState.js → milestoning/QueryBuilderMilestoningState.js} +20 -20
  182. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -0
  183. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +26 -0
  184. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -0
  185. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +55 -0
  186. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -0
  187. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +3 -1
  188. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  189. package/lib/stores/shared/ValueSpecificationEditorHelper.js +58 -2
  190. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  191. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts +2 -2
  192. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts.map +1 -1
  193. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js +2 -2
  194. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js.map +1 -1
  195. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts +2 -2
  196. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts.map +1 -1
  197. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js +7 -4
  198. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js.map +1 -1
  199. package/lib/stores/workflows/ServiceQueryBuilderState.js +1 -1
  200. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  201. package/package.json +13 -13
  202. package/src/components/QueryBuilder.tsx +38 -0
  203. package/src/components/QueryBuilderConstantExpressionPanel.tsx +284 -0
  204. package/src/components/QueryBuilderDiffPanel.tsx +0 -2
  205. package/src/components/QueryBuilderParametersPanel.tsx +22 -103
  206. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +119 -36
  207. package/src/components/QueryBuilderSideBar.tsx +5 -22
  208. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +29 -39
  209. package/src/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.tsx → QueryBuilderOLAPGroupByPanel.tsx} +1 -1
  210. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +18 -19
  211. package/src/components/fetch-structure/QueryBuilderPostTDSPanel.tsx +1 -1
  212. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +9 -9
  213. package/src/components/filter/QueryBuilderFilterPanel.tsx +16 -17
  214. package/src/components/shared/BasicValueSpecificationEditor.tsx +47 -22
  215. package/src/components/shared/LambdaEditor.tsx +0 -15
  216. package/src/components/shared/QueryBuilderVariableSelector.tsx +186 -0
  217. package/src/components/watermark/QueryBuilderWatermark.tsx +19 -31
  218. package/src/graphManager/QueryBuilderHashUtils.ts +2 -0
  219. package/src/stores/QueryBuilderConfig.ts +1 -0
  220. package/src/stores/QueryBuilderConstantsState.ts +173 -0
  221. package/src/stores/QueryBuilderParametersState.ts +0 -6
  222. package/src/stores/QueryBuilderPropertyEditorState.ts +6 -235
  223. package/src/stores/QueryBuilderState.ts +25 -4
  224. package/src/stores/QueryBuilderStateBuilder.ts +111 -52
  225. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +34 -51
  226. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +16 -105
  227. package/src/stores/QueryBuilderValueSpecificationHelper.ts +10 -29
  228. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +5 -0
  229. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +2 -2
  230. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.ts +7 -0
  231. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.ts → QueryBuilderOLAPGroupByOperatorLoader.ts} +0 -0
  232. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.ts → QueryBuilderOLAPGroupByState.ts} +0 -0
  233. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.ts → QueryBuilderOLAPGroupByStateBuilder.ts} +3 -1
  234. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.ts → QueryBuilderOLAPGroupByValueSpecificationBuilder.ts} +1 -1
  235. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +1 -1
  236. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +11 -0
  237. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +1 -1
  238. package/src/stores/filter/QueryBuilderFilterValueSpecificationBuilder.ts +10 -5
  239. package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +165 -0
  240. package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +96 -0
  241. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +311 -0
  242. package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +77 -0
  243. package/src/stores/{QueryBuilderMilestoningState.ts → milestoning/QueryBuilderMilestoningState.ts} +55 -39
  244. package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +88 -0
  245. package/src/stores/shared/ValueSpecificationEditorHelper.ts +84 -2
  246. package/src/stores/watermark/QueryBuilderWatermarkStateBuilder.ts +3 -0
  247. package/src/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.ts +11 -5
  248. package/src/stores/workflows/ServiceQueryBuilderState.ts +1 -1
  249. package/tsconfig.json +14 -6
  250. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.d.ts.map +0 -1
  251. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.js.map +0 -1
  252. package/lib/stores/QueryBuilderMilestoningState.d.ts.map +0 -1
  253. package/lib/stores/QueryBuilderMilestoningState.js.map +0 -1
  254. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader_.d.ts.map +0 -1
  255. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader_.js.map +0 -1
  256. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder_.d.ts.map +0 -1
  257. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder_.js.map +0 -1
  258. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState_.d.ts.map +0 -1
  259. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState_.js.map +0 -1
  260. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder_.d.ts.map +0 -1
  261. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder_.js.map +0 -1
@@ -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
+ }
@@ -15,8 +15,6 @@
15
15
  */
16
16
 
17
17
  import {
18
- BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
19
- PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
20
18
  GenericType,
21
19
  GenericTypeExplicitReference,
22
20
  getMilestoneTemporalStereotype,
@@ -27,13 +25,24 @@ import {
27
25
  Multiplicity,
28
26
  PrimitiveType,
29
27
  } from '@finos/legend-graph';
30
- import { type Hashable, hashArray } from '@finos/legend-shared';
28
+ import {
29
+ type Hashable,
30
+ hashArray,
31
+ guaranteeNonNullable,
32
+ } from '@finos/legend-shared';
31
33
  import { action, computed, makeObservable, observable } from 'mobx';
32
- import { QUERY_BUILDER_HASH_STRUCTURE } from '../graphManager/QueryBuilderHashUtils.js';
33
- import type { QueryBuilderState } from './QueryBuilderState.js';
34
- import { LambdaParameterState } from './shared/LambdaParameterState.js';
34
+ import { QUERY_BUILDER_HASH_STRUCTURE } from '../../graphManager/QueryBuilderHashUtils.js';
35
+ import type { QueryBuilderState } from '../QueryBuilderState.js';
36
+ import { LambdaParameterState } from '../shared/LambdaParameterState.js';
37
+ import { QueryBuilderBitemporalMilestoningImplementation } from './QueryBuilderBitemporalMilestoningImplementation.js';
38
+ import { QueryBuilderBusinessTemporalMilestoningImplementation } from './QueryBuilderBusinessTemporalMilestoningImplementation.js';
39
+ import type { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
40
+ import { QueryBuilderProcessingTemporalMilestoningImplementation } from './QueryBuilderProcessingTemporalMilestoningImplementation.js';
35
41
 
36
42
  export class QueryBuilderMilestoningState implements Hashable {
43
+ readonly milestoningImplementations: QueryBuilderMilestoningImplementation[] =
44
+ [];
45
+
37
46
  queryBuilderState: QueryBuilderState;
38
47
 
39
48
  showMilestoningEditor = false;
@@ -51,10 +60,29 @@ export class QueryBuilderMilestoningState implements Hashable {
51
60
  setProcessingDate: action,
52
61
  setBusinessDate: action,
53
62
  setShowMilestoningEditor: action,
63
+ clearMilestoningDates: action,
54
64
  hashCode: computed,
55
65
  });
56
66
 
57
67
  this.queryBuilderState = queryBuilderState;
68
+ this.milestoningImplementations.push(
69
+ new QueryBuilderBusinessTemporalMilestoningImplementation(
70
+ this,
71
+ MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL,
72
+ ),
73
+ );
74
+ this.milestoningImplementations.push(
75
+ new QueryBuilderProcessingTemporalMilestoningImplementation(
76
+ this,
77
+ MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL,
78
+ ),
79
+ );
80
+ this.milestoningImplementations.push(
81
+ new QueryBuilderBitemporalMilestoningImplementation(
82
+ this,
83
+ MILESTONING_STEREOTYPE.BITEMPORAL,
84
+ ),
85
+ );
58
86
  }
59
87
 
60
88
  get isMilestonedQuery(): boolean {
@@ -65,39 +93,22 @@ export class QueryBuilderMilestoningState implements Hashable {
65
93
  this.showMilestoningEditor = val;
66
94
  }
67
95
 
68
- private initializeQueryMilestoningParameters(stereotype: string): void {
69
- switch (stereotype) {
70
- case MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL: {
71
- this.setBusinessDate(
72
- this.buildMilestoningParameter(
73
- BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
74
- ),
75
- );
76
- break;
77
- }
78
- case MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL: {
79
- this.setProcessingDate(
80
- this.buildMilestoningParameter(
81
- PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
82
- ),
83
- );
84
- break;
85
- }
86
- case MILESTONING_STEREOTYPE.BITEMPORAL: {
87
- this.setProcessingDate(
88
- this.buildMilestoningParameter(
89
- PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
90
- ),
91
- );
92
- this.setBusinessDate(
93
- this.buildMilestoningParameter(
94
- BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
95
- ),
96
- );
97
- break;
98
- }
99
- default:
100
- }
96
+ getMilestoningImplementation(
97
+ stereotype: MILESTONING_STEREOTYPE,
98
+ ): QueryBuilderMilestoningImplementation {
99
+ return guaranteeNonNullable(
100
+ this.milestoningImplementations.find(
101
+ (imp) => imp.stereotype === stereotype,
102
+ ),
103
+ );
104
+ }
105
+
106
+ private initializeQueryMilestoningParameters(
107
+ stereotype: MILESTONING_STEREOTYPE,
108
+ ): void {
109
+ this.getMilestoningImplementation(
110
+ stereotype,
111
+ ).initializeMilestoningParameters(true);
101
112
  }
102
113
 
103
114
  setProcessingDate(val: ValueSpecification | undefined): void {
@@ -118,6 +129,11 @@ export class QueryBuilderMilestoningState implements Hashable {
118
129
  : val;
119
130
  }
120
131
 
132
+ clearMilestoningDates(): void {
133
+ this.setBusinessDate(undefined);
134
+ this.setProcessingDate(undefined);
135
+ }
136
+
121
137
  updateMilestoningConfiguration(): void {
122
138
  const currentclass = this.queryBuilderState.class;
123
139
  if (currentclass !== undefined) {
@@ -0,0 +1,88 @@
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
+ type SimpleFunctionExpression,
21
+ type AbstractPropertyExpression,
22
+ INTERNAL__PropagatedValue,
23
+ } from '@finos/legend-graph';
24
+ import { assertTrue, guaranteeNonNullable } from '@finos/legend-shared';
25
+ import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
26
+ import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
27
+
28
+ export class QueryBuilderProcessingTemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
29
+ getMilestoningDate(): ValueSpecification | undefined {
30
+ return this.milestoningState.processingDate;
31
+ }
32
+
33
+ getMilestoningToolTipText(): string {
34
+ return `Processing Date: ${getParameterValue(this.getMilestoningDate())}`;
35
+ }
36
+
37
+ initializeMilestoningParameters(force?: boolean): void {
38
+ if (!this.milestoningState.processingDate || force) {
39
+ this.milestoningState.setProcessingDate(
40
+ this.milestoningState.buildMilestoningParameter(
41
+ PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
42
+ ),
43
+ );
44
+ }
45
+ }
46
+
47
+ processGetAllParamaters(parameterValues: ValueSpecification[]): void {
48
+ assertTrue(
49
+ parameterValues.length === 2,
50
+ `Can't process getAll() expression: when used with a milestoned class getAll() expects a parameter`,
51
+ );
52
+ this.milestoningState.setProcessingDate(parameterValues[1]);
53
+ }
54
+
55
+ buildGetAllParameters(getAllFunction: SimpleFunctionExpression): void {
56
+ getAllFunction.parametersValues.push(
57
+ guaranteeNonNullable(
58
+ this.getMilestoningDate(),
59
+ `Milestoning class should have a parameter of type 'Date'`,
60
+ ),
61
+ );
62
+ }
63
+
64
+ generateMilestoningDate(
65
+ isDatePropagationSupported: boolean,
66
+ hasDefaultMilestoningDate: boolean,
67
+ prevPropertyExpression: AbstractPropertyExpression | undefined,
68
+ ): ValueSpecification {
69
+ this.initializeMilestoningParameters();
70
+ if (
71
+ isDatePropagationSupported &&
72
+ prevPropertyExpression &&
73
+ !hasDefaultMilestoningDate
74
+ ) {
75
+ return new INTERNAL__PropagatedValue(() =>
76
+ guaranteeNonNullable(prevPropertyExpression.parametersValues[1]),
77
+ );
78
+ } else {
79
+ const milestoningDate = new INTERNAL__PropagatedValue(() =>
80
+ guaranteeNonNullable(this.getMilestoningDate()),
81
+ );
82
+ milestoningDate.isPropagatedValue = hasDefaultMilestoningDate
83
+ ? false
84
+ : isDatePropagationSupported;
85
+ return milestoningDate;
86
+ }
87
+ }
88
+ }