@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
|
@@ -1,87 +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 { guaranteeNonNullable, guaranteeType, } from '@finos/legend-shared';
|
|
17
|
-
import { LegendDataCubeSourceLoaderState } from './LegendDataCubeSourceLoaderState.js';
|
|
18
|
-
import { V1_AdHocDeploymentDataProductOrigin, V1_entitlementsDataProductDetailsResponseToDataProductDetails, V1_EntitlementsLakehouseEnvironmentType, } from '@finos/legend-graph';
|
|
19
|
-
import { action, makeObservable, observable } from 'mobx';
|
|
20
|
-
import { LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
|
|
21
|
-
import { LakehouseEnvironmentType, RawLakehouseConsumerDataCubeSource, RawLakehouseSdlcOrigin, } from '../../model/LakehouseConsumerDataCubeSource.js';
|
|
22
|
-
export class LakehouseConsumerDataCubeSourceLoaderState extends LegendDataCubeSourceLoaderState {
|
|
23
|
-
fullGraphGrammar;
|
|
24
|
-
dataProductId;
|
|
25
|
-
dpLoaded;
|
|
26
|
-
environment;
|
|
27
|
-
constructor(application, engine, alertService, sourceData, persistentDataCube, onSuccess, onError) {
|
|
28
|
-
super(application, engine, alertService, sourceData, persistentDataCube, onSuccess, onError);
|
|
29
|
-
this.dpLoaded = false;
|
|
30
|
-
makeObservable(this, {
|
|
31
|
-
dpLoaded: observable,
|
|
32
|
-
setDpLoaded: action,
|
|
33
|
-
dataProductId: observable,
|
|
34
|
-
setDataProductId: action,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
setDpLoaded(dpLoaded) {
|
|
38
|
-
this.dpLoaded = dpLoaded;
|
|
39
|
-
}
|
|
40
|
-
setDataProductId(id) {
|
|
41
|
-
this.dataProductId = id;
|
|
42
|
-
}
|
|
43
|
-
get isValid() {
|
|
44
|
-
return this.dpLoaded;
|
|
45
|
-
}
|
|
46
|
-
get label() {
|
|
47
|
-
return LegendDataCubeSourceBuilderType.LAKEHOUSE_CONSUMER;
|
|
48
|
-
}
|
|
49
|
-
reset() {
|
|
50
|
-
const rawSource = RawLakehouseConsumerDataCubeSource.serialization.fromJson(this.sourceData);
|
|
51
|
-
if (!rawSource.origin ||
|
|
52
|
-
rawSource.origin instanceof RawLakehouseSdlcOrigin) {
|
|
53
|
-
this.setDpLoaded(true);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
this.setDpLoaded(false);
|
|
57
|
-
}
|
|
58
|
-
this.setDataProductId(rawSource.paths[0]);
|
|
59
|
-
this.environment = rawSource.environment;
|
|
60
|
-
this.fullGraphGrammar = undefined;
|
|
61
|
-
}
|
|
62
|
-
async loadAdhocDataProduct(access_token, lakehouseContractServerClient) {
|
|
63
|
-
const dataProducts = V1_entitlementsDataProductDetailsResponseToDataProductDetails(await lakehouseContractServerClient.getDataProduct(this.dataProductId?.split('::').pop() ?? '', access_token));
|
|
64
|
-
const selectedEnv = guaranteeNonNullable(this.environment);
|
|
65
|
-
const dataProduct = selectedEnv.includes(LakehouseEnvironmentType.DEVELOPMENT)
|
|
66
|
-
? dataProducts.find((dp) => dp.lakehouseEnvironment?.type ===
|
|
67
|
-
V1_EntitlementsLakehouseEnvironmentType.DEVELOPMENT)
|
|
68
|
-
: selectedEnv.includes(LakehouseEnvironmentType.PRODUCTION_PARALLEL)
|
|
69
|
-
? dataProducts.find((dp) => dp.lakehouseEnvironment?.type ===
|
|
70
|
-
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL)
|
|
71
|
-
: dataProducts.find((dp) => dp.lakehouseEnvironment?.type ===
|
|
72
|
-
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION);
|
|
73
|
-
if (dataProduct?.origin &&
|
|
74
|
-
dataProduct.origin instanceof V1_AdHocDeploymentDataProductOrigin) {
|
|
75
|
-
this.fullGraphGrammar = guaranteeType(dataProduct.origin, V1_AdHocDeploymentDataProductOrigin).definition;
|
|
76
|
-
this.setDpLoaded(true);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async load(source) {
|
|
80
|
-
const deserializedSource = RawLakehouseConsumerDataCubeSource.serialization.fromJson(guaranteeNonNullable(source));
|
|
81
|
-
if (this.fullGraphGrammar) {
|
|
82
|
-
this._engine.registerAdhocDataProductGraphGrammar(this.fullGraphGrammar);
|
|
83
|
-
}
|
|
84
|
-
return RawLakehouseConsumerDataCubeSource.serialization.toJson(deserializedSource);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=LakehouseConsumerDataCubeSourceLoaderState.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LakehouseConsumerDataCubeSourceLoaderState.js","sourceRoot":"","sources":["../../../../src/stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,oBAAoB,EACpB,aAAa,GAEd,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,OAAO,EACL,mCAAmC,EACnC,6DAA6D,EAC7D,uCAAuC,GAExC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EACL,wBAAwB,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AC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAEQ,KAAK,CAAC,IAAI,CAAC,MAA+B;QACjD,MAAM,kBAAkB,GACtB,kCAAkC,CAAC,aAAa,CAAC,QAAQ,CACvD,oBAAoB,CAAC,MAAM,CAAC,CAC7B,CAAC;QAEJ,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,oCAAoC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC3E,CAAC;QAED,OAAO,kCAAkC,CAAC,aAAa,CAAC,MAAM,CAC5D,kBAAkB,CACnB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,69 +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 { observer } from 'mobx-react-lite';
|
|
18
|
-
import { useEffect } from 'react';
|
|
19
|
-
import type { LakehouseConsumerDataCubeSourceLoaderState } from '../../../stores/builder/source/LakehouseConsumerDataCubeSourceLoaderState.js';
|
|
20
|
-
import { useAuth } from 'react-oidc-context';
|
|
21
|
-
import { useLegendDataCubeBuilderStore } from '../LegendDataCubeBuilderStoreProvider.js';
|
|
22
|
-
import { FormButton, FormTextInput } from '@finos/legend-data-cube';
|
|
23
|
-
|
|
24
|
-
export const LakehouseConsumerDataCubeSourceLoader = observer(
|
|
25
|
-
(props: {
|
|
26
|
-
partialSourceLoader: LakehouseConsumerDataCubeSourceLoaderState;
|
|
27
|
-
}) => {
|
|
28
|
-
const { partialSourceLoader } = props;
|
|
29
|
-
const auth = useAuth();
|
|
30
|
-
const store = useLegendDataCubeBuilderStore();
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
partialSourceLoader.reset();
|
|
34
|
-
}, [partialSourceLoader]);
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div className="flex h-full w-full">
|
|
38
|
-
<div className="m-3 flex w-full flex-col items-stretch gap-2 text-neutral-500">
|
|
39
|
-
<div className="query-setup__wizard__group">
|
|
40
|
-
<div className="query-setup__wizard__group__title">Ingest Urn</div>
|
|
41
|
-
<div className="flex h-full w-full flex-auto items-center justify-between text-nowrap">
|
|
42
|
-
<FormTextInput
|
|
43
|
-
className="w-3/4 text-base"
|
|
44
|
-
value={partialSourceLoader.dataProductId}
|
|
45
|
-
disabled={true}
|
|
46
|
-
/>
|
|
47
|
-
<FormButton
|
|
48
|
-
compact={true}
|
|
49
|
-
className="ml-1.5 text-nowrap text-sm text-black"
|
|
50
|
-
onClick={() => {
|
|
51
|
-
partialSourceLoader
|
|
52
|
-
.loadAdhocDataProduct(
|
|
53
|
-
auth.user?.access_token,
|
|
54
|
-
store.contractServerClient,
|
|
55
|
-
)
|
|
56
|
-
.catch((error) =>
|
|
57
|
-
store.alertService.alertUnhandledError(error),
|
|
58
|
-
);
|
|
59
|
-
}}
|
|
60
|
-
>
|
|
61
|
-
{partialSourceLoader.dpLoaded ? 'Loaded!' : 'Load'}
|
|
62
|
-
</FormButton>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
);
|
|
@@ -1,169 +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
|
-
|
|
17
|
-
import {
|
|
18
|
-
guaranteeNonNullable,
|
|
19
|
-
guaranteeType,
|
|
20
|
-
type PlainObject,
|
|
21
|
-
} from '@finos/legend-shared';
|
|
22
|
-
import type { LegendDataCubeApplicationStore } from '../../LegendDataCubeBaseStore.js';
|
|
23
|
-
import type { LegendDataCubeDataCubeEngine } from '../../LegendDataCubeDataCubeEngine.js';
|
|
24
|
-
import { LegendDataCubeSourceLoaderState } from './LegendDataCubeSourceLoaderState.js';
|
|
25
|
-
import type { DataCubeAlertService } from '@finos/legend-data-cube';
|
|
26
|
-
import {
|
|
27
|
-
V1_AdHocDeploymentDataProductOrigin,
|
|
28
|
-
V1_entitlementsDataProductDetailsResponseToDataProductDetails,
|
|
29
|
-
V1_EntitlementsLakehouseEnvironmentType,
|
|
30
|
-
type PersistentDataCube,
|
|
31
|
-
} from '@finos/legend-graph';
|
|
32
|
-
import type { LakehouseContractServerClient } from '@finos/legend-server-lakehouse';
|
|
33
|
-
import { action, makeObservable, observable } from 'mobx';
|
|
34
|
-
import { LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
|
|
35
|
-
import {
|
|
36
|
-
LakehouseEnvironmentType,
|
|
37
|
-
RawLakehouseConsumerDataCubeSource,
|
|
38
|
-
RawLakehouseSdlcOrigin,
|
|
39
|
-
} from '../../model/LakehouseConsumerDataCubeSource.js';
|
|
40
|
-
|
|
41
|
-
export class LakehouseConsumerDataCubeSourceLoaderState extends LegendDataCubeSourceLoaderState {
|
|
42
|
-
fullGraphGrammar: string | undefined;
|
|
43
|
-
dataProductId: string | undefined;
|
|
44
|
-
dpLoaded: boolean;
|
|
45
|
-
environment: string | undefined;
|
|
46
|
-
|
|
47
|
-
constructor(
|
|
48
|
-
application: LegendDataCubeApplicationStore,
|
|
49
|
-
engine: LegendDataCubeDataCubeEngine,
|
|
50
|
-
alertService: DataCubeAlertService,
|
|
51
|
-
sourceData: PlainObject,
|
|
52
|
-
persistentDataCube: PersistentDataCube,
|
|
53
|
-
onSuccess: () => Promise<void>,
|
|
54
|
-
onError: (error: unknown) => Promise<void>,
|
|
55
|
-
) {
|
|
56
|
-
super(
|
|
57
|
-
application,
|
|
58
|
-
engine,
|
|
59
|
-
alertService,
|
|
60
|
-
sourceData,
|
|
61
|
-
persistentDataCube,
|
|
62
|
-
onSuccess,
|
|
63
|
-
onError,
|
|
64
|
-
);
|
|
65
|
-
this.dpLoaded = false;
|
|
66
|
-
|
|
67
|
-
makeObservable(this, {
|
|
68
|
-
dpLoaded: observable,
|
|
69
|
-
setDpLoaded: action,
|
|
70
|
-
|
|
71
|
-
dataProductId: observable,
|
|
72
|
-
setDataProductId: action,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
setDpLoaded(dpLoaded: boolean) {
|
|
77
|
-
this.dpLoaded = dpLoaded;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
setDataProductId(id: string | undefined) {
|
|
81
|
-
this.dataProductId = id;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
override get isValid(): boolean {
|
|
85
|
-
return this.dpLoaded;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
override get label() {
|
|
89
|
-
return LegendDataCubeSourceBuilderType.LAKEHOUSE_CONSUMER;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
reset() {
|
|
93
|
-
const rawSource = RawLakehouseConsumerDataCubeSource.serialization.fromJson(
|
|
94
|
-
this.sourceData,
|
|
95
|
-
);
|
|
96
|
-
if (
|
|
97
|
-
!rawSource.origin ||
|
|
98
|
-
rawSource.origin instanceof RawLakehouseSdlcOrigin
|
|
99
|
-
) {
|
|
100
|
-
this.setDpLoaded(true);
|
|
101
|
-
} else {
|
|
102
|
-
this.setDpLoaded(false);
|
|
103
|
-
}
|
|
104
|
-
this.setDataProductId(rawSource.paths[0]);
|
|
105
|
-
this.environment = rawSource.environment;
|
|
106
|
-
this.fullGraphGrammar = undefined;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
async loadAdhocDataProduct(
|
|
110
|
-
access_token: string | undefined,
|
|
111
|
-
lakehouseContractServerClient: LakehouseContractServerClient,
|
|
112
|
-
) {
|
|
113
|
-
const dataProducts =
|
|
114
|
-
V1_entitlementsDataProductDetailsResponseToDataProductDetails(
|
|
115
|
-
await lakehouseContractServerClient.getDataProduct(
|
|
116
|
-
this.dataProductId?.split('::').pop() ?? '',
|
|
117
|
-
access_token,
|
|
118
|
-
),
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
const selectedEnv = guaranteeNonNullable(this.environment);
|
|
122
|
-
|
|
123
|
-
const dataProduct = selectedEnv.includes(
|
|
124
|
-
LakehouseEnvironmentType.DEVELOPMENT,
|
|
125
|
-
)
|
|
126
|
-
? dataProducts.find(
|
|
127
|
-
(dp) =>
|
|
128
|
-
dp.lakehouseEnvironment?.type ===
|
|
129
|
-
V1_EntitlementsLakehouseEnvironmentType.DEVELOPMENT,
|
|
130
|
-
)
|
|
131
|
-
: selectedEnv.includes(LakehouseEnvironmentType.PRODUCTION_PARALLEL)
|
|
132
|
-
? dataProducts.find(
|
|
133
|
-
(dp) =>
|
|
134
|
-
dp.lakehouseEnvironment?.type ===
|
|
135
|
-
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION_PARALLEL,
|
|
136
|
-
)
|
|
137
|
-
: dataProducts.find(
|
|
138
|
-
(dp) =>
|
|
139
|
-
dp.lakehouseEnvironment?.type ===
|
|
140
|
-
V1_EntitlementsLakehouseEnvironmentType.PRODUCTION,
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
dataProduct?.origin &&
|
|
145
|
-
dataProduct.origin instanceof V1_AdHocDeploymentDataProductOrigin
|
|
146
|
-
) {
|
|
147
|
-
this.fullGraphGrammar = guaranteeType(
|
|
148
|
-
dataProduct.origin,
|
|
149
|
-
V1_AdHocDeploymentDataProductOrigin,
|
|
150
|
-
).definition;
|
|
151
|
-
this.setDpLoaded(true);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
override async load(source: PlainObject | undefined) {
|
|
156
|
-
const deserializedSource =
|
|
157
|
-
RawLakehouseConsumerDataCubeSource.serialization.fromJson(
|
|
158
|
-
guaranteeNonNullable(source),
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
if (this.fullGraphGrammar) {
|
|
162
|
-
this._engine.registerAdhocDataProductGraphGrammar(this.fullGraphGrammar);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return RawLakehouseConsumerDataCubeSource.serialization.toJson(
|
|
166
|
-
deserializedSource,
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
}
|