@finos/legend-query-builder 4.17.100 → 4.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +2 -1
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderSideBar.js +9 -8
  6. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  7. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  8. package/lib/components/explorer/QueryBuilderExplorerPanel.js +48 -5
  9. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  10. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.d.ts +24 -0
  11. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.d.ts.map +1 -0
  12. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.js +202 -0
  13. package/lib/components/explorer/QueryBuilderRelationExplorerPanel.js.map +1 -0
  14. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  15. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  16. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +3 -3
  17. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  18. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  19. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +25 -6
  20. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  21. package/lib/components/workflows/AccessorQueryBuilder.d.ts +18 -0
  22. package/lib/components/workflows/AccessorQueryBuilder.d.ts.map +1 -0
  23. package/lib/components/workflows/AccessorQueryBuilder.js +87 -0
  24. package/lib/components/workflows/AccessorQueryBuilder.js.map +1 -0
  25. package/lib/components/workflows/ClassQueryBuilder.js +5 -5
  26. package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
  27. package/lib/data-access-overview.css +1 -1
  28. package/lib/graph/QueryBuilderMetaModelConst.d.ts +4 -0
  29. package/lib/graph/QueryBuilderMetaModelConst.d.ts.map +1 -1
  30. package/lib/graph/QueryBuilderMetaModelConst.js +4 -0
  31. package/lib/graph/QueryBuilderMetaModelConst.js.map +1 -1
  32. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  33. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +7 -1
  34. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +2 -0
  36. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  37. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +93 -3
  38. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  39. package/lib/index.css +2 -2
  40. package/lib/index.css.map +1 -1
  41. package/lib/index.d.ts +2 -0
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/index.js +2 -0
  44. package/lib/index.js.map +1 -1
  45. package/lib/package.json +1 -1
  46. package/lib/stores/QueryBuilderConfig.d.ts +3 -0
  47. package/lib/stores/QueryBuilderConfig.d.ts.map +1 -1
  48. package/lib/stores/QueryBuilderConfig.js +3 -0
  49. package/lib/stores/QueryBuilderConfig.js.map +1 -1
  50. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  51. package/lib/stores/QueryBuilderResultState.js +6 -2
  52. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  53. package/lib/stores/QueryBuilderState.d.ts +14 -4
  54. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  55. package/lib/stores/QueryBuilderState.js +41 -13
  56. package/lib/stores/QueryBuilderState.js.map +1 -1
  57. package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -1
  58. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  59. package/lib/stores/QueryBuilderStateBuilder.js +51 -20
  60. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  61. package/lib/stores/QueryBuilderStateHashUtils.d.ts +1 -0
  62. package/lib/stores/QueryBuilderStateHashUtils.d.ts.map +1 -1
  63. package/lib/stores/QueryBuilderStateHashUtils.js +1 -0
  64. package/lib/stores/QueryBuilderStateHashUtils.js.map +1 -1
  65. package/lib/stores/QueryBuilderTypeaheadHelper.js +2 -2
  66. package/lib/stores/QueryBuilderTypeaheadHelper.js.map +1 -1
  67. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts +1 -1
  68. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  69. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +54 -45
  70. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  71. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js +1 -1
  72. package/lib/stores/__test-utils__/QueryBuilderStateTestUtils.js.map +1 -1
  73. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +12 -2
  74. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  75. package/lib/stores/explorer/QueryBuilderExplorerState.js +12 -2
  76. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  77. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts +2 -2
  78. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.d.ts.map +1 -1
  79. package/lib/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.js.map +1 -1
  80. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts +2 -2
  81. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.d.ts.map +1 -1
  82. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +4 -3
  83. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  84. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +1 -1
  85. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -1
  86. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts +2 -0
  87. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.d.ts.map +1 -1
  88. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js +19 -0
  89. package/lib/stores/fetch-structure/tds/QueryBuilderTDSHelper.js.map +1 -1
  90. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +7 -4
  91. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  92. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +59 -12
  93. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  94. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts +16 -3
  95. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  96. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +102 -24
  97. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  98. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +2 -1
  99. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  100. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +16 -1
  101. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  102. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +3 -3
  103. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  104. package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.d.ts.map +1 -1
  105. package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.js +11 -2
  106. package/lib/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.js.map +1 -1
  107. package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.d.ts.map +1 -1
  108. package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.js +16 -12
  109. package/lib/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.js.map +1 -1
  110. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts +4 -3
  111. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.d.ts.map +1 -1
  112. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js +19 -9
  113. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowState.js.map +1 -1
  114. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.d.ts +1 -0
  115. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.d.ts.map +1 -1
  116. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js +57 -5
  117. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js.map +1 -1
  118. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.d.ts +4 -3
  119. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.d.ts.map +1 -1
  120. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js +85 -6
  121. package/lib/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.js.map +1 -1
  122. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts +1 -0
  123. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.d.ts.map +1 -1
  124. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.js.map +1 -1
  125. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.d.ts +1 -0
  126. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.d.ts.map +1 -1
  127. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js +3 -0
  128. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.js.map +1 -1
  129. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.d.ts +1 -0
  130. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.d.ts.map +1 -1
  131. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js +3 -0
  132. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.js.map +1 -1
  133. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.d.ts +1 -0
  134. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.d.ts.map +1 -1
  135. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js +3 -0
  136. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.js.map +1 -1
  137. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.d.ts +1 -0
  138. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.d.ts.map +1 -1
  139. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js +3 -0
  140. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.js.map +1 -1
  141. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.d.ts +1 -0
  142. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.d.ts.map +1 -1
  143. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js +3 -0
  144. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.js.map +1 -1
  145. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.d.ts +1 -0
  146. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.d.ts.map +1 -1
  147. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.js +4 -0
  148. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.js.map +1 -1
  149. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.d.ts +1 -0
  150. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.d.ts.map +1 -1
  151. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.js +3 -0
  152. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.js.map +1 -1
  153. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.d.ts +1 -0
  154. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.d.ts.map +1 -1
  155. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.js +3 -0
  156. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.js.map +1 -1
  157. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.d.ts +1 -0
  158. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.d.ts.map +1 -1
  159. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js +3 -0
  160. package/lib/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.js.map +1 -1
  161. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +4 -4
  162. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  163. package/lib/stores/workflows/MappingQueryBuilderState.js +2 -2
  164. package/lib/stores/workflows/MappingQueryBuilderState.js.map +1 -1
  165. package/lib/stores/workflows/ServiceQueryBuilderState.js +2 -2
  166. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  167. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.d.ts +18 -0
  168. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.d.ts.map +1 -0
  169. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.js +32 -0
  170. package/lib/stores/workflows/accessor/AccessorQueryBuilderHelper.js.map +1 -0
  171. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts +57 -0
  172. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.d.ts.map +1 -0
  173. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js +125 -0
  174. package/lib/stores/workflows/accessor/AccessorQueryBuilderState.js.map +1 -0
  175. package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js +4 -4
  176. package/lib/stores/workflows/dataProduct/DataProductQueryBuilderState.js.map +1 -1
  177. package/package.json +7 -7
  178. package/src/components/QueryBuilder.tsx +2 -1
  179. package/src/components/QueryBuilderSideBar.tsx +12 -8
  180. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +77 -14
  181. package/src/components/explorer/QueryBuilderRelationExplorerPanel.tsx +536 -0
  182. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -0
  183. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +3 -3
  184. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +62 -4
  185. package/src/components/workflows/AccessorQueryBuilder.tsx +211 -0
  186. package/src/components/workflows/ClassQueryBuilder.tsx +5 -5
  187. package/src/graph/QueryBuilderMetaModelConst.ts +5 -0
  188. package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +28 -0
  189. package/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +223 -4
  190. package/src/index.ts +2 -0
  191. package/src/stores/QueryBuilderConfig.ts +3 -0
  192. package/src/stores/QueryBuilderResultState.ts +12 -8
  193. package/src/stores/QueryBuilderState.ts +47 -12
  194. package/src/stores/QueryBuilderStateBuilder.ts +107 -43
  195. package/src/stores/QueryBuilderStateHashUtils.ts +1 -0
  196. package/src/stores/QueryBuilderTypeaheadHelper.ts +2 -2
  197. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +72 -59
  198. package/src/stores/__test-utils__/QueryBuilderStateTestUtils.ts +1 -1
  199. package/src/stores/explorer/QueryBuilderExplorerState.ts +26 -2
  200. package/src/stores/fetch-structure/QueryBuilderFetchStructureImplementationState.ts +1 -2
  201. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +4 -3
  202. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +1 -1
  203. package/src/stores/fetch-structure/tds/QueryBuilderTDSHelper.ts +42 -0
  204. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +135 -19
  205. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +197 -38
  206. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +30 -0
  207. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +3 -3
  208. package/src/stores/fetch-structure/tds/projection/QueryBuilderRelationProjectValueSpecBuilder.ts +21 -0
  209. package/src/stores/fetch-structure/tds/projection/QueryBuilderTypedProjectionStateBuilder.ts +25 -16
  210. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowState.ts +23 -9
  211. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowStateBuilder.ts +146 -4
  212. package/src/stores/fetch-structure/tds/window/QueryBuilderWindowValueSpecificationBuilder.ts +145 -10
  213. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator.ts +2 -0
  214. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Average.ts +4 -0
  215. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Count.ts +4 -0
  216. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Max.ts +4 -0
  217. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Min.ts +4 -0
  218. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowOperator_Sum.ts +4 -0
  219. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_AverageRank.ts +5 -0
  220. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_DenseRank.ts +4 -0
  221. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_Rank.ts +4 -0
  222. package/src/stores/fetch-structure/tds/window/operators/QueryBuilderTDS_WindowRankOperator_RowNumber.ts +4 -0
  223. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +4 -4
  224. package/src/stores/workflows/MappingQueryBuilderState.ts +2 -2
  225. package/src/stores/workflows/ServiceQueryBuilderState.ts +2 -2
  226. package/src/stores/workflows/accessor/AccessorQueryBuilderHelper.ts +51 -0
  227. package/src/stores/workflows/accessor/AccessorQueryBuilderState.ts +195 -0
  228. package/src/stores/workflows/dataProduct/DataProductQueryBuilderState.ts +4 -4
  229. package/tsconfig.json +4 -0
@@ -55,10 +55,12 @@ import {
55
55
  type PackageableElement,
56
56
  type ValueSpecification,
57
57
  type Type,
58
+ type RelationType,
58
59
  type QueryGridConfig,
59
60
  type QueryExecutionContext,
60
61
  type FunctionAnalysisInfo,
61
62
  type GraphData,
63
+ Accessor,
62
64
  GRAPH_MANAGER_EVENT,
63
65
  CompilationError,
64
66
  extractSourceInformationCoordinates,
@@ -226,7 +228,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
226
228
 
227
229
  lambdaWriteMode = QUERY_BUILDER_LAMBDA_WRITER_MODE.STANDARD;
228
230
 
229
- class?: Class | undefined;
231
+ sourceElement?: Class | Accessor | undefined;
230
232
  getAllFunction: QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS =
231
233
  QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL;
232
234
  executionContextState: QueryBuilderExecutionContextState;
@@ -270,7 +272,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
270
272
  changeDetectionState: observable,
271
273
  changeHistoryState: observable,
272
274
  executionContextState: observable,
273
- class: observable,
275
+ sourceElement: observable,
274
276
  queryChatState: observable,
275
277
  isQueryChatOpened: observable,
276
278
  isLocalModeEnabled: observable,
@@ -280,9 +282,13 @@ export abstract class QueryBuilderState implements CommandRegistrar {
280
282
  INTERNAL__enableInitializingDefaultSimpleExpressionValue: observable,
281
283
 
282
284
  sideBarClassName: computed,
285
+ sourceClass: computed,
286
+ sourceAccessor: computed,
287
+ sourceRelationType: computed,
283
288
  isQuerySupported: computed,
284
289
  allValidationIssues: computed,
285
290
  canBuildQuery: computed,
291
+ useRelation: computed,
286
292
 
287
293
  setShowFunctionsExplorerPanel: action,
288
294
  setShowParametersPanel: action,
@@ -291,7 +297,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
291
297
  setDataCubeViewerState: action,
292
298
  openDataCubeEngine: action,
293
299
  setIsCheckingEntitlments: action,
294
- setClass: action,
300
+ setSourceElement: action,
295
301
  setIsQueryChatOpened: action,
296
302
  setIsLocalModeEnabled: action,
297
303
  setGetAllFunction: action,
@@ -301,7 +307,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
301
307
 
302
308
  resetQueryResult: action,
303
309
  resetQueryContent: action,
304
- changeClass: action,
310
+ changeSourceElement: action,
305
311
  changeMapping: action,
306
312
  changeRuntime: action,
307
313
  setExecutionContextState: action,
@@ -358,6 +364,10 @@ export abstract class QueryBuilderState implements CommandRegistrar {
358
364
  return new QueryBuilderExternalExecutionContextState(this);
359
365
  }
360
366
 
367
+ get useRelation(): boolean {
368
+ return this.sourceElement instanceof Accessor || this.isFetchStructureTyped;
369
+ }
370
+
361
371
  get isMappingReadOnly(): boolean {
362
372
  return false;
363
373
  }
@@ -415,6 +425,10 @@ export abstract class QueryBuilderState implements CommandRegistrar {
415
425
  return this.isFetchStructureTyped;
416
426
  }
417
427
 
428
+ get requiresMappingForExecution(): boolean {
429
+ return true;
430
+ }
431
+
418
432
  setLambdaWriteMode(val: QUERY_BUILDER_LAMBDA_WRITER_MODE): void {
419
433
  this.lambdaWriteMode = val;
420
434
  }
@@ -463,7 +477,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
463
477
  */
464
478
  getStateInfo(): QueryableClassMappingRuntimeInfo | undefined {
465
479
  if (this.sourceInfo) {
466
- const classPath = this.class?.path;
480
+ const classPath = this.sourceClass?.path;
467
481
  const mappingPath = this.executionContextState.mapping?.path;
468
482
  const runtimePath =
469
483
  this.executionContextState.runtimeValue instanceof RuntimePointer
@@ -528,8 +542,29 @@ export abstract class QueryBuilderState implements CommandRegistrar {
528
542
  this.isCalendarEnabled = val;
529
543
  }
530
544
 
531
- setClass(val: Class | undefined): void {
532
- this.class = val;
545
+ /**
546
+ * Convenience getter that returns the class only when the source
547
+ * type is a Class (not a RelationType). Use this in code paths
548
+ * that are Class-specific (milestoning, explorer tree, graph-fetch, etc.).
549
+ */
550
+ get sourceClass(): Class | undefined {
551
+ return this.sourceElement instanceof Accessor
552
+ ? undefined
553
+ : this.sourceElement;
554
+ }
555
+
556
+ get sourceAccessor(): Accessor | undefined {
557
+ return this.sourceElement instanceof Accessor
558
+ ? this.sourceElement
559
+ : undefined;
560
+ }
561
+
562
+ get sourceRelationType(): RelationType | undefined {
563
+ return this.sourceAccessor?.relationType;
564
+ }
565
+
566
+ setSourceElement(val: Class | Accessor | undefined): void {
567
+ this.sourceElement = val;
533
568
  }
534
569
 
535
570
  setExecutionContextState(val: QueryBuilderExecutionContextState): void {
@@ -651,13 +686,13 @@ export abstract class QueryBuilderState implements CommandRegistrar {
651
686
  }
652
687
  }
653
688
 
654
- changeClass(val: Class): void {
689
+ changeSourceElement(val: Class | Accessor): void {
655
690
  this.resetQueryResult();
656
691
  this.resetQueryContent();
657
692
  this.setGetAllFunction(QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL);
658
- this.setClass(val);
693
+ this.setSourceElement(val);
659
694
  this.explorerState.refreshTreeData();
660
- this.fetchStructureState.implementation.onClassChange(val);
695
+ this.fetchStructureState.implementation.onClassChange();
661
696
  this.milestoningState.updateMilestoningConfiguration();
662
697
  this.changeHistoryState.cacheNewQuery(this.buildQuery());
663
698
  }
@@ -878,7 +913,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
878
913
  this.resetQueryContent();
879
914
  this.unsupportedQueryState.setLambdaError(error);
880
915
  this.unsupportedQueryState.setRawLambda(query);
881
- this.setClass(undefined);
916
+ this.setSourceElement(undefined);
882
917
  const parameters = buildLambdaVariableExpressions(
883
918
  query,
884
919
  this.graphManagerState,
@@ -1019,7 +1054,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
1019
1054
  this.workflowState,
1020
1055
  undefined,
1021
1056
  );
1022
- basicState.class = this.class;
1057
+ basicState.sourceElement = this.sourceElement;
1023
1058
  basicState.executionContextState.mapping =
1024
1059
  this.executionContextState.mapping;
1025
1060
  basicState.executionContextState.runtimeValue =
@@ -27,8 +27,8 @@ import {
27
27
  import type { QueryBuilderState } from './QueryBuilderState.js';
28
28
  import {
29
29
  AbstractPropertyExpression,
30
+ FunctionExpression,
30
31
  type EnumValueInstanceValue,
31
- type FunctionExpression,
32
32
  type GraphFetchTreeInstanceValue,
33
33
  type ValueSpecificationVisitor,
34
34
  type LambdaFunction,
@@ -55,6 +55,8 @@ import {
55
55
  PackageableElementExplicitReference,
56
56
  MILESTONING_STEREOTYPE,
57
57
  type ColSpecInstanceValue,
58
+ type AccessorInstanceValue,
59
+ RelationColumn,
58
60
  } from '@finos/legend-graph';
59
61
  import { processTDSPostFilterExpression } from './fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js';
60
62
  import { processFilterExpression } from './filter/QueryBuilderFilterStateBuilder.js';
@@ -76,6 +78,7 @@ import {
76
78
  processTDSProjectExpression,
77
79
  processTDSProjectionColumnPropertyExpression,
78
80
  processTDSProjectionDerivationExpression,
81
+ processTDSRelationColumn,
79
82
  processTDSSliceExpression,
80
83
  processTDSSortDirectionExpression,
81
84
  processTDSSortExpression,
@@ -87,7 +90,10 @@ import {
87
90
  QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
88
91
  } from '../graph/QueryBuilderMetaModelConst.js';
89
92
  import { LambdaParameterState } from './shared/LambdaParameterState.js';
90
- import { processTDS_OLAPGroupByExpression } from './fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js';
93
+ import {
94
+ processTDS_ExtendExpression,
95
+ processTDS_OLAPGroupByExpression,
96
+ } from './fetch-structure/tds/window/QueryBuilderWindowStateBuilder.js';
91
97
  import { processWatermarkExpression } from './watermark/QueryBuilderWatermarkStateBuilder.js';
92
98
  import {
93
99
  type QueryBuilderConstantExpressionState,
@@ -117,7 +123,7 @@ const processGetAllExpression = (
117
123
  Class,
118
124
  `Can't process getAll() expression: getAll() return type is missing`,
119
125
  );
120
- queryBuilderState.setClass(_class);
126
+ queryBuilderState.setSourceElement(_class);
121
127
  queryBuilderState.milestoningState.clearMilestoningDates();
122
128
  queryBuilderState.explorerState.refreshTreeData();
123
129
 
@@ -149,7 +155,7 @@ const processGetAllVersionsExpression = (
149
155
  Class,
150
156
  `Can't process getAllVersions() expression: getAllVersions() return type is missing`,
151
157
  );
152
- queryBuilderState.setClass(_class);
158
+ queryBuilderState.setSourceElement(_class);
153
159
  queryBuilderState.milestoningState.clearMilestoningDates();
154
160
  queryBuilderState.explorerState.refreshTreeData();
155
161
 
@@ -183,7 +189,7 @@ const processGetAllVersionsInRangeExpression = (
183
189
  Class,
184
190
  `Can't process getAllVersionsInRange() expression: getAllVersionsInRange() return type is missing`,
185
191
  );
186
- queryBuilderState.setClass(_class);
192
+ queryBuilderState.setSourceElement(_class);
187
193
  queryBuilderState.milestoningState.clearMilestoningDates();
188
194
  queryBuilderState.explorerState.refreshTreeData();
189
195
 
@@ -309,24 +315,34 @@ const processFromFunction = (
309
315
  expression: SimpleFunctionExpression,
310
316
  queryBuilderState: QueryBuilderState,
311
317
  ): void => {
312
- // mapping
313
- const mappingInstanceExpression = guaranteeType(
314
- expression.parametersValues[1],
315
- InstanceValue,
316
- `Can't process from() expression: only support from() with 1st parameter as instance value`,
317
- );
318
- const mapping = guaranteeType(
319
- guaranteeType(
320
- mappingInstanceExpression.values[0],
321
- PackageableElementReference,
322
- `Can't process from() expression: only support from() with 1st parameter as packagableElement value`,
323
- ).value,
324
- Mapping,
325
- `Can't process from() expression: only support from() with 1st parameter as mapping value`,
326
- );
318
+ const mappingParameter =
319
+ expression.parametersValues[2] !== undefined
320
+ ? expression.parametersValues[1]
321
+ : undefined;
322
+ const runtimeParameter = mappingParameter
323
+ ? expression.parametersValues[2]
324
+ : expression.parametersValues[1];
325
+ let mapping: Mapping | undefined;
326
+ if (mappingParameter) {
327
+ // mapping
328
+ const mappingInstanceExpression = guaranteeType(
329
+ mappingParameter,
330
+ InstanceValue,
331
+ `Can't process from() expression: only support from() with 1st parameter as instance value`,
332
+ );
333
+ mapping = guaranteeType(
334
+ guaranteeType(
335
+ mappingInstanceExpression.values[0],
336
+ PackageableElementReference,
337
+ `Can't process from() expression: only support from() with 1st parameter as packagableElement value`,
338
+ ).value,
339
+ Mapping,
340
+ `Can't process from() expression: only support from() with 1st parameter as mapping value`,
341
+ );
342
+ }
327
343
  // runtime
328
344
  const runtimeInstanceExpression = guaranteeType(
329
- expression.parametersValues[2],
345
+ runtimeParameter,
330
346
  InstanceValue,
331
347
  `Can't process from() expression: only support from() with 2nd parameter as instance value`,
332
348
  );
@@ -516,6 +532,16 @@ export class QueryBuilderValueSpecificationProcessor
516
532
  throw new UnsupportedOperationError();
517
533
  }
518
534
 
535
+ visit_AccessorInstanceValue(
536
+ valueAccessorInstanceValue: AccessorInstanceValue,
537
+ ): void {
538
+ const value = guaranteeNonNullable(
539
+ valueAccessorInstanceValue.values[0],
540
+ `Accessor instance value must have a value`,
541
+ );
542
+ this.queryBuilderState.setSourceElement(value);
543
+ }
544
+
519
545
  visit_SimpleFunctionExpression(
520
546
  valueSpecification: SimpleFunctionExpression,
521
547
  ): void {
@@ -832,8 +858,8 @@ export class QueryBuilderValueSpecificationProcessor
832
858
  } else if (matchFunctionName(functionName, [SUPPORTED_FUNCTIONS.FROM])) {
833
859
  const parameters = valueSpecification.parametersValues;
834
860
  assertTrue(
835
- parameters.length === 3,
836
- 'From function expects 2 parameters (mapping and runtime)',
861
+ parameters.length === 3 || parameters.length === 2,
862
+ 'From function expects an optional mapping with required runtime',
837
863
  );
838
864
  processFromFunction(valueSpecification, this.queryBuilderState);
839
865
  QueryBuilderValueSpecificationProcessor.processChild(
@@ -874,6 +900,18 @@ export class QueryBuilderValueSpecificationProcessor
874
900
  this.parentLambda,
875
901
  );
876
902
  return;
903
+ } else if (
904
+ matchFunctionName(
905
+ functionName,
906
+ QUERY_BUILDER_SUPPORTED_FUNCTIONS.RELATION_EXTEND,
907
+ )
908
+ ) {
909
+ processTDS_ExtendExpression(
910
+ valueSpecification,
911
+ this.queryBuilderState,
912
+ this.parentLambda,
913
+ );
914
+ return;
877
915
  }
878
916
  throw new UnsupportedOperationError(
879
917
  `Can't process expression of function ${functionName}()`,
@@ -983,38 +1021,64 @@ export class QueryBuilderValueSpecificationProcessor
983
1021
  `Can't process col spec array instance: value expected to be of size 1`,
984
1022
  );
985
1023
  guaranteeNonNullable(spec[0]).colSpecs.forEach((col) => {
986
- const _function1 = guaranteeType(
987
- col.function1,
988
- LambdaFunctionInstanceValue,
989
- `Can't process col spec: function1 not a lambda function instance value`,
990
- );
991
- assertTrue(_function1.values.length === 1);
992
- const lambdaVal = guaranteeNonNullable(_function1.values[0]);
993
- assertTrue(lambdaVal.expressionSequence.length === 1);
994
- const expression = guaranteeNonNullable(
995
- lambdaVal.expressionSequence[0],
996
- );
997
-
998
- if (expression instanceof AbstractPropertyExpression) {
999
- processTDSProjectionColumnPropertyExpression(
1000
- expression,
1001
- col.name,
1002
- this.queryBuilderState,
1024
+ const _function1 = col.function1;
1025
+ if (_function1 instanceof LambdaFunctionInstanceValue) {
1026
+ assertTrue(_function1.values.length === 1);
1027
+ const lambdaVal = guaranteeNonNullable(_function1.values[0]);
1028
+ assertTrue(lambdaVal.expressionSequence.length === 1);
1029
+ const expression = guaranteeNonNullable(
1030
+ lambdaVal.expressionSequence[0],
1003
1031
  );
1004
- } else if (expression instanceof INTERNAL__UnknownValueSpecification) {
1032
+ if (expression instanceof AbstractPropertyExpression) {
1033
+ processTDSProjectionColumnPropertyExpression(
1034
+ expression,
1035
+ col.name,
1036
+ this.queryBuilderState,
1037
+ );
1038
+ } else if (expression instanceof FunctionExpression) {
1039
+ const func = expression.func;
1040
+ const relationCol = guaranteeType(
1041
+ func,
1042
+ RelationColumn,
1043
+ 'Can`t process col spec: function1 lambda function does not contain a relation column',
1044
+ );
1045
+ processTDSRelationColumn(
1046
+ expression,
1047
+ col.name,
1048
+ relationCol,
1049
+ this.queryBuilderState,
1050
+ );
1051
+ } else if (
1052
+ expression instanceof INTERNAL__UnknownValueSpecification
1053
+ ) {
1054
+ assertNonNullable(
1055
+ this.parentExpression,
1056
+ `Can't process unknown value: parent expression cannot be retrieved`,
1057
+ );
1058
+ processTDSProjectionDerivationExpression(
1059
+ expression,
1060
+ col.name,
1061
+ this.parentExpression,
1062
+ this.queryBuilderState,
1063
+ );
1064
+ }
1065
+ } else if (_function1 instanceof INTERNAL__UnknownValueSpecification) {
1005
1066
  assertNonNullable(
1006
1067
  this.parentExpression,
1007
1068
  `Can't process unknown value: parent expression cannot be retrieved`,
1008
1069
  );
1009
1070
  processTDSProjectionDerivationExpression(
1010
- expression,
1071
+ _function1,
1011
1072
  col.name,
1012
1073
  this.parentExpression,
1013
1074
  this.queryBuilderState,
1014
1075
  );
1076
+ } else {
1077
+ throw new UnsupportedOperationError(
1078
+ `Can't process col spec: only support col spec with function lambda value`,
1079
+ );
1015
1080
  }
1016
1081
  });
1017
-
1018
1082
  return;
1019
1083
  } else if (
1020
1084
  matchFunctionName(this.parentExpression.functionName, [
@@ -36,6 +36,7 @@ export enum QUERY_BUILDER_STATE_HASH_STRUCTURE {
36
36
  AGGREGATE_OPERATOR_PERCENTILE = 'AGGREGATE_OPERATOR_PERCENTILE',
37
37
  AGGREGATION_STATE = 'AGGREGATION_STATE',
38
38
  SIMPLE_PROJECTION_COLUMN_STATE = 'SIMPLE_PROJECTION_COLUMN_STATE',
39
+ RELATION_COLUMN_PROJECTION_COLUMN_STATE = 'RELATION_COLUMN_PROJECTION_COLUMN_STATE',
39
40
  PROPERTY_EXPRESSION_STATE = 'PROPERTY_EXPRESSION_STATE',
40
41
  DERIVATION_PROJECTION_COLUMN_STATE = 'DERIVATION_PROJECTION_COLUMN_STATE',
41
42
  RESULT_SET_MODIFIER_STATE = 'RESULT_SET_MODIFIER_STATE',
@@ -180,9 +180,9 @@ const buildRawLambda = (
180
180
  );
181
181
 
182
182
  // build getAll function
183
- const _class = guaranteeNonNullable(queryBuilderState.class);
183
+ const _class = guaranteeNonNullable(queryBuilderState.sourceClass);
184
184
  const getAllFn = buildGetAllFunction(
185
- guaranteeNonNullable(queryBuilderState.class),
185
+ guaranteeNonNullable(queryBuilderState.sourceClass),
186
186
  Multiplicity.ONE,
187
187
  );
188
188
  const milestoningStereotype = getMilestoneTemporalStereotype(
@@ -20,7 +20,7 @@ import {
20
20
  isNonNullable,
21
21
  } from '@finos/legend-shared';
22
22
  import {
23
- type Class,
23
+ Class,
24
24
  Multiplicity,
25
25
  getMilestoneTemporalStereotype,
26
26
  extractElementNameFromPath,
@@ -34,6 +34,7 @@ import {
34
34
  SimpleFunctionExpression,
35
35
  SUPPORTED_FUNCTIONS,
36
36
  RuntimePointer,
37
+ AccessorInstanceValue,
37
38
  } from '@finos/legend-graph';
38
39
  import type { QueryBuilderState } from './QueryBuilderState.js';
39
40
  import { buildFilterExpression } from './filter/QueryBuilderFilterValueSpecificationBuilder.js';
@@ -154,10 +155,6 @@ export const buildLambdaFunction = (
154
155
  queryBuilderState: QueryBuilderState,
155
156
  options?: LambdaFunctionBuilderOption,
156
157
  ): LambdaFunction => {
157
- const _class = guaranteeNonNullable(
158
- queryBuilderState.class,
159
- 'Class is required to build query',
160
- );
161
158
  const lambdaFunction = new LambdaFunction(
162
159
  new FunctionType(
163
160
  PackageableElementExplicitReference.create(
@@ -167,70 +164,86 @@ export const buildLambdaFunction = (
167
164
  ),
168
165
  );
169
166
 
170
- const milestoningStereotype = getMilestoneTemporalStereotype(
171
- _class,
172
- queryBuilderState.graphManagerState.graph,
167
+ const sourceElement = guaranteeNonNullable(
168
+ queryBuilderState.sourceElement,
169
+ 'Source element of type class or accessor is required to build query',
173
170
  );
171
+ if (sourceElement instanceof Class) {
172
+ const _class = guaranteeNonNullable(
173
+ queryBuilderState.sourceClass,
174
+ 'Class is required to build query',
175
+ );
174
176
 
175
- if (milestoningStereotype && options?.useAllVersionsForMilestoning) {
176
- // build getAllVersions() when we preview data for milestoned classes
177
- // because if we use getAll() we need to pass in data to execute the query
178
- // but we don't give user that option in this flow.
179
- const getAllVersionsFunction = buildGetAllVersionsFunction(
177
+ const milestoningStereotype = getMilestoneTemporalStereotype(
180
178
  _class,
181
- Multiplicity.ONE,
179
+ queryBuilderState.graphManagerState.graph,
182
180
  );
183
- lambdaFunction.expressionSequence[0] = getAllVersionsFunction;
184
- } else {
185
- switch (queryBuilderState.getAllFunction) {
186
- case QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS: {
187
- if (milestoningStereotype) {
188
- const getAllVersionsFunction = buildGetAllVersionsFunction(
189
- _class,
190
- Multiplicity.ONE,
191
- );
192
- lambdaFunction.expressionSequence[0] = getAllVersionsFunction;
193
- } else {
194
- throw new UnsupportedOperationError(
195
- `Unable to build query lamdba: getAllVersions() expects source class to be milestoned`,
196
- );
181
+
182
+ if (milestoningStereotype && options?.useAllVersionsForMilestoning) {
183
+ // build getAllVersions() when we preview data for milestoned classes
184
+ // because if we use getAll() we need to pass in data to execute the query
185
+ // but we don't give user that option in this flow.
186
+ const getAllVersionsFunction = buildGetAllVersionsFunction(
187
+ _class,
188
+ Multiplicity.ONE,
189
+ );
190
+ lambdaFunction.expressionSequence[0] = getAllVersionsFunction;
191
+ } else {
192
+ switch (queryBuilderState.getAllFunction) {
193
+ case QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS: {
194
+ if (milestoningStereotype) {
195
+ const getAllVersionsFunction = buildGetAllVersionsFunction(
196
+ _class,
197
+ Multiplicity.ONE,
198
+ );
199
+ lambdaFunction.expressionSequence[0] = getAllVersionsFunction;
200
+ } else {
201
+ throw new UnsupportedOperationError(
202
+ `Unable to build query lamdba: getAllVersions() expects source class to be milestoned`,
203
+ );
204
+ }
205
+ break;
197
206
  }
198
- break;
199
- }
200
- case QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE: {
201
- if (milestoningStereotype) {
202
- const getAllVersionsInRangeFunction =
203
- buildGetAllVersionsInRangeFunction(_class, Multiplicity.ONE);
204
- queryBuilderState.milestoningState
205
- .getMilestoningImplementation(milestoningStereotype)
206
- .buildGetAllVersionsInRangeParameters(
207
- getAllVersionsInRangeFunction,
207
+ case QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE: {
208
+ if (milestoningStereotype) {
209
+ const getAllVersionsInRangeFunction =
210
+ buildGetAllVersionsInRangeFunction(_class, Multiplicity.ONE);
211
+ queryBuilderState.milestoningState
212
+ .getMilestoningImplementation(milestoningStereotype)
213
+ .buildGetAllVersionsInRangeParameters(
214
+ getAllVersionsInRangeFunction,
215
+ );
216
+ lambdaFunction.expressionSequence[0] =
217
+ getAllVersionsInRangeFunction;
218
+ } else {
219
+ throw new UnsupportedOperationError(
220
+ `Unable to build query lamdba: getAllVersionsInRange() expects source class to be milestoned`,
208
221
  );
209
- lambdaFunction.expressionSequence[0] = getAllVersionsInRangeFunction;
210
- } else {
211
- throw new UnsupportedOperationError(
212
- `Unable to build query lamdba: getAllVersionsInRange() expects source class to be milestoned`,
213
- );
222
+ }
223
+ break;
214
224
  }
215
- break;
216
- }
217
- case QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL: {
218
- // build getAll()
219
- const getAllFunction = buildGetAllFunction(_class, Multiplicity.ONE);
220
- if (milestoningStereotype) {
221
- // build milestoning parameter(s) for getAll()
222
- queryBuilderState.milestoningState
223
- .getMilestoningImplementation(milestoningStereotype)
224
- .buildGetAllParameters(getAllFunction);
225
+ case QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL: {
226
+ // build getAll()
227
+ const getAllFunction = buildGetAllFunction(_class, Multiplicity.ONE);
228
+ if (milestoningStereotype) {
229
+ // build milestoning parameter(s) for getAll()
230
+ queryBuilderState.milestoningState
231
+ .getMilestoningImplementation(milestoningStereotype)
232
+ .buildGetAllParameters(getAllFunction);
233
+ }
234
+ lambdaFunction.expressionSequence[0] = getAllFunction;
235
+ break;
225
236
  }
226
- lambdaFunction.expressionSequence[0] = getAllFunction;
227
- break;
237
+ default:
238
+ throw new UnsupportedOperationError(
239
+ `Unable to build query lambda: unknown ${queryBuilderState.getAllFunction} function`,
240
+ );
228
241
  }
229
- default:
230
- throw new UnsupportedOperationError(
231
- `Unable to build query lambda: unknown ${queryBuilderState.getAllFunction} function`,
232
- );
233
242
  }
243
+ } else {
244
+ const accessorInstanceValue = new AccessorInstanceValue();
245
+ accessorInstanceValue.values = [sourceElement];
246
+ lambdaFunction.expressionSequence[0] = accessorInstanceValue;
234
247
  }
235
248
 
236
249
  // build watermark
@@ -140,7 +140,7 @@ export const TEST__setUpQueryBuilderState = async (
140
140
  }
141
141
  if (executionContext) {
142
142
  const graph = queryBuilderState.graphManagerState.graph;
143
- queryBuilderState.class = graph.getClass(executionContext._class);
143
+ queryBuilderState.sourceElement = graph.getClass(executionContext._class);
144
144
  queryBuilderState.executionContextState.mapping = graph.getMapping(
145
145
  executionContext.mapping,
146
146
  );
@@ -60,6 +60,7 @@ import {
60
60
  getAllSubclasses,
61
61
  PropertyExplicitReference,
62
62
  reportGraphAnalytics,
63
+ type RelationColumn,
63
64
  } from '@finos/legend-graph';
64
65
  import type { QueryBuilderState } from '../QueryBuilderState.js';
65
66
  import { action, flow, flowResult, makeObservable, observable } from 'mobx';
@@ -80,6 +81,7 @@ export enum QUERY_BUILDER_EXPLORER_TREE_DND_TYPE {
80
81
  CLASS_PROPERTY = 'CLASS_PROPERTY',
81
82
  ENUM_PROPERTY = 'ENUM_PROPERTY',
82
83
  PRIMITIVE_PROPERTY = 'PRIMITIVE_PROPERTY',
84
+ RELATION_COLUMN = 'RELATION_COLUMN',
83
85
  }
84
86
 
85
87
  export const generateExplorerTreePropertyNodeID = (
@@ -96,6 +98,10 @@ export interface QueryBuilderExplorerTreeDragSource {
96
98
  node: QueryBuilderExplorerTreePropertyNodeData;
97
99
  }
98
100
 
101
+ export interface QueryBuilderExplorerTreeRelationColumnDragSource {
102
+ node: QueryBuilderExplorerTreeRelationColumnNodeData;
103
+ }
104
+
99
105
  export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
100
106
  isSelected?: boolean | undefined;
101
107
  isOpen?: boolean | undefined;
@@ -221,6 +227,24 @@ export class QueryBuilderExplorerTreeSubTypeNodeData extends QueryBuilderExplore
221
227
  }
222
228
  }
223
229
 
230
+ export class QueryBuilderExplorerTreeRelationRootNodeData extends QueryBuilderExplorerTreeNodeData {}
231
+
232
+ export class QueryBuilderExplorerTreeRelationColumnNodeData extends QueryBuilderExplorerTreeNodeData {
233
+ column: RelationColumn;
234
+
235
+ constructor(
236
+ id: string,
237
+ label: string,
238
+ dndText: string,
239
+ column: RelationColumn,
240
+ type: Type,
241
+ mappingData: QueryBuilderExplorerTreeNodeMappingData,
242
+ ) {
243
+ super(id, label, dndText, false, type, mappingData);
244
+ this.column = column;
245
+ }
246
+ }
247
+
224
248
  export const buildPropertyExpressionFromExplorerTreeNodeData = (
225
249
  node: QueryBuilderExplorerTreePropertyNodeData,
226
250
  explorerState: QueryBuilderExplorerState,
@@ -807,7 +831,7 @@ export class QueryBuilderExplorerState {
807
831
  }
808
832
 
809
833
  refreshTreeData(): void {
810
- const _class = this.queryBuilderState.class;
834
+ const _class = this.queryBuilderState.sourceClass;
811
835
  const _mapping = this.queryBuilderState.executionContextState.mapping;
812
836
  this.setTreeData(
813
837
  _class && _mapping && this.mappingModelCoverageAnalysisResult
@@ -984,7 +1008,7 @@ export class QueryBuilderExplorerState {
984
1008
  }
985
1009
  if (
986
1010
  !node.mappingData.mapped ||
987
- !this.queryBuilderState.class ||
1011
+ !this.queryBuilderState.sourceClass ||
988
1012
  !this.queryBuilderState.executionContextState.mapping
989
1013
  ) {
990
1014
  return;