@finos/legend-application-repl 0.0.21 → 0.0.23

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 (291) hide show
  1. package/lib/{stores/CompletionResult.d.ts → __lib__/LegendREPLEvent.d.ts} +4 -6
  2. package/lib/__lib__/LegendREPLEvent.d.ts.map +1 -0
  3. package/lib/__lib__/LegendREPLEvent.js +21 -0
  4. package/lib/__lib__/LegendREPLEvent.js.map +1 -0
  5. package/lib/{stores/dataCube/DataCubePanelState.js → __lib__/LegendREPLSetting.d.ts} +3 -6
  6. package/lib/__lib__/LegendREPLSetting.d.ts.map +1 -0
  7. package/lib/{components/grid/TDSLambdaBuilder.d.ts → __lib__/LegendREPLSetting.js} +5 -4
  8. package/lib/__lib__/LegendREPLSetting.js.map +1 -0
  9. package/lib/application/{LegendREPLGridClient.d.ts → LegendREPL.d.ts} +10 -10
  10. package/lib/application/LegendREPL.d.ts.map +1 -0
  11. package/lib/application/{LegendREPLGridClient.js → LegendREPL.js} +10 -15
  12. package/lib/application/LegendREPL.js.map +1 -0
  13. package/lib/application/{LegendREPLGridClientApplicationConfig.d.ts → LegendREPLApplicationConfig.d.ts} +4 -4
  14. package/lib/application/LegendREPLApplicationConfig.d.ts.map +1 -0
  15. package/lib/application/{LegendREPLGridClientApplicationConfig.js → LegendREPLApplicationConfig.js} +2 -2
  16. package/lib/application/LegendREPLApplicationConfig.js.map +1 -0
  17. package/lib/application/{LegendREPLGridClientPluginManager.d.ts → LegendREPLPluginManager.d.ts} +4 -4
  18. package/lib/application/LegendREPLPluginManager.d.ts.map +1 -0
  19. package/lib/application/{LegendREPLGridClientPluginManager.js → LegendREPLPluginManager.js} +3 -3
  20. package/lib/application/LegendREPLPluginManager.js.map +1 -0
  21. package/lib/components/{Core_LegendREPLGridClientApplicationPlugin.d.ts → Core_LegendREPLApplicationPlugin.d.ts} +3 -3
  22. package/lib/components/Core_LegendREPLApplicationPlugin.d.ts.map +1 -0
  23. package/lib/components/{Core_LegendREPLGridClientApplicationPlugin.js → Core_LegendREPLApplicationPlugin.js} +12 -7
  24. package/lib/components/Core_LegendREPLApplicationPlugin.js.map +1 -0
  25. package/lib/components/{AgGrid.d.ts → LegendREPLApplication.d.ts} +8 -6
  26. package/lib/components/LegendREPLApplication.d.ts.map +1 -0
  27. package/lib/components/LegendREPLApplication.js +32 -0
  28. package/lib/components/LegendREPLApplication.js.map +1 -0
  29. package/lib/components/{LegendREPLGridClientFrameworkProvider.d.ts → LegendREPLFrameworkProvider.d.ts} +4 -4
  30. package/lib/components/LegendREPLFrameworkProvider.d.ts.map +1 -0
  31. package/lib/components/{LegendREPLGridClientFrameworkProvider.js → LegendREPLFrameworkProvider.js} +9 -9
  32. package/lib/components/LegendREPLFrameworkProvider.js.map +1 -0
  33. package/lib/components/{REPLGridClientStoreProvider.d.ts → REPLStoreProvider.d.ts} +5 -5
  34. package/lib/components/REPLStoreProvider.d.ts.map +1 -0
  35. package/lib/components/{REPLGridClientStoreProvider.js → REPLStoreProvider.js} +9 -9
  36. package/lib/components/REPLStoreProvider.js.map +1 -0
  37. package/lib/components/dataCube/DataCube.d.ts +19 -0
  38. package/lib/components/dataCube/DataCube.d.ts.map +1 -0
  39. package/lib/components/dataCube/DataCube.js +33 -0
  40. package/lib/components/dataCube/DataCube.js.map +1 -0
  41. package/lib/components/{REPLGridClient.d.ts → dataCube/editor/DataCubeEditor.d.ts} +5 -9
  42. package/lib/components/dataCube/editor/DataCubeEditor.d.ts.map +1 -0
  43. package/lib/components/dataCube/editor/DataCubeEditor.js +54 -0
  44. package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -0
  45. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.d.ts +19 -0
  46. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.d.ts.map +1 -0
  47. package/lib/components/dataCube/{DataCubeQueryTextEditor.js → editor/DataCubeEditorCodePanel.js} +20 -20
  48. package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -0
  49. package/lib/components/dataCube/{DataCubeGridEditor.d.ts → editor/DataCubeEditorSortPanel.d.ts} +4 -4
  50. package/lib/components/dataCube/editor/DataCubeEditorSortPanel.d.ts.map +1 -0
  51. package/lib/components/dataCube/editor/DataCubeEditorSortPanel.js +61 -0
  52. package/lib/components/dataCube/editor/DataCubeEditorSortPanel.js.map +1 -0
  53. package/lib/components/dataCube/{DataCubeQueryTextEditor.d.ts → grid/DataCubeGrid.d.ts} +4 -4
  54. package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -0
  55. package/lib/components/dataCube/grid/DataCubeGrid.js +59 -0
  56. package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -0
  57. package/lib/grid.css +1 -1
  58. package/lib/index.css +2 -2
  59. package/lib/index.css.map +1 -1
  60. package/lib/index.d.ts +1 -1
  61. package/lib/index.d.ts.map +1 -1
  62. package/lib/index.js +8 -8
  63. package/lib/index.js.map +1 -1
  64. package/lib/package.json +3 -3
  65. package/lib/repl.css +1 -1
  66. package/lib/server/REPLServerClient.d.ts +11 -13
  67. package/lib/server/REPLServerClient.d.ts.map +1 -1
  68. package/lib/server/REPLServerClient.js +27 -15
  69. package/lib/server/REPLServerClient.js.map +1 -1
  70. package/lib/server/models/DataCubeEngineModels.d.ts +50 -0
  71. package/lib/server/models/DataCubeEngineModels.d.ts.map +1 -0
  72. package/lib/server/models/DataCubeEngineModels.js +39 -0
  73. package/lib/server/models/DataCubeEngineModels.js.map +1 -0
  74. package/lib/server/models/DataCubeQuery.d.ts +41 -0
  75. package/lib/server/models/DataCubeQuery.d.ts.map +1 -0
  76. package/lib/server/models/DataCubeQuery.js +78 -0
  77. package/lib/server/models/DataCubeQuery.js.map +1 -0
  78. package/lib/stores/{LegendREPLGridClientApplicationPlugin.d.ts → LegendREPLApplicationPlugin.d.ts} +4 -4
  79. package/lib/stores/LegendREPLApplicationPlugin.d.ts.map +1 -0
  80. package/lib/stores/{LegendREPLGridClientApplicationPlugin.js → LegendREPLApplicationPlugin.js} +2 -2
  81. package/lib/stores/LegendREPLApplicationPlugin.js.map +1 -0
  82. package/lib/stores/LegendREPLBaseStore.d.ts +25 -0
  83. package/lib/stores/LegendREPLBaseStore.d.ts.map +1 -0
  84. package/lib/stores/{LegendREPLGridClientBaseStore.js → LegendREPLBaseStore.js} +2 -2
  85. package/lib/stores/LegendREPLBaseStore.js.map +1 -0
  86. package/lib/stores/dataCube/DataCubeMetaModelConst.d.ts +49 -0
  87. package/lib/stores/dataCube/DataCubeMetaModelConst.d.ts.map +1 -0
  88. package/lib/stores/dataCube/DataCubeMetaModelConst.js +57 -0
  89. package/lib/stores/dataCube/DataCubeMetaModelConst.js.map +1 -0
  90. package/lib/stores/dataCube/DataCubeState.d.ts +18 -23
  91. package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
  92. package/lib/stores/dataCube/DataCubeState.js +31 -181
  93. package/lib/stores/dataCube/DataCubeState.js.map +1 -1
  94. package/lib/stores/{REPLGridClientStore.d.ts → dataCube/DataCubeStore.d.ts} +7 -7
  95. package/lib/stores/dataCube/DataCubeStore.d.ts.map +1 -0
  96. package/lib/stores/{REPLGridClientStore.js → dataCube/DataCubeStore.js} +5 -4
  97. package/lib/stores/dataCube/DataCubeStore.js.map +1 -0
  98. package/lib/stores/dataCube/core/DataCubeEngine.d.ts +29 -0
  99. package/lib/stores/dataCube/core/DataCubeEngine.d.ts.map +1 -0
  100. package/lib/stores/dataCube/core/DataCubeEngine.js +47 -0
  101. package/lib/stores/dataCube/core/DataCubeEngine.js.map +1 -0
  102. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.d.ts +37 -0
  103. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.d.ts.map +1 -0
  104. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.js +269 -0
  105. package/lib/stores/dataCube/core/DataCubeQueryAnalyzer.js.map +1 -0
  106. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts +19 -0
  107. package/lib/stores/dataCube/core/DataCubeQueryBuilder.d.ts.map +1 -0
  108. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +98 -0
  109. package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -0
  110. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +73 -0
  111. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -0
  112. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js +56 -0
  113. package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -0
  114. package/lib/stores/dataCube/{DataCubePanelState.d.ts → core/DataCubeQuerySnapshotManager.d.ts} +11 -6
  115. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -0
  116. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js +46 -0
  117. package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js.map +1 -0
  118. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts +27 -0
  119. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.d.ts.map +1 -0
  120. package/lib/{components/grid/REPLGridServerResult.js → stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js} +18 -10
  121. package/lib/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.js.map +1 -0
  122. package/lib/stores/dataCube/{DataCubeQueryEditorState.d.ts → editor/DataCubeEditorCodeState.d.ts} +12 -2
  123. package/lib/stores/dataCube/editor/DataCubeEditorCodeState.d.ts.map +1 -0
  124. package/lib/stores/dataCube/editor/DataCubeEditorCodeState.js +87 -0
  125. package/lib/stores/dataCube/editor/DataCubeEditorCodeState.js.map +1 -0
  126. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.d.ts +28 -0
  127. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.d.ts.map +1 -0
  128. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.js +17 -0
  129. package/lib/stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.js.map +1 -0
  130. package/lib/stores/dataCube/editor/DataCubeEditorSortState.d.ts +46 -0
  131. package/lib/stores/dataCube/editor/DataCubeEditorSortState.d.ts.map +1 -0
  132. package/lib/stores/dataCube/editor/DataCubeEditorSortState.js +133 -0
  133. package/lib/stores/dataCube/editor/DataCubeEditorSortState.js.map +1 -0
  134. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts +44 -0
  135. package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -0
  136. package/lib/stores/dataCube/editor/DataCubeEditorState.js +77 -0
  137. package/lib/stores/dataCube/editor/DataCubeEditorState.js.map +1 -0
  138. package/lib/{components/grid/ServerSideDataSource.d.ts → stores/dataCube/grid/DataCubeGridClientEngine.d.ts} +17 -14
  139. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -0
  140. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +96 -0
  141. package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -0
  142. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts +19 -0
  143. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts.map +1 -0
  144. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js +224 -0
  145. package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js.map +1 -0
  146. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts +33 -0
  147. package/lib/stores/dataCube/grid/DataCubeGridState.d.ts.map +1 -0
  148. package/lib/stores/dataCube/grid/DataCubeGridState.js +50 -0
  149. package/lib/stores/dataCube/grid/DataCubeGridState.js.map +1 -0
  150. package/package.json +9 -9
  151. package/src/{Const.ts → __lib__/LegendREPLEvent.ts} +1 -16
  152. package/{lib/components/grid/REPLGridServerResult.d.ts → src/__lib__/LegendREPLSetting.ts} +3 -6
  153. package/src/application/LegendREPL.tsx +64 -0
  154. package/src/application/{LegendREPLGridClientApplicationConfig.ts → LegendREPLApplicationConfig.ts} +3 -3
  155. package/src/application/{LegendREPLGridClientPluginManager.ts → LegendREPLPluginManager.ts} +5 -5
  156. package/src/components/{Core_LegendREPLGridClientApplicationPlugin.tsx → Core_LegendREPLApplicationPlugin.tsx} +11 -6
  157. package/src/components/{LegendREPLGridClientApplication.tsx → LegendREPLApplication.tsx} +11 -28
  158. package/src/components/LegendREPLFrameworkProvider.tsx +57 -0
  159. package/src/components/{REPLGridClientStoreProvider.tsx → REPLStoreProvider.tsx} +17 -21
  160. package/src/components/dataCube/DataCube.tsx +63 -0
  161. package/src/components/dataCube/editor/DataCubeEditor.tsx +127 -0
  162. package/src/components/dataCube/{DataCubeQueryTextEditor.tsx → editor/DataCubeEditorCodePanel.tsx} +69 -76
  163. package/src/components/dataCube/editor/DataCubeEditorSortPanel.tsx +274 -0
  164. package/src/components/dataCube/grid/DataCubeGrid.tsx +77 -0
  165. package/src/index.tsx +12 -8
  166. package/src/server/REPLServerClient.ts +50 -78
  167. package/src/server/models/DataCubeEngineModels.ts +84 -0
  168. package/src/server/models/DataCubeQuery.ts +130 -0
  169. package/src/stores/{LegendREPLGridClientApplicationPlugin.ts → LegendREPLApplicationPlugin.ts} +4 -4
  170. package/src/stores/{LegendREPLGridClientBaseStore.ts → LegendREPLBaseStore.ts} +9 -9
  171. package/src/stores/dataCube/DataCubeMetaModelConst.ts +61 -0
  172. package/src/stores/dataCube/DataCubeState.ts +39 -303
  173. package/src/stores/{REPLGridClientStore.ts → dataCube/DataCubeStore.ts} +8 -6
  174. package/src/stores/dataCube/core/DataCubeEngine.ts +79 -0
  175. package/src/stores/dataCube/core/DataCubeQueryAnalyzer.ts +424 -0
  176. package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +151 -0
  177. package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +201 -0
  178. package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +67 -0
  179. package/src/stores/dataCube/core/DataCubeQuerySnapshotSubscriber.ts +43 -0
  180. package/src/stores/dataCube/editor/DataCubeEditorCodeState.ts +166 -0
  181. package/src/{components/grid/REPLGridServerResult.ts → stores/dataCube/editor/DataCubeEditorQuerySnapshotBuilder.ts} +14 -11
  182. package/src/stores/dataCube/editor/DataCubeEditorSortState.ts +198 -0
  183. package/src/stores/dataCube/editor/DataCubeEditorState.ts +94 -0
  184. package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +152 -0
  185. package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.ts +245 -0
  186. package/src/stores/dataCube/grid/DataCubeGridState.ts +62 -0
  187. package/tsconfig.json +33 -29
  188. package/lib/Const.d.ts +0 -32
  189. package/lib/Const.d.ts.map +0 -1
  190. package/lib/Const.js +0 -35
  191. package/lib/Const.js.map +0 -1
  192. package/lib/application/LegendREPLGridClient.d.ts.map +0 -1
  193. package/lib/application/LegendREPLGridClient.js.map +0 -1
  194. package/lib/application/LegendREPLGridClientApplicationConfig.d.ts.map +0 -1
  195. package/lib/application/LegendREPLGridClientApplicationConfig.js.map +0 -1
  196. package/lib/application/LegendREPLGridClientPluginManager.d.ts.map +0 -1
  197. package/lib/application/LegendREPLGridClientPluginManager.js.map +0 -1
  198. package/lib/components/AgGrid.d.ts.map +0 -1
  199. package/lib/components/AgGrid.js +0 -41
  200. package/lib/components/AgGrid.js.map +0 -1
  201. package/lib/components/Core_LegendREPLGridClientApplicationPlugin.d.ts.map +0 -1
  202. package/lib/components/Core_LegendREPLGridClientApplicationPlugin.js.map +0 -1
  203. package/lib/components/LegendREPLGridClientApplication.d.ts +0 -31
  204. package/lib/components/LegendREPLGridClientApplication.d.ts.map +0 -1
  205. package/lib/components/LegendREPLGridClientApplication.js +0 -39
  206. package/lib/components/LegendREPLGridClientApplication.js.map +0 -1
  207. package/lib/components/LegendREPLGridClientFrameworkProvider.d.ts.map +0 -1
  208. package/lib/components/LegendREPLGridClientFrameworkProvider.js.map +0 -1
  209. package/lib/components/REPLGridClient.d.ts.map +0 -1
  210. package/lib/components/REPLGridClient.js +0 -143
  211. package/lib/components/REPLGridClient.js.map +0 -1
  212. package/lib/components/REPLGridClientStoreProvider.d.ts.map +0 -1
  213. package/lib/components/REPLGridClientStoreProvider.js.map +0 -1
  214. package/lib/components/dataCube/DataCubeGridEditor.d.ts.map +0 -1
  215. package/lib/components/dataCube/DataCubeGridEditor.js +0 -37
  216. package/lib/components/dataCube/DataCubeGridEditor.js.map +0 -1
  217. package/lib/components/dataCube/DataCubeQueryTextEditor.d.ts.map +0 -1
  218. package/lib/components/dataCube/DataCubeQueryTextEditor.js.map +0 -1
  219. package/lib/components/grid/GridUtils.d.ts +0 -31
  220. package/lib/components/grid/GridUtils.d.ts.map +0 -1
  221. package/lib/components/grid/GridUtils.js +0 -174
  222. package/lib/components/grid/GridUtils.js.map +0 -1
  223. package/lib/components/grid/REPLGridServerResult.d.ts.map +0 -1
  224. package/lib/components/grid/REPLGridServerResult.js.map +0 -1
  225. package/lib/components/grid/ServerSideDataSource.d.ts.map +0 -1
  226. package/lib/components/grid/ServerSideDataSource.js +0 -109
  227. package/lib/components/grid/ServerSideDataSource.js.map +0 -1
  228. package/lib/components/grid/TDSLambdaBuilder.d.ts.map +0 -1
  229. package/lib/components/grid/TDSLambdaBuilder.js +0 -314
  230. package/lib/components/grid/TDSLambdaBuilder.js.map +0 -1
  231. package/lib/components/grid/TDSQuery.d.ts +0 -25
  232. package/lib/components/grid/TDSQuery.d.ts.map +0 -1
  233. package/lib/components/grid/TDSQuery.js +0 -32
  234. package/lib/components/grid/TDSQuery.js.map +0 -1
  235. package/lib/components/grid/TDSRequest.d.ts +0 -103
  236. package/lib/components/grid/TDSRequest.d.ts.map +0 -1
  237. package/lib/components/grid/TDSRequest.js +0 -172
  238. package/lib/components/grid/TDSRequest.js.map +0 -1
  239. package/lib/stores/CompletionResult.d.ts.map +0 -1
  240. package/lib/stores/CompletionResult.js +0 -26
  241. package/lib/stores/CompletionResult.js.map +0 -1
  242. package/lib/stores/LegendREPLGridClientApplicationPlugin.d.ts.map +0 -1
  243. package/lib/stores/LegendREPLGridClientApplicationPlugin.js.map +0 -1
  244. package/lib/stores/LegendREPLGridClientBaseStore.d.ts +0 -25
  245. package/lib/stores/LegendREPLGridClientBaseStore.d.ts.map +0 -1
  246. package/lib/stores/LegendREPLGridClientBaseStore.js.map +0 -1
  247. package/lib/stores/REPLGridClientStore.d.ts.map +0 -1
  248. package/lib/stores/REPLGridClientStore.js.map +0 -1
  249. package/lib/stores/dataCube/DataCubeConfigState.d.ts +0 -32
  250. package/lib/stores/dataCube/DataCubeConfigState.d.ts.map +0 -1
  251. package/lib/stores/dataCube/DataCubeConfigState.js +0 -62
  252. package/lib/stores/dataCube/DataCubeConfigState.js.map +0 -1
  253. package/lib/stores/dataCube/DataCubeGridState.d.ts +0 -39
  254. package/lib/stores/dataCube/DataCubeGridState.d.ts.map +0 -1
  255. package/lib/stores/dataCube/DataCubeGridState.js +0 -108
  256. package/lib/stores/dataCube/DataCubeGridState.js.map +0 -1
  257. package/lib/stores/dataCube/DataCubePanelState.d.ts.map +0 -1
  258. package/lib/stores/dataCube/DataCubePanelState.js.map +0 -1
  259. package/lib/stores/dataCube/DataCubePropertiesPanelState.d.ts +0 -34
  260. package/lib/stores/dataCube/DataCubePropertiesPanelState.d.ts.map +0 -1
  261. package/lib/stores/dataCube/DataCubePropertiesPanelState.js +0 -57
  262. package/lib/stores/dataCube/DataCubePropertiesPanelState.js.map +0 -1
  263. package/lib/stores/dataCube/DataCubeQueryEditorState.d.ts.map +0 -1
  264. package/lib/stores/dataCube/DataCubeQueryEditorState.js +0 -49
  265. package/lib/stores/dataCube/DataCubeQueryEditorState.js.map +0 -1
  266. package/lib/stores/dataCube/DataCubeQueryTextEditorState.d.ts +0 -25
  267. package/lib/stores/dataCube/DataCubeQueryTextEditorState.d.ts.map +0 -1
  268. package/lib/stores/dataCube/DataCubeQueryTextEditorState.js +0 -35
  269. package/lib/stores/dataCube/DataCubeQueryTextEditorState.js.map +0 -1
  270. package/lib/stores/dataCube/HPivotAndSortPanelState.d.ts +0 -40
  271. package/lib/stores/dataCube/HPivotAndSortPanelState.d.ts.map +0 -1
  272. package/lib/stores/dataCube/HPivotAndSortPanelState.js +0 -130
  273. package/lib/stores/dataCube/HPivotAndSortPanelState.js.map +0 -1
  274. package/src/application/LegendREPLGridClient.tsx +0 -72
  275. package/src/components/AgGrid.tsx +0 -59
  276. package/src/components/LegendREPLGridClientFrameworkProvider.tsx +0 -63
  277. package/src/components/REPLGridClient.tsx +0 -560
  278. package/src/components/dataCube/DataCubeGridEditor.tsx +0 -69
  279. package/src/components/grid/GridUtils.ts +0 -220
  280. package/src/components/grid/ServerSideDataSource.ts +0 -197
  281. package/src/components/grid/TDSLambdaBuilder.ts +0 -456
  282. package/src/components/grid/TDSQuery.ts +0 -37
  283. package/src/components/grid/TDSRequest.ts +0 -231
  284. package/src/stores/CompletionResult.ts +0 -30
  285. package/src/stores/dataCube/DataCubeConfigState.ts +0 -79
  286. package/src/stores/dataCube/DataCubeGridState.ts +0 -143
  287. package/src/stores/dataCube/DataCubePanelState.ts +0 -28
  288. package/src/stores/dataCube/DataCubePropertiesPanelState.ts +0 -65
  289. package/src/stores/dataCube/DataCubeQueryEditorState.ts +0 -66
  290. package/src/stores/dataCube/DataCubeQueryTextEditorState.ts +0 -41
  291. package/src/stores/dataCube/HPivotAndSortPanelState.ts +0 -170
@@ -0,0 +1,130 @@
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
+ SerializationFactory,
19
+ UnsupportedOperationError,
20
+ usingConstantValueSchema,
21
+ usingModelSchema,
22
+ type PlainObject,
23
+ } from '@finos/legend-shared';
24
+ import {
25
+ createModelSchema,
26
+ custom,
27
+ deserialize,
28
+ list,
29
+ primitive,
30
+ raw,
31
+ serialize,
32
+ } from 'serializr';
33
+
34
+ export abstract class DataCubeQuerySource {
35
+ columns: DataCubeQueryColumn[] = [];
36
+ query!: string;
37
+ runtime!: string;
38
+ }
39
+
40
+ export class DataCubeQueryColumn {
41
+ name!: string;
42
+ type!: string;
43
+
44
+ static readonly serialization = new SerializationFactory(
45
+ createModelSchema(DataCubeQueryColumn, {
46
+ name: primitive(),
47
+ type: primitive(),
48
+ }),
49
+ );
50
+ }
51
+
52
+ enum DATA_CUBE_QUERY_SOURCE_TYPE {
53
+ REPL_EXECUTED_QUERY = 'REPLExecutedQuery',
54
+ }
55
+
56
+ export class DataCubeQuerySourceREPLExecutedQuery extends DataCubeQuerySource {
57
+ static readonly serialization = new SerializationFactory(
58
+ createModelSchema(DataCubeQuerySourceREPLExecutedQuery, {
59
+ _type: usingConstantValueSchema(
60
+ DATA_CUBE_QUERY_SOURCE_TYPE.REPL_EXECUTED_QUERY,
61
+ ),
62
+ columns: list(usingModelSchema(DataCubeQueryColumn.serialization.schema)),
63
+ query: primitive(),
64
+ runtime: primitive(),
65
+ }),
66
+ );
67
+ }
68
+
69
+ function deserializeQuerySource(
70
+ json: PlainObject<DataCubeQuerySource>,
71
+ ): DataCubeQuerySource {
72
+ switch (json._type) {
73
+ case DATA_CUBE_QUERY_SOURCE_TYPE.REPL_EXECUTED_QUERY:
74
+ return deserialize(
75
+ DataCubeQuerySourceREPLExecutedQuery.serialization.schema,
76
+ json,
77
+ );
78
+ default:
79
+ throw new UnsupportedOperationError(
80
+ `Can't deserialize data cube query source of type '${json._type}'`,
81
+ );
82
+ }
83
+ }
84
+
85
+ function serializeQuerySource(
86
+ object: DataCubeQuerySource,
87
+ ): PlainObject<DataCubeQuerySource> {
88
+ if (object instanceof DataCubeQuerySourceREPLExecutedQuery) {
89
+ return serialize(
90
+ DataCubeQuerySourceREPLExecutedQuery.serialization.schema,
91
+ object,
92
+ );
93
+ }
94
+ throw new UnsupportedOperationError(
95
+ `Can't serialize data cube query source`,
96
+ object,
97
+ );
98
+ }
99
+
100
+ export class DataCubeConfiguration {
101
+ // TODO
102
+ }
103
+
104
+ export class DataCubeQuery {
105
+ name!: string;
106
+ query!: string;
107
+ partialQuery!: string;
108
+ source!: DataCubeQuerySource;
109
+ configuration!: DataCubeConfiguration;
110
+
111
+ constructor(
112
+ name: string,
113
+ query: string,
114
+ configuration: DataCubeConfiguration,
115
+ ) {
116
+ this.name = name;
117
+ this.query = query;
118
+ this.configuration = configuration;
119
+ }
120
+
121
+ static readonly serialization = new SerializationFactory(
122
+ createModelSchema(DataCubeQuery, {
123
+ configuration: raw(), // TODO: @akphi - populate this once we know the shape better
124
+ name: primitive(),
125
+ partialQuery: primitive(),
126
+ query: primitive(),
127
+ source: custom(serializeQuerySource, deserializeQuerySource),
128
+ }),
129
+ );
130
+ }
@@ -15,16 +15,16 @@
15
15
  */
16
16
 
17
17
  import { LegendApplicationPlugin } from '@finos/legend-application';
18
- import type { LegendREPLGridClientPluginManager } from '../application/LegendREPLGridClientPluginManager.js';
18
+ import type { LegendREPLPluginManager } from '../application/LegendREPLPluginManager.js';
19
19
 
20
- export abstract class LegendREPLGridClientApplicationPlugin extends LegendApplicationPlugin {
20
+ export abstract class LegendREPLApplicationPlugin extends LegendApplicationPlugin {
21
21
  /**
22
22
  * This helps to better type-check for this empty abtract type
23
23
  * See https://github.com/finos/legend-studio/blob/master/docs/technical/typescript-usage.md#understand-typescript-structual-type-system
24
24
  */
25
- private readonly _$nominalTypeBrand!: 'LegendREPLGridClientApplicationPlugin';
25
+ private readonly _$nominalTypeBrand!: 'LegendREPLApplicationPlugin';
26
26
 
27
- install(pluginManager: LegendREPLGridClientPluginManager): void {
27
+ install(pluginManager: LegendREPLPluginManager): void {
28
28
  pluginManager.registerApplicationPlugin(this);
29
29
  }
30
30
  }
@@ -15,19 +15,19 @@
15
15
  */
16
16
 
17
17
  import type { ApplicationStore } from '@finos/legend-application';
18
- import type { LegendREPLGridClientApplicationConfig } from '../application/LegendREPLGridClientApplicationConfig.js';
19
- import type { LegendREPLGridClientPluginManager } from '../application/LegendREPLGridClientPluginManager.js';
18
+ import type { LegendREPLApplicationConfig } from '../application/LegendREPLApplicationConfig.js';
19
+ import type { LegendREPLPluginManager } from '../application/LegendREPLPluginManager.js';
20
20
 
21
- export type LegendREPLGridClientApplicationStore = ApplicationStore<
22
- LegendREPLGridClientApplicationConfig,
23
- LegendREPLGridClientPluginManager
21
+ export type LegendREPLApplicationStore = ApplicationStore<
22
+ LegendREPLApplicationConfig,
23
+ LegendREPLPluginManager
24
24
  >;
25
25
 
26
- export class LegendREPLGridClientBaseStore {
27
- readonly applicationStore: LegendREPLGridClientApplicationStore;
28
- readonly pluginManager: LegendREPLGridClientPluginManager;
26
+ export class LegendREPLBaseStore {
27
+ readonly applicationStore: LegendREPLApplicationStore;
28
+ readonly pluginManager: LegendREPLPluginManager;
29
29
 
30
- constructor(applicationStore: LegendREPLGridClientApplicationStore) {
30
+ constructor(applicationStore: LegendREPLApplicationStore) {
31
31
  this.applicationStore = applicationStore;
32
32
  this.pluginManager = applicationStore.pluginManager;
33
33
  }
@@ -0,0 +1,61 @@
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
+ export enum DATA_CUBE_FUNCTIONS {
18
+ // relation
19
+ EXTEND = 'meta::pure::functions::relation::extend',
20
+ FILTER = 'meta::pure::functions::relation::filter',
21
+ GROUP_BY = 'meta::pure::functions::relation::groupBy',
22
+ LIMIT = 'meta::pure::functions::relation::limit',
23
+ PIVOT = 'meta::pure::functions::relation::pivot',
24
+ RENAME = 'meta::pure::functions::relation::rename',
25
+ SELECT = 'meta::pure::functions::relation::select',
26
+ SLICE = 'meta::pure::functions::relation::slice',
27
+ SORT = 'meta::pure::functions::relation::sort',
28
+
29
+ // core
30
+ CAST = 'meta::pure::functions::lang::cast',
31
+ FROM = 'meta::pure::mapping::from',
32
+
33
+ // sort
34
+ ASC = 'meta::pure::functions::relation::ascending',
35
+ DESC = 'meta::pure::functions::relation::descending',
36
+
37
+ // filter
38
+ AND = 'meta::pure::functions::boolean::and',
39
+ NOT = 'meta::pure::functions::boolean::not',
40
+ OR = 'meta::pure::functions::boolean::or',
41
+
42
+ // aggregate
43
+ }
44
+
45
+ export const DEFAULT_LAMBDA_VARIABLE_NAME = 'x';
46
+ export const PIVOT_COLUMN_NAME_VALUE_SEPARATOR = '__|__';
47
+
48
+ export enum DATA_CUBE_AGGREGATE_FUNCTION {
49
+ SUM = 'sum',
50
+ MIN = 'min',
51
+ MAX = 'max',
52
+ COUNT = 'count',
53
+ AVG = 'avg',
54
+ FIRST = 'first',
55
+ LAST = 'last',
56
+ }
57
+
58
+ export enum DATA_CUBE_COLUMN_SORT_DIRECTION {
59
+ ASCENDING = 'ascending',
60
+ DESCENDING = 'descending',
61
+ }
@@ -14,320 +14,56 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { flow, flowResult, makeObservable, observable } from 'mobx';
18
- import type { REPLGridClientStore } from '../REPLGridClientStore.js';
19
- import { DataCubeGridState } from './DataCubeGridState.js';
20
- import { DataCubeQueryTextEditorState } from './DataCubeQueryTextEditorState.js';
21
- import { DataCubeConfigState } from './DataCubeConfigState.js';
22
- import { DataCubePropertiesPanelState } from './DataCubePropertiesPanelState.js';
23
- import {
24
- ActionState,
25
- HttpStatus,
26
- LogEvent,
27
- NetworkClientError,
28
- assertErrorThrown,
29
- guaranteeNonNullable,
30
- guaranteeType,
31
- type GeneratorFn,
32
- type PlainObject,
33
- } from '@finos/legend-shared';
34
- import { generatePath } from '@finos/legend-application/browser';
35
- import {
36
- V1_serializeValueSpecification,
37
- type V1_TDSExecutionResult,
38
- V1_buildExecutionResult,
39
- V1_serializeExecutionResult,
40
- TDSExecutionResult,
41
- V1_ParserError,
42
- ParserError,
43
- SourceInformation,
44
- V1_Lambda,
45
- V1_deserializeValueSpecification,
46
- } from '@finos/legend-graph';
47
- import {
48
- languages as monacoLanguagesAPI,
49
- type IPosition,
50
- type editor as monacoEditorAPI,
51
- } from 'monaco-editor';
52
- import { LEGEND_REPL_EVENT } from '../../Const.js';
53
- import {
54
- LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN,
55
- LEGEND_REPL_GRID_CLIENT_PATTERN_TOKEN,
56
- } from '../../components/LegendREPLGridClientApplication.js';
57
- import { REPLGridServerResult } from '../../components/grid/REPLGridServerResult.js';
58
- import { buildLambdaExpressions } from '../../components/grid/TDSLambdaBuilder.js';
59
- import { TDSQuery } from '../../components/grid/TDSQuery.js';
60
- import { TDSRequest, TDSGroupby } from '../../components/grid/TDSRequest.js';
61
- import { CompletionItem } from '../CompletionResult.js';
17
+ import { flowResult } from 'mobx';
18
+ import type { REPLStore } from './DataCubeStore.js';
19
+ import { DataCubeGridState } from './grid/DataCubeGridState.js';
20
+ import { DataCubeEditorState } from './editor/DataCubeEditorState.js';
21
+ import type { DataCubeQuery } from '../../server/models/DataCubeQuery.js';
22
+ import { ActionState, assertErrorThrown } from '@finos/legend-shared';
23
+ import { DataCubeEngine } from './core/DataCubeEngine.js';
24
+ import { DataCubeQuerySnapshotManager } from './core/DataCubeQuerySnapshotManager.js';
25
+ import { buildSnapshotFromQuery } from './core/DataCubeQueryAnalyzer.js';
26
+ import type { LegendREPLApplicationStore } from '../LegendREPLBaseStore.js';
62
27
 
63
28
  export class DataCubeState {
64
- readonly editorStore!: REPLGridClientStore;
29
+ readonly editorStore: REPLStore;
30
+ readonly applicationStore: LegendREPLApplicationStore;
31
+ readonly engine: DataCubeEngine;
32
+ readonly snapshotManager: DataCubeQuerySnapshotManager;
33
+ readonly grid: DataCubeGridState;
34
+ readonly editor: DataCubeEditorState;
35
+ readonly initState = ActionState.create();
65
36
 
66
- gridState!: DataCubeGridState;
67
- queryTextEditorState!: DataCubeQueryTextEditorState;
68
- configState!: DataCubeConfigState;
69
- propertiesPanelState!: DataCubePropertiesPanelState;
70
-
71
- executeAction = ActionState.create();
72
-
73
- constructor(editorStore: REPLGridClientStore) {
74
- makeObservable(this, {
75
- gridState: observable,
76
- queryTextEditorState: observable,
77
- configState: observable,
78
- propertiesPanelState: observable,
79
- executeAction: observable,
80
- getREPLGridServerResult: flow,
81
- getInitialQueryLambda: flow,
82
- getInitialREPLGridServerResult: flow,
83
- getLicenseKey: flow,
84
- executeLambda: flow,
85
- parseQuery: flow,
86
- saveQuery: flow,
87
- });
37
+ baseQuery!: DataCubeQuery;
88
38
 
39
+ constructor(editorStore: REPLStore) {
89
40
  this.editorStore = editorStore;
41
+ this.applicationStore = editorStore.applicationStore;
42
+ this.engine = new DataCubeEngine(this.editorStore.client);
90
43
 
91
- this.gridState = new DataCubeGridState(this);
92
- this.queryTextEditorState = new DataCubeQueryTextEditorState(this);
93
- this.configState = new DataCubeConfigState(this);
94
- this.propertiesPanelState = new DataCubePropertiesPanelState(this);
95
- }
96
-
97
- *getREPLGridServerResult(tdsRequest: TDSRequest): GeneratorFn<void> {
98
- try {
99
- const isSubQuery = tdsRequest.groupBy.groupKeys.length !== 0;
100
- const lambda = buildLambdaExpressions(
101
- guaranteeNonNullable(this.gridState.initialQueryLambda?.body[0]),
102
- tdsRequest,
103
- this.configState.isPaginationEnabled,
104
- );
105
- const resultObj = (yield flowResult(
106
- this.editorStore.client.getREPLGridServerResult(
107
- V1_serializeValueSpecification(lambda, []),
108
- ),
109
- )) as PlainObject<REPLGridServerResult>;
110
- const replGridResult =
111
- REPLGridServerResult.serialization.fromJson(resultObj);
112
- const tdsResult = JSON.parse(
113
- replGridResult.result,
114
- ) as PlainObject<V1_TDSExecutionResult>;
115
- this.gridState.setCurrentResult(
116
- guaranteeType(
117
- V1_buildExecutionResult(V1_serializeExecutionResult(tdsResult)),
118
- TDSExecutionResult,
119
- ),
120
- );
121
- if (isSubQuery) {
122
- this.queryTextEditorState.setCurrentSubQuery(
123
- replGridResult.currentQuery,
124
- );
125
- } else {
126
- this.queryTextEditorState.queryEditorState.setQuery(
127
- replGridResult.currentQuery.substring(1),
128
- );
129
- this.queryTextEditorState.setCurrentSubQuery(undefined);
130
- }
131
- } catch (error) {
132
- assertErrorThrown(error);
133
- this.editorStore.applicationStore.notificationService.notifyError(error);
134
- this.editorStore.applicationStore.logService.error(
135
- LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
136
- error,
137
- );
138
- }
139
- }
140
-
141
- async getTypeaheadResults(
142
- position: IPosition,
143
- model: monacoEditorAPI.ITextModel,
144
- ): Promise<monacoLanguagesAPI.CompletionItem[]> {
145
- try {
146
- const textUntilPosition = model.getValueInRange({
147
- startLineNumber: 1,
148
- startColumn: 1,
149
- endLineNumber: position.lineNumber,
150
- endColumn: position.column,
151
- });
152
- const resultObj =
153
- await this.editorStore.client.getTypeaheadResults(textUntilPosition);
154
- const result = resultObj.map((res) =>
155
- CompletionItem.serialization.fromJson(res),
156
- );
157
- const currentWord = model.getWordUntilPosition(position);
158
- return result.map((res) => ({
159
- label: res.display,
160
- kind: monacoLanguagesAPI.CompletionItemKind.Text,
161
- range: {
162
- startLineNumber: position.lineNumber,
163
- startColumn: currentWord.startColumn + 1,
164
- endLineNumber: position.lineNumber,
165
- endColumn: currentWord.endColumn + 1,
166
- },
167
- insertText: res.completion,
168
- })) as monacoLanguagesAPI.CompletionItem[];
169
- } catch (e) {
170
- return [];
171
- }
172
- }
173
-
174
- *executeLambda(): GeneratorFn<void> {
175
- try {
176
- this.executeAction.inProgress();
177
- const resultObj = (yield this.editorStore.client.executeLambda(
178
- this.queryTextEditorState.queryEditorState.query,
179
- this.configState.isPaginationEnabled,
180
- )) as PlainObject<REPLGridServerResult>;
181
- const replGridResult =
182
- REPLGridServerResult.serialization.fromJson(resultObj);
183
- const tdsResultObj = JSON.parse(
184
- replGridResult.result,
185
- ) as PlainObject<V1_TDSExecutionResult>;
186
- const tdsResult = guaranteeType(
187
- V1_buildExecutionResult(V1_serializeExecutionResult(tdsResultObj)),
188
- TDSExecutionResult,
189
- );
190
- this.gridState.setInitialResult(tdsResult);
191
- this.queryTextEditorState.queryEditorState.setQuery(
192
- replGridResult.currentQuery.substring(1),
193
- );
194
- this.queryTextEditorState.setCurrentSubQuery(undefined);
195
- this.gridState.setColumns(tdsResult.result.columns);
196
-
197
- yield flowResult(this.getInitialQueryLambda());
198
- this.executeAction.complete();
199
- } catch (error) {
200
- this.executeAction.fail();
201
- assertErrorThrown(error);
202
- this.editorStore.applicationStore.notificationService.notifyError(error);
203
- this.editorStore.applicationStore.logService.error(
204
- LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
205
- error,
206
- );
207
- }
44
+ // NOTE: snapshot manager must be instantiated before subscribers
45
+ this.snapshotManager = new DataCubeQuerySnapshotManager(this);
46
+ this.grid = new DataCubeGridState(this);
47
+ this.editor = new DataCubeEditorState(this);
208
48
  }
209
49
 
210
- *parseQuery(): GeneratorFn<void> {
50
+ async initialize(): Promise<void> {
51
+ this.initState.inProgress();
211
52
  try {
212
- this.queryTextEditorState.queryEditorState.setParserError(undefined);
213
- yield flowResult(
214
- this.editorStore.client.parseQuery(
215
- `|${this.queryTextEditorState.queryEditorState.query}`,
216
- ),
53
+ await flowResult(this.grid.initialize());
54
+ this.snapshotManager.registerSubscriber(this.grid);
55
+ this.snapshotManager.registerSubscriber(this.editor);
56
+
57
+ this.baseQuery = await this.engine.getBaseQuery();
58
+ const initialSnapshot = await buildSnapshotFromQuery(
59
+ this.baseQuery,
60
+ this.engine,
217
61
  );
218
- } catch (error) {
62
+ this.snapshotManager.broadcastSnapshot(initialSnapshot);
63
+ this.initState.complete();
64
+ } catch (error: unknown) {
219
65
  assertErrorThrown(error);
220
- if (
221
- error instanceof NetworkClientError &&
222
- error.response.status === HttpStatus.BAD_REQUEST
223
- ) {
224
- const protocol = V1_ParserError.serialization.fromJson(
225
- error.payload as PlainObject<V1_ParserError>,
226
- );
227
- const parserError = new ParserError(protocol.message);
228
- if (protocol.sourceInformation) {
229
- parserError.sourceInformation = new SourceInformation(
230
- protocol.sourceInformation.sourceId,
231
- protocol.sourceInformation.startLine,
232
- protocol.sourceInformation.startColumn,
233
- protocol.sourceInformation.endLine,
234
- protocol.sourceInformation.endColumn,
235
- );
236
- }
237
- this.queryTextEditorState.queryEditorState.setParserError(parserError);
238
- }
66
+ this.initState.fail();
239
67
  }
240
68
  }
241
-
242
- *saveQuery(): GeneratorFn<void> {
243
- try {
244
- const query = TDSQuery.serialization.toJson(
245
- new TDSQuery(
246
- guaranteeNonNullable(this.gridState.initialQueryLambda),
247
- this.gridState.lastQueryTDSRequest ??
248
- new TDSRequest([], [], [], new TDSGroupby([], [], []), 0, 100),
249
- ),
250
- );
251
- const queryId = (yield flowResult(
252
- this.editorStore.client.saveQuery(query),
253
- )) as string;
254
- this.editorStore.applicationStore.navigationService.navigator.goToLocation(
255
- generatePath(LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN.SAVED_QUERY, {
256
- [LEGEND_REPL_GRID_CLIENT_PATTERN_TOKEN.QUERY_ID]: queryId,
257
- }),
258
- );
259
- } catch (error) {
260
- assertErrorThrown(error);
261
- this.editorStore.applicationStore.notificationService.notifyError(error);
262
- this.editorStore.applicationStore.logService.error(
263
- LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
264
- error,
265
- );
266
- }
267
- }
268
-
269
- *getInitialQueryLambda(queryId?: string): GeneratorFn<void> {
270
- if (!queryId) {
271
- const lambdaObj =
272
- (yield this.editorStore.client.getIntialQueryLambda()) as PlainObject<V1_Lambda>;
273
- const lambda = V1_deserializeValueSpecification(lambdaObj, []);
274
- if (lambda instanceof V1_Lambda) {
275
- this.gridState.setInitialQueryLambda(lambda);
276
- }
277
- // this.replGridState.setCurrentQueryTDSRequest(undefined);
278
- } else {
279
- const queryObj = (yield this.editorStore.client.getREPLQuery(
280
- queryId,
281
- )) as PlainObject<TDSQuery>;
282
- const query = TDSQuery.serialization.fromJson(queryObj);
283
- this.gridState.setCurrentQueryTDSRequest(query.currentQueryInfo);
284
- this.gridState.setInitialQueryLambda(query.initialQuery);
285
- }
286
- }
287
-
288
- *getInitialREPLGridServerResult(queryId?: string): GeneratorFn<void> {
289
- try {
290
- this.executeAction.inProgress();
291
- if (!this.configState.licenseKey) {
292
- yield flowResult(this.getLicenseKey());
293
- }
294
-
295
- yield flowResult(this.getInitialQueryLambda(queryId));
296
-
297
- const resultObj =
298
- (yield this.editorStore.client.getInitialREPLGridServerResult(
299
- this.configState.isPaginationEnabled,
300
- )) as PlainObject<REPLGridServerResult>;
301
- const replGridResult =
302
- REPLGridServerResult.serialization.fromJson(resultObj);
303
- const tdsResultObj = JSON.parse(
304
- replGridResult.result,
305
- ) as PlainObject<V1_TDSExecutionResult>;
306
- const tdsResult = guaranteeType(
307
- V1_buildExecutionResult(V1_serializeExecutionResult(tdsResultObj)),
308
- TDSExecutionResult,
309
- );
310
- this.gridState.setInitialResult(tdsResult);
311
- this.queryTextEditorState.queryEditorState.setQuery(
312
- replGridResult.currentQuery.substring(1),
313
- );
314
- this.queryTextEditorState.setCurrentSubQuery(undefined);
315
- this.gridState.setColumns(tdsResult.result.columns);
316
- this.executeAction.complete();
317
- } catch (error) {
318
- this.executeAction.fail();
319
- assertErrorThrown(error);
320
- this.editorStore.applicationStore.notificationService.notifyError(error);
321
- this.editorStore.applicationStore.logService.error(
322
- LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
323
- error,
324
- );
325
- }
326
- }
327
-
328
- *getLicenseKey(): GeneratorFn<void> {
329
- const licenseKey =
330
- (yield this.editorStore.client.getLicenseKey()) as string;
331
- this.configState.setLicenseKey(licenseKey);
332
- }
333
69
  }
@@ -14,18 +14,20 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { LegendREPLGridClientApplicationStore } from './LegendREPLGridClientBaseStore.js';
18
- import { REPLServerClient } from '../server/REPLServerClient.js';
17
+ import type { LegendREPLApplicationStore } from '../LegendREPLBaseStore.js';
18
+ import { REPLServerClient } from '../../server/REPLServerClient.js';
19
19
  import { NetworkClient } from '@finos/legend-shared';
20
20
  import { makeObservable, observable } from 'mobx';
21
- import { DataCubeState } from './dataCube/DataCubeState.js';
21
+ import { DataCubeState } from './DataCubeState.js';
22
22
 
23
- export class REPLGridClientStore {
24
- readonly applicationStore: LegendREPLGridClientApplicationStore;
23
+ export class REPLStore {
24
+ readonly applicationStore: LegendREPLApplicationStore;
25
25
  readonly client: REPLServerClient;
26
+
27
+ // TODO: when we support multi-view, we would need to support multiple states
26
28
  dataCubeState!: DataCubeState;
27
29
 
28
- constructor(applicationStore: LegendREPLGridClientApplicationStore) {
30
+ constructor(applicationStore: LegendREPLApplicationStore) {
29
31
  makeObservable(this, {
30
32
  dataCubeState: observable,
31
33
  });