@finos/legend-application-query 13.6.0 → 13.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/lib/components/CloneQueryServiceSetup.d.ts.map +1 -1
  2. package/lib/components/CloneQueryServiceSetup.js +6 -2
  3. package/lib/components/CloneQueryServiceSetup.js.map +1 -1
  4. package/lib/components/Core_LegendQueryApplicationPlugin.js +4 -4
  5. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  6. package/lib/components/CreateMappingQuerySetup.d.ts.map +1 -1
  7. package/lib/components/CreateMappingQuerySetup.js +6 -2
  8. package/lib/components/CreateMappingQuerySetup.js.map +1 -1
  9. package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
  10. package/lib/components/LegendQueryWebApplication.js +4 -32
  11. package/lib/components/LegendQueryWebApplication.js.map +1 -1
  12. package/lib/components/QueryEditor.d.ts.map +1 -1
  13. package/lib/components/QueryEditor.js +8 -8
  14. package/lib/components/QueryEditor.js.map +1 -1
  15. package/lib/components/QueryEdtiorExistingQueryVersionRevertModal.d.ts.map +1 -1
  16. package/lib/components/QueryEdtiorExistingQueryVersionRevertModal.js +1 -1
  17. package/lib/components/QueryEdtiorExistingQueryVersionRevertModal.js.map +1 -1
  18. package/lib/components/UpdateExistingServiceQuerySetup.js +1 -1
  19. package/lib/components/UpdateExistingServiceQuerySetup.js.map +1 -1
  20. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  21. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +3 -1
  22. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
  23. package/lib/components/data-cube/ExistingQueryDataCubeViewer.d.ts.map +1 -1
  24. package/lib/components/data-cube/ExistingQueryDataCubeViewer.js +2 -1
  25. package/lib/components/data-cube/ExistingQueryDataCubeViewer.js.map +1 -1
  26. package/lib/components/data-space/DataSpaceQueryCreator.d.ts.map +1 -1
  27. package/lib/components/data-space/DataSpaceQueryCreator.js +3 -3
  28. package/lib/components/data-space/DataSpaceQueryCreator.js.map +1 -1
  29. package/lib/components/data-space/DataSpaceQuerySetup.js +1 -1
  30. package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
  31. package/lib/components/data-space/DataSpaceTemplateQueryCreator.d.ts.map +1 -1
  32. package/lib/components/data-space/DataSpaceTemplateQueryCreator.js +4 -3
  33. package/lib/components/data-space/DataSpaceTemplateQueryCreator.js.map +1 -1
  34. package/lib/index.css +1 -1
  35. package/lib/package.json +5 -5
  36. package/lib/stores/data-cube/ExistingQueryDataCubeViewer.d.ts.map +1 -1
  37. package/lib/stores/data-cube/ExistingQueryDataCubeViewer.js +7 -1
  38. package/lib/stores/data-cube/ExistingQueryDataCubeViewer.js.map +1 -1
  39. package/package.json +17 -17
  40. package/src/components/CloneQueryServiceSetup.tsx +10 -2
  41. package/src/components/Core_LegendQueryApplicationPlugin.tsx +4 -4
  42. package/src/components/CreateMappingQuerySetup.tsx +10 -2
  43. package/src/components/LegendQueryWebApplication.tsx +31 -85
  44. package/src/components/QueryEditor.tsx +24 -10
  45. package/src/components/QueryEdtiorExistingQueryVersionRevertModal.tsx +1 -3
  46. package/src/components/UpdateExistingServiceQuerySetup.tsx +1 -1
  47. package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +14 -2
  48. package/src/components/data-cube/ExistingQueryDataCubeViewer.tsx +6 -1
  49. package/src/components/data-space/DataSpaceQueryCreator.tsx +4 -6
  50. package/src/components/data-space/DataSpaceQuerySetup.tsx +1 -1
  51. package/src/components/data-space/DataSpaceTemplateQueryCreator.tsx +10 -6
  52. package/src/stores/data-cube/ExistingQueryDataCubeViewer.ts +7 -0
@@ -89,7 +89,11 @@ import {
89
89
  import { LATEST_VERSION_ALIAS } from '@finos/legend-server-depot';
90
90
  import { buildVersionOption, type VersionOption } from './QuerySetup.js';
91
91
  import { QueryEditorExistingQueryVersionRevertModal } from './QueryEdtiorExistingQueryVersionRevertModal.js';
92
- import { debounce, compareSemVerVersions } from '@finos/legend-shared';
92
+ import {
93
+ debounce,
94
+ compareSemVerVersions,
95
+ guaranteeNonNullable,
96
+ } from '@finos/legend-shared';
93
97
  import { LegendQueryInfo } from './LegendQueryAppInfo.js';
94
98
  import { QueryEditorDataspaceInfoModal } from './data-space/DataSpaceInfo.js';
95
99
  import { DataSpaceQueryBuilderState } from '@finos/legend-extension-dsl-data-space/application';
@@ -422,9 +426,7 @@ const QueryEditorExistingQueryInfoModal = observer(
422
426
  const selectedVersionOption = updateState.queryVersionId
423
427
  ? buildVersionOption(updateState.queryVersionId)
424
428
  : buildVersionOption(query.versionId);
425
- const onVersionOptionChange = async (
426
- option: VersionOption | null,
427
- ): Promise<void> => {
429
+ const onVersionOptionChange = (option: VersionOption | null) => {
428
430
  if (option?.value && option.value !== updateState.queryVersionId) {
429
431
  updateState.setQueryVersionId(option.value);
430
432
  }
@@ -816,7 +818,9 @@ const processQueryParams = (
816
818
  export const ExistingQueryEditor = observer(() => {
817
819
  const applicationStore = useApplicationStore();
818
820
  const params = useParams<ExistingQueryEditorPathParams>();
819
- const queryId = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID];
821
+ const queryId = guaranteeNonNullable(
822
+ params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID],
823
+ );
820
824
  const queryParams =
821
825
  applicationStore.navigationService.navigator.getCurrentLocationParameters();
822
826
  const processed = processQueryParams(queryParams);
@@ -839,8 +843,12 @@ export const ExistingQueryEditor = observer(() => {
839
843
  export const ServiceQueryCreator = observer(() => {
840
844
  const applicationStore = useApplicationStore();
841
845
  const parameters = useParams<ServiceQueryCreatorPathParams>();
842
- const gav = parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV];
843
- const servicePath = parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.SERVICE_PATH];
846
+ const gav = guaranteeNonNullable(
847
+ parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV],
848
+ );
849
+ const servicePath = guaranteeNonNullable(
850
+ parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.SERVICE_PATH],
851
+ );
844
852
  const executionKey =
845
853
  applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
846
854
  LEGEND_QUERY_QUERY_PARAM_TOKEN.SERVICE_EXECUTION_KEY,
@@ -859,9 +867,15 @@ export const ServiceQueryCreator = observer(() => {
859
867
 
860
868
  export const MappingQueryCreator = observer(() => {
861
869
  const params = useParams<MappingQueryCreatorPathParams>();
862
- const gav = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV];
863
- const mappingPath = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.MAPPING_PATH];
864
- const runtimePath = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.RUNTIME_PATH];
870
+ const gav = guaranteeNonNullable(
871
+ params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV],
872
+ );
873
+ const mappingPath = guaranteeNonNullable(
874
+ params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.MAPPING_PATH],
875
+ );
876
+ const runtimePath = guaranteeNonNullable(
877
+ params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.RUNTIME_PATH],
878
+ );
865
879
 
866
880
  return (
867
881
  <MappingQueryCreatorStoreProvider
@@ -49,9 +49,7 @@ export const QueryEditorExistingQueryVersionRevertModal = observer(
49
49
  const selectedVersionOption = queryVersion
50
50
  ? buildVersionOption(queryVersion)
51
51
  : null;
52
- const onVersionOptionChange = async (
53
- option: VersionOption | null,
54
- ): Promise<void> => {
52
+ const onVersionOptionChange = (option: VersionOption | null) => {
55
53
  if (option?.value && option.value !== queryVersion) {
56
54
  setQueryVersion(option.value);
57
55
  }
@@ -131,7 +131,7 @@ const UpdateExistingServiceQuerySetupContent = observer(() => {
131
131
  <SearchIcon />
132
132
  </div>
133
133
  <CustomSelectorInput
134
- ref={serviceSearchRef}
134
+ inputRef={serviceSearchRef}
135
135
  className="query-setup__wizard__selector"
136
136
  options={serviceOptions}
137
137
  isLoading={setupStore.loadServicesState.isInProgress}
@@ -44,6 +44,11 @@ import {
44
44
  import { LegendQueryFrameworkProvider } from '../LegendQueryFrameworkProvider.js';
45
45
  import { TEST__BrowserEnvironmentProvider } from '@finos/legend-application/test';
46
46
  import { Core_LegendQueryApplicationPlugin } from '../Core_LegendQueryApplicationPlugin.js';
47
+ import { Route, Routes } from '@finos/legend-application/browser';
48
+ import {
49
+ generateExistingQueryEditorRoute,
50
+ LEGEND_QUERY_ROUTE_PATTERN,
51
+ } from '../../__lib__/LegendQueryNavigation.js';
47
52
 
48
53
  const TEST_QUERY_ID = 'test-query-id';
49
54
  export const TEST_QUERY_NAME = 'MyTestQuery';
@@ -170,9 +175,16 @@ export const TEST__setUpQueryEditor = async (
170
175
 
171
176
  const renderResult = render(
172
177
  <ApplicationStoreProvider store={MOCK__editorStore.applicationStore}>
173
- <TEST__BrowserEnvironmentProvider>
178
+ <TEST__BrowserEnvironmentProvider
179
+ initialEntries={[generateExistingQueryEditorRoute(lightQuery.id)]}
180
+ >
174
181
  <LegendQueryFrameworkProvider>
175
- <ExistingQueryEditor />
182
+ <Routes>
183
+ <Route
184
+ path={LEGEND_QUERY_ROUTE_PATTERN.EDIT_EXISTING_QUERY}
185
+ element={<ExistingQueryEditor />}
186
+ />
187
+ </Routes>
176
188
  </LegendQueryFrameworkProvider>
177
189
  </TEST__BrowserEnvironmentProvider>
178
190
  </ApplicationStoreProvider>,
@@ -29,6 +29,7 @@ import { useEffect } from 'react';
29
29
  import { flowResult } from 'mobx';
30
30
  import { DataCube, DataCubeProvider } from '@finos/legend-data-cube';
31
31
  import { QueryBuilderDataCubeApplicationEngine } from '@finos/legend-query-builder';
32
+ import { guaranteeNonNullable } from '@finos/legend-shared';
32
33
 
33
34
  export const DataCubeWrapper = observer(() => {
34
35
  const applicationStore = useApplicationStore();
@@ -44,6 +45,7 @@ export const DataCubeWrapper = observer(() => {
44
45
  const _appEngine = new QueryBuilderDataCubeApplicationEngine(
45
46
  applicationStore,
46
47
  );
48
+
47
49
  return (
48
50
  <DataCubeProvider application={_appEngine} engine={store.engine}>
49
51
  <DataCube />
@@ -53,7 +55,10 @@ export const DataCubeWrapper = observer(() => {
53
55
 
54
56
  export const ExistingQueryDataCubeViewer = observer(() => {
55
57
  const params = useParams<ExistingQueryEditorPathParams>();
56
- const queryId = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID];
58
+ const queryId = guaranteeNonNullable(
59
+ params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID],
60
+ );
61
+
57
62
  return (
58
63
  <ExistingQueryDataCubeEditorStoreProvider queryId={queryId}>
59
64
  <DataCubeWrapper />
@@ -88,14 +88,12 @@ const DataSpaceQueryCreatorStoreProvider: React.FC<{
88
88
 
89
89
  export const DataSpaceQueryCreator = observer(() => {
90
90
  const applicationStore = useApplicationStore();
91
- const parameters = useParams<DataSpaceQueryCreatorPathParams | undefined>();
92
- const gav = parameters?.[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
91
+ const parameters = useParams<DataSpaceQueryCreatorPathParams>();
92
+ const gav = parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
93
93
  const dataSpacePath =
94
- parameters?.[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH];
94
+ parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH];
95
95
  const executionContext =
96
- parameters?.[
97
- DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT
98
- ];
96
+ parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT];
99
97
  const runtimePath =
100
98
  applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
101
99
  DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.RUNTIME_PATH,
@@ -82,7 +82,7 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
82
82
  </label>
83
83
  <CustomSelectorInput
84
84
  inputId="query-builder__setup__data-space-selector"
85
- ref={dataSpaceSearchRef}
85
+ inputRef={dataSpaceSearchRef}
86
86
  className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
87
87
  options={dataSpaceOptions}
88
88
  isLoading={queryBuilderState.loadDataSpacesState.isInProgress}
@@ -28,6 +28,7 @@ import {
28
28
  type DataSpaceTemplateQueryCreatorPathParams,
29
29
  } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
30
30
  import { QueryEditor } from '../QueryEditor.js';
31
+ import { guaranteeNonNullable } from '@finos/legend-shared';
31
32
 
32
33
  const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
33
34
  children: React.ReactNode;
@@ -59,16 +60,19 @@ const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
59
60
 
60
61
  export const DataSpaceTemplateQueryCreator = observer(() => {
61
62
  const parameters = useParams<DataSpaceTemplateQueryCreatorPathParams>();
62
- const gav =
63
- parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
64
- const dataSpacePath =
63
+ const gav = guaranteeNonNullable(
64
+ parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV],
65
+ );
66
+ const dataSpacePath = guaranteeNonNullable(
65
67
  parameters[
66
68
  DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
67
- ];
68
- const templateQueryId =
69
+ ],
70
+ );
71
+ const templateQueryId = guaranteeNonNullable(
69
72
  parameters[
70
73
  DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.TEMPLATE_QUERY_ID
71
- ];
74
+ ],
75
+ );
72
76
 
73
77
  return (
74
78
  <DataSpaceTemplateQueryCreatorStoreProvider
@@ -24,6 +24,7 @@ import {
24
24
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
25
25
  import { assertErrorThrown, type GeneratorFn } from '@finos/legend-shared';
26
26
  import { QueryBuilderDataCubeEngine } from '@finos/legend-query-builder';
27
+ import { flow, makeObservable, observable } from 'mobx';
27
28
 
28
29
  export class ExistingQueryDataCubeEditorStore {
29
30
  readonly applicationStore: LegendQueryApplicationStore;
@@ -37,6 +38,10 @@ export class ExistingQueryDataCubeEditorStore {
37
38
  depotServerClient: DepotServerClient,
38
39
  queryId: string,
39
40
  ) {
41
+ makeObservable(this, {
42
+ initialize: flow,
43
+ engine: observable,
44
+ });
40
45
  this.applicationStore = applicationStore;
41
46
  this.depotServerClient = depotServerClient;
42
47
  this.graphManagerState = new GraphManagerState(
@@ -81,8 +86,10 @@ export class ExistingQueryDataCubeEditorStore {
81
86
  (yield this.graphManagerState.graphManager.pureCodeToLambda(
82
87
  content,
83
88
  )) as unknown as RawLambda;
89
+ // TODO: we should be able to call engine and convert lambda to relation if not one.
84
90
  const engine = new QueryBuilderDataCubeEngine(
85
91
  lambda,
92
+ undefined,
86
93
  execConext.mapping,
87
94
  execConext.runtime,
88
95
  this.graphManagerState,