@finos/legend-application-data-cube 0.7.7 → 0.7.8
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/components/LegendDataCubeWebApplication.d.ts.map +1 -1
- package/lib/components/LegendDataCubeWebApplication.js +11 -1
- package/lib/components/LegendDataCubeWebApplication.js.map +1 -1
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.d.ts.map +1 -1
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.js +42 -33
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.js.map +1 -1
- package/lib/components/builder/source/LegendDataCubeSourceLoader.d.ts.map +1 -1
- package/lib/components/builder/source/LegendDataCubeSourceLoader.js +1 -3
- package/lib/components/builder/source/LegendDataCubeSourceLoader.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/AuthStore.d.ts +9 -0
- package/lib/stores/AuthStore.d.ts.map +1 -0
- package/lib/{components/builder/source/LakehouseConsumerDataCubeSourceLoader.d.ts → stores/AuthStore.js} +16 -7
- package/lib/stores/AuthStore.js.map +1 -0
- package/lib/stores/LegendDataCubeBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendDataCubeBaseStore.js +1 -1
- package/lib/stores/LegendDataCubeBaseStore.js.map +1 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts +3 -3
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts.map +1 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.js +21 -7
- package/lib/stores/LegendDataCubeDataCubeEngine.js.map +1 -1
- package/lib/stores/builder/LegendDataCubeBuilderStore.d.ts.map +1 -1
- package/lib/stores/builder/LegendDataCubeBuilderStore.js +0 -4
- package/lib/stores/builder/LegendDataCubeBuilderStore.js.map +1 -1
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.d.ts +8 -8
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.d.ts.map +1 -1
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.js +66 -76
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.js.map +1 -1
- package/lib/stores/model/LakehouseConsumerDataCubeSource.d.ts +0 -4
- package/lib/stores/model/LakehouseConsumerDataCubeSource.d.ts.map +1 -1
- package/lib/stores/model/LakehouseConsumerDataCubeSource.js +0 -5
- package/lib/stores/model/LakehouseConsumerDataCubeSource.js.map +1 -1
- package/package.json +8 -8
- package/src/components/LegendDataCubeWebApplication.tsx +11 -0
- package/src/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.tsx +91 -66
- package/src/components/builder/source/LegendDataCubeSourceLoader.tsx +0 -10
- package/src/stores/AuthStore.ts +32 -0
- package/src/stores/LegendDataCubeBaseStore.ts +1 -0
- package/src/stores/LegendDataCubeDataCubeEngine.ts +36 -6
- package/src/stores/builder/LegendDataCubeBuilderStore.tsx +0 -12
- package/src/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.ts +98 -114
- package/src/stores/model/LakehouseConsumerDataCubeSource.ts +0 -5
- package/tsconfig.json +1 -2
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceLoader.d.ts.map +0 -1
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceLoader.js +0 -35
- package/lib/components/builder/source/LakehouseConsumerDataCubeSourceLoader.js.map +0 -1
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.d.ts +0 -38
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.d.ts.map +0 -1
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.js +0 -87
- package/lib/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.js.map +0 -1
- package/src/components/builder/source/LakehouseConsumerDataCubeSourceLoader.tsx +0 -69
- package/src/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.ts +0 -169
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// authStore.ts
|
|
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 { makeAutoObservable } from 'mobx';
|
|
18
|
+
|
|
19
|
+
class AuthStore {
|
|
20
|
+
accessToken: string | undefined = undefined;
|
|
21
|
+
constructor() {
|
|
22
|
+
makeAutoObservable(this);
|
|
23
|
+
}
|
|
24
|
+
setAccessToken(token?: string) {
|
|
25
|
+
this.accessToken = token;
|
|
26
|
+
}
|
|
27
|
+
getAccessToken(): string | undefined {
|
|
28
|
+
return this.accessToken;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const authStore = new AuthStore();
|
|
@@ -93,6 +93,8 @@ import {
|
|
|
93
93
|
PRECISE_PRIMITIVE_TYPE,
|
|
94
94
|
CORE_PURE_PATH,
|
|
95
95
|
V1_DataProductOriginType,
|
|
96
|
+
V1_entitlementsDataProductDetailsResponseToDataProductDetails,
|
|
97
|
+
V1_AdHocDeploymentDataProductOrigin,
|
|
96
98
|
} from '@finos/legend-graph';
|
|
97
99
|
import {
|
|
98
100
|
_elementPtr,
|
|
@@ -167,20 +169,27 @@ import {
|
|
|
167
169
|
RawLakehouseConsumerDataCubeSource,
|
|
168
170
|
RawLakehouseSdlcOrigin,
|
|
169
171
|
} from './model/LakehouseConsumerDataCubeSource.js';
|
|
172
|
+
import {
|
|
173
|
+
isEnvNameCompatibleWithEntitlementsLakehouseEnvironmentType,
|
|
174
|
+
type LakehouseContractServerClient,
|
|
175
|
+
} from '@finos/legend-server-lakehouse';
|
|
176
|
+
import { authStore } from './AuthStore.js';
|
|
177
|
+
import { extractEntityNameFromPath } from '@finos/legend-storage';
|
|
170
178
|
|
|
171
179
|
export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
172
180
|
private readonly _application: LegendDataCubeApplicationStore;
|
|
173
181
|
private readonly _depotServerClient: DepotServerClient;
|
|
174
182
|
private readonly _engineServerClient: V1_EngineServerClient;
|
|
183
|
+
private readonly _lakehouseContractServerClient: LakehouseContractServerClient;
|
|
175
184
|
private readonly _graphManager: V1_PureGraphManager;
|
|
176
185
|
private readonly _duckDBEngine: LegendDataCubeDuckDBEngine;
|
|
177
186
|
private _ingestDefinition: PlainObject | undefined;
|
|
178
|
-
private _adhocDataProductGraphGrammar: string | undefined;
|
|
179
187
|
|
|
180
188
|
constructor(
|
|
181
189
|
application: LegendDataCubeApplicationStore,
|
|
182
190
|
depotServerClient: DepotServerClient,
|
|
183
191
|
engineServerClient: V1_EngineServerClient,
|
|
192
|
+
lakehouseContractServerClient: LakehouseContractServerClient,
|
|
184
193
|
graphManager: V1_PureGraphManager,
|
|
185
194
|
) {
|
|
186
195
|
super();
|
|
@@ -189,6 +198,7 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
189
198
|
this._depotServerClient = depotServerClient;
|
|
190
199
|
this._engineServerClient = engineServerClient;
|
|
191
200
|
this._graphManager = graphManager;
|
|
201
|
+
this._lakehouseContractServerClient = lakehouseContractServerClient;
|
|
192
202
|
this._duckDBEngine = new LegendDataCubeDuckDBEngine();
|
|
193
203
|
}
|
|
194
204
|
|
|
@@ -1331,10 +1341,6 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
1331
1341
|
this._ingestDefinition = ingestDefinition;
|
|
1332
1342
|
}
|
|
1333
1343
|
|
|
1334
|
-
registerAdhocDataProductGraphGrammar(fullGraphGrammar: string | undefined) {
|
|
1335
|
-
this._adhocDataProductGraphGrammar = fullGraphGrammar;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
1344
|
// ---------------------------------- CACHING --------------------------------------
|
|
1339
1345
|
|
|
1340
1346
|
override async initializeCache(
|
|
@@ -1878,8 +1884,32 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
1878
1884
|
true,
|
|
1879
1885
|
);
|
|
1880
1886
|
} else {
|
|
1887
|
+
const dataProducts = rawSource.paths[0]
|
|
1888
|
+
? V1_entitlementsDataProductDetailsResponseToDataProductDetails(
|
|
1889
|
+
await this._lakehouseContractServerClient.getDataProduct(
|
|
1890
|
+
extractEntityNameFromPath(rawSource.paths[0]),
|
|
1891
|
+
authStore.getAccessToken(),
|
|
1892
|
+
),
|
|
1893
|
+
)
|
|
1894
|
+
: [];
|
|
1895
|
+
const selectedEnv = rawSource.environment;
|
|
1896
|
+
const dataProduct = dataProducts.find((dp) => {
|
|
1897
|
+
const envType = dp.lakehouseEnvironment?.type;
|
|
1898
|
+
if (!envType) {
|
|
1899
|
+
return false;
|
|
1900
|
+
}
|
|
1901
|
+
return isEnvNameCompatibleWithEntitlementsLakehouseEnvironmentType(
|
|
1902
|
+
selectedEnv,
|
|
1903
|
+
envType,
|
|
1904
|
+
);
|
|
1905
|
+
});
|
|
1906
|
+
const fullGraphGrammar = guaranteeType(
|
|
1907
|
+
guaranteeNonNullable(dataProduct, 'Unable to resolve data product ')
|
|
1908
|
+
.origin,
|
|
1909
|
+
V1_AdHocDeploymentDataProductOrigin,
|
|
1910
|
+
).definition;
|
|
1881
1911
|
pmcd = await this.parseCompatibleModel(
|
|
1882
|
-
guaranteeNonNullable(
|
|
1912
|
+
guaranteeNonNullable(fullGraphGrammar),
|
|
1883
1913
|
);
|
|
1884
1914
|
}
|
|
1885
1915
|
|
|
@@ -77,8 +77,6 @@ import type {
|
|
|
77
77
|
} from '@finos/legend-server-lakehouse';
|
|
78
78
|
import { LAKEHOUSE_PRODUCER_DATA_CUBE_SOURCE_TYPE } from '../model/LakehouseProducerDataCubeSource.js';
|
|
79
79
|
import { LakehouseProducerDataCubeSourceLoaderState } from './source/LakehouseProducerDataCubeSourceLoaderState.js';
|
|
80
|
-
import { LAKEHOUSE_CONSUMER_DATA_CUBE_SOURCE_TYPE } from '../model/LakehouseConsumerDataCubeSource.js';
|
|
81
|
-
import { LakehouseConsumerDataCubeSourceLoaderState } from './source/LakehouseConsumerDataCubeSourceLoaderState.js';
|
|
82
80
|
|
|
83
81
|
export class LegendDataCubeBuilderState {
|
|
84
82
|
readonly uuid = uuid();
|
|
@@ -361,16 +359,6 @@ export class LegendDataCubeBuilderStore {
|
|
|
361
359
|
onSuccess,
|
|
362
360
|
onError,
|
|
363
361
|
);
|
|
364
|
-
case LAKEHOUSE_CONSUMER_DATA_CUBE_SOURCE_TYPE:
|
|
365
|
-
return new LakehouseConsumerDataCubeSourceLoaderState(
|
|
366
|
-
this.application,
|
|
367
|
-
this.engine,
|
|
368
|
-
this.alertService,
|
|
369
|
-
sourceData,
|
|
370
|
-
persistentDataCube,
|
|
371
|
-
onSuccess,
|
|
372
|
-
onError,
|
|
373
|
-
);
|
|
374
362
|
default:
|
|
375
363
|
throw new UnsupportedOperationError(
|
|
376
364
|
`Can't create source loader for unsupported type '${sourceData._type}'`,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { action, flow, makeObservable, observable } from 'mobx';
|
|
17
|
+
import { action, computed, flow, makeObservable, observable } from 'mobx';
|
|
18
18
|
import {
|
|
19
19
|
LegendDataCubeSourceBuilderState,
|
|
20
20
|
LegendDataCubeSourceBuilderType,
|
|
@@ -23,6 +23,8 @@ import {
|
|
|
23
23
|
ActionState,
|
|
24
24
|
assertErrorThrown,
|
|
25
25
|
guaranteeNonNullable,
|
|
26
|
+
isNonNullable,
|
|
27
|
+
uniq,
|
|
26
28
|
type GeneratorFn,
|
|
27
29
|
type PlainObject,
|
|
28
30
|
} from '@finos/legend-shared';
|
|
@@ -33,10 +35,11 @@ import {
|
|
|
33
35
|
type LakehousePlatformServerClient,
|
|
34
36
|
type LakehouseContractServerClient,
|
|
35
37
|
type IngestDeploymentServerConfig,
|
|
38
|
+
filterEnvironmentsByEntitlementsEnv,
|
|
39
|
+
getIngestDeploymentServerConfigName,
|
|
36
40
|
} from '@finos/legend-server-lakehouse';
|
|
37
41
|
import { VersionedProjectData } from '@finos/legend-server-depot';
|
|
38
42
|
import {
|
|
39
|
-
V1_EntitlementsLakehouseEnvironmentType,
|
|
40
43
|
V1_SdlcDeploymentDataProductOrigin,
|
|
41
44
|
type V1_EntitlementsDataProductLite,
|
|
42
45
|
type V1_EntitlementsDataProductLiteResponse,
|
|
@@ -44,9 +47,9 @@ import {
|
|
|
44
47
|
V1_DataProductOriginType,
|
|
45
48
|
V1_AdHocDeploymentDataProductOrigin,
|
|
46
49
|
type V1_EntitlementsDataProductDetails,
|
|
50
|
+
V1_isIngestEnvsCompatibleWithEntitlements,
|
|
47
51
|
} from '@finos/legend-graph';
|
|
48
52
|
import {
|
|
49
|
-
LakehouseEnvironmentType,
|
|
50
53
|
RawLakehouseAdhocOrigin,
|
|
51
54
|
RawLakehouseConsumerDataCubeSource,
|
|
52
55
|
RawLakehouseSdlcOrigin,
|
|
@@ -57,20 +60,19 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
57
60
|
selectedDataProduct: string | undefined;
|
|
58
61
|
selectedAccessPoint: string | undefined;
|
|
59
62
|
paths: string[] = [];
|
|
60
|
-
allEnvironments: string[] = [];
|
|
61
|
-
environments: string[] = [];
|
|
62
|
-
selectedEnvironment: string | undefined;
|
|
63
63
|
dataProducts: V1_EntitlementsDataProductLite[] = [];
|
|
64
64
|
accessPoints: string[] = [];
|
|
65
65
|
dpCoordinates: VersionedProjectData | undefined;
|
|
66
66
|
origin: string | undefined;
|
|
67
67
|
fullGraphGrammar: string | undefined;
|
|
68
68
|
deploymentId: number | undefined;
|
|
69
|
-
|
|
70
|
-
dataProductDetails: V1_EntitlementsDataProductDetails[] = [];
|
|
71
|
-
|
|
69
|
+
dataProductDetails: V1_EntitlementsDataProductDetails[] | undefined;
|
|
72
70
|
DEFAULT_CONSUMER_WAREHOUSE = 'LAKEHOUSE_CONSUMER_DEFAULT_WH';
|
|
73
71
|
|
|
72
|
+
// envs
|
|
73
|
+
allEnvironments: IngestDeploymentServerConfig[] | undefined;
|
|
74
|
+
selectedEnvironment: IngestDeploymentServerConfig | undefined;
|
|
75
|
+
|
|
74
76
|
private readonly _platformServerClient: LakehousePlatformServerClient;
|
|
75
77
|
private readonly _contractServerClient: LakehouseContractServerClient;
|
|
76
78
|
readonly dataProductLoadingState = ActionState.create();
|
|
@@ -92,7 +94,9 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
92
94
|
dataProducts: observable,
|
|
93
95
|
selectedDataProduct: observable,
|
|
94
96
|
accessPoints: observable,
|
|
95
|
-
|
|
97
|
+
allEnvironments: observable,
|
|
98
|
+
environments: computed,
|
|
99
|
+
selectedDataProductDetail: computed,
|
|
96
100
|
selectedAccessPoint: observable,
|
|
97
101
|
selectedEnvironment: observable,
|
|
98
102
|
loadDataProducts: flow,
|
|
@@ -104,7 +108,6 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
104
108
|
setAccessPoints: action,
|
|
105
109
|
setSelectedAccessPoint: action,
|
|
106
110
|
setSelectedEnvironment: action,
|
|
107
|
-
setEnvironments: action,
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
|
|
@@ -124,11 +127,7 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
124
127
|
this.accessPoints = accessPoints;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
|
-
|
|
128
|
-
this.environments = environments;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
setAllEnvironments(environments: string[]) {
|
|
130
|
+
setAllEnvironments(environments: IngestDeploymentServerConfig[]) {
|
|
132
131
|
this.allEnvironments = environments;
|
|
133
132
|
}
|
|
134
133
|
|
|
@@ -136,10 +135,55 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
136
135
|
this.selectedAccessPoint = accessPoint;
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
setSelectedEnvironment(
|
|
138
|
+
setSelectedEnvironment(
|
|
139
|
+
environment: IngestDeploymentServerConfig | undefined,
|
|
140
|
+
) {
|
|
140
141
|
this.selectedEnvironment = environment;
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
get environments(): IngestDeploymentServerConfig[] {
|
|
145
|
+
const allEnvironments = this.allEnvironments;
|
|
146
|
+
if (allEnvironments) {
|
|
147
|
+
const details = this.dataProductDetails?.map(
|
|
148
|
+
(detail) => detail.lakehouseEnvironment?.type,
|
|
149
|
+
);
|
|
150
|
+
if (details?.length && !details.includes(undefined)) {
|
|
151
|
+
const entitlementsTypes = uniq(details.filter(isNonNullable));
|
|
152
|
+
return uniq(
|
|
153
|
+
entitlementsTypes
|
|
154
|
+
.map((type) =>
|
|
155
|
+
filterEnvironmentsByEntitlementsEnv(type, allEnvironments),
|
|
156
|
+
)
|
|
157
|
+
.flat(),
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return allEnvironments;
|
|
161
|
+
}
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
get selectedDataProductDetail():
|
|
166
|
+
| V1_EntitlementsDataProductDetails
|
|
167
|
+
| undefined {
|
|
168
|
+
const selectedEnv = this.selectedEnvironment;
|
|
169
|
+
if (selectedEnv && this.dataProductDetails?.length) {
|
|
170
|
+
const details = this.dataProductDetails.filter((dpDetail) => {
|
|
171
|
+
const dpDetailType = dpDetail.lakehouseEnvironment?.type;
|
|
172
|
+
if (!dpDetailType) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
return V1_isIngestEnvsCompatibleWithEntitlements(
|
|
176
|
+
selectedEnv.environmentClassification,
|
|
177
|
+
dpDetailType,
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
if (details.length === 1) {
|
|
181
|
+
return guaranteeNonNullable(details[0]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
|
|
143
187
|
*loadDataProducts(access_token?: string): GeneratorFn<void> {
|
|
144
188
|
try {
|
|
145
189
|
this.dataProductLoadingState.inProgress();
|
|
@@ -167,95 +211,41 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
167
211
|
access_token,
|
|
168
212
|
),
|
|
169
213
|
);
|
|
170
|
-
|
|
171
|
-
const filterEnvironments = (
|
|
172
|
-
type: V1_EntitlementsLakehouseEnvironmentType,
|
|
173
|
-
environments: string[],
|
|
174
|
-
): string[] => {
|
|
175
|
-
switch (type) {
|
|
176
|
-
case V1_EntitlementsLakehouseEnvironmentType.PRODUCTION:
|
|
177
|
-
return environments.filter(
|
|
178
|
-
(env) =>
|
|
179
|
-
!env.includes(LakehouseEnvironmentType.PRODUCTION_PARALLEL) &&
|
|
180
|
-
!env.includes(LakehouseEnvironmentType.DEVELOPMENT),
|
|
181
|
-
);
|
|
182
|
-
case V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL:
|
|
183
|
-
return environments.filter((env) =>
|
|
184
|
-
env.includes(LakehouseEnvironmentType.PRODUCTION_PARALLEL),
|
|
185
|
-
);
|
|
186
|
-
case V1_EntitlementsLakehouseEnvironmentType.DEVELOPMENT:
|
|
187
|
-
return environments.filter((env) =>
|
|
188
|
-
env.includes(LakehouseEnvironmentType.DEVELOPMENT),
|
|
189
|
-
);
|
|
190
|
-
default:
|
|
191
|
-
return environments;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
if (this.dataProductDetails.length === 1) {
|
|
196
|
-
const environmentType =
|
|
197
|
-
this.dataProductDetails.at(0)?.lakehouseEnvironment?.type;
|
|
198
|
-
if (environmentType) {
|
|
199
|
-
this.setEnvironments(
|
|
200
|
-
filterEnvironments(environmentType, this.allEnvironments),
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
} else if (this.dataProductDetails.length > 1) {
|
|
204
|
-
const allEnvironments = new Set<string>();
|
|
205
|
-
this.dataProductDetails.forEach((dataProduct) => {
|
|
206
|
-
const environmentType = dataProduct.lakehouseEnvironment?.type;
|
|
207
|
-
if (environmentType) {
|
|
208
|
-
filterEnvironments(environmentType, this.allEnvironments).forEach(
|
|
209
|
-
(env) => allEnvironments.add(env),
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
this.setEnvironments(Array.from(allEnvironments));
|
|
214
|
-
}
|
|
215
214
|
}
|
|
216
215
|
|
|
217
216
|
fetchAccessPoints() {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this.dpCoordinates = undefined;
|
|
250
|
-
this.origin = V1_DataProductOriginType.AD_HOC_DEPLOYMENT;
|
|
251
|
-
this.fullGraphGrammar = dataProduct.origin.definition;
|
|
217
|
+
try {
|
|
218
|
+
this.resetAccessPoint();
|
|
219
|
+
const dataProduct = guaranteeNonNullable(
|
|
220
|
+
this.selectedDataProductDetail,
|
|
221
|
+
'unable to resolve data product',
|
|
222
|
+
);
|
|
223
|
+
if (dataProduct.origin instanceof V1_SdlcDeploymentDataProductOrigin) {
|
|
224
|
+
const versionedData = new VersionedProjectData();
|
|
225
|
+
versionedData.groupId = dataProduct.origin.group;
|
|
226
|
+
versionedData.artifactId = dataProduct.origin.artifact;
|
|
227
|
+
versionedData.versionId = dataProduct.origin.version;
|
|
228
|
+
this.dpCoordinates = versionedData;
|
|
229
|
+
this.origin = V1_DataProductOriginType.SDLC_DEPLOYMENT;
|
|
230
|
+
} else if (
|
|
231
|
+
dataProduct.origin instanceof V1_AdHocDeploymentDataProductOrigin
|
|
232
|
+
) {
|
|
233
|
+
this.dpCoordinates = undefined;
|
|
234
|
+
this.origin = V1_DataProductOriginType.AD_HOC_DEPLOYMENT;
|
|
235
|
+
this.fullGraphGrammar = dataProduct.origin.definition;
|
|
236
|
+
}
|
|
237
|
+
this.deploymentId = dataProduct.deploymentId;
|
|
238
|
+
this.setAccessPoints(
|
|
239
|
+
dataProduct.dataProduct.accessPoints.map(
|
|
240
|
+
(accessPoint) => accessPoint.name,
|
|
241
|
+
),
|
|
242
|
+
);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
assertErrorThrown(error);
|
|
245
|
+
this._application.notificationService.notifyError(
|
|
246
|
+
`unable to fetch access points: ${error.message}`,
|
|
247
|
+
);
|
|
252
248
|
}
|
|
253
|
-
this.deploymentId = dataProduct?.deploymentId;
|
|
254
|
-
this.setAccessPoints(
|
|
255
|
-
dataProduct?.dataProduct.accessPoints.map(
|
|
256
|
-
(accessPoint) => accessPoint.name,
|
|
257
|
-
) ?? [],
|
|
258
|
-
);
|
|
259
249
|
}
|
|
260
250
|
|
|
261
251
|
*fetchEnvironment(access_token: string | undefined): GeneratorFn<void> {
|
|
@@ -264,16 +254,7 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
264
254
|
(yield this._platformServerClient.getIngestEnvironmentSummaries(
|
|
265
255
|
access_token,
|
|
266
256
|
)) as IngestDeploymentServerConfig[];
|
|
267
|
-
this.setAllEnvironments(
|
|
268
|
-
ingestServerConfigs
|
|
269
|
-
.map((config) => {
|
|
270
|
-
const baseUrl = new URL(config.ingestServerUrl).hostname;
|
|
271
|
-
const subdomain = baseUrl.split('.')[0];
|
|
272
|
-
const parts = subdomain?.split('-');
|
|
273
|
-
return parts?.slice(0, -1).join('-');
|
|
274
|
-
})
|
|
275
|
-
.filter((env) => env !== undefined),
|
|
276
|
-
);
|
|
257
|
+
this.setAllEnvironments(ingestServerConfigs);
|
|
277
258
|
this.ingestEnvLoadingState.complete();
|
|
278
259
|
}
|
|
279
260
|
|
|
@@ -326,13 +307,16 @@ export class LakehouseConsumerDataCubeSourceBuilderState extends LegendDataCubeS
|
|
|
326
307
|
);
|
|
327
308
|
|
|
328
309
|
const rawSource = new RawLakehouseConsumerDataCubeSource();
|
|
329
|
-
|
|
310
|
+
const selectedEnv = guaranteeNonNullable(this.selectedEnvironment);
|
|
311
|
+
rawSource.environment = guaranteeNonNullable(
|
|
312
|
+
getIngestDeploymentServerConfigName(selectedEnv),
|
|
313
|
+
'Unable to resolve env env string',
|
|
314
|
+
);
|
|
330
315
|
if (this.origin === V1_DataProductOriginType.SDLC_DEPLOYMENT) {
|
|
331
316
|
const lakehouseOrigin = new RawLakehouseSdlcOrigin();
|
|
332
317
|
lakehouseOrigin.dpCoordinates = guaranteeNonNullable(this.dpCoordinates);
|
|
333
318
|
rawSource.origin = lakehouseOrigin;
|
|
334
319
|
} else {
|
|
335
|
-
this._engine.registerAdhocDataProductGraphGrammar(this.fullGraphGrammar);
|
|
336
320
|
rawSource.origin = new RawLakehouseAdhocOrigin();
|
|
337
321
|
}
|
|
338
322
|
rawSource.paths = this.paths;
|
|
@@ -49,11 +49,6 @@ export class LakehouseConsumerDataCubeSource extends DataCubeSource {
|
|
|
49
49
|
deploymentId?: number | undefined;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export enum LakehouseEnvironmentType {
|
|
53
|
-
DEVELOPMENT = 'dev',
|
|
54
|
-
PRODUCTION_PARALLEL = 'pp',
|
|
55
|
-
}
|
|
56
|
-
|
|
57
52
|
export abstract class RawLakehouseOrigin {}
|
|
58
53
|
|
|
59
54
|
export class RawLakehouseAdhocOrigin extends RawLakehouseOrigin {
|
package/tsconfig.json
CHANGED
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"./src/application/LegendDataCubeApplicationPlugin.ts",
|
|
63
63
|
"./src/application/LegendDataCubePluginManager.ts",
|
|
64
64
|
"./src/application/__test-utils__/LegendDataCubeApplicationTestUtils.ts",
|
|
65
|
+
"./src/stores/AuthStore.ts",
|
|
65
66
|
"./src/stores/DuckDBWASM.d.ts",
|
|
66
67
|
"./src/stores/LegendDataCubeBaseStore.ts",
|
|
67
68
|
"./src/stores/LegendDataCubeDataCubeEngine.ts",
|
|
68
69
|
"./src/stores/LegendDataCubeDuckDBEngine.ts",
|
|
69
70
|
"./src/stores/builder/source/FreeformTDSExpressionDataCubeSourceBuilderState.ts",
|
|
70
71
|
"./src/stores/builder/source/LakehouseConsumerDataCubeSourceBuilderState.ts",
|
|
71
|
-
"./src/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.ts",
|
|
72
72
|
"./src/stores/builder/source/LakehouseProducerDataCubeSourceBuilderState.ts",
|
|
73
73
|
"./src/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.ts",
|
|
74
74
|
"./src/stores/builder/source/LegendDataCubeSourceBuilderState.ts",
|
|
@@ -97,7 +97,6 @@
|
|
|
97
97
|
"./src/components/builder/LegendDataCubeSourceViewer.tsx",
|
|
98
98
|
"./src/components/builder/source/FreeformTDSExpressionDataCubeSourceBuilder.tsx",
|
|
99
99
|
"./src/components/builder/source/LakehouseConsumerDataCubeSourceBuilder.tsx",
|
|
100
|
-
"./src/components/builder/source/LakehouseConsumerDataCubeSourceLoader.tsx",
|
|
101
100
|
"./src/components/builder/source/LakehouseProducerDataCubeSourceBuilder.tsx",
|
|
102
101
|
"./src/components/builder/source/LakehouseProducerDataCubeSourceLoader.tsx",
|
|
103
102
|
"./src/components/builder/source/LegendDataCubeSourceLoader.tsx",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LakehouseConsumerDataCubeSourceLoader.d.ts","sourceRoot":"","sources":["../../../../src/components/builder/source/LakehouseConsumerDataCubeSourceLoader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,8EAA8E,CAAC;AAK/I,eAAO,MAAM,qCAAqC,WACxC;IACN,mBAAmB,EAAE,0CAA0C,CAAC;CACjE;;CA0CF,CAAC"}
|
|
@@ -1,35 +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 { observer } from 'mobx-react-lite';
|
|
18
|
-
import { useEffect } from 'react';
|
|
19
|
-
import { useAuth } from 'react-oidc-context';
|
|
20
|
-
import { useLegendDataCubeBuilderStore } from '../LegendDataCubeBuilderStoreProvider.js';
|
|
21
|
-
import { FormButton, FormTextInput } from '@finos/legend-data-cube';
|
|
22
|
-
export const LakehouseConsumerDataCubeSourceLoader = observer((props) => {
|
|
23
|
-
const { partialSourceLoader } = props;
|
|
24
|
-
const auth = useAuth();
|
|
25
|
-
const store = useLegendDataCubeBuilderStore();
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
partialSourceLoader.reset();
|
|
28
|
-
}, [partialSourceLoader]);
|
|
29
|
-
return (_jsx("div", { className: "flex h-full w-full", children: _jsx("div", { className: "m-3 flex w-full flex-col items-stretch gap-2 text-neutral-500", children: _jsxs("div", { className: "query-setup__wizard__group", children: [_jsx("div", { className: "query-setup__wizard__group__title", children: "Ingest Urn" }), _jsxs("div", { className: "flex h-full w-full flex-auto items-center justify-between text-nowrap", children: [_jsx(FormTextInput, { className: "w-3/4 text-base", value: partialSourceLoader.dataProductId, disabled: true }), _jsx(FormButton, { compact: true, className: "ml-1.5 text-nowrap text-sm text-black", onClick: () => {
|
|
30
|
-
partialSourceLoader
|
|
31
|
-
.loadAdhocDataProduct(auth.user?.access_token, store.contractServerClient)
|
|
32
|
-
.catch((error) => store.alertService.alertUnhandledError(error));
|
|
33
|
-
}, children: partialSourceLoader.dpLoaded ? 'Loaded!' : 'Load' })] })] }) }) }));
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=LakehouseConsumerDataCubeSourceLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LakehouseConsumerDataCubeSourceLoader.js","sourceRoot":"","sources":["../../../../src/components/builder/source/LakehouseConsumerDataCubeSourceLoader.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEpE,MAAM,CAAC,MAAM,qCAAqC,GAAG,QAAQ,CAC3D,CAAC,KAEA,EAAE,EAAE;IACH,MAAM,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,6BAA6B,EAAE,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,mBAAmB,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAE1B,OAAO,CACL,cAAK,SAAS,EAAC,oBAAoB,YACjC,cAAK,SAAS,EAAC,+DAA+D,YAC5E,eAAK,SAAS,EAAC,4BAA4B,aACzC,cAAK,SAAS,EAAC,mCAAmC,2BAAiB,EACnE,eAAK,SAAS,EAAC,uEAAuE,aACpF,KAAC,aAAa,IACZ,SAAS,EAAC,iBAAiB,EAC3B,KAAK,EAAE,mBAAmB,CAAC,aAAa,EACxC,QAAQ,EAAE,IAAI,GACd,EACF,KAAC,UAAU,IACT,OAAO,EAAE,IAAI,EACb,SAAS,EAAC,uCAAuC,EACjD,OAAO,EAAE,GAAG,EAAE;oCACZ,mBAAmB;yCAChB,oBAAoB,CACnB,IAAI,CAAC,IAAI,EAAE,YAAY,EACvB,KAAK,CAAC,oBAAoB,CAC3B;yCACA,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACf,KAAK,CAAC,YAAY,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAC9C,CAAC;gCACN,CAAC,YAEA,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,GACvC,IACT,IACF,GACF,GACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025-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 PlainObject } from '@finos/legend-shared';
|
|
17
|
-
import type { LegendDataCubeApplicationStore } from '../../LegendDataCubeBaseStore.js';
|
|
18
|
-
import type { LegendDataCubeDataCubeEngine } from '../../LegendDataCubeDataCubeEngine.js';
|
|
19
|
-
import { LegendDataCubeSourceLoaderState } from './LegendDataCubeSourceLoaderState.js';
|
|
20
|
-
import type { DataCubeAlertService } from '@finos/legend-data-cube';
|
|
21
|
-
import { type PersistentDataCube } from '@finos/legend-graph';
|
|
22
|
-
import type { LakehouseContractServerClient } from '@finos/legend-server-lakehouse';
|
|
23
|
-
import { LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
|
|
24
|
-
export declare class LakehouseConsumerDataCubeSourceLoaderState extends LegendDataCubeSourceLoaderState {
|
|
25
|
-
fullGraphGrammar: string | undefined;
|
|
26
|
-
dataProductId: string | undefined;
|
|
27
|
-
dpLoaded: boolean;
|
|
28
|
-
environment: string | undefined;
|
|
29
|
-
constructor(application: LegendDataCubeApplicationStore, engine: LegendDataCubeDataCubeEngine, alertService: DataCubeAlertService, sourceData: PlainObject, persistentDataCube: PersistentDataCube, onSuccess: () => Promise<void>, onError: (error: unknown) => Promise<void>);
|
|
30
|
-
setDpLoaded(dpLoaded: boolean): void;
|
|
31
|
-
setDataProductId(id: string | undefined): void;
|
|
32
|
-
get isValid(): boolean;
|
|
33
|
-
get label(): LegendDataCubeSourceBuilderType;
|
|
34
|
-
reset(): void;
|
|
35
|
-
loadAdhocDataProduct(access_token: string | undefined, lakehouseContractServerClient: LakehouseContractServerClient): Promise<void>;
|
|
36
|
-
load(source: PlainObject | undefined): Promise<PlainObject<T>>;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=LakehouseConsumerDataCubeSourceLoaderState.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LakehouseConsumerDataCubeSourceLoaderState.d.ts","sourceRoot":"","sources":["../../../../src/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAEpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAOxF,qBAAa,0CAA2C,SAAQ,+BAA+B;IAC7F,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;gBAG9B,WAAW,EAAE,8BAA8B,EAC3C,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,oBAAoB,EAClC,UAAU,EAAE,WAAW,EACvB,kBAAkB,EAAE,kBAAkB,EACtC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC;IAsB5C,WAAW,CAAC,QAAQ,EAAE,OAAO;IAI7B,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS;IAIvC,IAAa,OAAO,IAAI,OAAO,CAE9B;IAED,IAAa,KAAK,oCAEjB;IAED,KAAK;IAiBC,oBAAoB,CACxB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,6BAA6B,EAAE,6BAA6B;IA4C/C,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS;CAcpD"}
|