@finos/legend-application-data-cube 0.7.8 → 0.7.9

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 (63) hide show
  1. package/lib/components/LegendDataCubeWebApplication.d.ts.map +1 -1
  2. package/lib/components/LegendDataCubeWebApplication.js +3 -1
  3. package/lib/components/LegendDataCubeWebApplication.js.map +1 -1
  4. package/lib/components/builder/source/LakehouseProducerDataCubeSourceBuilder.d.ts.map +1 -1
  5. package/lib/components/builder/source/LakehouseProducerDataCubeSourceBuilder.js +0 -3
  6. package/lib/components/builder/source/LakehouseProducerDataCubeSourceBuilder.js.map +1 -1
  7. package/lib/components/builder/source/LegendDataCubeSourceLoader.d.ts.map +1 -1
  8. package/lib/components/builder/source/LegendDataCubeSourceLoader.js +1 -3
  9. package/lib/components/builder/source/LegendDataCubeSourceLoader.js.map +1 -1
  10. package/lib/index.css +1 -1
  11. package/lib/package.json +1 -1
  12. package/lib/stores/AuthStore.d.ts +4 -0
  13. package/lib/stores/AuthStore.d.ts.map +1 -1
  14. package/lib/stores/AuthStore.js +7 -0
  15. package/lib/stores/AuthStore.js.map +1 -1
  16. package/lib/stores/LegendDataCubeBaseStore.d.ts.map +1 -1
  17. package/lib/stores/LegendDataCubeBaseStore.js +1 -1
  18. package/lib/stores/LegendDataCubeBaseStore.js.map +1 -1
  19. package/lib/stores/LegendDataCubeDataCubeEngine.d.ts +7 -5
  20. package/lib/stores/LegendDataCubeDataCubeEngine.d.ts.map +1 -1
  21. package/lib/stores/LegendDataCubeDataCubeEngine.js +25 -14
  22. package/lib/stores/LegendDataCubeDataCubeEngine.js.map +1 -1
  23. package/lib/stores/LegendDataCubeDuckDBEngine.d.ts +1 -1
  24. package/lib/stores/LegendDataCubeDuckDBEngine.d.ts.map +1 -1
  25. package/lib/stores/LegendDataCubeDuckDBEngine.js +2 -8
  26. package/lib/stores/LegendDataCubeDuckDBEngine.js.map +1 -1
  27. package/lib/stores/builder/LegendDataCubeBuilderStore.d.ts.map +1 -1
  28. package/lib/stores/builder/LegendDataCubeBuilderStore.js +0 -4
  29. package/lib/stores/builder/LegendDataCubeBuilderStore.js.map +1 -1
  30. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceBuilderState.d.ts +0 -3
  31. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceBuilderState.d.ts.map +1 -1
  32. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceBuilderState.js +0 -11
  33. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceBuilderState.js.map +1 -1
  34. package/lib/stores/model/LakehouseProducerDataCubeSource.d.ts +0 -1
  35. package/lib/stores/model/LakehouseProducerDataCubeSource.d.ts.map +1 -1
  36. package/lib/stores/model/LakehouseProducerDataCubeSource.js +0 -2
  37. package/lib/stores/model/LakehouseProducerDataCubeSource.js.map +1 -1
  38. package/lib/stores/model/SecondaryOauthClient.d.ts.map +1 -1
  39. package/lib/stores/model/SecondaryOauthClient.js +3 -2
  40. package/lib/stores/model/SecondaryOauthClient.js.map +1 -1
  41. package/package.json +6 -6
  42. package/src/components/LegendDataCubeWebApplication.tsx +3 -1
  43. package/src/components/builder/source/LakehouseProducerDataCubeSourceBuilder.tsx +0 -4
  44. package/src/components/builder/source/LegendDataCubeSourceLoader.tsx +0 -10
  45. package/src/stores/AuthStore.ts +8 -0
  46. package/src/stores/LegendDataCubeBaseStore.ts +1 -0
  47. package/src/stores/LegendDataCubeDataCubeEngine.ts +46 -17
  48. package/src/stores/LegendDataCubeDuckDBEngine.ts +1 -9
  49. package/src/stores/builder/LegendDataCubeBuilderStore.tsx +0 -12
  50. package/src/stores/builder/source/LakehouseProducerDataCubeSourceBuilderState.ts +0 -25
  51. package/src/stores/model/LakehouseProducerDataCubeSource.ts +0 -2
  52. package/src/stores/model/SecondaryOauthClient.ts +3 -2
  53. package/tsconfig.json +0 -2
  54. package/lib/components/builder/source/LakehouseProducerDataCubeSourceLoader.d.ts +0 -22
  55. package/lib/components/builder/source/LakehouseProducerDataCubeSourceLoader.d.ts.map +0 -1
  56. package/lib/components/builder/source/LakehouseProducerDataCubeSourceLoader.js +0 -40
  57. package/lib/components/builder/source/LakehouseProducerDataCubeSourceLoader.js.map +0 -1
  58. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.d.ts +0 -41
  59. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.d.ts.map +0 -1
  60. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.js +0 -82
  61. package/lib/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.js.map +0 -1
  62. package/src/components/builder/source/LakehouseProducerDataCubeSourceLoader.tsx +0 -75
  63. package/src/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.ts +0 -165
@@ -1,82 +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_deserializePureModelContext, V1_PureModelContextData, } from '@finos/legend-graph';
19
- import { RawLakehouseProducerDataCubeSource } from '../../model/LakehouseProducerDataCubeSource.js';
20
- import { action, makeObservable, observable } from 'mobx';
21
- import { LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
22
- import { SecondaryOAuthClient } from '../../model/SecondaryOauthClient.js';
23
- export class LakehouseProducerDataCubeSourceLoaderState extends LegendDataCubeSourceLoaderState {
24
- ingestDefinition;
25
- ingestDefinitionUrn;
26
- ingestServerUrl;
27
- userManagerSettings;
28
- LAKEHOUSE_SECTION = '###Lakehouse';
29
- constructor(application, engine, alertService, sourceData, persistentDataCube, onSuccess, onError) {
30
- super(application, engine, alertService, sourceData, persistentDataCube, onSuccess, onError);
31
- this.ingestDefinitionUrn = '';
32
- this.ingestServerUrl = '';
33
- makeObservable(this, {
34
- ingestDefinition: observable,
35
- setIngestDefinition: action,
36
- ingestDefinitionUrn: observable,
37
- setIngestDefinitionUrn: action,
38
- });
39
- }
40
- setIngestDefinition(ingestDefinition) {
41
- this.ingestDefinition = ingestDefinition;
42
- }
43
- setIngestDefinitionUrn(urn) {
44
- this.ingestDefinitionUrn = urn;
45
- }
46
- setUserManagerSettings(settings) {
47
- this.userManagerSettings = settings;
48
- }
49
- get isValid() {
50
- return Boolean(this.ingestDefinition);
51
- }
52
- get label() {
53
- return LegendDataCubeSourceBuilderType.LAKEHOUSE_PRODUCER;
54
- }
55
- reset() {
56
- const rawSource = RawLakehouseProducerDataCubeSource.serialization.fromJson(this.sourceData);
57
- this.setIngestDefinitionUrn(rawSource.ingestDefinitionUrn);
58
- this.ingestServerUrl = rawSource.ingestServerUrl;
59
- }
60
- async loadIngestDefinition(access_token, lakehouseIngestServerClient) {
61
- const ingestGrammar = await lakehouseIngestServerClient.getIngestDefinitionGrammar(guaranteeNonNullable(this.ingestDefinitionUrn), this.ingestServerUrl, access_token);
62
- const ingestPMCDPlainObject = await this._engine.parseCompatibleModel(`${this.LAKEHOUSE_SECTION}\n${ingestGrammar}`);
63
- const ingestDefPMCD = guaranteeType(V1_deserializePureModelContext(ingestPMCDPlainObject), V1_PureModelContextData);
64
- const protocolIngestDefinition = ingestDefPMCD.elements.at(0).content;
65
- this.setIngestDefinition(protocolIngestDefinition);
66
- }
67
- async load(source) {
68
- const deserializedSource = RawLakehouseProducerDataCubeSource.serialization.fromJson(guaranteeNonNullable(source));
69
- if (deserializedSource.icebergConfig?.icebergRef &&
70
- deserializedSource.icebergConfig.catalogUrl) {
71
- const oauthClient = new SecondaryOAuthClient(guaranteeNonNullable(this.userManagerSettings));
72
- const token = await oauthClient.getToken();
73
- const refId = await this._engine.ingestIcebergTable(deserializedSource.warehouse, deserializedSource.paths, deserializedSource.icebergConfig.catalogUrl, deserializedSource.icebergConfig.icebergRef, token);
74
- deserializedSource.icebergConfig.icebergRef = refId.dbReference;
75
- }
76
- else {
77
- this._engine.registerIngestDefinition(guaranteeNonNullable(this.ingestDefinition));
78
- }
79
- return RawLakehouseProducerDataCubeSource.serialization.toJson(deserializedSource);
80
- }
81
- }
82
- //# sourceMappingURL=LakehouseProducerDataCubeSourceLoaderState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LakehouseProducerDataCubeSourceLoaderState.js","sourceRoot":"","sources":["../../../../src/stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.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,8BAA8B,EAC9B,uBAAuB,GAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kCAAkC,EAAE,MAAM,gDAAgD,CAAC;AAEpG,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAExF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,MAAM,OAAO,0CAA2C,SAAQ,+BAA+B;IAC7F,gBAAgB,CAA0B;IAC1C,mBAAmB,CAAS;IAC5B,eAAe,CAAS;IAEhB,mBAAmB,CAAkC;IAErD,iBAAiB,GAAG,cAAc,CAAC;IAE3C,YACE,WAA2C,EAC3C,MAAoC,EACpC,YAAkC,EAClC,UAAuB,EACvB,kBAAsC,EACtC,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AAa,CAAC,MAAM,CAC5D,kBAAkB,CACnB,CAAC;IACJ,CAAC;CACF"}
@@ -1,75 +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 { LakehouseProducerDataCubeSourceLoaderState } from '../../../stores/builder/source/LakehouseProducerDataCubeSourceLoaderState.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 LakehouseProducerDataCubeSourceLoader = observer(
25
- (props: {
26
- partialSourceLoader: LakehouseProducerDataCubeSourceLoaderState;
27
- }) => {
28
- const { partialSourceLoader } = props;
29
- const auth = useAuth();
30
- const store = useLegendDataCubeBuilderStore();
31
-
32
- useEffect(() => {
33
- partialSourceLoader.reset();
34
- }, [partialSourceLoader]);
35
-
36
- useEffect(() => {
37
- partialSourceLoader.setUserManagerSettings(auth.settings);
38
- }, [partialSourceLoader, auth]);
39
-
40
- return (
41
- <div className="flex h-full w-full">
42
- <div className="m-3 flex w-full flex-col items-stretch gap-2 text-neutral-500">
43
- <div className="query-setup__wizard__group">
44
- <div className="query-setup__wizard__group__title">Ingest Urn</div>
45
- <div className="flex h-full w-full flex-auto items-center justify-between text-nowrap">
46
- <FormTextInput
47
- className="w-3/4 text-base"
48
- value={partialSourceLoader.ingestDefinitionUrn}
49
- disabled={true}
50
- />
51
- <FormButton
52
- compact={true}
53
- className="ml-1.5 text-nowrap text-sm text-black"
54
- onClick={() => {
55
- partialSourceLoader
56
- .loadIngestDefinition(
57
- auth.user?.access_token,
58
- store.ingestServerClient,
59
- )
60
- .catch((error) =>
61
- store.alertService.alertUnhandledError(error),
62
- );
63
- }}
64
- >
65
- {Boolean(partialSourceLoader.ingestDefinition)
66
- ? 'Loaded!'
67
- : 'Load Ingest'}
68
- </FormButton>
69
- </div>
70
- </div>
71
- </div>
72
- </div>
73
- );
74
- },
75
- );
@@ -1,165 +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_deserializePureModelContext,
28
- V1_PureModelContextData,
29
- type PersistentDataCube,
30
- type V1_IngestDefinition,
31
- } from '@finos/legend-graph';
32
- import { RawLakehouseProducerDataCubeSource } from '../../model/LakehouseProducerDataCubeSource.js';
33
- import type { LakehouseIngestServerClient } from '@finos/legend-server-lakehouse';
34
- import { action, makeObservable, observable } from 'mobx';
35
- import { LegendDataCubeSourceBuilderType } from './LegendDataCubeSourceBuilderState.js';
36
- import type { UserManagerSettings } from 'oidc-client-ts';
37
- import { SecondaryOAuthClient } from '../../model/SecondaryOauthClient.js';
38
-
39
- export class LakehouseProducerDataCubeSourceLoaderState extends LegendDataCubeSourceLoaderState {
40
- ingestDefinition: PlainObject | undefined;
41
- ingestDefinitionUrn: string;
42
- ingestServerUrl: string;
43
-
44
- private userManagerSettings: UserManagerSettings | undefined;
45
-
46
- private LAKEHOUSE_SECTION = '###Lakehouse';
47
-
48
- constructor(
49
- application: LegendDataCubeApplicationStore,
50
- engine: LegendDataCubeDataCubeEngine,
51
- alertService: DataCubeAlertService,
52
- sourceData: PlainObject,
53
- persistentDataCube: PersistentDataCube,
54
- onSuccess: () => Promise<void>,
55
- onError: (error: unknown) => Promise<void>,
56
- ) {
57
- super(
58
- application,
59
- engine,
60
- alertService,
61
- sourceData,
62
- persistentDataCube,
63
- onSuccess,
64
- onError,
65
- );
66
-
67
- this.ingestDefinitionUrn = '';
68
- this.ingestServerUrl = '';
69
-
70
- makeObservable(this, {
71
- ingestDefinition: observable,
72
- setIngestDefinition: action,
73
-
74
- ingestDefinitionUrn: observable,
75
- setIngestDefinitionUrn: action,
76
- });
77
- }
78
-
79
- setIngestDefinition(ingestDefinition: PlainObject | undefined) {
80
- this.ingestDefinition = ingestDefinition;
81
- }
82
-
83
- setIngestDefinitionUrn(urn: string) {
84
- this.ingestDefinitionUrn = urn;
85
- }
86
-
87
- setUserManagerSettings(settings: UserManagerSettings | undefined) {
88
- this.userManagerSettings = settings;
89
- }
90
-
91
- override get isValid(): boolean {
92
- return Boolean(this.ingestDefinition);
93
- }
94
-
95
- override get label() {
96
- return LegendDataCubeSourceBuilderType.LAKEHOUSE_PRODUCER;
97
- }
98
-
99
- reset() {
100
- const rawSource = RawLakehouseProducerDataCubeSource.serialization.fromJson(
101
- this.sourceData,
102
- );
103
- this.setIngestDefinitionUrn(rawSource.ingestDefinitionUrn);
104
- this.ingestServerUrl = rawSource.ingestServerUrl;
105
- }
106
-
107
- async loadIngestDefinition(
108
- access_token: string | undefined,
109
- lakehouseIngestServerClient: LakehouseIngestServerClient,
110
- ) {
111
- const ingestGrammar =
112
- await lakehouseIngestServerClient.getIngestDefinitionGrammar(
113
- guaranteeNonNullable(this.ingestDefinitionUrn),
114
- this.ingestServerUrl,
115
- access_token,
116
- );
117
-
118
- const ingestPMCDPlainObject = await this._engine.parseCompatibleModel(
119
- `${this.LAKEHOUSE_SECTION}\n${ingestGrammar}`,
120
- );
121
-
122
- const ingestDefPMCD = guaranteeType(
123
- V1_deserializePureModelContext(ingestPMCDPlainObject),
124
- V1_PureModelContextData,
125
- );
126
-
127
- const protocolIngestDefinition = (
128
- ingestDefPMCD.elements.at(0) as V1_IngestDefinition
129
- ).content;
130
- this.setIngestDefinition(protocolIngestDefinition);
131
- }
132
-
133
- override async load(source: PlainObject | undefined) {
134
- const deserializedSource =
135
- RawLakehouseProducerDataCubeSource.serialization.fromJson(
136
- guaranteeNonNullable(source),
137
- );
138
-
139
- if (
140
- deserializedSource.icebergConfig?.icebergRef &&
141
- deserializedSource.icebergConfig.catalogUrl
142
- ) {
143
- const oauthClient = new SecondaryOAuthClient(
144
- guaranteeNonNullable(this.userManagerSettings),
145
- );
146
- const token = await oauthClient.getToken();
147
- const refId = await this._engine.ingestIcebergTable(
148
- deserializedSource.warehouse,
149
- deserializedSource.paths,
150
- deserializedSource.icebergConfig.catalogUrl,
151
- deserializedSource.icebergConfig.icebergRef,
152
- token,
153
- );
154
- deserializedSource.icebergConfig.icebergRef = refId.dbReference;
155
- } else {
156
- this._engine.registerIngestDefinition(
157
- guaranteeNonNullable(this.ingestDefinition),
158
- );
159
- }
160
-
161
- return RawLakehouseProducerDataCubeSource.serialization.toJson(
162
- deserializedSource,
163
- );
164
- }
165
- }