@finos/legend-application-query 13.7.205 → 13.8.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.
- package/lib/__lib__/LegendQueryNavigation.d.ts +16 -10
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +17 -12
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts +25 -7
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.js +81 -6
- package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts +21 -4
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js +17 -0
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +10 -0
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +16 -0
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +7 -3
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryWebApplication.js +2 -2
- package/lib/components/LegendQueryWebApplication.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +5 -2
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +8 -0
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +190 -8
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/components/data-product/DataProductInfo.d.ts +28 -0
- package/lib/components/data-product/DataProductInfo.d.ts.map +1 -0
- package/lib/components/data-product/DataProductInfo.js +89 -0
- package/lib/components/data-product/DataProductInfo.js.map +1 -0
- package/lib/components/{data-space/DataSpaceQueryCreator.d.ts → data-product/LegendQueryDataProductQueryBuilder.d.ts} +3 -4
- package/lib/components/data-product/LegendQueryDataProductQueryBuilder.d.ts.map +1 -0
- package/lib/components/data-product/LegendQueryDataProductQueryBuilder.js +98 -0
- package/lib/components/data-product/LegendQueryDataProductQueryBuilder.js.map +1 -0
- package/lib/components/data-space/DataProductQueryCreator.d.ts +36 -0
- package/lib/components/data-space/DataProductQueryCreator.d.ts.map +1 -0
- package/lib/components/data-space/DataProductQueryCreator.js +76 -0
- package/lib/components/data-space/DataProductQueryCreator.js.map +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +2 -1
- package/lib/stores/QueryEditorStore.d.ts +46 -2
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +251 -5
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.d.ts +21 -0
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.d.ts.map +1 -0
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.js +35 -0
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.js.map +1 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts +11 -3
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js +50 -8
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.d.ts +94 -0
- package/lib/stores/data-space/DataProductQueryCreatorStore.d.ts.map +1 -0
- package/lib/stores/data-space/DataProductQueryCreatorStore.js +388 -0
- package/lib/stores/data-space/DataProductQueryCreatorStore.js.map +1 -0
- package/lib/stores/data-space/DataProductSelectorState.d.ts +44 -0
- package/lib/stores/data-space/DataProductSelectorState.d.ts.map +1 -0
- package/lib/stores/data-space/DataProductSelectorState.js +111 -0
- package/lib/stores/data-space/DataProductSelectorState.js.map +1 -0
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +3 -0
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts +4 -3
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js +24 -29
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js.map +1 -1
- package/package.json +8 -7
- package/src/__lib__/LegendQueryNavigation.ts +76 -18
- package/src/__lib__/LegendQueryUserDataHelper.ts +177 -12
- package/src/__lib__/LegendQueryUserDataSpaceHelper.ts +54 -4
- package/src/application/LegendQueryApplicationConfig.ts +31 -0
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +8 -2
- package/src/components/LegendQueryWebApplication.tsx +8 -4
- package/src/components/QueryEditor.tsx +13 -0
- package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +418 -5
- package/src/components/data-product/DataProductInfo.tsx +297 -0
- package/src/components/data-product/LegendQueryDataProductQueryBuilder.tsx +268 -0
- package/src/components/data-space/DataProductQueryCreator.tsx +167 -0
- package/src/components/data-space/DataSpaceQuerySetup.tsx +1 -1
- package/src/index.ts +6 -0
- package/src/stores/QueryEditorStore.ts +485 -2
- package/src/stores/data-product/query-builder/DataProductArtifactHelper.ts +48 -0
- package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +77 -16
- package/src/stores/data-space/DataProductQueryCreatorStore.ts +765 -0
- package/src/stores/data-space/DataProductSelectorState.ts +164 -0
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +10 -0
- package/src/stores/data-space/LegendQueryBareQueryBuilderState.ts +1 -1
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +27 -54
- package/tsconfig.json +6 -2
- package/lib/components/data-space/DataSpaceQueryCreator.d.ts.map +0 -1
- package/lib/components/data-space/DataSpaceQueryCreator.js +0 -62
- package/lib/components/data-space/DataSpaceQueryCreator.js.map +0 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +0 -92
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +0 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +0 -400
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +0 -1
- package/src/components/data-space/DataSpaceQueryCreator.tsx +0 -119
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +0 -697
|
@@ -0,0 +1,167 @@
|
|
|
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 { observer, useLocalObservable } from 'mobx-react-lite';
|
|
18
|
+
import { generatePath, useParams } from '@finos/legend-application/browser';
|
|
19
|
+
import { parseGAVCoordinates } from '@finos/legend-storage';
|
|
20
|
+
import {
|
|
21
|
+
useLegendQueryApplicationStore,
|
|
22
|
+
useLegendQueryBaseStore,
|
|
23
|
+
} from '../LegendQueryFrameworkProvider.js';
|
|
24
|
+
import {
|
|
25
|
+
DataProductQueryCreatorStore,
|
|
26
|
+
QueryableDataProduct,
|
|
27
|
+
QueryableLegacyDataProduct,
|
|
28
|
+
type LegendQueryableElement,
|
|
29
|
+
} from '../../stores/data-space/DataProductQueryCreatorStore.js';
|
|
30
|
+
import { QueryEditorStoreContext } from '../QueryEditorStoreProvider.js';
|
|
31
|
+
import {
|
|
32
|
+
DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN,
|
|
33
|
+
LEGEND_QUERY_ROUTE_PATTERN,
|
|
34
|
+
type DataProductPathParams,
|
|
35
|
+
} from '../../__lib__/LegendQueryNavigation.js';
|
|
36
|
+
import {
|
|
37
|
+
DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN,
|
|
38
|
+
DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN,
|
|
39
|
+
type DataSpaceQueryCreatorPathParams,
|
|
40
|
+
} from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
|
41
|
+
import { QueryEditor } from '../QueryEditor.js';
|
|
42
|
+
import { useEffect } from 'react';
|
|
43
|
+
import type { DataProductAccessType } from '@finos/legend-graph';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a {@link LegendQueryableElement} from the current route parameters.
|
|
47
|
+
*
|
|
48
|
+
* Data-product routes provide `dataProductPath`, `accessType` and `accessId`.
|
|
49
|
+
* Legacy data-space routes provide `dataSpacePath` and `executionContext`.
|
|
50
|
+
* The DEFAULT route (`/`) provides no params – returns `undefined`.
|
|
51
|
+
*/
|
|
52
|
+
export const resolveQueryableElement = (
|
|
53
|
+
dataProductParams: Readonly<Record<string, string | undefined>>,
|
|
54
|
+
dataSpaceParams: Readonly<Record<string, string | undefined>>,
|
|
55
|
+
runtimePath: string | undefined,
|
|
56
|
+
classPath: string | undefined,
|
|
57
|
+
): LegendQueryableElement | undefined => {
|
|
58
|
+
const dpGav =
|
|
59
|
+
dataProductParams[DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
|
|
60
|
+
const dpPath =
|
|
61
|
+
dataProductParams[
|
|
62
|
+
DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_PRODUCT_PATH
|
|
63
|
+
];
|
|
64
|
+
const dpAccessType =
|
|
65
|
+
dataProductParams[
|
|
66
|
+
DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_PRODUCT_ACCESS_TYPE
|
|
67
|
+
];
|
|
68
|
+
const dpAccessId =
|
|
69
|
+
dataProductParams[
|
|
70
|
+
DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_PRODUCT_ACCESS_ID
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
if (dpGav && dpPath && dpAccessType && dpAccessId) {
|
|
74
|
+
const { groupId, artifactId, versionId } = parseGAVCoordinates(dpGav);
|
|
75
|
+
return new QueryableDataProduct(
|
|
76
|
+
groupId,
|
|
77
|
+
artifactId,
|
|
78
|
+
versionId,
|
|
79
|
+
dpPath,
|
|
80
|
+
dpAccessType as DataProductAccessType,
|
|
81
|
+
dpAccessId,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const dsGav =
|
|
86
|
+
dataSpaceParams[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
|
|
87
|
+
const dsPath =
|
|
88
|
+
dataSpaceParams[
|
|
89
|
+
DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
|
|
90
|
+
];
|
|
91
|
+
const dsExecCtx =
|
|
92
|
+
dataSpaceParams[
|
|
93
|
+
DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
if (dsGav && dsPath && dsExecCtx) {
|
|
97
|
+
const { groupId, artifactId, versionId } = parseGAVCoordinates(dsGav);
|
|
98
|
+
return new QueryableLegacyDataProduct(
|
|
99
|
+
groupId,
|
|
100
|
+
artifactId,
|
|
101
|
+
versionId,
|
|
102
|
+
dsPath,
|
|
103
|
+
dsExecCtx,
|
|
104
|
+
runtimePath,
|
|
105
|
+
classPath,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return undefined;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Unified query creator component used for data-product routes,
|
|
114
|
+
* legacy data-space routes, and the default (`/`) route.
|
|
115
|
+
*
|
|
116
|
+
* Because every route renders the same component type, React Router
|
|
117
|
+
* reconciles rather than unmounting when the URL changes, which prevents
|
|
118
|
+
* the store from being recreated and `initialize()` from firing twice.
|
|
119
|
+
*/
|
|
120
|
+
export const QueryCreator = observer(() => {
|
|
121
|
+
const applicationStore = useLegendQueryApplicationStore();
|
|
122
|
+
const baseStore = useLegendQueryBaseStore();
|
|
123
|
+
|
|
124
|
+
// Grab all possible route params — only the ones belonging to
|
|
125
|
+
// the matched route pattern will be populated.
|
|
126
|
+
const params = useParams<
|
|
127
|
+
DataProductPathParams & DataSpaceQueryCreatorPathParams
|
|
128
|
+
>();
|
|
129
|
+
|
|
130
|
+
// Legacy data-space query params (from the query string)
|
|
131
|
+
const runtimePath =
|
|
132
|
+
applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
|
|
133
|
+
DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.RUNTIME_PATH,
|
|
134
|
+
);
|
|
135
|
+
const classPath =
|
|
136
|
+
applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
|
|
137
|
+
DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.CLASS_PATH,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const queryableElement = resolveQueryableElement(
|
|
141
|
+
params,
|
|
142
|
+
params,
|
|
143
|
+
runtimePath,
|
|
144
|
+
classPath,
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const store = useLocalObservable(
|
|
148
|
+
() =>
|
|
149
|
+
new DataProductQueryCreatorStore(
|
|
150
|
+
applicationStore,
|
|
151
|
+
baseStore.depotServerClient,
|
|
152
|
+
queryableElement,
|
|
153
|
+
),
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
applicationStore.navigationService.navigator.updateCurrentLocation(
|
|
158
|
+
generatePath(LEGEND_QUERY_ROUTE_PATTERN.DEFAULT),
|
|
159
|
+
);
|
|
160
|
+
}, [applicationStore]);
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<QueryEditorStoreContext.Provider value={store}>
|
|
164
|
+
<QueryEditor />
|
|
165
|
+
</QueryEditorStoreContext.Provider>
|
|
166
|
+
);
|
|
167
|
+
});
|
|
@@ -35,7 +35,7 @@ import type { LegendQueryBareQueryBuilderState } from '../../stores/data-space/L
|
|
|
35
35
|
import type {
|
|
36
36
|
DataProductOption,
|
|
37
37
|
DataProductWithLegacyOption,
|
|
38
|
-
} from '../../stores/data-space/
|
|
38
|
+
} from '../../stores/data-space/DataProductSelectorState.js';
|
|
39
39
|
import { flowResult } from 'mobx';
|
|
40
40
|
import { DepotEntityWithOrigin } from '@finos/legend-storage';
|
|
41
41
|
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,12 @@ export * from './__lib__/LegendQueryEventHelper.js';
|
|
|
24
24
|
export {
|
|
25
25
|
generateExistingQueryEditorRoute,
|
|
26
26
|
generateServiceQueryCreatorRoute,
|
|
27
|
+
generateDataProductRoute,
|
|
28
|
+
generateDataProductNativeRoute,
|
|
29
|
+
generateDataProductModelRoute,
|
|
30
|
+
generateDataProductLakehouseRoute,
|
|
31
|
+
LEGEND_QUERY_ROUTE_PATTERN,
|
|
32
|
+
type DataProductPathParams,
|
|
27
33
|
} from './__lib__/LegendQueryNavigation.js';
|
|
28
34
|
|
|
29
35
|
export {
|