@finos/legend-application-studio 28.19.114 → 28.19.116

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 (26) hide show
  1. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.d.ts.map +1 -1
  2. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js +25 -8
  3. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js.map +1 -1
  4. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  5. package/lib/components/editor/side-bar/Explorer.js +1 -8
  6. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  7. package/lib/index.css +1 -1
  8. package/lib/package.json +1 -1
  9. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  10. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +2 -2
  11. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  12. package/package.json +16 -16
  13. package/src/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.ts +54 -9
  14. package/src/components/editor/side-bar/Explorer.tsx +2 -19
  15. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +5 -4
  16. package/tsconfig.json +0 -2
  17. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.d.ts +0 -18
  18. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.d.ts.map +0 -1
  19. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.js +0 -58
  20. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.js.map +0 -1
  21. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.d.ts +0 -37
  22. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.d.ts.map +0 -1
  23. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js +0 -127
  24. package/lib/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js.map +0 -1
  25. package/src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx +0 -142
  26. package/src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts +0 -240
@@ -14,13 +14,20 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { type DataProduct, ModelAccessPointGroup } from '@finos/legend-graph';
17
+ import {
18
+ type DataProduct,
19
+ type DataProductAccessor,
20
+ type NativeModelExecutionContext,
21
+ LakehouseAccessPoint,
22
+ ModelAccessPointGroup,
23
+ } from '@finos/legend-graph';
18
24
  import type { EditorStore } from '../../../../stores/editor/EditorStore.js';
19
25
  import { flowResult } from 'mobx';
20
26
  import {
21
27
  DataProductQueryBuilderState,
22
28
  QueryBuilderActionConfig,
23
29
  QueryBuilderAdvancedWorkflowState,
30
+ buildDataProductAccessor,
24
31
  } from '@finos/legend-query-builder';
25
32
  import type { DepotEntityWithOrigin } from '@finos/legend-storage';
26
33
  import {
@@ -36,10 +43,33 @@ const isQueryableDataProduct = (dataProduct: DataProduct): boolean => {
36
43
  dataProduct.nativeModelAccess?.nativeModelExecutionContexts.length,
37
44
  ) ||
38
45
  dataProduct.accessPointGroups.filter(filterByType(ModelAccessPointGroup))
39
- .length > 0
46
+ .length > 0 ||
47
+ dataProduct.accessPointGroups
48
+ .map((group) => group.accessPoints)
49
+ .flat()
50
+ .filter(filterByType(LakehouseAccessPoint)).length > 0
40
51
  );
41
52
  };
42
53
 
54
+ const resolveDefaultExecState = (
55
+ dataProduct: DataProduct,
56
+ ):
57
+ | ModelAccessPointGroup
58
+ | LakehouseAccessPoint
59
+ | NativeModelExecutionContext
60
+ | undefined => {
61
+ const nativeAccessPoints =
62
+ dataProduct.nativeModelAccess?.defaultExecutionContext;
63
+ const modeled = dataProduct.accessPointGroups.filter(
64
+ filterByType(ModelAccessPointGroup),
65
+ )[0];
66
+ const lakehouseAccessPoints = dataProduct.accessPointGroups
67
+ .map((group) => group.accessPoints)
68
+ .flat()
69
+ .filter(filterByType(LakehouseAccessPoint))[0];
70
+ return modeled ?? lakehouseAccessPoints ?? nativeAccessPoints;
71
+ };
72
+
43
73
  export const queryDataProduct = async (
44
74
  dataProduct: DataProduct,
45
75
  editorStore: EditorStore,
@@ -47,16 +77,27 @@ export const queryDataProduct = async (
47
77
  try {
48
78
  assertTrue(
49
79
  isQueryableDataProduct(dataProduct),
50
- 'Data Product is not queryable. Must have either native model execution contexts or model access point groups defined to be queryable.',
80
+ 'Data Product is not queryable. Data Product must have either a lakehouse, model or native access point',
51
81
  );
52
82
  const embeddedQueryBuilderState = editorStore.embeddedQueryBuilderState;
53
83
  const defaultExecutionContext = guaranteeNonNullable(
54
- dataProduct.nativeModelAccess?.defaultExecutionContext ??
55
- dataProduct.accessPointGroups.filter(
56
- filterByType(ModelAccessPointGroup),
57
- )[0],
84
+ resolveDefaultExecState(dataProduct),
58
85
  'No execution context found for Data Product',
59
86
  );
87
+ let accessor: DataProductAccessor | undefined;
88
+ if (defaultExecutionContext instanceof LakehouseAccessPoint) {
89
+ const relationMetadata =
90
+ await editorStore.graphManagerState.graphManager.getLambdaRelationType(
91
+ defaultExecutionContext.func,
92
+ editorStore.graphManagerState.graph,
93
+ );
94
+ accessor = buildDataProductAccessor(
95
+ relationMetadata,
96
+ dataProduct,
97
+ defaultExecutionContext,
98
+ editorStore.graphManagerState.graph,
99
+ );
100
+ }
60
101
  await flowResult(
61
102
  embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
62
103
  setupQueryBuilderState: async () => {
@@ -78,11 +119,15 @@ export const queryDataProduct = async (
78
119
  undefined,
79
120
  async (val: DepotEntityWithOrigin) => {},
80
121
  undefined,
81
- undefined,
82
122
  editorStore.applicationStore.config.options.queryBuilderConfig,
83
123
  sourceInfo,
84
124
  );
85
- queryBuilderState.initWithDataProduct(dataProduct);
125
+
126
+ queryBuilderState.initWithDataProduct(
127
+ dataProduct,
128
+ accessor,
129
+ defaultExecutionContext,
130
+ );
86
131
  return queryBuilderState;
87
132
  },
88
133
  disableCompile: true,
@@ -148,7 +148,6 @@ import { CodeEditor } from '@finos/legend-lego/code-editor';
148
148
  import { DatabaseBuilderWizard } from '../editor-group/connection-editor/DatabaseBuilderWizard.js';
149
149
  import { DatabaseModelBuilder } from '../editor-group/connection-editor/DatabaseModelBuilder.js';
150
150
  import { queryService } from '../editor-group/service-editor/ServiceExecutionQueryEditor.js';
151
- import { QueryDatabaseState } from '../../../stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js';
152
151
  import {
153
152
  isElementSupportedByDataCube,
154
153
  openDataCube,
@@ -580,19 +579,6 @@ const ExplorerContextMenu = observer(
580
579
  }
581
580
  },
582
581
  );
583
- const buildDatabaseQuery = editorStore.applicationStore.guardUnhandledError(
584
- async () => {
585
- if (node?.packageableElement instanceof Database) {
586
- const state = new QueryDatabaseState(
587
- node.packageableElement,
588
- editorStore,
589
- );
590
- flowResult(state.init()).catch(
591
- editorStore.applicationStore.alertUnhandledError,
592
- );
593
- }
594
- },
595
- );
596
582
  const generateSampleData = editorStore.applicationStore.guardUnhandledError(
597
583
  async () => {
598
584
  if (node?.packageableElement instanceof Class) {
@@ -937,14 +923,11 @@ const ExplorerContextMenu = observer(
937
923
  )}
938
924
  {isRelationalDatabase(node.packageableElement) && (
939
925
  <>
940
- <MenuContentItem onClick={generateModelsFromDatabaseSpecification}>
941
- Build Models
942
- </MenuContentItem>
943
926
  <MenuContentItem onClick={buildAccessorQuery}>
944
927
  Query...
945
928
  </MenuContentItem>
946
- <MenuContentItem onClick={buildDatabaseQuery}>
947
- Query (Beta)...
929
+ <MenuContentItem onClick={generateModelsFromDatabaseSpecification}>
930
+ Build Models
948
931
  </MenuContentItem>
949
932
  <MenuContentDivider />
950
933
  </>
@@ -1106,16 +1106,17 @@ export class DataProductEditorState extends ElementEditorState {
1106
1106
  description: string | undefined,
1107
1107
  accessPointGroup: AccessPointGroupState | string,
1108
1108
  ): void {
1109
+ const groupState =
1110
+ accessPointGroup instanceof AccessPointGroupState
1111
+ ? accessPointGroup
1112
+ : this.createGroupAndAdd(accessPointGroup);
1109
1113
  const accesspoint = new LakehouseAccessPoint(
1110
1114
  id,
1111
1115
  LakehouseTargetEnv.Snowflake,
1112
1116
  stub_RawLambda(),
1117
+ groupState.value,
1113
1118
  );
1114
1119
  accesspoint.description = description;
1115
- const groupState =
1116
- accessPointGroup instanceof AccessPointGroupState
1117
- ? accessPointGroup
1118
- : this.createGroupAndAdd(accessPointGroup);
1119
1120
  groupState.addAccessPoint(accesspoint);
1120
1121
  addUniqueEntry(this.accessPointGroupStates, groupState);
1121
1122
  }
package/tsconfig.json CHANGED
@@ -132,7 +132,6 @@
132
132
  "./src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts",
133
133
  "./src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts",
134
134
  "./src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts",
135
- "./src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts",
136
135
  "./src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_BindingEditorState.ts",
137
136
  "./src/stores/editor/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.ts",
138
137
  "./src/stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.ts",
@@ -262,7 +261,6 @@
262
261
  "./src/components/editor/editor-group/data-editor/RelationElementsDataEditor.tsx",
263
262
  "./src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx",
264
263
  "./src/components/editor/editor-group/dataProduct/DataProductEditor.tsx",
265
- "./src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx",
266
264
  "./src/components/editor/editor-group/diff-editor/EntityChangeConflictEditor.tsx",
267
265
  "./src/components/editor/editor-group/diff-editor/EntityDiffView.tsx",
268
266
  "./src/components/editor/editor-group/diff-editor/ProjectConfigDiffView.tsx",
@@ -1,18 +0,0 @@
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
- import type { IsolatedDatabaseBuilderState } from '../../../../stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js';
17
- export declare const renderDatabaseQueryBuilderSetupPanelContent: (queryBuilderState: IsolatedDatabaseBuilderState) => React.ReactNode;
18
- //# sourceMappingURL=IsolatedQueryDatabase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IsolatedQueryDatabase.d.ts","sourceRoot":"","sources":["../../../../../src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4FAA4F,CAAC;AAiH/I,eAAO,MAAM,2CAA2C,GACtD,mBAAmB,4BAA4B,KAC9C,KAAK,CAAC,SAIR,CAAC"}
@@ -1,58 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } 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 { getMappingCompatibleClasses, } from '@finos/legend-graph';
18
- import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
19
- import { observer } from 'mobx-react-lite';
20
- import { CustomSelectorInput, PanelHeader, compareLabelFn, } from '@finos/legend-art';
21
- import { returnUndefOnError } from '@finos/legend-shared';
22
- const IsolatedDatabseQueryBuilderSetupPanelContext = observer((props) => {
23
- const { queryBuilderState } = props;
24
- const globalGraphManagerState = queryBuilderState.globalGraphManagerState;
25
- const getConnectionValue = (val) => returnUndefOnError(() => globalGraphManagerState.graph.getConnection(val));
26
- const database = queryBuilderState.database;
27
- const compConnections = queryBuilderState.compatibleConnections;
28
- const compConnectionsOptions = Array.from(compConnections.keys())
29
- .map((e) => ({ value: e, label: getConnectionValue(e)?.name ?? e }))
30
- .sort(compareLabelFn);
31
- const changeConnection = (val) => {
32
- if (val) {
33
- queryBuilderState.changeConnection(val.value);
34
- }
35
- };
36
- const connection = compConnections.get(queryBuilderState.connectionKey);
37
- const selectedConnection = connection
38
- ? {
39
- label: queryBuilderState.connectionKey,
40
- value: getConnectionValue(queryBuilderState.connectionKey)?.name ??
41
- queryBuilderState.connectionKey,
42
- }
43
- : undefined;
44
- const databaseOption = {
45
- value: database,
46
- label: database.path,
47
- };
48
- const classes = queryBuilderState.executionContextState.mapping
49
- ? getMappingCompatibleClasses(queryBuilderState.executionContextState.mapping, queryBuilderState.graphManagerState.usableClasses)
50
- : [];
51
- return (_jsxs("div", { className: "query-builder__setup__config-group", children: [_jsx(PanelHeader, { title: "properties" }), _jsxs("div", { className: "query-builder__setup__config-group__content", children: [_jsxs("div", { className: "query-builder__setup__config-group__item", children: [_jsx("label", { className: "btn--sm query-builder__setup__config-group__item__label", title: "store", htmlFor: "query-builder__setup__store-selector", children: "Store" }), _jsx(CustomSelectorInput, { inputId: "query-builder__setup__store-selector", className: "panel__content__form__section__dropdown query-builder__setup__config-group__item__selector", noMatchMessage: "No compatible mapping found for specified class", disabled: true, options: [], onChange: () => {
52
- // do nothing
53
- }, value: databaseOption, darkMode: !queryBuilderState.applicationStore.layoutService
54
- .TEMPORARY__isLightColorThemeEnabled })] }), _jsxs("div", { className: "query-builder__setup__config-group__item", children: [_jsx("label", { className: "btn--sm query-builder__setup__config-group__item__label", title: "connection", htmlFor: "query-builder__setup__connection-selector", children: "Connection" }), _jsx(CustomSelectorInput, { inputId: "query-builder__setup__connection-selector", className: "panel__content__form__section__dropdown query-builder__setup__config-group__item__selector", noMatchMessage: "No compatible mapping found for specified class", disabled: compConnectionsOptions.length < 2, options: compConnectionsOptions, onChange: changeConnection, value: selectedConnection, darkMode: !queryBuilderState.applicationStore.layoutService
55
- .TEMPORARY__isLightColorThemeEnabled })] }), _jsx("div", { className: "query-builder__setup__config-group__item", children: _jsx(QueryBuilderClassSelector, { queryBuilderState: queryBuilderState, classes: classes, noMatchMessage: "No entities selected from" }) })] })] }));
56
- });
57
- export const renderDatabaseQueryBuilderSetupPanelContent = (queryBuilderState) => (_jsx(IsolatedDatabseQueryBuilderSetupPanelContext, { queryBuilderState: queryBuilderState }));
58
- //# sourceMappingURL=IsolatedQueryDatabase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IsolatedQueryDatabase.js","sourceRoot":"","sources":["../../../../../src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,4CAA4C,GAAG,QAAQ,CAC3D,CAAC,KAA0D,EAAE,EAAE;IAC7D,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,uBAA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1C,GACE,IACF,IACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,2CAA2C,GAAG,CACzD,iBAA+C,EAC9B,EAAE,CAAC,CACpB,KAAC,4CAA4C,IAC3C,iBAAiB,EAAE,iBAAiB,GACpC,CACH,CAAC"}
@@ -1,37 +0,0 @@
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
- import { EngineRuntime, Database, RelationalDatabaseConnection, GraphManagerState } from '@finos/legend-graph';
17
- import type { EditorStore } from '../../../EditorStore.js';
18
- import { type GeneratorFn } from '@finos/legend-shared';
19
- import { QueryBuilderConfig, QueryBuilderState } from '@finos/legend-query-builder';
20
- import { type GenericLegendApplicationStore } from '@finos/legend-application';
21
- export declare class IsolatedDatabaseBuilderState extends QueryBuilderState {
22
- readonly database: Database;
23
- globalGraphManagerState: GraphManagerState;
24
- engineRuntime: EngineRuntime;
25
- connectionKey: string;
26
- compatibleConnections: Map<string, RelationalDatabaseConnection>;
27
- TEMPORARY__setupPanelContentRenderer: () => React.ReactNode;
28
- constructor(applicationStore: GenericLegendApplicationStore, isolatedGraphManagerState: GraphManagerState, globalGraphManagerState: GraphManagerState, database: Database, connectionKey: string, runtime: EngineRuntime, compatibleConnections: Map<string, RelationalDatabaseConnection>, acceptedElementPaths?: string[], config?: QueryBuilderConfig | undefined);
29
- changeConnection(key: string): void;
30
- }
31
- export declare class QueryDatabaseState {
32
- editorStore: EditorStore;
33
- database: Database;
34
- constructor(database: Database, editorStore: EditorStore);
35
- init(): GeneratorFn<void>;
36
- }
37
- //# sourceMappingURL=QueryDatabaseState.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryDatabaseState.d.ts","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,aAAa,EACb,QAAQ,EACR,4BAA4B,EAI5B,iBAAiB,EAElB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAIL,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,2BAA2B,CAAC;AAyBnC,qBAAa,4BAA6B,SAAQ,iBAAiB;IACjE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,uBAAuB,EAAE,iBAAiB,CAAC;IAC3C,aAAa,EAAE,aAAa,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;IAExD,oCAAoC,QAAO,KAAK,CAAC,SAAS,CACf;gBAGlD,gBAAgB,EAAE,6BAA6B,EAC/C,yBAAyB,EAAE,iBAAiB,EAC5C,uBAAuB,EAAE,iBAAiB,EAC1C,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,aAAa,EACtB,qBAAqB,EAAE,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,EAChE,oBAAoB,CAAC,EAAE,MAAM,EAAE,EAC/B,MAAM,CAAC,EAAE,kBAAkB,GAAG,SAAS;IAmCzC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAWpC;AAED,qBAAa,kBAAkB;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;gBAEP,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW;IAQvD,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC;CA0F3B"}
@@ -1,127 +0,0 @@
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
- import { DEFAULT_GENERATION_PACKAGE, EngineRuntime, Database, RelationalDatabaseConnection, PackageableElementExplicitReference, StoreConnections, IdentifiedConnection, GraphManagerState, getMappingCompatibleClasses, } from '@finos/legend-graph';
17
- import { ActionState, assertErrorThrown, guaranteeNonNullable, assertTrue, } from '@finos/legend-shared';
18
- import { action, flow, flowResult, makeObservable, observable } from 'mobx';
19
- import { QueryBuilderAdvancedWorkflowState, QueryBuilderConfig, QueryBuilderState, } from '@finos/legend-query-builder';
20
- import { DEFAULT_TAB_SIZE, } from '@finos/legend-application';
21
- import { payloadDebugger } from '../../../panel-group/DevToolPanelState.js';
22
- import { renderDatabaseQueryBuilderSetupPanelContent } from '../../../../../components/editor/editor-group/database/IsolatedQueryDatabase.js';
23
- const replaceConnectionInEngineRuntime = (engineRuntime, connection, databse) => {
24
- const _storeConnection = new StoreConnections(PackageableElementExplicitReference.create(databse));
25
- const newconnection = new RelationalDatabaseConnection(PackageableElementExplicitReference.create(databse), connection.type, connection.datasourceSpecification, connection.authenticationStrategy);
26
- newconnection.localMode = connection.localMode;
27
- newconnection.timeZone = connection.timeZone;
28
- _storeConnection.storeConnections = [
29
- new IdentifiedConnection('connection1', newconnection),
30
- ];
31
- engineRuntime.connections = [_storeConnection];
32
- };
33
- export class IsolatedDatabaseBuilderState extends QueryBuilderState {
34
- database;
35
- globalGraphManagerState;
36
- engineRuntime;
37
- connectionKey;
38
- compatibleConnections;
39
- TEMPORARY__setupPanelContentRenderer = () => renderDatabaseQueryBuilderSetupPanelContent(this);
40
- constructor(applicationStore, isolatedGraphManagerState, globalGraphManagerState, database, connectionKey, runtime, compatibleConnections, acceptedElementPaths, config) {
41
- super(applicationStore, isolatedGraphManagerState, QueryBuilderAdvancedWorkflowState.INSTANCE, config);
42
- makeObservable(this, {
43
- connectionKey: observable,
44
- engineRuntime: observable,
45
- changeConnection: action,
46
- });
47
- this.database = database;
48
- this.globalGraphManagerState = globalGraphManagerState;
49
- this.engineRuntime = runtime;
50
- this.compatibleConnections = compatibleConnections;
51
- this.connectionKey = connectionKey;
52
- const classes = isolatedGraphManagerState.usableClasses;
53
- const electedMapping = guaranteeNonNullable(isolatedGraphManagerState.graph.mappings.filter((m) => acceptedElementPaths ? acceptedElementPaths.includes(m.path) : true)[0], 'Compatible mapping expected');
54
- this.sourceElement = guaranteeNonNullable(getMappingCompatibleClasses(electedMapping, classes)[0], 'Compatible class expected for mapping');
55
- this.executionContextState.mapping = electedMapping;
56
- this.executionContextState.runtimeValue = runtime;
57
- }
58
- changeConnection(key) {
59
- const connection = this.compatibleConnections.get(key);
60
- if (connection) {
61
- replaceConnectionInEngineRuntime(this.engineRuntime, connection, this.database);
62
- this.connectionKey = key;
63
- }
64
- }
65
- }
66
- export class QueryDatabaseState {
67
- editorStore;
68
- database;
69
- constructor(database, editorStore) {
70
- this.database = database;
71
- this.editorStore = editorStore;
72
- makeObservable(this, {
73
- init: flow,
74
- });
75
- }
76
- *init() {
77
- try {
78
- const compConnections = new Map();
79
- this.editorStore.graphManagerState.usableConnections.forEach((conn) => {
80
- const val = conn.connectionValue;
81
- if (val instanceof RelationalDatabaseConnection) {
82
- compConnections.set(conn.path, val);
83
- }
84
- });
85
- assertTrue(compConnections.size > 0, `No compatible connections found for database ${this.database.path}`);
86
- const embeddedQueryBuilderState = this.editorStore.embeddedQueryBuilderState;
87
- const databaseGraphManagerState = new GraphManagerState(this.editorStore.applicationStore.pluginManager, this.editorStore.applicationStore.logService);
88
- yield databaseGraphManagerState.graphManager.initialize({
89
- env: this.editorStore.applicationStore.config.env,
90
- tabSize: DEFAULT_TAB_SIZE,
91
- clientConfig: {
92
- baseUrl: this.editorStore.applicationStore.config.engineServerUrl,
93
- queryBaseUrl: this.editorStore.applicationStore.config.engineQueryServerUrl,
94
- enableCompression: true,
95
- payloadDebugger,
96
- },
97
- }, {
98
- tracerService: this.editorStore.applicationStore.tracerService,
99
- });
100
- databaseGraphManagerState.graph =
101
- this.editorStore.graphManagerState.createNewGraph();
102
- const copiedDb = new Database(this.database.name);
103
- databaseGraphManagerState.graph.addElement(copiedDb, guaranteeNonNullable(this.database.package?.path));
104
- copiedDb.schemas = this.database.schemas;
105
- copiedDb.joins = this.database.joins;
106
- copiedDb.filters = this.database.filters;
107
- const entities = (yield this.editorStore.graphManagerState.graphManager.generateModelsFromDatabaseSpecification(this.database.path, DEFAULT_GENERATION_PACKAGE, this.editorStore.graphManagerState.graph));
108
- yield this.editorStore.graphManagerState.graphManager.buildGraph(databaseGraphManagerState.graph, entities, ActionState.create());
109
- const engineRuntime = new EngineRuntime();
110
- engineRuntime.mappings = databaseGraphManagerState.graph.mappings.map((e) => PackageableElementExplicitReference.create(e));
111
- const connectionEntry = guaranteeNonNullable(Array.from(compConnections.entries())[0]);
112
- const connection = connectionEntry[1];
113
- replaceConnectionInEngineRuntime(engineRuntime, connection, copiedDb);
114
- const config = new QueryBuilderConfig();
115
- const queryBuilderState = new IsolatedDatabaseBuilderState(this.editorStore.applicationStore, databaseGraphManagerState, this.editorStore.graphManagerState, copiedDb, connectionEntry[0], engineRuntime, compConnections, entities.map((e) => e.path), config);
116
- yield flowResult(embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
117
- setupQueryBuilderState: async () => queryBuilderState,
118
- actionConfigs: [],
119
- }));
120
- }
121
- catch (error) {
122
- assertErrorThrown(error);
123
- this.editorStore.applicationStore.notificationService.notifyError(`Unable to query database: ${error.message}`);
124
- }
125
- }
126
- }
127
- //# sourceMappingURL=QueryDatabaseState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"QueryDatabaseState.js","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,QAAQ,EACR,4BAA4B,EAC5B,mCAAmC,EACnC,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EAEpB,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE5E,OAAO,EACL,iCAAiC,EACjC,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,2CAA2C,EAAE,MAAM,iFAAiF,CAAC;AAE9I,MAAM,gCAAgC,GAAG,CACvC,aAA4B,EAC5B,UAAwC,EACxC,OAAiB,EACX,EAAE;IACR,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAC3C,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,CACpD,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,4BAA4B,CACpD,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,EACnD,UAAU,CAA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C,yBAAyB,EACzB,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAClC,QAAQ,EACR,eAAe,CAAC,CAAC,CAAC,EAClB,aAAa,EACb,eAAe,EACf,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAC3B,MAAM,CACP,CAAC;YACF,MAAM,UAAU,CACd,yBAAyB,CAAC,oCAAoC,CAAC;gBAC7D,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,iBAAiB;gBACrD,aAAa,EAAE,EAAE;aAClB,CAAC,CACH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAC/D,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAC7C,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -1,142 +0,0 @@
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
- type Database,
19
- type PackageableConnection,
20
- getMappingCompatibleClasses,
21
- } from '@finos/legend-graph';
22
- import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
23
- import type { IsolatedDatabaseBuilderState } from '../../../../stores/editor/editor-state/element-editor-state/database/QueryDatabaseState.js';
24
- import { observer } from 'mobx-react-lite';
25
- import {
26
- CustomSelectorInput,
27
- PanelHeader,
28
- compareLabelFn,
29
- } from '@finos/legend-art';
30
- import { returnUndefOnError } from '@finos/legend-shared';
31
-
32
- const IsolatedDatabseQueryBuilderSetupPanelContext = observer(
33
- (props: { queryBuilderState: IsolatedDatabaseBuilderState }) => {
34
- const { queryBuilderState } = props;
35
- const globalGraphManagerState = queryBuilderState.globalGraphManagerState;
36
- const getConnectionValue = (
37
- val: string,
38
- ): PackageableConnection | undefined =>
39
- returnUndefOnError(() =>
40
- globalGraphManagerState.graph.getConnection(val),
41
- );
42
- const database = queryBuilderState.database;
43
- const compConnections = queryBuilderState.compatibleConnections;
44
- const compConnectionsOptions = Array.from(compConnections.keys())
45
- .map((e) => ({ value: e, label: getConnectionValue(e)?.name ?? e }))
46
- .sort(compareLabelFn);
47
- const changeConnection = (
48
- val: { value: string; label: string } | null,
49
- ): void => {
50
- if (val) {
51
- queryBuilderState.changeConnection(val.value);
52
- }
53
- };
54
- const connection = compConnections.get(queryBuilderState.connectionKey);
55
- const selectedConnection = connection
56
- ? {
57
- label: queryBuilderState.connectionKey,
58
- value:
59
- getConnectionValue(queryBuilderState.connectionKey)?.name ??
60
- queryBuilderState.connectionKey,
61
- }
62
- : undefined;
63
- const databaseOption = {
64
- value: database,
65
- label: database.path,
66
- };
67
- const classes = queryBuilderState.executionContextState.mapping
68
- ? getMappingCompatibleClasses(
69
- queryBuilderState.executionContextState.mapping,
70
- queryBuilderState.graphManagerState.usableClasses,
71
- )
72
- : [];
73
- return (
74
- <div className="query-builder__setup__config-group">
75
- <PanelHeader title="properties" />
76
- <div className="query-builder__setup__config-group__content">
77
- <div className="query-builder__setup__config-group__item">
78
- <label
79
- className="btn--sm query-builder__setup__config-group__item__label"
80
- title="store"
81
- htmlFor="query-builder__setup__store-selector"
82
- >
83
- Store
84
- </label>
85
- <CustomSelectorInput
86
- inputId="query-builder__setup__store-selector"
87
- className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
88
- noMatchMessage="No compatible mapping found for specified class"
89
- disabled={true}
90
- options={[] as { label: string; value: Database }[]}
91
- onChange={() => {
92
- // do nothing
93
- }}
94
- value={databaseOption}
95
- darkMode={
96
- !queryBuilderState.applicationStore.layoutService
97
- .TEMPORARY__isLightColorThemeEnabled
98
- }
99
- />
100
- </div>
101
- <div className="query-builder__setup__config-group__item">
102
- <label
103
- className="btn--sm query-builder__setup__config-group__item__label"
104
- title="connection"
105
- htmlFor="query-builder__setup__connection-selector"
106
- >
107
- Connection
108
- </label>
109
- <CustomSelectorInput
110
- inputId="query-builder__setup__connection-selector"
111
- className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
112
- noMatchMessage="No compatible mapping found for specified class"
113
- disabled={compConnectionsOptions.length < 2}
114
- options={compConnectionsOptions}
115
- onChange={changeConnection}
116
- value={selectedConnection}
117
- darkMode={
118
- !queryBuilderState.applicationStore.layoutService
119
- .TEMPORARY__isLightColorThemeEnabled
120
- }
121
- />
122
- </div>
123
- <div className="query-builder__setup__config-group__item">
124
- <QueryBuilderClassSelector
125
- queryBuilderState={queryBuilderState}
126
- classes={classes}
127
- noMatchMessage="No entities selected from"
128
- />
129
- </div>
130
- </div>
131
- </div>
132
- );
133
- },
134
- );
135
-
136
- export const renderDatabaseQueryBuilderSetupPanelContent = (
137
- queryBuilderState: IsolatedDatabaseBuilderState,
138
- ): React.ReactNode => (
139
- <IsolatedDatabseQueryBuilderSetupPanelContext
140
- queryBuilderState={queryBuilderState}
141
- />
142
- );