@finos/legend-application-data-cube 0.1.20 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,10 +43,6 @@ import {
43
43
  type LegendDataCubeQueryBuilderStore,
44
44
  } from './LegendDataCubeQueryBuilderStore.js';
45
45
  import { generateQueryBuilderRoute } from '../../__lib__/LegendDataCubeNavigation.js';
46
- import {
47
- LEGEND_QUERY_DATA_CUBE_SOURCE_TYPE,
48
- RawLegendQueryDataCubeSource,
49
- } from '../model/LegendQueryDataCubeSource.js';
50
46
 
51
47
  export class LegendDataCubeNewQueryState {
52
48
  private readonly _application: LegendDataCubeApplicationStore;
@@ -85,30 +81,6 @@ export class LegendDataCubeNewQueryState {
85
81
  );
86
82
  }
87
83
 
88
- initWithSourceData(source: PlainObject) {
89
- if (source._type === LEGEND_QUERY_DATA_CUBE_SOURCE_TYPE) {
90
- this.changeSourceBuilder(LegendDataCubeSourceBuilderType.LEGEND_QUERY);
91
- const serializedSourceData =
92
- RawLegendQueryDataCubeSource.serialization.fromJson(source);
93
-
94
- this._store.graphManager
95
- .getLightQuery(serializedSourceData.queryId)
96
- .then(async (currentQuery) => {
97
- if (
98
- this.sourceBuilder instanceof LegendQueryDataCubeSourceBuilderState
99
- ) {
100
- this.sourceBuilder.query = currentQuery;
101
- await this.finalize();
102
- }
103
- })
104
- .catch(this._application.alertUnhandledError);
105
- } else {
106
- this._application.notificationService.notifyError(
107
- `Can't generate query: source of type ${source._type} is not supported`,
108
- );
109
- }
110
- }
111
-
112
84
  changeSourceBuilder(
113
85
  type: LegendDataCubeSourceBuilderType,
114
86
  skipCheck?: boolean | undefined,
@@ -142,14 +114,14 @@ export class LegendDataCubeNewQueryState {
142
114
  }
143
115
  }
144
116
 
145
- async finalize() {
146
- if (!this.sourceBuilder.isValid) {
117
+ async finalize(sourceData?: PlainObject) {
118
+ if (!this.sourceBuilder.isValid && !sourceData) {
147
119
  throw new IllegalStateError(`Can't generate query: source is not valid`);
148
120
  }
149
121
 
150
122
  this.finalizeState.inProgress();
151
123
  try {
152
- const source = await this.sourceBuilder.build();
124
+ const source = sourceData ?? (await this.sourceBuilder.build());
153
125
  const query = new DataCubeQuery();
154
126
  const processedSource = await this._engine.processQuerySource(source);
155
127
  query.source = source;
package/tsconfig.json CHANGED
@@ -60,7 +60,9 @@
60
60
  "./src/application/LegendDataCubeApplicationConfig.ts",
61
61
  "./src/application/LegendDataCubeApplicationPlugin.ts",
62
62
  "./src/application/LegendDataCubePluginManager.ts",
63
+ "./src/stores/DuckDBWASM.d.ts",
63
64
  "./src/stores/LegendDataCubeBaseStore.ts",
65
+ "./src/stores/LegendDataCubeCacheManager.ts",
64
66
  "./src/stores/LegendDataCubeDataCubeEngine.ts",
65
67
  "./src/stores/model/LegendQueryDataCubeSource.ts",
66
68
  "./src/stores/query-builder/source-builder/AdhocQueryDataCubeSourceBuilderState.ts",