@finos/legend-application-query 5.2.4 → 5.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +22 -11
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderResultPanel.js +14 -9
  6. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  7. package/lib/components/QueryBuilderSetupPanel.js +1 -1
  8. package/lib/components/QueryBuilderSetupPanel.js.map +1 -1
  9. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts +2 -0
  10. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  11. package/lib/components/explorer/QueryBuilderExplorerPanel.js +21 -5
  12. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  13. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +2 -2
  14. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
  15. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
  16. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js +22 -105
  17. package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.js.map +1 -1
  18. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +1 -2
  19. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
  20. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js +8 -10
  21. package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.js.map +1 -1
  22. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  23. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +23 -17
  24. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  25. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts +2 -2
  26. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.d.ts.map +1 -1
  27. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js +15 -12
  28. package/lib/components/fetch-structure/QueryBuilderProjectionPanel.js.map +1 -1
  29. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +2 -2
  30. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  31. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +23 -28
  32. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  33. package/lib/components/filter/QueryBuilderFilterPanel.js +7 -7
  34. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  35. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.d.ts.map +1 -1
  36. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js +1 -1
  37. package/lib/components/shared/QueryBuilderPanelIssueCountBadge.js.map +1 -1
  38. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  39. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +5 -3
  40. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  41. package/lib/index.css +2 -2
  42. package/lib/index.css.map +1 -1
  43. package/lib/package.json +13 -13
  44. package/lib/stores/QueryBuilderPreviewDataHelper.d.ts.map +1 -1
  45. package/lib/stores/QueryBuilderPreviewDataHelper.js +17 -14
  46. package/lib/stores/QueryBuilderPreviewDataHelper.js.map +1 -1
  47. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  48. package/lib/stores/QueryBuilderPropertyEditorState.js +34 -24
  49. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  50. package/lib/stores/QueryBuilderState.d.ts +1 -2
  51. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  52. package/lib/stores/QueryBuilderState.js +17 -26
  53. package/lib/stores/QueryBuilderState.js.map +1 -1
  54. package/lib/stores/QueryBuilderStateBuilder.d.ts +124 -0
  55. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -0
  56. package/lib/stores/QueryBuilderStateBuilder.js +310 -0
  57. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -0
  58. package/lib/stores/{QueryBuilderTestUtils.d.ts → QueryBuilderStateTestUtils.d.ts} +2 -2
  59. package/lib/stores/QueryBuilderStateTestUtils.d.ts.map +1 -0
  60. package/lib/stores/{QueryBuilderTestUtils.js → QueryBuilderStateTestUtils.js} +2 -2
  61. package/lib/stores/QueryBuilderStateTestUtils.js.map +1 -0
  62. package/lib/stores/QueryBuilderTypeaheadHelper.d.ts.map +1 -1
  63. package/lib/stores/QueryBuilderTypeaheadHelper.js +14 -12
  64. package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
  65. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts +3 -11
  66. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  67. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +10 -319
  68. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  69. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts +27 -0
  70. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -0
  71. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +153 -0
  72. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -0
  73. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +37 -1
  74. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  75. package/lib/stores/QueryBuilderValueSpecificationHelper.js +79 -2
  76. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  77. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +14 -9
  78. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  79. package/lib/stores/explorer/QueryBuilderExplorerState.js +62 -19
  80. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  81. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.d.ts +1 -1
  82. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.d.ts.map +1 -1
  83. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.js +3 -1
  84. package/lib/stores/explorer/QueryBuilderPropertySearchPanelState.js.map +1 -1
  85. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +17 -0
  86. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  87. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js +10 -0
  88. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  89. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts +3 -20
  90. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.d.ts.map +1 -1
  91. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js +31 -73
  92. package/lib/stores/fetch-structure/QueryBuilderFetchStructureState.js.map +1 -1
  93. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +17 -4
  94. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  95. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +110 -21
  96. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  97. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts +20 -0
  98. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -0
  99. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +62 -0
  100. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -0
  101. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts +2 -1
  102. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
  103. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +4 -4
  104. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
  105. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts +9 -2
  106. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts.map +1 -1
  107. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js +28 -5
  108. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js.map +1 -1
  109. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js +2 -2
  110. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  111. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts +11 -2
  112. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.d.ts.map +1 -1
  113. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js +106 -5
  114. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js.map +1 -1
  115. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.d.ts +25 -0
  116. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -0
  117. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js +186 -0
  118. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js.map +1 -0
  119. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts +9 -4
  120. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  121. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js +129 -13
  122. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  123. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.d.ts +20 -0
  124. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -0
  125. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js +96 -0
  126. package/lib/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -0
  127. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js +1 -1
  128. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js.map +1 -1
  129. package/lib/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.d.ts → QueryBuilderPostFilterStateBuilder.d.ts} +4 -3
  130. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -0
  131. package/lib/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.js → QueryBuilderPostFilterStateBuilder.js} +30 -21
  132. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -0
  133. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts.map +1 -1
  134. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +1 -4
  135. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
  136. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +1 -1
  137. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
  138. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +1 -1
  139. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  140. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +1 -1
  141. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
  142. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +1 -1
  143. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  144. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +1 -1
  145. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
  146. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js +1 -1
  147. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
  148. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +1 -1
  149. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
  150. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +1 -1
  151. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  152. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +1 -1
  153. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js.map +1 -1
  154. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +1 -1
  155. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  156. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts +19 -0
  157. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -0
  158. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +74 -0
  159. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -0
  160. package/lib/stores/filter/{QueryBuilderValueSpecificationBuilder.d.ts → QueryBuilderFilterValueSpecificationBuilder.d.ts} +1 -1
  161. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.d.ts.map +1 -0
  162. package/lib/stores/filter/{QueryBuilderValueSpecificationBuilder.js → QueryBuilderFilterValueSpecificationBuilder.js} +1 -1
  163. package/lib/stores/filter/QueryBuilderFilterValueSpecificationBuilder.js.map +1 -0
  164. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.d.ts.map +1 -1
  165. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js +5 -5
  166. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js.map +1 -1
  167. package/package.json +20 -20
  168. package/src/components/QueryBuilder.tsx +47 -28
  169. package/src/components/QueryBuilderResultPanel.tsx +21 -14
  170. package/src/components/QueryBuilderSetupPanel.tsx +1 -1
  171. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +50 -10
  172. package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +2 -2
  173. package/src/components/fetch-structure/QueryBuilderFetchStructurePanel.tsx +41 -175
  174. package/src/components/fetch-structure/QueryBuilderGraphFetchTreePanel.tsx +9 -12
  175. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +62 -28
  176. package/src/components/fetch-structure/QueryBuilderProjectionPanel.tsx +74 -48
  177. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +33 -41
  178. package/src/components/filter/QueryBuilderFilterPanel.tsx +7 -7
  179. package/src/components/shared/QueryBuilderPanelIssueCountBadge.tsx +3 -1
  180. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +5 -8
  181. package/src/stores/QueryBuilderPreviewDataHelper.ts +27 -18
  182. package/src/stores/QueryBuilderPropertyEditorState.ts +40 -31
  183. package/src/stores/QueryBuilderState.ts +26 -32
  184. package/src/stores/QueryBuilderStateBuilder.ts +584 -0
  185. package/src/stores/{QueryBuilderTestUtils.ts → QueryBuilderStateTestUtils.ts} +1 -1
  186. package/src/stores/QueryBuilderTypeaheadHelper.ts +23 -16
  187. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +24 -584
  188. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +248 -0
  189. package/src/stores/QueryBuilderValueSpecificationHelper.ts +114 -0
  190. package/src/stores/explorer/QueryBuilderExplorerState.ts +93 -32
  191. package/src/stores/explorer/QueryBuilderPropertySearchPanelState.ts +3 -1
  192. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +33 -2
  193. package/src/stores/fetch-structure/QueryBuilderFetchStructureState.ts +53 -118
  194. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +166 -26
  195. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +131 -0
  196. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +7 -6
  197. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.ts +68 -4
  198. package/src/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.ts +2 -2
  199. package/src/stores/fetch-structure/projection/QueryBuilderProjectionState.ts +182 -3
  200. package/src/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.ts +426 -0
  201. package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +266 -21
  202. package/src/stores/fetch-structure/projection/aggregation/QueryBuilderAggregationStateBuilder.ts +228 -0
  203. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.ts +1 -1
  204. package/src/stores/fetch-structure/projection/post-filter/{QueryBuilderPostFilterValueSpecificationProcessor.ts → QueryBuilderPostFilterStateBuilder.ts} +68 -48
  205. package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +1 -11
  206. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +1 -1
  207. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +1 -1
  208. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +1 -1
  209. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +1 -1
  210. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +1 -1
  211. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +1 -1
  212. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +1 -1
  213. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +1 -1
  214. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +1 -1
  215. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +1 -1
  216. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +155 -0
  217. package/src/stores/filter/{QueryBuilderValueSpecificationBuilder.ts → QueryBuilderFilterValueSpecificationBuilder.ts} +0 -0
  218. package/src/stores/filter/operators/QueryBuilderFilterOperatorHelper.ts +5 -5
  219. package/tsconfig.json +10 -5
  220. package/tsconfig.package.json +1 -1
  221. package/lib/stores/QueryBuilderTestUtils.d.ts.map +0 -1
  222. package/lib/stores/QueryBuilderTestUtils.js.map +0 -1
  223. package/lib/stores/QueryBuilderValueSpecificationProcessor.d.ts +0 -56
  224. package/lib/stores/QueryBuilderValueSpecificationProcessor.d.ts.map +0 -1
  225. package/lib/stores/QueryBuilderValueSpecificationProcessor.js +0 -548
  226. package/lib/stores/QueryBuilderValueSpecificationProcessor.js.map +0 -1
  227. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationProcessor.d.ts.map +0 -1
  228. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationProcessor.js.map +0 -1
  229. package/lib/stores/filter/QueryBuilderValueSpecificationBuilder.d.ts.map +0 -1
  230. package/lib/stores/filter/QueryBuilderValueSpecificationBuilder.js.map +0 -1
  231. package/src/stores/QueryBuilderValueSpecificationProcessor.ts +0 -1254
@@ -14,9 +14,22 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import type {
18
+ Class,
19
+ CompilationError,
20
+ LambdaFunction,
21
+ } from '@finos/legend-graph';
22
+ import { computed, makeObservable } from 'mobx';
23
+ import type { QueryBuilderExplorerTreePropertyNodeData } from '../explorer/QueryBuilderExplorerState.js';
17
24
  import type { QueryBuilderState } from '../QueryBuilderState.js';
25
+ import type { LambdaFunctionBuilderOption } from '../QueryBuilderValueSpecificationBuilderHelper.js';
18
26
  import type { QueryBuilderFetchStructureState } from './QueryBuilderFetchStructureState.js';
19
27
 
28
+ export enum FETCH_STRUCTURE_IMPLEMENTATION {
29
+ PROJECTION = 'PROJECTION',
30
+ GRAPH_FETCH = 'GRAPH_FETCH',
31
+ }
32
+
20
33
  export abstract class QueryBuilderFetchStructureImplementationState {
21
34
  queryBuilderState: QueryBuilderState;
22
35
  fetchStructureState: QueryBuilderFetchStructureState;
@@ -25,10 +38,28 @@ export abstract class QueryBuilderFetchStructureImplementationState {
25
38
  queryBuilderState: QueryBuilderState,
26
39
  fetchStructureState: QueryBuilderFetchStructureState,
27
40
  ) {
41
+ makeObservable(this, {
42
+ usedExplorerTreePropertyNodeIDs: computed,
43
+ validationIssues: computed,
44
+ });
45
+
28
46
  this.queryBuilderState = queryBuilderState;
29
47
  this.fetchStructureState = fetchStructureState;
30
48
  }
31
49
 
32
- // abstract addProperty(node: QueryBuilderExplorerTreePropertyNodeData): void;
33
- // abstract addChildrenProperties(node: QueryBuilderExplorerTreePropertyNodeData): void;
50
+ abstract get type(): string;
51
+ abstract get usedExplorerTreePropertyNodeIDs(): string[];
52
+ abstract get validationIssues(): string[] | undefined;
53
+ abstract onClassChange(_class: Class | undefined): void;
54
+ abstract revealCompilationError(compilationError: CompilationError): boolean;
55
+ abstract clearCompilationError(): void;
56
+ abstract fetchProperty(node: QueryBuilderExplorerTreePropertyNodeData): void;
57
+ abstract fetchProperties(
58
+ nodes: QueryBuilderExplorerTreePropertyNodeData[],
59
+ ): void;
60
+ abstract checkBeforeChangingImplementation(onChange: () => void): void;
61
+ abstract appendFetchStructure(
62
+ lambdaFunction: LambdaFunction,
63
+ options?: LambdaFunctionBuilderOption,
64
+ ): void;
34
65
  }
@@ -19,56 +19,61 @@ import type { QueryBuilderState } from '../QueryBuilderState.js';
19
19
  import { QueryBuilderGraphFetchTreeState } from './graph-fetch/QueryBuilderGraphFetchTreeState.js';
20
20
  import { QueryBuilderProjectionState } from './projection/QueryBuilderProjectionState.js';
21
21
  import {
22
- buildPropertyExpressionFromExplorerTreeNodeData,
23
22
  type QueryBuilderExplorerTreeNodeData,
24
23
  QueryBuilderExplorerTreePropertyNodeData,
25
24
  } from '../explorer/QueryBuilderExplorerState.js';
26
25
  import { Class } from '@finos/legend-graph';
27
- import { filterByType } from '@finos/legend-shared';
28
- import { addQueryBuilderPropertyNode } from './graph-fetch/QueryBuilderGraphFetchTreeUtil.js';
29
- import { QueryBuilderSimpleProjectionColumnState } from './projection/QueryBuilderProjectionColumnState.js';
30
-
31
- export enum FETCH_STRUCTURE_MODE {
32
- PROJECTION = 'PROJECTION',
33
- GRAPH_FETCH = 'GRAPH_FETCH',
34
- }
26
+ import { filterByType, UnsupportedOperationError } from '@finos/legend-shared';
27
+ import {
28
+ FETCH_STRUCTURE_IMPLEMENTATION,
29
+ type QueryBuilderFetchStructureImplementationState,
30
+ } from './QueryBuilderFetchStructureImplementationState.js';
35
31
 
36
32
  export class QueryBuilderFetchStructureState {
37
33
  queryBuilderState: QueryBuilderState;
38
- /**
39
- * TODO: refactor this so we could reduce this to
40
- * `implementationState: QueryBuilderFetchStructureImplementationState`
41
- * so we don't have graph fetch and projection at the same time
42
- *
43
- * TODO?: perhaps it would eventually make sense to default to
44
- * graph-fetch since `getAll()` naturally works for graph-fetch case
45
- * and graph-fetch allows somewhat an empty tree
46
- */
47
- fetchStructureMode = FETCH_STRUCTURE_MODE.PROJECTION;
48
- projectionState: QueryBuilderProjectionState;
49
- graphFetchTreeState: QueryBuilderGraphFetchTreeState;
34
+ implementation: QueryBuilderFetchStructureImplementationState;
50
35
 
51
36
  constructor(queryBuilderState: QueryBuilderState) {
52
37
  makeAutoObservable(this, {
53
38
  queryBuilderState: false,
54
- setFetchStructureMode: action,
39
+ changeImplementation: action,
55
40
  });
56
41
 
57
42
  this.queryBuilderState = queryBuilderState;
58
- // TODO: we probably should modularize this a bit better
59
- // See https://github.com/finos/legend-studio/issues/731
60
- this.projectionState = new QueryBuilderProjectionState(
61
- queryBuilderState,
62
- this,
63
- );
64
- this.graphFetchTreeState = new QueryBuilderGraphFetchTreeState(
65
- queryBuilderState,
43
+ /**
44
+ * TODO?: perhaps it would eventually make sense to default to
45
+ * graph-fetch since `getAll()` naturally works for graph-fetch case
46
+ * and graph-fetch allows somewhat an empty tree
47
+ *
48
+ * TODO?: we could consider making this configurable
49
+ */
50
+ this.implementation = new QueryBuilderProjectionState(
51
+ this.queryBuilderState,
66
52
  this,
67
53
  );
68
54
  }
69
55
 
70
- setFetchStructureMode(val: FETCH_STRUCTURE_MODE): void {
71
- this.fetchStructureMode = val;
56
+ changeImplementation(type: string): void {
57
+ switch (type) {
58
+ case FETCH_STRUCTURE_IMPLEMENTATION.PROJECTION: {
59
+ this.implementation = new QueryBuilderProjectionState(
60
+ this.queryBuilderState,
61
+ this,
62
+ );
63
+ return;
64
+ }
65
+ case FETCH_STRUCTURE_IMPLEMENTATION.GRAPH_FETCH: {
66
+ this.implementation = new QueryBuilderGraphFetchTreeState(
67
+ this.queryBuilderState,
68
+ this,
69
+ );
70
+ return;
71
+ }
72
+ default:
73
+ throw new UnsupportedOperationError(
74
+ `Can't change fetch-structure implementation to unsupported type: '${type}'`,
75
+ );
76
+ }
72
77
  }
73
78
 
74
79
  fetchProperty(node: QueryBuilderExplorerTreeNodeData): void {
@@ -76,98 +81,28 @@ export class QueryBuilderFetchStructureState {
76
81
  node instanceof QueryBuilderExplorerTreePropertyNodeData &&
77
82
  !(node.type instanceof Class)
78
83
  ) {
79
- switch (this.fetchStructureMode) {
80
- case FETCH_STRUCTURE_MODE.GRAPH_FETCH: {
81
- this.graphFetchTreeState.addProperty(node);
82
- return;
83
- }
84
- case FETCH_STRUCTURE_MODE.PROJECTION: {
85
- this.projectionState.addColumn(
86
- new QueryBuilderSimpleProjectionColumnState(
87
- this.projectionState,
88
- buildPropertyExpressionFromExplorerTreeNodeData(
89
- this.queryBuilderState.explorerState.nonNullableTreeData,
90
- node,
91
- this.queryBuilderState.graphManagerState.graph,
92
- this.queryBuilderState.explorerState.propertySearchPanelState
93
- .allMappedPropertyNodes,
94
- ),
95
- this.queryBuilderState.explorerState.humanizePropertyName,
96
- ),
97
- );
98
- return;
99
- }
100
- default:
101
- return;
102
- }
84
+ this.implementation.fetchProperty(node);
103
85
  }
104
86
  }
105
87
 
106
88
  fetchNodeChildrenProperties(node: QueryBuilderExplorerTreeNodeData): void {
107
89
  if (node.type instanceof Class) {
108
- // NOTE: here we require the node to already been expanded so the child nodes are generated
109
- // we don't allow adding unopened node. Maybe if it helps, we can show a warning.
110
- const nodesToAdd = node.childrenIds
111
- .map((childId) =>
112
- this.queryBuilderState.explorerState.nonNullableTreeData.nodes.get(
113
- childId,
90
+ this.implementation.fetchProperties(
91
+ // NOTE: here we require the node to already been expanded so the child nodes are generated
92
+ // we don't allow adding unopened node. Maybe if it helps, we can show a warning.
93
+ node.childrenIds
94
+ .map((childId) =>
95
+ this.queryBuilderState.explorerState.nonNullableTreeData.nodes.get(
96
+ childId,
97
+ ),
98
+ )
99
+ .filter(filterByType(QueryBuilderExplorerTreePropertyNodeData))
100
+ .filter(
101
+ (childNode) =>
102
+ !(childNode.type instanceof Class) &&
103
+ childNode.mappingData.mapped,
114
104
  ),
115
- )
116
- .filter(filterByType(QueryBuilderExplorerTreePropertyNodeData))
117
- .filter(
118
- (childNode) =>
119
- !(childNode.type instanceof Class) && childNode.mappingData.mapped,
120
- );
121
-
122
- switch (this.fetchStructureMode) {
123
- case FETCH_STRUCTURE_MODE.GRAPH_FETCH: {
124
- const graphFetchTreeData = this.graphFetchTreeState.treeData;
125
- if (graphFetchTreeData) {
126
- nodesToAdd.forEach((nodeToAdd) =>
127
- addQueryBuilderPropertyNode(
128
- graphFetchTreeData,
129
- this.queryBuilderState.explorerState.nonNullableTreeData,
130
- nodeToAdd,
131
- this.queryBuilderState,
132
- ),
133
- );
134
- this.graphFetchTreeState.setGraphFetchTree({
135
- ...graphFetchTreeData,
136
- });
137
- }
138
- return;
139
- }
140
- case FETCH_STRUCTURE_MODE.PROJECTION: {
141
- nodesToAdd.forEach((nodeToAdd) => {
142
- this.projectionState.addColumn(
143
- new QueryBuilderSimpleProjectionColumnState(
144
- this.projectionState,
145
- buildPropertyExpressionFromExplorerTreeNodeData(
146
- this.queryBuilderState.explorerState.nonNullableTreeData,
147
- nodeToAdd,
148
- this.queryBuilderState.graphManagerState.graph,
149
- this.queryBuilderState.explorerState.propertySearchPanelState
150
- .allMappedPropertyNodes,
151
- ),
152
- this.queryBuilderState.explorerState.humanizePropertyName,
153
- ),
154
- );
155
- });
156
- return;
157
- }
158
- default:
159
- return;
160
- }
161
- }
162
- }
163
-
164
- get validationIssues(): string[] | undefined {
165
- switch (this.fetchStructureMode) {
166
- case FETCH_STRUCTURE_MODE.PROJECTION:
167
- return this.projectionState.validationIssues;
168
- case FETCH_STRUCTURE_MODE.GRAPH_FETCH:
169
- default:
170
- return undefined;
105
+ );
171
106
  }
172
107
  }
173
108
  }
@@ -17,18 +17,35 @@
17
17
  import type { QueryBuilderState } from '../../QueryBuilderState.js';
18
18
  import { action, makeObservable, observable } from 'mobx';
19
19
  import {
20
+ type CompilationError,
20
21
  PackageableElementExplicitReference,
21
22
  RootGraphFetchTree,
23
+ type Class,
24
+ type LambdaFunction,
25
+ getAllSuperclasses,
22
26
  } from '@finos/legend-graph';
23
27
  import {
24
28
  type QueryBuilderGraphFetchTreeData,
25
29
  addQueryBuilderPropertyNode,
26
30
  buildGraphFetchTreeData,
27
31
  } from './QueryBuilderGraphFetchTreeUtil.js';
28
- import type { QueryBuilderExplorerTreePropertyNodeData } from '../../explorer/QueryBuilderExplorerState.js';
29
- import { assertNonNullable } from '@finos/legend-shared';
30
- import { QueryBuilderFetchStructureImplementationState } from '../QueryBuilderFetchStructureImplementationState.js';
32
+ import {
33
+ generateExplorerTreePropertyNodeID,
34
+ generateExplorerTreeSubtypeNodeID,
35
+ type QueryBuilderExplorerTreePropertyNodeData,
36
+ } from '../../explorer/QueryBuilderExplorerState.js';
37
+ import {
38
+ FETCH_STRUCTURE_IMPLEMENTATION,
39
+ QueryBuilderFetchStructureImplementationState,
40
+ } from '../QueryBuilderFetchStructureImplementationState.js';
31
41
  import type { QueryBuilderFetchStructureState } from '../QueryBuilderFetchStructureState.js';
42
+ import {
43
+ ActionAlertActionType,
44
+ ActionAlertType,
45
+ } from '@finos/legend-application';
46
+ import type { LambdaFunctionBuilderOption } from '../../QueryBuilderValueSpecificationBuilderHelper.js';
47
+ import { appendGraphFetch } from './QueryBuilderGraphFetchValueSpecificationBuilder.js';
48
+ import { guaranteeNonNullable } from '@finos/legend-shared';
32
49
 
33
50
  export class QueryBuilderGraphFetchTreeState extends QueryBuilderFetchStructureImplementationState {
34
51
  treeData?: QueryBuilderGraphFetchTreeData | undefined;
@@ -46,11 +63,73 @@ export class QueryBuilderGraphFetchTreeState extends QueryBuilderFetchStructureI
46
63
  super(queryBuilderState, fetchStructureState);
47
64
 
48
65
  makeObservable(this, {
49
- treeData: observable,
66
+ treeData: observable.ref,
50
67
  isChecked: observable,
51
68
  setGraphFetchTree: action,
52
69
  setChecked: action,
53
70
  });
71
+
72
+ // try to initialize the graph-fetch tree data using the setup class
73
+ this.updateTreeData(this.queryBuilderState.querySetupState._class);
74
+ }
75
+
76
+ get type(): string {
77
+ return FETCH_STRUCTURE_IMPLEMENTATION.GRAPH_FETCH;
78
+ }
79
+
80
+ get usedExplorerTreePropertyNodeIDs(): string[] {
81
+ if (!this.treeData) {
82
+ return [];
83
+ }
84
+ const explorerTreeNodeIDIndex = new Map<string, string>();
85
+ const ids: string[] = [];
86
+
87
+ // traverse in breadth-first fashion
88
+ const nodesToProcess: string[] = this.treeData.rootIds.slice();
89
+ while (nodesToProcess.length) {
90
+ const currentNodeID = guaranteeNonNullable(nodesToProcess[0]);
91
+ const node = this.treeData.nodes.get(currentNodeID);
92
+ if (!node) {
93
+ continue;
94
+ }
95
+ let nodeID: string;
96
+ const parentNodeID = node.parentId
97
+ ? // since we traverse the nodes in order, parent node ID should already been computed
98
+ guaranteeNonNullable(explorerTreeNodeIDIndex.get(node.parentId))
99
+ : '';
100
+ const propertyNodeID = generateExplorerTreePropertyNodeID(
101
+ parentNodeID,
102
+ node.tree.property.value.name,
103
+ );
104
+ ids.push(propertyNodeID);
105
+ if (node.tree.subType) {
106
+ nodeID = generateExplorerTreeSubtypeNodeID(
107
+ propertyNodeID,
108
+ node.tree.subType.value.path,
109
+ );
110
+ getAllSuperclasses(node.tree.subType.value)
111
+ .concat(node.tree.subType.value)
112
+ .forEach((_class) =>
113
+ ids.push(
114
+ generateExplorerTreeSubtypeNodeID(propertyNodeID, _class.path),
115
+ ),
116
+ );
117
+ } else {
118
+ nodeID = propertyNodeID;
119
+ }
120
+ explorerTreeNodeIDIndex.set(node.id, nodeID);
121
+
122
+ // update list of nodes to process
123
+ nodesToProcess.shift();
124
+ node.childrenIds.forEach((childId) => nodesToProcess.push(childId));
125
+ }
126
+
127
+ // de-duplicate
128
+ return Array.from(new Set(ids).values());
129
+ }
130
+
131
+ get validationIssues(): string[] | undefined {
132
+ return undefined;
54
133
  }
55
134
 
56
135
  setGraphFetchTree(val: QueryBuilderGraphFetchTreeData | undefined): void {
@@ -61,40 +140,101 @@ export class QueryBuilderGraphFetchTreeState extends QueryBuilderFetchStructureI
61
140
  this.isChecked = val;
62
141
  }
63
142
 
64
- // TODO-BEFORE-PR: consider removing this
65
- initialize(tree?: RootGraphFetchTree): void {
66
- if (tree) {
67
- this.setGraphFetchTree(buildGraphFetchTreeData(tree));
68
- } else {
69
- const _class = this.queryBuilderState.querySetupState._class;
70
- if (_class) {
71
- this.setGraphFetchTree(
72
- buildGraphFetchTreeData(
143
+ private updateTreeData(_class: Class | undefined): void {
144
+ this.setGraphFetchTree(
145
+ _class
146
+ ? buildGraphFetchTreeData(
73
147
  new RootGraphFetchTree(
74
148
  PackageableElementExplicitReference.create(_class),
75
149
  ),
76
- ),
77
- );
78
- } else {
79
- this.setGraphFetchTree(undefined);
80
- }
81
- }
150
+ )
151
+ : undefined,
152
+ );
153
+ }
154
+
155
+ onClassChange(_class: Class | undefined): void {
156
+ this.updateTreeData(_class);
157
+ }
158
+
159
+ appendFetchStructure(
160
+ lambdaFunction: LambdaFunction,
161
+ options?: LambdaFunctionBuilderOption,
162
+ ): void {
163
+ appendGraphFetch(this, lambdaFunction, options);
82
164
  }
83
165
 
84
- addProperty(node: QueryBuilderExplorerTreePropertyNodeData): void {
166
+ addProperty(
167
+ node: QueryBuilderExplorerTreePropertyNodeData,
168
+ options?: {
169
+ refreshTreeData?: boolean;
170
+ },
171
+ ): void {
85
172
  if (!this.treeData) {
86
- this.initialize();
173
+ this.queryBuilderState.applicationStore.notifyWarning(
174
+ `Can't add property: graph-fetch tree has not been properly initialized`,
175
+ );
176
+ return;
87
177
  }
88
- assertNonNullable(
89
- this.treeData,
90
- `Graph-fetch tree has not been properly initialized`,
91
- );
92
178
  addQueryBuilderPropertyNode(
93
179
  this.treeData,
94
180
  this.queryBuilderState.explorerState.nonNullableTreeData,
95
181
  node,
96
182
  this.queryBuilderState,
97
183
  );
98
- this.setGraphFetchTree({ ...this.treeData });
184
+ if (options?.refreshTreeData) {
185
+ this.setGraphFetchTree({ ...this.treeData });
186
+ }
187
+ }
188
+
189
+ revealCompilationError(compilationError: CompilationError): boolean {
190
+ return false;
191
+ }
192
+
193
+ clearCompilationError(): void {
194
+ return;
195
+ }
196
+
197
+ fetchProperty(node: QueryBuilderExplorerTreePropertyNodeData): void {
198
+ this.addProperty(node, { refreshTreeData: true });
199
+ }
200
+
201
+ fetchProperties(nodes: QueryBuilderExplorerTreePropertyNodeData[]): void {
202
+ if (!this.treeData) {
203
+ this.queryBuilderState.applicationStore.notifyWarning(
204
+ `Can't add property: graph-fetch tree has not been properly initialized`,
205
+ );
206
+ return;
207
+ }
208
+ nodes.forEach((nodeToAdd) => this.addProperty(nodeToAdd));
209
+ this.setGraphFetchTree({
210
+ ...this.treeData,
211
+ });
212
+ }
213
+
214
+ checkBeforeChangingImplementation(onChange: () => void): void {
215
+ if (this.treeData?.rootIds.length) {
216
+ this.queryBuilderState.applicationStore.setActionAlertInfo({
217
+ message:
218
+ 'Current graph-fetch will be lost when switching to projection mode. Do you still want to proceed?',
219
+ type: ActionAlertType.CAUTION,
220
+ actions: [
221
+ {
222
+ label: 'Proceed',
223
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
224
+ handler:
225
+ this.queryBuilderState.applicationStore.guardUnhandledError(
226
+ async () => onChange(),
227
+ ),
228
+ },
229
+ {
230
+ label: 'Cancel',
231
+ type: ActionAlertActionType.PROCEED,
232
+ default: true,
233
+ },
234
+ ],
235
+ });
236
+ } else {
237
+ onChange();
238
+ }
99
239
  }
100
240
  }
@@ -0,0 +1,131 @@
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
+ GraphFetchTreeInstanceValue,
19
+ matchFunctionName,
20
+ RootGraphFetchTree,
21
+ SimpleFunctionExpression,
22
+ } from '@finos/legend-graph';
23
+ import { assertTrue, guaranteeType } from '@finos/legend-shared';
24
+ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../QueryBuilder_Const.js';
25
+ import type { QueryBuilderState } from '../../QueryBuilderState.js';
26
+ import { QueryBuilderValueSpecificationProcessor } from '../../QueryBuilderStateBuilder.js';
27
+ import { FETCH_STRUCTURE_IMPLEMENTATION } from '../QueryBuilderFetchStructureImplementationState.js';
28
+ import { QueryBuilderGraphFetchTreeState } from './QueryBuilderGraphFetchTreeState.js';
29
+ import { buildGraphFetchTreeData } from './QueryBuilderGraphFetchTreeUtil.js';
30
+
31
+ export const processGraphFetchExpression = (
32
+ expression: SimpleFunctionExpression,
33
+ queryBuilderState: QueryBuilderState,
34
+ ): void => {
35
+ const functionName = expression.functionName;
36
+
37
+ // check parameters
38
+ assertTrue(
39
+ expression.parametersValues.length === 2,
40
+ `Can't process ${functionName}() expression: ${functionName}() expects 1 argument`,
41
+ );
42
+
43
+ // check preceding expression
44
+ const precedingExpression = guaranteeType(
45
+ expression.parametersValues[0],
46
+ SimpleFunctionExpression,
47
+ `Can't process ${functionName}() expression: only support ${functionName}() immediately following an expression`,
48
+ );
49
+ assertTrue(
50
+ matchFunctionName(precedingExpression.functionName, [
51
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
52
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_ALL,
53
+ ]),
54
+ `Can't process ${functionName}(): only support ${functionName}() immediately following either getAll() or filter()`,
55
+ );
56
+ QueryBuilderValueSpecificationProcessor.process(
57
+ precedingExpression,
58
+ queryBuilderState,
59
+ );
60
+
61
+ // build state
62
+ if (
63
+ queryBuilderState.fetchStructureState.implementation instanceof
64
+ QueryBuilderGraphFetchTreeState
65
+ ) {
66
+ const graphFetchTreeState =
67
+ queryBuilderState.fetchStructureState.implementation;
68
+ graphFetchTreeState.setChecked(
69
+ matchFunctionName(
70
+ expression.functionName,
71
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GRAPH_FETCH_CHECKED,
72
+ ),
73
+ );
74
+ }
75
+ };
76
+
77
+ export const processGraphFetchSerializeExpression = (
78
+ expression: SimpleFunctionExpression,
79
+ queryBuilderState: QueryBuilderState,
80
+ ): void => {
81
+ // update fetch-structure
82
+ queryBuilderState.fetchStructureState.changeImplementation(
83
+ FETCH_STRUCTURE_IMPLEMENTATION.GRAPH_FETCH,
84
+ );
85
+
86
+ // check parameters
87
+ assertTrue(
88
+ expression.parametersValues.length === 2,
89
+ `Can't process serialize() expression: serialize() expects 1 argument`,
90
+ );
91
+
92
+ // check preceding expression
93
+ const precedingExpression = guaranteeType(
94
+ expression.parametersValues[0],
95
+ SimpleFunctionExpression,
96
+ `Can't process serialize() expression: only support serialize() immediately following an expression`,
97
+ );
98
+ assertTrue(
99
+ matchFunctionName(precedingExpression.functionName, [
100
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GRAPH_FETCH,
101
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.GRAPH_FETCH_CHECKED,
102
+ ]),
103
+ `Can't process serialize() expression: only support serialize() in graph-fetch expression`,
104
+ );
105
+ QueryBuilderValueSpecificationProcessor.process(
106
+ precedingExpression,
107
+ queryBuilderState,
108
+ );
109
+
110
+ // build state
111
+ if (
112
+ queryBuilderState.fetchStructureState.implementation instanceof
113
+ QueryBuilderGraphFetchTreeState
114
+ ) {
115
+ const graphFetchTreeState =
116
+ queryBuilderState.fetchStructureState.implementation;
117
+ const graphFetchTree = guaranteeType(
118
+ expression.parametersValues[1],
119
+ GraphFetchTreeInstanceValue,
120
+ `Can't process serialize() expression: serialize() graph-fetch is missing`,
121
+ );
122
+ const graphFetchTreeRoot = guaranteeType(
123
+ graphFetchTree.values[0],
124
+ RootGraphFetchTree,
125
+ `Can't process serialize() expression: serialize() graph-fetch tree root is missing`,
126
+ );
127
+ graphFetchTreeState.setGraphFetchTree(
128
+ buildGraphFetchTreeData(graphFetchTreeRoot),
129
+ );
130
+ }
131
+ };
@@ -25,6 +25,7 @@ import {
25
25
  Class,
26
26
  PropertyGraphFetchTree,
27
27
  PackageableElementExplicitReference,
28
+ TYPE_CAST_TOKEN,
28
29
  } from '@finos/legend-graph';
29
30
  import {
30
31
  type QueryBuilderExplorerTreeNodeData,
@@ -70,13 +71,13 @@ export interface QueryBuilderGraphFetchTreeData
70
71
  tree: RootGraphFetchTree;
71
72
  }
72
73
 
73
- const generateNodeId = (
74
+ export const generateGraphFetchTreeNodeID = (
74
75
  property: AbstractProperty,
75
- subType: Type | undefined,
76
76
  parentNodeId: string | undefined,
77
+ subType: Type | undefined,
77
78
  ): string =>
78
79
  `${parentNodeId ? `${parentNodeId}.` : ''}${property.name}${
79
- subType ? subType.path : ''
80
+ subType ? `${TYPE_CAST_TOKEN}${subType.path}` : ''
80
81
  }`;
81
82
 
82
83
  const buildGraphFetchSubTree = (
@@ -93,7 +94,7 @@ const buildGraphFetchSubTree = (
93
94
  const subType = tree.subType?.value;
94
95
  const parentNodeId = parentNode?.id;
95
96
  const node = new QueryBuilderGraphFetchTreeNodeData(
96
- generateNodeId(property, subType, parentNodeId),
97
+ generateGraphFetchTreeNodeID(property, parentNodeId, subType),
97
98
  property.name,
98
99
  parentNodeId,
99
100
  tree,
@@ -248,10 +249,10 @@ export const addQueryBuilderPropertyNode = (
248
249
  let parentNode: QueryBuilderGraphFetchTreeNodeData | undefined = undefined;
249
250
  let newSubTree: PropertyGraphFetchTree | undefined;
250
251
  for (const propertyGraphFetchTree of propertyGraphFetchTrees) {
251
- currentNodeId = generateNodeId(
252
+ currentNodeId = generateGraphFetchTreeNodeID(
252
253
  propertyGraphFetchTree.property.value,
253
- propertyGraphFetchTree.subType?.value,
254
254
  currentNodeId,
255
+ propertyGraphFetchTree.subType?.value,
255
256
  );
256
257
  const existingGraphFetchNode = treeData.nodes.get(currentNodeId);
257
258
  if (existingGraphFetchNode) {