@finos/legend-application-query 13.7.204 → 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 +28 -12
- 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 +9 -8
- 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 +132 -42
- 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,76 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
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 { useLegendQueryApplicationStore, useLegendQueryBaseStore, } from '../LegendQueryFrameworkProvider.js';
|
|
21
|
+
import { DataProductQueryCreatorStore, QueryableDataProduct, QueryableLegacyDataProduct, } from '../../stores/data-space/DataProductQueryCreatorStore.js';
|
|
22
|
+
import { QueryEditorStoreContext } from '../QueryEditorStoreProvider.js';
|
|
23
|
+
import { DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN, LEGEND_QUERY_ROUTE_PATTERN, } from '../../__lib__/LegendQueryNavigation.js';
|
|
24
|
+
import { DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN, DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN, } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
|
25
|
+
import { QueryEditor } from '../QueryEditor.js';
|
|
26
|
+
import { useEffect } from 'react';
|
|
27
|
+
/**
|
|
28
|
+
* Resolves a {@link LegendQueryableElement} from the current route parameters.
|
|
29
|
+
*
|
|
30
|
+
* Data-product routes provide `dataProductPath`, `accessType` and `accessId`.
|
|
31
|
+
* Legacy data-space routes provide `dataSpacePath` and `executionContext`.
|
|
32
|
+
* The DEFAULT route (`/`) provides no params – returns `undefined`.
|
|
33
|
+
*/
|
|
34
|
+
export const resolveQueryableElement = (dataProductParams, dataSpaceParams, runtimePath, classPath) => {
|
|
35
|
+
const dpGav = dataProductParams[DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
|
|
36
|
+
const dpPath = dataProductParams[DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_PRODUCT_PATH];
|
|
37
|
+
const dpAccessType = dataProductParams[DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_PRODUCT_ACCESS_TYPE];
|
|
38
|
+
const dpAccessId = dataProductParams[DATA_PRODUCT_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_PRODUCT_ACCESS_ID];
|
|
39
|
+
if (dpGav && dpPath && dpAccessType && dpAccessId) {
|
|
40
|
+
const { groupId, artifactId, versionId } = parseGAVCoordinates(dpGav);
|
|
41
|
+
return new QueryableDataProduct(groupId, artifactId, versionId, dpPath, dpAccessType, dpAccessId);
|
|
42
|
+
}
|
|
43
|
+
const dsGav = dataSpaceParams[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
|
|
44
|
+
const dsPath = dataSpaceParams[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH];
|
|
45
|
+
const dsExecCtx = dataSpaceParams[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT];
|
|
46
|
+
if (dsGav && dsPath && dsExecCtx) {
|
|
47
|
+
const { groupId, artifactId, versionId } = parseGAVCoordinates(dsGav);
|
|
48
|
+
return new QueryableLegacyDataProduct(groupId, artifactId, versionId, dsPath, dsExecCtx, runtimePath, classPath);
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Unified query creator component used for data-product routes,
|
|
54
|
+
* legacy data-space routes, and the default (`/`) route.
|
|
55
|
+
*
|
|
56
|
+
* Because every route renders the same component type, React Router
|
|
57
|
+
* reconciles rather than unmounting when the URL changes, which prevents
|
|
58
|
+
* the store from being recreated and `initialize()` from firing twice.
|
|
59
|
+
*/
|
|
60
|
+
export const QueryCreator = observer(() => {
|
|
61
|
+
const applicationStore = useLegendQueryApplicationStore();
|
|
62
|
+
const baseStore = useLegendQueryBaseStore();
|
|
63
|
+
// Grab all possible route params — only the ones belonging to
|
|
64
|
+
// the matched route pattern will be populated.
|
|
65
|
+
const params = useParams();
|
|
66
|
+
// Legacy data-space query params (from the query string)
|
|
67
|
+
const runtimePath = applicationStore.navigationService.navigator.getCurrentLocationParameterValue(DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.RUNTIME_PATH);
|
|
68
|
+
const classPath = applicationStore.navigationService.navigator.getCurrentLocationParameterValue(DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.CLASS_PATH);
|
|
69
|
+
const queryableElement = resolveQueryableElement(params, params, runtimePath, classPath);
|
|
70
|
+
const store = useLocalObservable(() => new DataProductQueryCreatorStore(applicationStore, baseStore.depotServerClient, queryableElement));
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
applicationStore.navigationService.navigator.updateCurrentLocation(generatePath(LEGEND_QUERY_ROUTE_PATTERN.DEFAULT));
|
|
73
|
+
}, [applicationStore]);
|
|
74
|
+
return (_jsx(QueryEditorStoreContext.Provider, { value: store, children: _jsx(QueryEditor, {}) }));
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=DataProductQueryCreator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataProductQueryCreator.js","sourceRoot":"","sources":["../../../src/components/data-space/DataProductQueryCreator.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,8BAA8B,EAC9B,uBAAu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CACjD,CAAC;IACJ,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,CACL,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC5C,KAAC,WAAW,KAAG,GACkB,CACpC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/index.css
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export * from './application/LegendQueryApplicationConfig.js';
|
|
|
18
18
|
export * from './application/LegendQueryPluginManager.js';
|
|
19
19
|
export * from './__lib__/LegendQueryEvent.js';
|
|
20
20
|
export * from './__lib__/LegendQueryEventHelper.js';
|
|
21
|
-
export { generateExistingQueryEditorRoute, generateServiceQueryCreatorRoute, } from './__lib__/LegendQueryNavigation.js';
|
|
21
|
+
export { generateExistingQueryEditorRoute, generateServiceQueryCreatorRoute, generateDataProductRoute, generateDataProductNativeRoute, generateDataProductModelRoute, generateDataProductLakehouseRoute, LEGEND_QUERY_ROUTE_PATTERN, type DataProductPathParams, } from './__lib__/LegendQueryNavigation.js';
|
|
22
22
|
export { useLegendQueryApplicationStore, useLegendQueryBaseStore, } from './components/LegendQueryFrameworkProvider.js';
|
|
23
23
|
export type { LegendQueryApplicationStore } from './stores/LegendQueryBaseStore.js';
|
|
24
24
|
export * from './stores/LegendQueryApplicationPlugin.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAE1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACL,gCAAgC,EAChC,gCAAgC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAE1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,0BAA0B,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,8CAA8C,CAAC;AACtD,YAAY,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAGpF,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,KAAK,yBAAyB,EAC9B,gBAAgB,EAChB,wBAAwB,EACxB,yCAAyC,GAC1C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yDAAyD,CAAC;AAG3G,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,cAAc,8DAA8D,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export * from './application/LegendQueryApplicationConfig.js';
|
|
|
19
19
|
export * from './application/LegendQueryPluginManager.js';
|
|
20
20
|
export * from './__lib__/LegendQueryEvent.js';
|
|
21
21
|
export * from './__lib__/LegendQueryEventHelper.js';
|
|
22
|
-
export { generateExistingQueryEditorRoute, generateServiceQueryCreatorRoute, } from './__lib__/LegendQueryNavigation.js';
|
|
22
|
+
export { generateExistingQueryEditorRoute, generateServiceQueryCreatorRoute, generateDataProductRoute, generateDataProductNativeRoute, generateDataProductModelRoute, generateDataProductLakehouseRoute, LEGEND_QUERY_ROUTE_PATTERN, } from './__lib__/LegendQueryNavigation.js';
|
|
23
23
|
export { useLegendQueryApplicationStore, useLegendQueryBaseStore, } from './components/LegendQueryFrameworkProvider.js';
|
|
24
24
|
// stores
|
|
25
25
|
export * from './stores/LegendQueryApplicationPlugin.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc;AACd,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAE1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACL,gCAAgC,EAChC,gCAAgC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc;AACd,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAE1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,OAAO,EACL,gCAAgC,EAChC,gCAAgC,EAChC,wBAAwB,EACxB,8BAA8B,EAC9B,6BAA6B,EAC7B,iCAAiC,EACjC,0BAA0B,GAE3B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,8CAA8C,CAAC;AAGtD,SAAS;AACT,cAAc,0CAA0C,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAEL,gBAAgB,EAChB,wBAAwB,EACxB,yCAAyC,GAC1C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yDAAyD,CAAC;AAE3G,aAAa;AACb,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,cAAc,8DAA8D,CAAC"}
|
package/lib/light-mode.css
CHANGED
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application-query",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.8.0",
|
|
4
4
|
"description": "Legend Query application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@finos/legend-lego": "workspace:*",
|
|
54
54
|
"@finos/legend-query-builder": "workspace:*",
|
|
55
55
|
"@finos/legend-server-depot": "workspace:*",
|
|
56
|
+
"@finos/legend-server-lakehouse": "workspace:*",
|
|
56
57
|
"@finos/legend-shared": "workspace:*",
|
|
57
58
|
"@finos/legend-storage": "workspace:*",
|
|
58
59
|
"@testing-library/dom": "10.4.0",
|
|
@@ -14,13 +14,16 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { type GeneratorFn, ActionState, StopWatch } from '@finos/legend-shared';
|
|
17
|
-
import { type LightQuery, type RawLambda, type QueryGridConfig, type ValueSpecification, type GraphInitializationReport, type QueryInfo, GraphManagerState, Query, QuerySearchSpecification } from '@finos/legend-graph';
|
|
18
|
-
import { type ProjectGAVCoordinates } from '@finos/legend-storage';
|
|
17
|
+
import { type LightQuery, NativeModelExecutionContext, type RawLambda, type QueryGridConfig, type ValueSpecification, type GraphInitializationReport, PackageableRuntime, type QueryInfo, GraphManagerState, Query, QuerySearchSpecification, ModelAccessPointGroup, type DataProduct, V1_DataProductArtifact, DataProductAccessType, type DataProductAnalysisQueryResult } from '@finos/legend-graph';
|
|
18
|
+
import { type ProjectGAVCoordinates, type DepotEntityWithOrigin } from '@finos/legend-storage';
|
|
19
19
|
import { type DepotServerClient } from '@finos/legend-server-depot';
|
|
20
20
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
|
21
21
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
|
22
22
|
import { type QueryBuilderState, type QueryBuilderDiffViewState, QueryLoaderState, QueryBuilderActionConfig } from '@finos/legend-query-builder';
|
|
23
23
|
import { type DataSpaceAnalysisResult } from '@finos/legend-extension-dsl-data-space/graph';
|
|
24
|
+
import { LegendQueryDataProductQueryBuilderState } from './data-product/query-builder/LegendQueryDataProductQueryBuilderState.js';
|
|
25
|
+
import { DataProductSelectorState } from './data-space/DataProductSelectorState.js';
|
|
26
|
+
import { LakehouseContractServerClient } from '@finos/legend-server-lakehouse';
|
|
24
27
|
export interface QueryPersistConfiguration {
|
|
25
28
|
defaultName?: string | undefined;
|
|
26
29
|
allowUpdate?: boolean | undefined;
|
|
@@ -41,12 +44,17 @@ export declare class QueryCreatorState {
|
|
|
41
44
|
close(): void;
|
|
42
45
|
createQuery(): GeneratorFn<void>;
|
|
43
46
|
}
|
|
47
|
+
export declare class LegendQueryLakehouseState {
|
|
48
|
+
readonly contractServerClient: LakehouseContractServerClient;
|
|
49
|
+
constructor(contractServerClient: LakehouseContractServerClient);
|
|
50
|
+
}
|
|
44
51
|
export declare abstract class QueryEditorStore {
|
|
45
52
|
readonly applicationStore: LegendQueryApplicationStore;
|
|
46
53
|
readonly depotServerClient: DepotServerClient;
|
|
47
54
|
readonly pluginManager: LegendQueryPluginManager;
|
|
48
55
|
readonly graphManagerState: GraphManagerState;
|
|
49
56
|
readonly queryLoaderState: QueryLoaderState;
|
|
57
|
+
readonly lakehouseState?: LegendQueryLakehouseState | undefined;
|
|
50
58
|
readonly initState: ActionState;
|
|
51
59
|
queryBuilderState?: QueryBuilderState | undefined;
|
|
52
60
|
queryCreatorState: QueryCreatorState;
|
|
@@ -54,6 +62,7 @@ export declare abstract class QueryEditorStore {
|
|
|
54
62
|
showRegisterServiceModal: boolean;
|
|
55
63
|
showAppInfo: boolean;
|
|
56
64
|
showDataspaceInfo: boolean;
|
|
65
|
+
showDataProductInfo: boolean;
|
|
57
66
|
enableMinialGraphForDataSpaceLoadingPerformance: boolean;
|
|
58
67
|
constructor(applicationStore: LegendQueryApplicationStore, depotServerClient: DepotServerClient);
|
|
59
68
|
get isViewProjectActionDisabled(): boolean;
|
|
@@ -61,6 +70,7 @@ export declare abstract class QueryEditorStore {
|
|
|
61
70
|
setExistingQueryName(val: string | undefined): void;
|
|
62
71
|
setShowAppInfo(val: boolean): void;
|
|
63
72
|
setShowDataspaceInfo(val: boolean): void;
|
|
73
|
+
setShowDataProductInfo(val: boolean): void;
|
|
64
74
|
setShowRegisterServiceModal(val: boolean): void;
|
|
65
75
|
setEnableMinialGraphForDataSpaceLoadingPerformance(val: boolean): void;
|
|
66
76
|
get isPerformingBlockingAction(): boolean;
|
|
@@ -88,6 +98,40 @@ export declare abstract class QueryEditorStore {
|
|
|
88
98
|
dataSpaceAnalysisResult: DataSpaceAnalysisResult | undefined;
|
|
89
99
|
isLightGraphEnabled: boolean;
|
|
90
100
|
}>;
|
|
101
|
+
fetchDataProductArtifact(groupId: string, artifactId: string, versionId: string, dataProductPath: string): Promise<V1_DataProductArtifact>;
|
|
102
|
+
resolveDataProductMappingPath(artifact: V1_DataProductArtifact, executionContextId: string | undefined): string;
|
|
103
|
+
buildGraphAndDataproductAnalyticsResult(groupId: string, artifactId: string, versionId: string, dataProductPath: string, dataProductAccessType: DataProductAccessType, accessPointId: string, preFetchedArtifact?: V1_DataProductArtifact | undefined): Promise<DataProductAnalysisQueryResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Resolves the execution state for a data product by looking up `accessId`
|
|
106
|
+
* in both model access point groups (by `id`) and native execution contexts
|
|
107
|
+
* (by `key`). Throws if no matching state is found.
|
|
108
|
+
*/
|
|
109
|
+
resolveDataProductExecutionState(dataProduct: DataProduct, accessId: string | undefined): NativeModelExecutionContext | ModelAccessPointGroup;
|
|
110
|
+
/**
|
|
111
|
+
* Resolves the user's lakehouse environment and warehouse, creates a
|
|
112
|
+
* `LakehouseRuntime`, and wraps it in a `PackageableRuntime`.
|
|
113
|
+
*
|
|
114
|
+
* Resolution order:
|
|
115
|
+
* 1. Check local storage (`LakehouseUserInfo`) for a previously persisted value.
|
|
116
|
+
* 2. If not found, fetch from the lakehouse contract server via
|
|
117
|
+
* `getUserEntitlementEnvs()` and persist the result to local storage.
|
|
118
|
+
*/
|
|
119
|
+
createLakehousePackageableRuntime(dataProductPath: string, gav: {
|
|
120
|
+
groupId: string;
|
|
121
|
+
artifactId: string;
|
|
122
|
+
versionId: string;
|
|
123
|
+
}): Promise<PackageableRuntime>;
|
|
124
|
+
/**
|
|
125
|
+
* Centralized method to build a data product query builder state.
|
|
126
|
+
* Used by both the creator flow (new query from data product route/picker)
|
|
127
|
+
* and the existing query flow (loading a saved data product query).
|
|
128
|
+
*
|
|
129
|
+
* This fetches the data product artifact, resolves the mapping path,
|
|
130
|
+
* builds the minimal graph via `buildGraphAndDataproductAnalyticsResult`,
|
|
131
|
+
* creates `LegendQueryDataProductQueryBuilderState`, and wires in
|
|
132
|
+
* mapping coverage results.
|
|
133
|
+
*/
|
|
134
|
+
buildDataProductQueryBuilderState(groupId: string, artifactId: string, versionId: string, dataProductPath: string, artifact: V1_DataProductArtifact, accessId: string, dataProductAccessType: DataProductAccessType, onDataProductChange: (val: DepotEntityWithOrigin) => Promise<void>, productSelectorState?: DataProductSelectorState | undefined): Promise<LegendQueryDataProductQueryBuilderState>;
|
|
91
135
|
}
|
|
92
136
|
export declare class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig {
|
|
93
137
|
editorStore: QueryEditorStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryEditorStore.d.ts","sourceRoot":"","sources":["../../src/stores/QueryEditorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,OAAO,EACL,KAAK,WAAW,EAOhB,WAAW,EACX,SAAS,EAOV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EAGd,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"QueryEditorStore.d.ts","sourceRoot":"","sources":["../../src/stores/QueryEditorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAWH,OAAO,EACL,KAAK,WAAW,EAOhB,WAAW,EACX,SAAS,EAOV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,UAAU,EACf,2BAA2B,EAC3B,KAAK,SAAS,EAGd,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,kBAAkB,EAClB,KAAK,SAAS,EACd,iBAAiB,EACjB,KAAK,EASL,wBAAwB,EAiBxB,qBAAqB,EACrB,KAAK,WAAW,EAGhB,sBAAsB,EAEtB,qBAAqB,EACrB,KAAK,8BAA8B,EACpC,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EAEL,KAAK,qBAAqB,EAE1B,KAAK,qBAAqB,EAG3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,iBAAiB,EAQvB,MAAM,4BAA4B,CAAC;AAOpC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAE3F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,yBAAyB,EAI9B,gBAAgB,EAEhB,wBAAwB,EAIzB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,KAAK,uBAAuB,EAM7B,MAAM,8CAA8C,CAAC;AAItD,OAAO,EAAE,uCAAuC,EAAE,MAA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BAA2B,EAC7C,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,EAAE,MAAM,EACf,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS;IAqBzD,IAAI,UAAU,IAAI,UAAU,CAE3B;IAED,IAAa,0BAA0B,IAAI,OAAO,CAKjD;IAEQ,oBAAoB,CAC3B,sBAAsB,EAAE,yBAAyB,GAChD,IAAI;IAiBP,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAIpC,QAAQ,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI;IAI1B,YAAY,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAIlC,cAAc,IAAI,qBAAqB;IAQ7B,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC;IAuB1B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB1C,4BAA4B,CAChC,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,iBAAiB,CAAC;IA6OvB,2BAA2B,CAC/B,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,iBAAiB,CAAC;IAiG7B,uBAAuB,CACrB,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GACzC,yBAAyB;IAmBnB,2BAA2B,CAClC,GAAG,EAAE,wBAAwB,GAC5B,wBAAwB;CAsB5B"}
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { action, computed, flow, flowResult, makeObservable, observable, override, } from 'mobx';
|
|
17
17
|
import { LogEvent, assertErrorThrown, uuid, assertType, guaranteeNonNullable, ActionState, StopWatch, guaranteeType, quantifyList, assertNonNullable, returnUndefOnError, UnsupportedOperationError, filterByType, } from '@finos/legend-shared';
|
|
18
|
-
import { GraphManagerState, Query, PureExecution, PackageableElementExplicitReference, RuntimePointer, GRAPH_MANAGER_EVENT, extractElementNameFromPath, Mapping, createGraphBuilderReport, LegendSDLC, QuerySearchSpecification, toLightQuery, QueryParameterValue, reportGraphAnalytics, cloneQueryStereotype, cloneQueryTaggedValue, QueryProjectCoordinates, buildLambdaVariableExpressions, VariableExpression, PrimitiveType, CORE_PURE_PATH, isValidFullPath, QUERY_PROFILE_PATH, QueryDataSpaceExecutionContextInfo, QueryExplicitExecutionContextInfo, } from '@finos/legend-graph';
|
|
18
|
+
import { NativeModelExecutionContext, PackageableRuntime, GraphManagerState, Query, PureExecution, PackageableElementExplicitReference, RuntimePointer, GRAPH_MANAGER_EVENT, extractElementNameFromPath, Mapping, createGraphBuilderReport, LegendSDLC, QuerySearchSpecification, toLightQuery, QueryParameterValue, reportGraphAnalytics, cloneQueryStereotype, cloneQueryTaggedValue, QueryProjectCoordinates, buildLambdaVariableExpressions, VariableExpression, PrimitiveType, CORE_PURE_PATH, isValidFullPath, QUERY_PROFILE_PATH, QueryDataSpaceExecutionContextInfo, QueryExplicitExecutionContextInfo, QueryDataProductNativeExecutionContextInfo, QueryDataProductModelAccessExecutionContextInfo, ModelAccessPointGroup, LakehouseRuntime, V1_DATA_PRODUCT_ELEMENT_PROTOCOL_TYPE, V1_DataProductArtifact, V1_ModelAccessPointGroupInfo, DataProductAccessType, } from '@finos/legend-graph';
|
|
19
19
|
import { generateExistingQueryEditorRoute, generateMappingQueryCreatorRoute, generateServiceQueryCreatorRoute, } from '../__lib__/LegendQueryNavigation.js';
|
|
20
20
|
import { LEGEND_QUERY_APP_EVENT } from '../__lib__/LegendQueryEvent.js';
|
|
21
|
-
import { parseGACoordinates, } from '@finos/legend-storage';
|
|
22
|
-
import { resolveVersion, StoreProjectData, LATEST_VERSION_ALIAS, VersionedProjectData, retrieveProjectEntitiesWithClassifier, } from '@finos/legend-server-depot';
|
|
21
|
+
import { parseGACoordinates, StoredFileGeneration, } from '@finos/legend-storage';
|
|
22
|
+
import { resolveVersion, StoreProjectData, LATEST_VERSION_ALIAS, VersionedProjectData, retrieveProjectEntitiesWithClassifier, isSnapshotVersion, SNAPSHOT_VERSION_ALIAS, } from '@finos/legend-server-depot';
|
|
23
23
|
import { ActionAlertActionType, ActionAlertType, DEFAULT_TAB_SIZE, DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH, } from '@finos/legend-application';
|
|
24
24
|
import { LegendQueryEventHelper } from '../__lib__/LegendQueryEventHelper.js';
|
|
25
|
-
import { ClassQueryBuilderState, MappingQueryBuilderState, ServiceQueryBuilderState, QueryLoaderState, QueryBuilderDataBrowserWorkflow, QueryBuilderActionConfig, QUERY_LOADER_DEFAULT_QUERY_SEARCH_LIMIT, } from '@finos/legend-query-builder';
|
|
25
|
+
import { ClassQueryBuilderState, MappingQueryBuilderState, ServiceQueryBuilderState, QueryLoaderState, QueryBuilderDataBrowserWorkflow, QueryBuilderActionConfig, QUERY_LOADER_DEFAULT_QUERY_SEARCH_LIMIT, NativeModelDataProductExecutionState, ModelAccessPointDataProductExecutionState, } from '@finos/legend-query-builder';
|
|
26
26
|
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
|
27
27
|
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
|
28
28
|
import {} from '@finos/legend-extension-dsl-data-space/application';
|
|
@@ -30,6 +30,9 @@ import { DSL_DataSpace_getGraphManagerExtension, getOwnDataSpace, QUERY_PROFILE_
|
|
|
30
30
|
import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
|
31
31
|
import { hasDataSpaceInfoBeenVisited } from '../__lib__/LegendQueryUserDataSpaceHelper.js';
|
|
32
32
|
import { LegendQueryDataSpaceQueryBuilderState } from './data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js';
|
|
33
|
+
import { LegendQueryDataProductQueryBuilderState } from './data-product/query-builder/LegendQueryDataProductQueryBuilderState.js';
|
|
34
|
+
import { DataProductSelectorState } from './data-space/DataProductSelectorState.js';
|
|
35
|
+
import { decorateEnvWithRealm, LakehouseContractServerClient, LakehouseEnvironmentType, } from '@finos/legend-server-lakehouse';
|
|
33
36
|
export class QueryCreatorState {
|
|
34
37
|
editorStore;
|
|
35
38
|
createQueryState = ActionState.create();
|
|
@@ -116,12 +119,19 @@ export class QueryCreatorState {
|
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
121
|
}
|
|
122
|
+
export class LegendQueryLakehouseState {
|
|
123
|
+
contractServerClient;
|
|
124
|
+
constructor(contractServerClient) {
|
|
125
|
+
this.contractServerClient = contractServerClient;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
119
128
|
export class QueryEditorStore {
|
|
120
129
|
applicationStore;
|
|
121
130
|
depotServerClient;
|
|
122
131
|
pluginManager;
|
|
123
132
|
graphManagerState;
|
|
124
133
|
queryLoaderState;
|
|
134
|
+
lakehouseState;
|
|
125
135
|
initState = ActionState.create();
|
|
126
136
|
queryBuilderState;
|
|
127
137
|
queryCreatorState;
|
|
@@ -129,6 +139,7 @@ export class QueryEditorStore {
|
|
|
129
139
|
showRegisterServiceModal = false;
|
|
130
140
|
showAppInfo = false;
|
|
131
141
|
showDataspaceInfo = false;
|
|
142
|
+
showDataProductInfo = false;
|
|
132
143
|
enableMinialGraphForDataSpaceLoadingPerformance = true;
|
|
133
144
|
constructor(applicationStore, depotServerClient) {
|
|
134
145
|
makeObservable(this, {
|
|
@@ -138,6 +149,7 @@ export class QueryEditorStore {
|
|
|
138
149
|
showRegisterServiceModal: observable,
|
|
139
150
|
showAppInfo: observable,
|
|
140
151
|
showDataspaceInfo: observable,
|
|
152
|
+
showDataProductInfo: observable,
|
|
141
153
|
queryBuilderState: observable,
|
|
142
154
|
enableMinialGraphForDataSpaceLoadingPerformance: observable,
|
|
143
155
|
isPerformingBlockingAction: computed,
|
|
@@ -145,6 +157,7 @@ export class QueryEditorStore {
|
|
|
145
157
|
setShowRegisterServiceModal: action,
|
|
146
158
|
setShowAppInfo: action,
|
|
147
159
|
setShowDataspaceInfo: action,
|
|
160
|
+
setShowDataProductInfo: action,
|
|
148
161
|
setEnableMinialGraphForDataSpaceLoadingPerformance: action,
|
|
149
162
|
initialize: flow,
|
|
150
163
|
buildGraph: flow,
|
|
@@ -155,6 +168,14 @@ export class QueryEditorStore {
|
|
|
155
168
|
this.depotServerClient = depotServerClient;
|
|
156
169
|
this.pluginManager = applicationStore.pluginManager;
|
|
157
170
|
this.graphManagerState = new GraphManagerState(applicationStore.pluginManager, applicationStore.logService);
|
|
171
|
+
// lakehouse
|
|
172
|
+
if (applicationStore.config.lakehouseContractUrl) {
|
|
173
|
+
const contractServerClient = new LakehouseContractServerClient({
|
|
174
|
+
baseUrl: applicationStore.config.lakehouseContractUrl,
|
|
175
|
+
});
|
|
176
|
+
contractServerClient.setTracerService(applicationStore.tracerService);
|
|
177
|
+
this.lakehouseState = new LegendQueryLakehouseState(contractServerClient);
|
|
178
|
+
}
|
|
158
179
|
this.queryLoaderState = new QueryLoaderState(applicationStore, this.graphManagerState.graphManager, {
|
|
159
180
|
loadQuery: (query) => {
|
|
160
181
|
this.queryBuilderState?.changeDetectionState.alertUnsavedChanges(() => {
|
|
@@ -205,6 +226,9 @@ export class QueryEditorStore {
|
|
|
205
226
|
setShowDataspaceInfo(val) {
|
|
206
227
|
this.showDataspaceInfo = val;
|
|
207
228
|
}
|
|
229
|
+
setShowDataProductInfo(val) {
|
|
230
|
+
this.showDataProductInfo = val;
|
|
231
|
+
}
|
|
208
232
|
setShowRegisterServiceModal(val) {
|
|
209
233
|
this.showRegisterServiceModal = val;
|
|
210
234
|
}
|
|
@@ -436,6 +460,208 @@ export class QueryEditorStore {
|
|
|
436
460
|
isLightGraphEnabled,
|
|
437
461
|
};
|
|
438
462
|
}
|
|
463
|
+
async fetchDataProductArtifact(groupId, artifactId, versionId, dataProductPath) {
|
|
464
|
+
const project = StoreProjectData.serialization.fromJson(await this.depotServerClient.getProject(groupId, artifactId));
|
|
465
|
+
const files = (await this.depotServerClient.getGenerationFilesByType(project, versionId, V1_DATA_PRODUCT_ELEMENT_PROTOCOL_TYPE)).map((rawFile) => StoredFileGeneration.serialization.fromJson(rawFile));
|
|
466
|
+
const fileContent = guaranteeNonNullable(files.find((e) => e.path === dataProductPath)?.file.content, `Artifact generation not found for data product: ${groupId}:${artifactId}:${versionId}/${dataProductPath}`);
|
|
467
|
+
const result = V1_DataProductArtifact.serialization.fromJson(JSON.parse(fileContent));
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
resolveDataProductMappingPath(artifact, executionContextId) {
|
|
471
|
+
// Try native execution contexts first
|
|
472
|
+
if (artifact.nativeModelAccess) {
|
|
473
|
+
const native = artifact.nativeModelAccess;
|
|
474
|
+
if (executionContextId) {
|
|
475
|
+
const matchingContext = native.nativeModelExecutionContexts.find((ctx) => ctx.key === executionContextId);
|
|
476
|
+
if (matchingContext) {
|
|
477
|
+
return matchingContext.mapping;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
// Fall back to default execution context
|
|
481
|
+
const defaultContext = native.nativeModelExecutionContexts.find((ctx) => ctx.key === native.defaultExecutionContext);
|
|
482
|
+
if (defaultContext) {
|
|
483
|
+
return defaultContext.mapping;
|
|
484
|
+
}
|
|
485
|
+
// Fall back to first context
|
|
486
|
+
const firstContext = native.nativeModelExecutionContexts[0];
|
|
487
|
+
if (firstContext) {
|
|
488
|
+
return firstContext.mapping;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
// Try model access point groups
|
|
492
|
+
const modelGroups = artifact.accessPointGroups.filter((g) => g instanceof V1_ModelAccessPointGroupInfo);
|
|
493
|
+
if (executionContextId) {
|
|
494
|
+
const matchingGroup = modelGroups.find((g) => g.id === executionContextId);
|
|
495
|
+
if (matchingGroup) {
|
|
496
|
+
return matchingGroup.mappingGeneration.path;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
// Fall back to first model access point group
|
|
500
|
+
const firstGroup = modelGroups[0];
|
|
501
|
+
if (firstGroup) {
|
|
502
|
+
return firstGroup.mappingGeneration.path;
|
|
503
|
+
}
|
|
504
|
+
throw new UnsupportedOperationError(`Can't resolve mapping path for data product artifact`);
|
|
505
|
+
}
|
|
506
|
+
async buildGraphAndDataproductAnalyticsResult(groupId, artifactId, versionId, dataProductPath, dataProductAccessType, accessPointId, preFetchedArtifact) {
|
|
507
|
+
this.initState.setMessage('Fetching data product analysis result...');
|
|
508
|
+
const project = StoreProjectData.serialization.fromJson(await this.depotServerClient.getProject(groupId, artifactId));
|
|
509
|
+
const graph_buildReport = createGraphBuilderReport();
|
|
510
|
+
const stopWatch = new StopWatch();
|
|
511
|
+
// initialize system
|
|
512
|
+
stopWatch.record();
|
|
513
|
+
await this.graphManagerState.initializeSystem();
|
|
514
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS);
|
|
515
|
+
const dependency_buildReport = createGraphBuilderReport();
|
|
516
|
+
const dataProductAnalysisResult = preFetchedArtifact
|
|
517
|
+
? await this.graphManagerState.graphManager.buildDataProductAnalysis(preFetchedArtifact, dataProductPath, this.graphManagerState.graph, accessPointId, dataProductAccessType, { groupId, artifactId, versionId }, graph_buildReport)
|
|
518
|
+
: await this.graphManagerState.graphManager.analyzeDataProductAndBuildMinimalGraph(dataProductPath, async () => {
|
|
519
|
+
const files = (await this.depotServerClient.getGenerationFilesByType(project, versionId, V1_DATA_PRODUCT_ELEMENT_PROTOCOL_TYPE)).map((rawFile) => StoredFileGeneration.serialization.fromJson(rawFile));
|
|
520
|
+
const fileContent = guaranteeNonNullable(files.find((e) => e.path === dataProductPath)?.file.content, `Artifact generation not found for data product: ${groupId}:${artifactId}:${versionId}/${dataProductPath}`);
|
|
521
|
+
return JSON.parse(fileContent);
|
|
522
|
+
}, this.graphManagerState.graph, accessPointId, dataProductAccessType, { groupId, artifactId, versionId }, undefined, graph_buildReport);
|
|
523
|
+
// report
|
|
524
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
|
|
525
|
+
const graphBuilderReportData = {
|
|
526
|
+
timings: this.applicationStore.timeService.finalizeTimingsRecord(stopWatch),
|
|
527
|
+
dependencies: dependency_buildReport,
|
|
528
|
+
dependenciesCount: this.graphManagerState.graph.dependencyManager.numberOfDependencies,
|
|
529
|
+
graph: graph_buildReport,
|
|
530
|
+
isLightGraphEnabled: true,
|
|
531
|
+
};
|
|
532
|
+
this.logBuildGraphMetrics(graphBuilderReportData);
|
|
533
|
+
this.applicationStore.logService.info(LogEvent.create(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS), graphBuilderReportData);
|
|
534
|
+
return dataProductAnalysisResult;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Resolves the execution state for a data product by looking up `accessId`
|
|
538
|
+
* in both model access point groups (by `id`) and native execution contexts
|
|
539
|
+
* (by `key`). Throws if no matching state is found.
|
|
540
|
+
*/
|
|
541
|
+
resolveDataProductExecutionState(dataProduct, accessId) {
|
|
542
|
+
// Search model access point groups
|
|
543
|
+
const modelGroups = dataProduct.accessPointGroups.filter(filterByType(ModelAccessPointGroup));
|
|
544
|
+
if (accessId) {
|
|
545
|
+
const matchingGroup = modelGroups.find((g) => g.id === accessId);
|
|
546
|
+
if (matchingGroup) {
|
|
547
|
+
return matchingGroup;
|
|
548
|
+
}
|
|
549
|
+
// Search native execution contexts
|
|
550
|
+
const matchingNative = dataProduct.nativeModelAccess?.nativeModelExecutionContexts.find((ctx) => ctx.key === accessId);
|
|
551
|
+
if (matchingNative) {
|
|
552
|
+
return matchingNative;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
// No accessId: fall back to defaults
|
|
557
|
+
if (dataProduct.nativeModelAccess) {
|
|
558
|
+
return dataProduct.nativeModelAccess.defaultExecutionContext;
|
|
559
|
+
}
|
|
560
|
+
if (modelGroups.length > 0) {
|
|
561
|
+
return guaranteeNonNullable(modelGroups[0]);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
throw new UnsupportedOperationError(`Can't resolve execution state for data product '${dataProduct.path}'${accessId ? ` with access ID '${accessId}'` : ''}`);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Resolves the user's lakehouse environment and warehouse, creates a
|
|
568
|
+
* `LakehouseRuntime`, and wraps it in a `PackageableRuntime`.
|
|
569
|
+
*
|
|
570
|
+
* Resolution order:
|
|
571
|
+
* 1. Check local storage (`LakehouseUserInfo`) for a previously persisted value.
|
|
572
|
+
* 2. If not found, fetch from the lakehouse contract server via
|
|
573
|
+
* `getUserEntitlementEnvs()` and persist the result to local storage.
|
|
574
|
+
*/
|
|
575
|
+
async createLakehousePackageableRuntime(dataProductPath, gav) {
|
|
576
|
+
// 1. Check local storage for persisted lakehouse user info
|
|
577
|
+
const persistedInfo = LegendQueryUserDataHelper.getLakehouseUserInfo(this.applicationStore.userDataService);
|
|
578
|
+
let userEnvironment = persistedInfo?.env;
|
|
579
|
+
const userWarehouse = persistedInfo?.snowflakeWarehouse ?? 'LAKEHOUSE_CONSUMER_DEFAULT_WH';
|
|
580
|
+
// 2. If no persisted environment, fetch from the server
|
|
581
|
+
if (userEnvironment === undefined && this.lakehouseState) {
|
|
582
|
+
try {
|
|
583
|
+
const entitlementEnvs = await this.lakehouseState.contractServerClient.getUserEntitlementEnvs(this.applicationStore.identityService.currentUser, this.applicationStore.getAccessToken());
|
|
584
|
+
userEnvironment = entitlementEnvs.users
|
|
585
|
+
.map((e) => e.lakehouseEnvironment)
|
|
586
|
+
.at(0);
|
|
587
|
+
// Persist to local storage for future use
|
|
588
|
+
LegendQueryUserDataHelper.persistLakehouseUserInfo(this.applicationStore.userDataService, {
|
|
589
|
+
env: userEnvironment,
|
|
590
|
+
snowflakeWarehouse: userWarehouse,
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
catch (error) {
|
|
594
|
+
assertErrorThrown(error);
|
|
595
|
+
this.applicationStore.logService.warn(LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE), `Unable to fetch user lakehouse environment: ${error.message}`);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
if (userEnvironment === undefined) {
|
|
599
|
+
throw new Error(`Can't query data product '${dataProductPath}': unable to resolve lakehouse user environment. ` +
|
|
600
|
+
`Please ensure your lakehouse entitlements are configured.`);
|
|
601
|
+
}
|
|
602
|
+
if (isSnapshotVersion(gav.versionId) ||
|
|
603
|
+
gav.versionId === SNAPSHOT_VERSION_ALIAS) {
|
|
604
|
+
userEnvironment = decorateEnvWithRealm(userEnvironment, LakehouseEnvironmentType.PRODUCTION_PARALLEL);
|
|
605
|
+
}
|
|
606
|
+
const lakehouseRuntime = new LakehouseRuntime(userEnvironment, userWarehouse);
|
|
607
|
+
const packageableRuntime = new PackageableRuntime(`${dataProductPath}_LakehouseRuntime`);
|
|
608
|
+
packageableRuntime.runtimeValue = lakehouseRuntime;
|
|
609
|
+
return packageableRuntime;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Centralized method to build a data product query builder state.
|
|
613
|
+
* Used by both the creator flow (new query from data product route/picker)
|
|
614
|
+
* and the existing query flow (loading a saved data product query).
|
|
615
|
+
*
|
|
616
|
+
* This fetches the data product artifact, resolves the mapping path,
|
|
617
|
+
* builds the minimal graph via `buildGraphAndDataproductAnalyticsResult`,
|
|
618
|
+
* creates `LegendQueryDataProductQueryBuilderState`, and wires in
|
|
619
|
+
* mapping coverage results.
|
|
620
|
+
*/
|
|
621
|
+
async buildDataProductQueryBuilderState(groupId, artifactId, versionId, dataProductPath, artifact, accessId, dataProductAccessType, onDataProductChange, productSelectorState) {
|
|
622
|
+
// 3. Build minimal graph and get analysis result
|
|
623
|
+
const dataProductAnalysisResult = await this.buildGraphAndDataproductAnalyticsResult(groupId, artifactId, versionId, dataProductPath, dataProductAccessType, accessId, artifact);
|
|
624
|
+
// 3.5. Create a LakehouseRuntime and add it to the graph
|
|
625
|
+
const packageableRuntime = await this.createLakehousePackageableRuntime(dataProductPath, {
|
|
626
|
+
groupId,
|
|
627
|
+
artifactId,
|
|
628
|
+
versionId,
|
|
629
|
+
});
|
|
630
|
+
this.graphManagerState.graph.addElement(packageableRuntime, '_internal_');
|
|
631
|
+
// 4. Get the data product from the built graph
|
|
632
|
+
const dataProduct = this.graphManagerState.graph.getDataProduct(dataProductPath);
|
|
633
|
+
// 5. Resolve execution state from accessId
|
|
634
|
+
const resolvedState = this.resolveDataProductExecutionState(dataProduct, accessId);
|
|
635
|
+
// 6. Create query builder state
|
|
636
|
+
const projectInfo = { groupId, artifactId, versionId };
|
|
637
|
+
const sourceInfo = {
|
|
638
|
+
groupId,
|
|
639
|
+
artifactId,
|
|
640
|
+
versionId,
|
|
641
|
+
dataProduct: dataProductPath,
|
|
642
|
+
};
|
|
643
|
+
const queryBuilderState = new LegendQueryDataProductQueryBuilderState(this.applicationStore, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE,
|
|
644
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
645
|
+
new QueryBuilderActionConfig_QueryApplication(this), dataProduct, artifact, resolvedState, this.depotServerClient, projectInfo, onDataProductChange, productSelectorState ??
|
|
646
|
+
new DataProductSelectorState(this.depotServerClient, this.applicationStore), undefined, undefined, this.applicationStore.config.options.queryBuilderConfig, sourceInfo);
|
|
647
|
+
// Pass pre-resolved state to avoid double-resolution
|
|
648
|
+
queryBuilderState.initWithDataProduct(dataProduct, resolvedState);
|
|
649
|
+
// 7. Wire in mapping coverage result
|
|
650
|
+
const mappingCoverageResult = dataProductAnalysisResult.dataProductAnalysis.mappingToMappingCoverageResult?.get(dataProductAnalysisResult.targetMappingPath);
|
|
651
|
+
if (mappingCoverageResult) {
|
|
652
|
+
queryBuilderState.explorerState.mappingModelCoverageAnalysisResult =
|
|
653
|
+
mappingCoverageResult;
|
|
654
|
+
}
|
|
655
|
+
// init
|
|
656
|
+
const execValue = dataProductAnalysisResult.targetExecState;
|
|
657
|
+
queryBuilderState.executionState =
|
|
658
|
+
execValue instanceof NativeModelExecutionContext
|
|
659
|
+
? new NativeModelDataProductExecutionState(execValue, queryBuilderState)
|
|
660
|
+
: new ModelAccessPointDataProductExecutionState(execValue, queryBuilderState).withAdhocRuntime();
|
|
661
|
+
queryBuilderState.changeMapping(queryBuilderState.executionState.mapping);
|
|
662
|
+
queryBuilderState.changeRuntime(new RuntimePointer(PackageableElementExplicitReference.create(packageableRuntime)));
|
|
663
|
+
return queryBuilderState;
|
|
664
|
+
}
|
|
439
665
|
}
|
|
440
666
|
export class QueryBuilderActionConfig_QueryApplication extends QueryBuilderActionConfig {
|
|
441
667
|
editorStore;
|
|
@@ -834,7 +1060,11 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
834
1060
|
isValidFullPath(taggedValue.value));
|
|
835
1061
|
if (!(dataSpaceTaggedValue !== undefined ||
|
|
836
1062
|
queryInfo?.executionContext instanceof
|
|
837
|
-
QueryDataSpaceExecutionContextInfo
|
|
1063
|
+
QueryDataSpaceExecutionContextInfo ||
|
|
1064
|
+
queryInfo?.executionContext instanceof
|
|
1065
|
+
QueryDataProductNativeExecutionContextInfo ||
|
|
1066
|
+
queryInfo?.executionContext instanceof
|
|
1067
|
+
QueryDataProductModelAccessExecutionContextInfo)) {
|
|
838
1068
|
yield flowResult(this.buildFullGraph());
|
|
839
1069
|
}
|
|
840
1070
|
}
|
|
@@ -915,6 +1145,8 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
915
1145
|
else {
|
|
916
1146
|
this.applicationStore.notificationService.notifyWarning(`Can't switch data product: default execution context not specified`);
|
|
917
1147
|
}
|
|
1148
|
+
}, new DataProductSelectorState(this.depotServerClient, this.applicationStore), () => {
|
|
1149
|
+
this.applicationStore.notificationService.notifyWarning('Switching data products is not supported from the existing query editor. Please open a new query instead.');
|
|
918
1150
|
}, dataSpaceAnalysisResult, undefined, undefined, undefined, this.applicationStore.config.options.queryBuilderConfig, sourceInfo);
|
|
919
1151
|
const mappingModelCoverageAnalysisResult = dataSpaceAnalysisResult?.mappingToMappingCoverageResult?.get(matchingExecutionContext.mapping.value.path);
|
|
920
1152
|
if (mappingModelCoverageAnalysisResult) {
|
|
@@ -947,6 +1179,20 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
947
1179
|
: undefined);
|
|
948
1180
|
return classQueryBuilderState;
|
|
949
1181
|
}
|
|
1182
|
+
else if (exec instanceof QueryDataProductNativeExecutionContextInfo ||
|
|
1183
|
+
exec instanceof QueryDataProductModelAccessExecutionContextInfo) {
|
|
1184
|
+
const executionContextId = exec instanceof QueryDataProductNativeExecutionContextInfo
|
|
1185
|
+
? exec.executionKey
|
|
1186
|
+
: exec.accessPointGroupId;
|
|
1187
|
+
const accessType = exec instanceof QueryDataProductNativeExecutionContextInfo
|
|
1188
|
+
? DataProductAccessType.NATIVE
|
|
1189
|
+
: DataProductAccessType.MODEL;
|
|
1190
|
+
const artifact = await this.fetchDataProductArtifact(queryInfo.groupId, queryInfo.artifactId, queryInfo.versionId, exec.dataProductPath);
|
|
1191
|
+
const queryBuilderState = await this.buildDataProductQueryBuilderState(queryInfo.groupId, queryInfo.artifactId, queryInfo.versionId, exec.dataProductPath, artifact, executionContextId, accessType, async () => {
|
|
1192
|
+
this.applicationStore.notificationService.notifyWarning('Switching data products is not supported from the existing query editor. Please open a new query instead.');
|
|
1193
|
+
});
|
|
1194
|
+
return queryBuilderState;
|
|
1195
|
+
}
|
|
950
1196
|
throw new UnsupportedOperationError(`Unsupported query execution context`);
|
|
951
1197
|
}
|
|
952
1198
|
async initializeQueryBuilderState(stopWatch) {
|