@finos/legend-query-builder 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +11 -2
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts +23 -0
  5. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -0
  6. package/lib/components/QueryBuilderConstantExpressionPanel.js +104 -0
  7. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -0
  8. package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
  9. package/lib/components/QueryBuilderDiffPanel.js +1 -2
  10. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  11. package/lib/components/QueryBuilderParametersPanel.d.ts +0 -9
  12. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  13. package/lib/components/QueryBuilderParametersPanel.js +10 -30
  14. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  15. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  16. package/lib/components/QueryBuilderPropertyExpressionEditor.js +60 -12
  17. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  18. package/lib/components/QueryBuilderSideBar.d.ts +2 -1
  19. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  20. package/lib/components/QueryBuilderSideBar.js +6 -14
  21. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  22. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  23. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +12 -18
  24. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  25. package/lib/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.d.ts → QueryBuilderOLAPGroupByPanel.d.ts} +2 -2
  26. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel.d.ts.map +1 -0
  27. package/lib/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.js → QueryBuilderOLAPGroupByPanel.js} +2 -2
  28. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel.js.map +1 -0
  29. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  30. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +9 -11
  31. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  32. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js +1 -1
  33. package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.js.map +1 -1
  34. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  35. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +4 -4
  36. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  37. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  38. package/lib/components/filter/QueryBuilderFilterPanel.js +8 -9
  39. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  40. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +12 -1
  41. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  42. package/lib/components/shared/BasicValueSpecificationEditor.js +11 -7
  43. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  44. package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
  45. package/lib/components/shared/LambdaEditor.js +1 -15
  46. package/lib/components/shared/LambdaEditor.js.map +1 -1
  47. package/lib/components/shared/QueryBuilderVariableSelector.d.ts +36 -0
  48. package/lib/components/shared/QueryBuilderVariableSelector.d.ts.map +1 -0
  49. package/lib/components/shared/QueryBuilderVariableSelector.js +50 -0
  50. package/lib/components/shared/QueryBuilderVariableSelector.js.map +1 -0
  51. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  52. package/lib/components/watermark/QueryBuilderWatermark.js +9 -11
  53. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
  54. package/lib/graphManager/QueryBuilderHashUtils.d.ts +2 -0
  55. package/lib/graphManager/QueryBuilderHashUtils.d.ts.map +1 -1
  56. package/lib/graphManager/QueryBuilderHashUtils.js +2 -0
  57. package/lib/graphManager/QueryBuilderHashUtils.js.map +1 -1
  58. package/lib/index.css +17 -1
  59. package/lib/index.css.map +1 -1
  60. package/lib/package.json +8 -8
  61. package/lib/stores/QueryBuilderConfig.d.ts +1 -0
  62. package/lib/stores/QueryBuilderConfig.d.ts.map +1 -1
  63. package/lib/stores/QueryBuilderConfig.js +1 -0
  64. package/lib/stores/QueryBuilderConfig.js.map +1 -1
  65. package/lib/stores/QueryBuilderConstantsState.d.ts +43 -0
  66. package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -0
  67. package/lib/stores/QueryBuilderConstantsState.js +116 -0
  68. package/lib/stores/QueryBuilderConstantsState.js.map +1 -0
  69. package/lib/stores/QueryBuilderParametersState.d.ts +0 -4
  70. package/lib/stores/QueryBuilderParametersState.d.ts.map +1 -1
  71. package/lib/stores/QueryBuilderParametersState.js +0 -1
  72. package/lib/stores/QueryBuilderParametersState.js.map +1 -1
  73. package/lib/stores/QueryBuilderPropertyEditorState.d.ts +3 -10
  74. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  75. package/lib/stores/QueryBuilderPropertyEditorState.js +6 -140
  76. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  77. package/lib/stores/QueryBuilderResultState.d.ts +1 -2
  78. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  79. package/lib/stores/QueryBuilderResultState.js +7 -12
  80. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  81. package/lib/stores/QueryBuilderState.d.ts +9 -3
  82. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  83. package/lib/stores/QueryBuilderState.js +19 -4
  84. package/lib/stores/QueryBuilderState.js.map +1 -1
  85. package/lib/stores/QueryBuilderStateBuilder.d.ts +4 -3
  86. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  87. package/lib/stores/QueryBuilderStateBuilder.js +50 -42
  88. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  89. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  90. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +32 -29
  91. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  92. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
  93. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +14 -78
  94. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
  95. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  96. package/lib/stores/QueryBuilderValueSpecificationHelper.js +4 -20
  97. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  98. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts +3 -3
  99. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -1
  100. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +4 -4
  101. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -1
  102. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +1 -1
  103. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  104. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +2 -2
  105. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  106. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts +3 -3
  107. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -1
  108. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js +6 -6
  109. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -1
  110. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.d.ts → QueryBuilderOLAPGroupByOperatorLoader.d.ts} +1 -1
  111. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.d.ts.map +1 -0
  112. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.js → QueryBuilderOLAPGroupByOperatorLoader.js} +1 -1
  113. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader.js.map +1 -0
  114. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.d.ts → QueryBuilderOLAPGroupByState.d.ts} +1 -1
  115. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.d.ts.map +1 -0
  116. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.js → QueryBuilderOLAPGroupByState.js} +1 -1
  117. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState.js.map +1 -0
  118. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.d.ts → QueryBuilderOLAPGroupByStateBuilder.d.ts} +3 -3
  119. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.d.ts.map +1 -0
  120. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.js → QueryBuilderOLAPGroupByStateBuilder.js} +4 -4
  121. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder.js.map +1 -0
  122. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.d.ts → QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts} +2 -2
  123. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.d.ts.map +1 -0
  124. package/lib/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.js → QueryBuilderOLAPGroupByValueSpecificationBuilder.js} +2 -2
  125. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder.js.map +1 -0
  126. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +1 -1
  127. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  128. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +5 -5
  129. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  130. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +10 -10
  131. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  132. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +1 -1
  133. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  134. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts +2 -2
  135. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -1
  136. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js +6 -4
  137. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -1
  138. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +27 -0
  139. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -0
  140. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +93 -0
  141. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -0
  142. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +26 -0
  143. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -0
  144. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +60 -0
  145. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -0
  146. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts +70 -0
  147. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -0
  148. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +199 -0
  149. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -0
  150. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +49 -0
  151. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -0
  152. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js +24 -0
  153. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -0
  154. package/lib/stores/{QueryBuilderMilestoningState.d.ts → milestoning/QueryBuilderMilestoningState.d.ts} +6 -2
  155. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -0
  156. package/lib/stores/{QueryBuilderMilestoningState.js → milestoning/QueryBuilderMilestoningState.js} +20 -20
  157. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -0
  158. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +26 -0
  159. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -0
  160. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +55 -0
  161. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -0
  162. package/lib/stores/shared/LambdaParameterState.d.ts +14 -2
  163. package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -1
  164. package/lib/stores/shared/LambdaParameterState.js +79 -6
  165. package/lib/stores/shared/LambdaParameterState.js.map +1 -1
  166. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +3 -1
  167. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  168. package/lib/stores/shared/ValueSpecificationEditorHelper.js +58 -2
  169. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  170. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts +2 -2
  171. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts.map +1 -1
  172. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js +2 -2
  173. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js.map +1 -1
  174. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts +2 -2
  175. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.d.ts.map +1 -1
  176. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js +7 -4
  177. package/lib/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.js.map +1 -1
  178. package/lib/stores/workflows/ServiceQueryBuilderState.js +1 -1
  179. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  180. package/package.json +15 -15
  181. package/src/components/QueryBuilder.tsx +38 -0
  182. package/src/components/QueryBuilderConstantExpressionPanel.tsx +284 -0
  183. package/src/components/QueryBuilderDiffPanel.tsx +0 -2
  184. package/src/components/QueryBuilderParametersPanel.tsx +24 -110
  185. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +119 -36
  186. package/src/components/QueryBuilderSideBar.tsx +5 -22
  187. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +29 -39
  188. package/src/components/fetch-structure/{QueryBuilderOLAPGroupByPanel_.tsx → QueryBuilderOLAPGroupByPanel.tsx} +1 -1
  189. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +18 -19
  190. package/src/components/fetch-structure/QueryBuilderPostTDSPanel.tsx +1 -1
  191. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +9 -9
  192. package/src/components/filter/QueryBuilderFilterPanel.tsx +16 -17
  193. package/src/components/shared/BasicValueSpecificationEditor.tsx +47 -22
  194. package/src/components/shared/LambdaEditor.tsx +0 -15
  195. package/src/components/shared/QueryBuilderVariableSelector.tsx +186 -0
  196. package/src/components/watermark/QueryBuilderWatermark.tsx +19 -31
  197. package/src/graphManager/QueryBuilderHashUtils.ts +2 -0
  198. package/src/stores/QueryBuilderConfig.ts +1 -0
  199. package/src/stores/QueryBuilderConstantsState.ts +173 -0
  200. package/src/stores/QueryBuilderParametersState.ts +0 -6
  201. package/src/stores/QueryBuilderPropertyEditorState.ts +6 -235
  202. package/src/stores/QueryBuilderResultState.ts +19 -17
  203. package/src/stores/QueryBuilderState.ts +25 -4
  204. package/src/stores/QueryBuilderStateBuilder.ts +111 -52
  205. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +48 -58
  206. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +16 -105
  207. package/src/stores/QueryBuilderValueSpecificationHelper.ts +10 -29
  208. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +5 -0
  209. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +2 -2
  210. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.ts +7 -0
  211. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByOperatorLoader_.ts → QueryBuilderOLAPGroupByOperatorLoader.ts} +0 -0
  212. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByState_.ts → QueryBuilderOLAPGroupByState.ts} +0 -0
  213. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByStateBuilder_.ts → QueryBuilderOLAPGroupByStateBuilder.ts} +3 -1
  214. package/src/stores/fetch-structure/tds/olapGroupBy/{QueryBuilderOLAPGroupByValueSpecificationBuilder_.ts → QueryBuilderOLAPGroupByValueSpecificationBuilder.ts} +1 -1
  215. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +1 -1
  216. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +11 -0
  217. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +1 -1
  218. package/src/stores/filter/QueryBuilderFilterValueSpecificationBuilder.ts +10 -5
  219. package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +165 -0
  220. package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +96 -0
  221. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +311 -0
  222. package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +77 -0
  223. package/src/stores/{QueryBuilderMilestoningState.ts → milestoning/QueryBuilderMilestoningState.ts} +55 -39
  224. package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +88 -0
  225. package/src/stores/shared/LambdaParameterState.ts +151 -10
  226. package/src/stores/shared/ValueSpecificationEditorHelper.ts +84 -2
  227. package/src/stores/watermark/QueryBuilderWatermarkStateBuilder.ts +3 -0
  228. package/src/stores/watermark/QueryBuilderWatermarkValueSpecificationBuilder.ts +11 -5
  229. package/src/stores/workflows/ServiceQueryBuilderState.ts +1 -1
  230. package/tsconfig.json +14 -6
  231. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.d.ts.map +0 -1
  232. package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.js.map +0 -1
  233. package/lib/stores/QueryBuilderMilestoningState.d.ts.map +0 -1
  234. package/lib/stores/QueryBuilderMilestoningState.js.map +0 -1
  235. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader_.d.ts.map +0 -1
  236. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByOperatorLoader_.js.map +0 -1
  237. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder_.d.ts.map +0 -1
  238. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByStateBuilder_.js.map +0 -1
  239. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState_.d.ts.map +0 -1
  240. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByState_.js.map +0 -1
  241. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder_.d.ts.map +0 -1
  242. package/lib/stores/fetch-structure/tds/olapGroupBy/QueryBuilderOLAPGroupByValueSpecificationBuilder_.js.map +0 -1
@@ -0,0 +1,173 @@
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 Type,
19
+ type ValueSpecification,
20
+ GenericType,
21
+ GenericTypeExplicitReference,
22
+ observe_ValueSpecification,
23
+ VariableExpression,
24
+ } from '@finos/legend-graph';
25
+ import {
26
+ type Hashable,
27
+ hashArray,
28
+ deleteEntry,
29
+ addUniqueEntry,
30
+ IllegalStateError,
31
+ uuid,
32
+ assertErrorThrown,
33
+ } from '@finos/legend-shared';
34
+ import { action, makeObservable, observable } from 'mobx';
35
+ import { QUERY_BUILDER_HASH_STRUCTURE } from '../graphManager/QueryBuilderHashUtils.js';
36
+ import type { QueryBuilderState } from './QueryBuilderState.js';
37
+ import { buildDefaultInstanceValue } from './shared/ValueSpecificationEditorHelper.js';
38
+ import { valueSpecification_setGenericType } from './shared/ValueSpecificationModifierHelper.js';
39
+
40
+ export class QueryBuilderConstantExpressionState implements Hashable {
41
+ readonly queryBuilderState: QueryBuilderState;
42
+ readonly uuid = uuid();
43
+ variable: VariableExpression;
44
+ value: ValueSpecification;
45
+
46
+ constructor(
47
+ queryBuilderState: QueryBuilderState,
48
+ variable: VariableExpression,
49
+ value: ValueSpecification,
50
+ ) {
51
+ makeObservable(this, {
52
+ variable: observable,
53
+ value: observable,
54
+ setValueSpec: action,
55
+ changeValSpecType: action,
56
+ });
57
+ this.queryBuilderState = queryBuilderState;
58
+ this.value = observe_ValueSpecification(
59
+ value,
60
+ this.queryBuilderState.observableContext,
61
+ );
62
+ observe_ValueSpecification(
63
+ variable,
64
+ this.queryBuilderState.observableContext,
65
+ );
66
+ this.variable = variable;
67
+ }
68
+
69
+ changeValSpecType(type: Type): void {
70
+ const variableType = this.value.genericType?.value.rawType;
71
+ if (variableType !== type) {
72
+ try {
73
+ const valSpec = buildDefaultInstanceValue(
74
+ this.queryBuilderState.graphManagerState.graph,
75
+ type,
76
+ );
77
+ this.setValueSpec(valSpec);
78
+ } catch (error) {
79
+ assertErrorThrown(error);
80
+ this.queryBuilderState.applicationStore.notifyError(error.message);
81
+ }
82
+ }
83
+ }
84
+
85
+ setValueSpec(value: ValueSpecification): void {
86
+ if (value instanceof VariableExpression) {
87
+ throw new IllegalStateError(
88
+ 'Can not assign a parameter to another parameter',
89
+ );
90
+ }
91
+ this.value = observe_ValueSpecification(
92
+ value,
93
+ this.queryBuilderState.observableContext,
94
+ );
95
+ const valueSpecType = value.genericType?.value.rawType;
96
+ if (
97
+ valueSpecType &&
98
+ valueSpecType !== this.variable.genericType?.value.rawType
99
+ ) {
100
+ valueSpecification_setGenericType(
101
+ this.variable,
102
+ GenericTypeExplicitReference.create(new GenericType(valueSpecType)),
103
+ );
104
+ }
105
+ }
106
+
107
+ get hashCode(): string {
108
+ return hashArray([
109
+ QUERY_BUILDER_HASH_STRUCTURE.CONSTANT_EXPRESSION_STATE,
110
+ this.variable.name,
111
+ this.value,
112
+ ]);
113
+ }
114
+ }
115
+
116
+ export class QueryBuilderConstantsState implements Hashable {
117
+ readonly queryBuilderState: QueryBuilderState;
118
+ showConstantPanel = false;
119
+ constants: QueryBuilderConstantExpressionState[] = [];
120
+ selectedConstant: QueryBuilderConstantExpressionState | undefined;
121
+
122
+ constructor(queryBuilderState: QueryBuilderState) {
123
+ this.queryBuilderState = queryBuilderState;
124
+
125
+ makeObservable(this, {
126
+ constants: observable,
127
+ showConstantPanel: observable,
128
+ selectedConstant: observable,
129
+ addConstant: action,
130
+ removeConstant: action,
131
+ setShowConstantPanel: action,
132
+ setSelectedConstant: action,
133
+ });
134
+ }
135
+
136
+ get isEmpty(): boolean {
137
+ return !this.constants.length;
138
+ }
139
+
140
+ setShowConstantPanel(val: boolean): void {
141
+ this.showConstantPanel = val;
142
+ }
143
+
144
+ addConstant(val: QueryBuilderConstantExpressionState): void {
145
+ addUniqueEntry(this.constants, val);
146
+ }
147
+
148
+ removeConstant(val: QueryBuilderConstantExpressionState): void {
149
+ deleteEntry(this.constants, val);
150
+ }
151
+
152
+ setSelectedConstant(
153
+ val: QueryBuilderConstantExpressionState | undefined,
154
+ ): void {
155
+ this.selectedConstant = val;
156
+ }
157
+
158
+ isValueSpecConstant(value: ValueSpecification): boolean {
159
+ if (value instanceof VariableExpression) {
160
+ return Boolean(
161
+ this.constants.find((v) => v.variable.name === value.name),
162
+ );
163
+ }
164
+ return false;
165
+ }
166
+
167
+ get hashCode(): string {
168
+ return hashArray([
169
+ QUERY_BUILDER_HASH_STRUCTURE.CONSTANT_STATE,
170
+ hashArray(this.constants),
171
+ ]);
172
+ }
173
+ }
@@ -23,12 +23,6 @@ import {
23
23
  LambdaParametersState,
24
24
  } from './shared/LambdaParameterState.js';
25
25
 
26
- export const QUERY_BUILDER_PARAMETER_DND_TYPE = 'PARAMETER';
27
-
28
- export interface QueryBuilderParameterDragSource {
29
- variable: LambdaParameterState;
30
- }
31
-
32
26
  export class QueryBuilderParametersState
33
27
  extends LambdaParametersState
34
28
  implements Hashable
@@ -38,21 +38,14 @@ import {
38
38
  EnumValueInstanceValue,
39
39
  InstanceValue,
40
40
  PrimitiveInstanceValue,
41
- PRIMITIVE_TYPE,
41
+ type PRIMITIVE_TYPE,
42
42
  VariableExpression,
43
- getMilestoneTemporalStereotype,
44
- MILESTONING_STEREOTYPE,
45
43
  SimpleFunctionExpression,
46
44
  matchFunctionName,
47
45
  TYPE_CAST_TOKEN,
48
46
  observe_AbstractPropertyExpression,
49
47
  GenericTypeExplicitReference,
50
48
  GenericType,
51
- BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
52
- PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
53
- INTERNAL__PropagatedValue,
54
- Association,
55
- getGeneratedMilestonedPropertiesForAssociation,
56
49
  PropertyExplicitReference,
57
50
  PrimitiveType,
58
51
  } from '@finos/legend-graph';
@@ -61,7 +54,6 @@ import {
61
54
  generateDefaultValueForPrimitiveType,
62
55
  } from './QueryBuilderValueSpecificationHelper.js';
63
56
  import type { QueryBuilderState } from './QueryBuilderState.js';
64
- import type { QueryBuilderMilestoningState } from './QueryBuilderMilestoningState.js';
65
57
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../graphManager/QueryBuilderSupportedFunctions.js';
66
58
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../graphManager/QueryBuilderHashUtils.js';
67
59
  import {
@@ -69,236 +61,11 @@ import {
69
61
  functionExpression_setParametersValues,
70
62
  instanceValue_setValues,
71
63
  } from './shared/ValueSpecificationModifierHelper.js';
72
-
73
- export const getDerivedPropertyMilestoningSteoreotype = (
74
- property: DerivedProperty,
75
- graph: PureModel,
76
- ): MILESTONING_STEREOTYPE | undefined => {
77
- const owner = property._OWNER;
78
- if (owner instanceof Class) {
79
- return getMilestoneTemporalStereotype(owner, graph);
80
- } else if (owner instanceof Association) {
81
- const generatedMilestonedProperties =
82
- getGeneratedMilestonedPropertiesForAssociation(owner, property);
83
- if (generatedMilestonedProperties.length) {
84
- const ownerClass =
85
- generatedMilestonedProperties[0]?.genericType.value.rawType;
86
- return getMilestoneTemporalStereotype(
87
- guaranteeType(ownerClass, Class),
88
- graph,
89
- );
90
- }
91
- }
92
- return undefined;
93
- };
94
-
95
- /**
96
- * Check if the parameter value of the milestoned property is
97
- * the same as those specified in global scope, so that we can
98
- * potentially replace them with propgated value.
99
- */
100
- const matchMilestoningParameterValue = (
101
- stereotype: MILESTONING_STEREOTYPE,
102
- idx: number,
103
- parameterValue: ValueSpecification,
104
- milestoningDate: QueryBuilderMilestoningState,
105
- ): boolean => {
106
- const checkIfEquivalent = (
107
- param1: ValueSpecification | undefined,
108
- param2: ValueSpecification | undefined,
109
- ): boolean => {
110
- if (
111
- param1 instanceof VariableExpression &&
112
- param2 instanceof VariableExpression
113
- ) {
114
- return param1.name === param2.name;
115
- } else if (
116
- param1 instanceof PrimitiveInstanceValue &&
117
- param2 instanceof PrimitiveInstanceValue
118
- ) {
119
- if (
120
- param1.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE &&
121
- param2.genericType.value.rawType.name === PRIMITIVE_TYPE.LATESTDATE
122
- ) {
123
- return true;
124
- }
125
- return (
126
- param1.genericType.value.rawType.name ===
127
- param2.genericType.value.rawType.name &&
128
- param1.values[0] === param2.values[0]
129
- );
130
- }
131
- return false;
132
- };
133
- switch (stereotype) {
134
- case MILESTONING_STEREOTYPE.BITEMPORAL:
135
- return (
136
- (idx === 0 &&
137
- checkIfEquivalent(parameterValue, milestoningDate.processingDate)) ||
138
- (idx === 1 &&
139
- checkIfEquivalent(parameterValue, milestoningDate.businessDate))
140
- );
141
- case MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL:
142
- return checkIfEquivalent(parameterValue, milestoningDate.processingDate);
143
- case MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL:
144
- return checkIfEquivalent(parameterValue, milestoningDate.businessDate);
145
- default:
146
- }
147
- return false;
148
- };
64
+ import { generateMilestonedPropertyParameterValue } from './milestoning/QueryBuilderMilestoningHelper.js';
149
65
 
150
66
  export const prettyPropertyName = (value: string): string =>
151
67
  isCamelCase(value) ? prettyCamelCase(value) : prettyCONSTName(value);
152
68
 
153
- /**
154
- * Generate a parameter value for the derived property given the index if the property is milestoned.
155
- *
156
- * This method considers different scenarios for milestoning and take into account date propagation
157
- * See https://github.com/finos/legend-studio/pull/891
158
- */
159
- export const generateMilestonedPropertyParameterValue = (
160
- derivedPropertyExpressionState: QueryBuilderDerivedPropertyExpressionState,
161
- idx: number,
162
- ): ValueSpecification | undefined => {
163
- // Milestoning transformations should not be done on actual derived properties.
164
- if (
165
- derivedPropertyExpressionState.derivedProperty._OWNER.derivedProperties.includes(
166
- derivedPropertyExpressionState.derivedProperty,
167
- )
168
- ) {
169
- return undefined;
170
- }
171
- const milestoningState =
172
- derivedPropertyExpressionState.queryBuilderState.milestoningState;
173
- const temporalSource = getDerivedPropertyMilestoningSteoreotype(
174
- derivedPropertyExpressionState.derivedProperty,
175
- derivedPropertyExpressionState.queryBuilderState.graphManagerState.graph,
176
- );
177
- const temporalTarget =
178
- derivedPropertyExpressionState.propertyExpression.func.value.genericType
179
- .value.rawType instanceof Class &&
180
- derivedPropertyExpressionState.propertyExpression.func.value._OWNER
181
- ._generatedMilestonedProperties.length !== 0
182
- ? getMilestoneTemporalStereotype(
183
- derivedPropertyExpressionState.propertyExpression.func.value
184
- .genericType.value.rawType,
185
- derivedPropertyExpressionState.queryBuilderState.graphManagerState
186
- .graph,
187
- )
188
- : undefined;
189
- const shouldReturnMilestoningParameter =
190
- temporalTarget &&
191
- ((idx < derivedPropertyExpressionState.parameterValues.length &&
192
- (matchMilestoningParameterValue(
193
- temporalTarget,
194
- idx,
195
- guaranteeNonNullable(
196
- derivedPropertyExpressionState.parameterValues[idx],
197
- ),
198
- milestoningState,
199
- ) ||
200
- /**
201
- * Checks if the given milestoning needs to be overwritten or not.
202
- * Specially, we would need to rewrite the query if the user passes a single parameter
203
- * to the `bitemporal` property expression with `processing temporal` source.
204
- */
205
- (getDerivedPropertyMilestoningSteoreotype(
206
- derivedPropertyExpressionState.derivedProperty,
207
- derivedPropertyExpressionState.queryBuilderState.graphManagerState
208
- .graph,
209
- ) === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL &&
210
- temporalTarget === MILESTONING_STEREOTYPE.BITEMPORAL &&
211
- derivedPropertyExpressionState.parameterValues.length === 1))) ||
212
- idx >= derivedPropertyExpressionState.parameterValues.length);
213
-
214
- if (!shouldReturnMilestoningParameter) {
215
- return undefined;
216
- }
217
-
218
- switch (temporalTarget) {
219
- case MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL: {
220
- if (!milestoningState.businessDate) {
221
- milestoningState.setBusinessDate(
222
- derivedPropertyExpressionState.queryBuilderState.milestoningState.buildMilestoningParameter(
223
- BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
224
- ),
225
- );
226
- }
227
- const parameter = new INTERNAL__PropagatedValue(() =>
228
- guaranteeNonNullable(milestoningState.businessDate),
229
- );
230
- return parameter;
231
- }
232
- case MILESTONING_STEREOTYPE.BITEMPORAL: {
233
- if (!milestoningState.processingDate) {
234
- milestoningState.setProcessingDate(
235
- derivedPropertyExpressionState.queryBuilderState.milestoningState.buildMilestoningParameter(
236
- PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
237
- ),
238
- );
239
- }
240
- if (!milestoningState.businessDate) {
241
- milestoningState.setBusinessDate(
242
- derivedPropertyExpressionState.queryBuilderState.milestoningState.buildMilestoningParameter(
243
- BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
244
- ),
245
- );
246
- }
247
- if (idx === 0) {
248
- if (
249
- temporalSource === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL &&
250
- derivedPropertyExpressionState.parameterValues.length === 1
251
- ) {
252
- return guaranteeType(
253
- derivedPropertyExpressionState.propertyExpression
254
- .parametersValues[0],
255
- AbstractPropertyExpression,
256
- ).parametersValues[1];
257
- }
258
- const parameter = new INTERNAL__PropagatedValue(() =>
259
- guaranteeNonNullable(milestoningState.processingDate),
260
- );
261
- return parameter;
262
- } else {
263
- if (
264
- temporalSource === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL &&
265
- derivedPropertyExpressionState.parameterValues.length === 1
266
- ) {
267
- return derivedPropertyExpressionState.parameterValues[0];
268
- } else if (
269
- temporalSource === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL &&
270
- derivedPropertyExpressionState.parameterValues.length === 1
271
- ) {
272
- return guaranteeType(
273
- derivedPropertyExpressionState.propertyExpression
274
- .parametersValues[0],
275
- AbstractPropertyExpression,
276
- ).parametersValues[1];
277
- }
278
- const parameter = new INTERNAL__PropagatedValue(() =>
279
- guaranteeNonNullable(milestoningState.businessDate),
280
- );
281
- return parameter;
282
- }
283
- }
284
- case MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL: {
285
- if (!milestoningState.processingDate) {
286
- milestoningState.setProcessingDate(
287
- derivedPropertyExpressionState.queryBuilderState.milestoningState.buildMilestoningParameter(
288
- PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
289
- ),
290
- );
291
- }
292
- const parameter = new INTERNAL__PropagatedValue(() =>
293
- guaranteeNonNullable(milestoningState.processingDate),
294
- );
295
- return parameter;
296
- }
297
- default:
298
- return undefined;
299
- }
300
- };
301
-
302
69
  export const getPropertyChainName = (
303
70
  propertyExpression: AbstractPropertyExpression,
304
71
  humanizePropertyName: boolean,
@@ -468,10 +235,12 @@ export class QueryBuilderDerivedPropertyExpressionState {
468
235
  readonly propertyExpression: AbstractPropertyExpression;
469
236
  readonly derivedProperty: DerivedProperty;
470
237
  readonly parameters: VariableExpression[] = [];
238
+ readonly propertyExpressionState: QueryBuilderPropertyExpressionState;
471
239
 
472
240
  constructor(
473
241
  queryBuilderState: QueryBuilderState,
474
242
  propertyExpression: AbstractPropertyExpression,
243
+ propertyExpressionState: QueryBuilderPropertyExpressionState,
475
244
  ) {
476
245
  this.path = getPropertyPath(propertyExpression);
477
246
  this.title = getPropertyChainName(propertyExpression, true);
@@ -484,6 +253,7 @@ export class QueryBuilderDerivedPropertyExpressionState {
484
253
  propertyExpression.func.value,
485
254
  DerivedProperty,
486
255
  );
256
+ this.propertyExpressionState = propertyExpressionState;
487
257
  // build the parameters of the derived properties
488
258
  if (Array.isArray(this.derivedProperty.parameters)) {
489
259
  this.parameters = this.derivedProperty.parameters.map((parameter) =>
@@ -625,6 +395,7 @@ export class QueryBuilderPropertyExpressionState implements Hashable {
625
395
  new QueryBuilderDerivedPropertyExpressionState(
626
396
  this.queryBuilderState,
627
397
  currentExpression,
398
+ this,
628
399
  );
629
400
  result.push(derivedPropertyExpressionState);
630
401
  }
@@ -35,10 +35,13 @@ import {
35
35
  EXECUTION_SERIALIZATION_FORMAT,
36
36
  RawExecutionResult,
37
37
  buildRawLambdaFromLambdaFunction,
38
- ParameterValue,
39
38
  } from '@finos/legend-graph';
40
39
  import { buildLambdaFunction } from './QueryBuilderValueSpecificationBuilder.js';
41
40
  import { ExecutionPlanState } from '@finos/legend-application';
41
+ import {
42
+ buildExecutionParameterValues,
43
+ getExecutionQueryFromRawLambda,
44
+ } from './shared/LambdaParameterState.js';
42
45
 
43
46
  const DEFAULT_LIMIT = 1000;
44
47
 
@@ -125,24 +128,17 @@ export class QueryBuilderResultState {
125
128
  this.queryBuilderState.unsupportedQueryState.rawLambda,
126
129
  'Lambda is required to execute query',
127
130
  );
131
+ if (!this.queryBuilderState.isParameterSupportDisabled) {
132
+ return getExecutionQueryFromRawLambda(
133
+ query,
134
+ this.queryBuilderState.parametersState.parameterStates,
135
+ this.queryBuilderState.graphManagerState,
136
+ );
137
+ }
128
138
  }
129
139
  return query;
130
140
  }
131
141
 
132
- buildExecutionParameterValues(): ParameterValue[] {
133
- return this.queryBuilderState.parametersState.parameterStates.map(
134
- (queryParamState) => {
135
- const paramValue = new ParameterValue();
136
- paramValue.name = queryParamState.parameter.name;
137
- paramValue.value =
138
- this.queryBuilderState.graphManagerState.graphManager.serializeValueSpecification(
139
- guaranteeNonNullable(queryParamState.value),
140
- );
141
- return paramValue;
142
- },
143
- );
144
- }
145
-
146
142
  *exportData(
147
143
  serializationFormat: EXECUTION_SERIALIZATION_FORMAT,
148
144
  ): GeneratorFn<void> {
@@ -165,6 +161,10 @@ export class QueryBuilderResultState {
165
161
  this.queryBuilderState.graphManagerState.graph,
166
162
  {
167
163
  serializationFormat,
164
+ parameterValues: buildExecutionParameterValues(
165
+ this.queryBuilderState.parametersState.parameterStates,
166
+ this.queryBuilderState.graphManagerState,
167
+ ),
168
168
  },
169
169
  )) as ExecutionResult;
170
170
  let contentType: ContentType;
@@ -210,7 +210,6 @@ export class QueryBuilderResultState {
210
210
  `Runtime is required to execute query`,
211
211
  );
212
212
  const query = this.buildExecutionRawLambda();
213
- const parameterValues = this.buildExecutionParameterValues();
214
213
  const startTime = Date.now();
215
214
  const promise =
216
215
  this.queryBuilderState.graphManagerState.graphManager.executeMapping(
@@ -219,7 +218,10 @@ export class QueryBuilderResultState {
219
218
  runtime,
220
219
  this.queryBuilderState.graphManagerState.graph,
221
220
  {
222
- parameterValues: parameterValues,
221
+ parameterValues: buildExecutionParameterValues(
222
+ this.queryBuilderState.parametersState.parameterStates,
223
+ this.queryBuilderState.graphManagerState,
224
+ ),
223
225
  },
224
226
  );
225
227
  this.setQueryRunPromise(promise);
@@ -72,10 +72,11 @@ import { QueryBuilderParametersState } from './QueryBuilderParametersState.js';
72
72
  import type { QueryBuilderFilterOperator } from './filter/QueryBuilderFilterOperator.js';
73
73
  import { getQueryBuilderCoreFilterOperators } from './filter/QueryBuilderFilterOperatorLoader.js';
74
74
  import { QueryBuilderChangeDetectionState } from './QueryBuilderChangeDetectionState.js';
75
- import { QueryBuilderMilestoningState } from './QueryBuilderMilestoningState.js';
75
+ import { QueryBuilderMilestoningState } from './milestoning/QueryBuilderMilestoningState.js';
76
76
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../graphManager/QueryBuilderHashUtils.js';
77
77
  import { QUERY_BUILDER_COMMAND_KEY } from './QueryBuilderCommand.js';
78
78
  import { QueryBuilderWatermarkState } from './watermark/QueryBuilderWatermarkState.js';
79
+ import { QueryBuilderConstantsState } from './QueryBuilderConstantsState.js';
79
80
 
80
81
  export abstract class QueryBuilderState implements CommandRegistrar {
81
82
  applicationStore: GenericLegendApplicationStore;
@@ -85,6 +86,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
85
86
  explorerState: QueryBuilderExplorerState;
86
87
  functionsExplorerState: QueryFunctionsExplorerState;
87
88
  parametersState: QueryBuilderParametersState;
89
+ constantState: QueryBuilderConstantsState;
88
90
  milestoningState: QueryBuilderMilestoningState;
89
91
  fetchStructureState: QueryBuilderFetchStructureState;
90
92
  filterState: QueryBuilderFilterState;
@@ -116,6 +118,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
116
118
  makeObservable(this, {
117
119
  explorerState: observable,
118
120
  parametersState: observable,
121
+ constantState: observable,
119
122
  functionsExplorerState: observable,
120
123
  fetchStructureState: observable,
121
124
  filterState: observable,
@@ -159,6 +162,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
159
162
  this.milestoningState = new QueryBuilderMilestoningState(this);
160
163
  this.explorerState = new QueryBuilderExplorerState(this);
161
164
  this.parametersState = new QueryBuilderParametersState(this);
165
+ this.constantState = new QueryBuilderConstantsState(this);
162
166
  this.functionsExplorerState = new QueryFunctionsExplorerState(this);
163
167
  this.fetchStructureState = new QueryBuilderFetchStructureState(this);
164
168
  this.filterState = new QueryBuilderFilterState(this, this.filterOperators);
@@ -200,6 +204,20 @@ export abstract class QueryBuilderState implements CommandRegistrar {
200
204
  return true;
201
205
  }
202
206
 
207
+ get allVariables(): VariableExpression[] {
208
+ const parameterVars = this.parametersState.parameterStates.map(
209
+ (paramState) => paramState.parameter,
210
+ );
211
+ const letVars = this.constantState.constants.map(
212
+ (letVar) => letVar.variable,
213
+ );
214
+ return [...parameterVars, ...letVars];
215
+ }
216
+
217
+ get allVariableNames(): string[] {
218
+ return this.allVariables.map((e) => e.name);
219
+ }
220
+
203
221
  setShowFunctionsExplorerPanel(val: boolean): void {
204
222
  this.showFunctionsExplorerPanel = val;
205
223
  }
@@ -258,6 +276,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
258
276
  this.explorerState = new QueryBuilderExplorerState(this);
259
277
  this.explorerState.refreshTreeData();
260
278
  this.parametersState = new QueryBuilderParametersState(this);
279
+ this.constantState = new QueryBuilderConstantsState(this);
261
280
  this.functionsExplorerState = new QueryFunctionsExplorerState(this);
262
281
  this.filterState = new QueryBuilderFilterState(this, this.filterOperators);
263
282
  this.watermarkState = new QueryBuilderWatermarkState(this);
@@ -284,10 +303,12 @@ export abstract class QueryBuilderState implements CommandRegistrar {
284
303
  this.milestoningState.updateMilestoningConfiguration();
285
304
  }
286
305
 
287
- changeMapping(val: Mapping): void {
306
+ changeMapping(val: Mapping, options?: { keepQueryContent?: boolean }): void {
288
307
  this.resetQueryResult();
289
- this.resetQueryContent();
290
- this.milestoningState.updateMilestoningConfiguration();
308
+ if (!options?.keepQueryContent) {
309
+ this.resetQueryContent();
310
+ this.milestoningState.updateMilestoningConfiguration();
311
+ }
291
312
  this.setMapping(val);
292
313
  }
293
314