@finos/legend-application-repl 0.0.30 → 0.0.31
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/dataCube/DataCube.d.ts.map +1 -1
- package/lib/components/dataCube/DataCube.js +13 -9
- package/lib/components/dataCube/DataCube.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditor.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditor.js +4 -2
- package/lib/components/dataCube/editor/DataCubeEditor.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorCodePanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js +163 -6
- package/lib/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorColumnsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts +5 -0
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js +130 -47
- package/lib/components/dataCube/editor/DataCubeEditorColumnsSelector.js.map +1 -1
- package/lib/{stores/dataCube/DataCubeDefaultConfig.d.ts → components/dataCube/editor/DataCubeEditorDeveloperPanel.d.ts} +4 -2
- package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.d.ts.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.js +27 -0
- package/lib/components/dataCube/editor/DataCubeEditorDeveloperPanel.js.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorFilterPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js +104 -5
- package/lib/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorHPivotsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorShared.d.ts +46 -0
- package/lib/components/dataCube/editor/DataCubeEditorShared.d.ts.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorShared.js +171 -0
- package/lib/components/dataCube/editor/DataCubeEditorShared.js.map +1 -0
- package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.d.ts.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js +36 -3
- package/lib/components/dataCube/editor/DataCubeEditorSortsPanel.js.map +1 -1
- package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js +2 -2
- package/lib/components/dataCube/editor/DataCubeEditorVPivotsPanel.js.map +1 -1
- package/lib/components/dataCube/grid/DataCubeGrid.d.ts.map +1 -1
- package/lib/components/dataCube/grid/DataCubeGrid.js +42 -26
- package/lib/components/dataCube/grid/DataCubeGrid.js.map +1 -1
- package/{src/stores/dataCube/DataCubeDefaultConfig.ts → lib/components/dataCube/grid/DataCubeGridShared.d.ts} +3 -2
- package/lib/components/dataCube/grid/DataCubeGridShared.d.ts.map +1 -0
- package/lib/components/dataCube/grid/DataCubeGridShared.js +25 -0
- package/lib/components/dataCube/grid/DataCubeGridShared.js.map +1 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts +23 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.d.ts.map +1 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js +382 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridMenu.js.map +1 -0
- package/lib/{stores/dataCube/DataCubeDefaultConfig.js → components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts} +4 -2
- package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.d.ts.map +1 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js +83 -0
- package/lib/components/dataCube/grid/menu/DataCubeGridSortsMenu.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +4 -2
- package/lib/server/models/DataCubeQuery.d.ts +3 -5
- package/lib/server/models/DataCubeQuery.d.ts.map +1 -1
- package/lib/server/models/DataCubeQuery.js +0 -2
- package/lib/server/models/DataCubeQuery.js.map +1 -1
- package/lib/stores/dataCube/DataCubeState.d.ts +11 -2
- package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -1
- package/lib/stores/dataCube/DataCubeState.js +34 -5
- package/lib/stores/dataCube/DataCubeState.js.map +1 -1
- package/lib/stores/dataCube/REPLStore.d.ts +1 -1
- package/lib/stores/dataCube/REPLStore.d.ts.map +1 -1
- package/lib/stores/dataCube/REPLStore.js +3 -3
- package/lib/stores/dataCube/REPLStore.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts +89 -0
- package/lib/stores/dataCube/core/DataCubeConfiguration.d.ts.map +1 -0
- package/lib/stores/dataCube/core/DataCubeConfiguration.js +161 -0
- package/lib/stores/dataCube/core/DataCubeConfiguration.js.map +1 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.d.ts +25 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.d.ts.map +1 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.js +44 -0
- package/lib/stores/dataCube/core/DataCubeConfigurationBuilder.js.map +1 -0
- package/lib/stores/dataCube/core/DataCubeCoreState.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeCoreState.js +3 -3
- package/lib/stores/dataCube/core/DataCubeCoreState.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.js +8 -8
- package/lib/stores/dataCube/core/DataCubeQueryBuilder.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts +82 -4
- package/lib/stores/dataCube/core/DataCubeQueryEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQueryEngine.js +131 -3
- package/lib/stores/dataCube/core/DataCubeQueryEngine.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts +19 -5
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js +36 -6
- package/lib/stores/dataCube/core/DataCubeQuerySnapshot.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js +37 -18
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotBuilder.js.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.d.ts.map +1 -1
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js +6 -2
- package/lib/stores/dataCube/core/DataCubeQuerySnapshotManager.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts +3 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js +4 -2
- package/lib/stores/dataCube/editor/DataCubeEditorCodePanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts +33 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js +57 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.js.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts +3 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js +10 -0
- package/lib/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts +8 -3
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js +20 -24
- package/lib/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts +27 -0
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js +30 -0
- package/lib/stores/dataCube/editor/DataCubeEditorHPivotPanelState.js.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts +13 -6
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js +64 -19
- package/lib/stores/dataCube/editor/DataCubeEditorSortsPanelState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts +4 -1
- package/lib/stores/dataCube/editor/DataCubeEditorState.d.ts.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeEditorState.js +15 -10
- package/lib/stores/dataCube/editor/DataCubeEditorState.js.map +1 -1
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts +95 -0
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.d.ts.map +1 -0
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js +369 -0
- package/lib/stores/dataCube/editor/DataCubeMutableConfiguration.js.map +1 -0
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts +7 -2
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js +29 -2
- package/lib/stores/dataCube/grid/DataCubeGridClientEngine.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js +0 -9
- package/lib/stores/dataCube/grid/DataCubeGridQueryBuilder.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js +4 -3
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.js.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.d.ts.map +1 -1
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js +16 -28
- package/lib/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.js.map +1 -1
- package/package.json +10 -8
- package/src/components/dataCube/DataCube.tsx +44 -23
- package/src/components/dataCube/editor/DataCubeEditor.tsx +6 -1
- package/src/components/dataCube/editor/DataCubeEditorCodePanel.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorColumnPropertiesPanel.tsx +837 -7
- package/src/components/dataCube/editor/DataCubeEditorColumnsPanel.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorColumnsSelector.tsx +264 -50
- package/src/components/dataCube/editor/DataCubeEditorDeveloperPanel.tsx +41 -0
- package/src/components/dataCube/editor/DataCubeEditorExtendedColumnsPanel.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorFilterPanel.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorGeneralPropertiesPanel.tsx +682 -13
- package/src/components/dataCube/editor/DataCubeEditorHPivotsPanel.tsx +2 -2
- package/src/components/dataCube/editor/DataCubeEditorShared.tsx +448 -0
- package/src/components/dataCube/editor/DataCubeEditorSortsPanel.tsx +103 -4
- package/src/components/dataCube/editor/DataCubeEditorVPivotsPanel.tsx +2 -2
- package/src/components/dataCube/grid/DataCubeGrid.tsx +65 -32
- package/src/components/dataCube/grid/DataCubeGridShared.tsx +41 -0
- package/src/components/dataCube/grid/menu/DataCubeGridMenu.tsx +394 -0
- package/src/components/dataCube/grid/menu/DataCubeGridSortsMenu.tsx +120 -0
- package/src/server/models/DataCubeQuery.ts +2 -6
- package/src/stores/dataCube/DataCubeState.ts +39 -5
- package/src/stores/dataCube/REPLStore.ts +3 -3
- package/src/stores/dataCube/core/DataCubeConfiguration.ts +200 -0
- package/src/stores/dataCube/core/DataCubeConfigurationBuilder.ts +56 -0
- package/src/stores/dataCube/core/DataCubeCoreState.ts +3 -3
- package/src/stores/dataCube/core/DataCubeQueryBuilder.ts +13 -13
- package/src/stores/dataCube/core/DataCubeQueryEngine.ts +136 -4
- package/src/stores/dataCube/core/DataCubeQuerySnapshot.ts +43 -6
- package/src/stores/dataCube/core/DataCubeQuerySnapshotBuilder.ts +45 -24
- package/src/stores/dataCube/core/DataCubeQuerySnapshotManager.ts +9 -2
- package/src/stores/dataCube/editor/DataCubeEditorCodePanelState.ts +5 -2
- package/src/stores/dataCube/editor/DataCubeEditorColumnPropertiesPanelState.ts +82 -0
- package/src/stores/dataCube/editor/DataCubeEditorColumnsSelectorState.ts +12 -0
- package/src/stores/dataCube/editor/DataCubeEditorGeneralPropertiesPanelState.ts +31 -28
- package/src/stores/dataCube/editor/DataCubeEditorHPivotPanelState.ts +43 -0
- package/src/stores/dataCube/editor/DataCubeEditorPanelState.ts +1 -1
- package/src/stores/dataCube/editor/DataCubeEditorSortsPanelState.ts +92 -25
- package/src/stores/dataCube/editor/DataCubeEditorState.ts +17 -10
- package/src/stores/dataCube/editor/DataCubeMutableConfiguration.ts +533 -0
- package/src/stores/dataCube/grid/DataCubeGridClientEngine.ts +33 -2
- package/src/stores/dataCube/grid/DataCubeGridQueryBuilder.ts +0 -10
- package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotAnalyzer.tsx +4 -3
- package/src/stores/dataCube/grid/DataCubeGridQuerySnapshotBuilder.ts +16 -36
- package/tsconfig.json +10 -1
- package/lib/stores/dataCube/DataCubeDefaultConfig.d.ts.map +0 -1
- package/lib/stores/dataCube/DataCubeDefaultConfig.js.map +0 -1
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { V1_Lambda, V1_ValueSpecification } from '@finos/legend-graph';
|
|
18
|
-
import type { DataCubeConfiguration } from '
|
|
18
|
+
import type { DataCubeConfiguration } from './DataCubeConfiguration.js';
|
|
19
19
|
import {
|
|
20
20
|
IllegalStateError,
|
|
21
21
|
guaranteeNonNullable,
|
|
22
|
+
hashObject,
|
|
23
|
+
pruneObject,
|
|
22
24
|
uuid,
|
|
23
25
|
type PlainObject,
|
|
24
26
|
type Writable,
|
|
@@ -54,7 +56,7 @@ export enum DataCubeQuerySnapshotFilterOperation {
|
|
|
54
56
|
ENDS_WITH = 'endsWith',
|
|
55
57
|
}
|
|
56
58
|
|
|
57
|
-
export enum
|
|
59
|
+
export enum DataCubeQuerySnapshotSortOperation {
|
|
58
60
|
ASCENDING = 'ascending',
|
|
59
61
|
DESCENDING = 'descending',
|
|
60
62
|
}
|
|
@@ -90,7 +92,7 @@ export type DataCubeQuerySnapshotExtendedColumn =
|
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
export type DataCubeQuerySnapshotSortColumn = DataCubeQuerySnapshotColumn & {
|
|
93
|
-
|
|
95
|
+
operation: DataCubeQuerySnapshotSortOperation;
|
|
94
96
|
};
|
|
95
97
|
|
|
96
98
|
export type DataCubeQuerySnapshotAggregateColumn =
|
|
@@ -113,7 +115,7 @@ export type DataCubeQuerySnapshotData = {
|
|
|
113
115
|
name: string;
|
|
114
116
|
runtime: string;
|
|
115
117
|
sourceQuery: PlainObject<V1_ValueSpecification>;
|
|
116
|
-
configuration: DataCubeConfiguration
|
|
118
|
+
configuration: PlainObject<DataCubeConfiguration>;
|
|
117
119
|
originalColumns: DataCubeQuerySnapshotColumn[];
|
|
118
120
|
leafExtendedColumns: DataCubeQuerySnapshotExtendedColumn[];
|
|
119
121
|
filter?: DataCubeQuerySnapshotFilter | undefined;
|
|
@@ -138,11 +140,14 @@ export class DataCubeQuerySnapshot {
|
|
|
138
140
|
timestamp = Date.now();
|
|
139
141
|
readonly data: DataCubeQuerySnapshotData;
|
|
140
142
|
|
|
143
|
+
private _finalized = false;
|
|
144
|
+
private _hashCode?: string | undefined;
|
|
145
|
+
|
|
141
146
|
private constructor(
|
|
142
147
|
name: string,
|
|
143
148
|
runtime: string,
|
|
144
149
|
sourceQuery: PlainObject<V1_ValueSpecification>,
|
|
145
|
-
configuration: DataCubeConfiguration
|
|
150
|
+
configuration: PlainObject<DataCubeConfiguration>,
|
|
146
151
|
) {
|
|
147
152
|
this.data = {
|
|
148
153
|
name,
|
|
@@ -165,7 +170,7 @@ export class DataCubeQuerySnapshot {
|
|
|
165
170
|
name: string,
|
|
166
171
|
runtime: string,
|
|
167
172
|
sourceQuery: PlainObject<V1_ValueSpecification>,
|
|
168
|
-
configuration: DataCubeConfiguration
|
|
173
|
+
configuration: PlainObject<DataCubeConfiguration>,
|
|
169
174
|
) {
|
|
170
175
|
return new DataCubeQuerySnapshot(name, runtime, sourceQuery, configuration);
|
|
171
176
|
}
|
|
@@ -204,6 +209,38 @@ export class DataCubeQuerySnapshot {
|
|
|
204
209
|
throw new IllegalStateError(`Unknown stage '${stage}'`);
|
|
205
210
|
}
|
|
206
211
|
}
|
|
212
|
+
|
|
213
|
+
isFinalized(): boolean {
|
|
214
|
+
return this._finalized;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
finalize(): DataCubeQuerySnapshot {
|
|
218
|
+
if (this._finalized) {
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
221
|
+
this._hashCode = this.computeHashCode();
|
|
222
|
+
this._finalized = true;
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
get hashCode(): string {
|
|
227
|
+
if (!this._finalized || !this._hashCode) {
|
|
228
|
+
throw new IllegalStateError('Snapshot is not finalized');
|
|
229
|
+
}
|
|
230
|
+
return this._hashCode;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* NOTE: if this becomes a performance bottleneck, we can consider
|
|
235
|
+
* more granular hashing strategy
|
|
236
|
+
*
|
|
237
|
+
* Here, we are just hashing the raw object, but we must ensure
|
|
238
|
+
* to properly prune the snapshot data object before hashing
|
|
239
|
+
* else there would be mismatch
|
|
240
|
+
*/
|
|
241
|
+
private computeHashCode(): string {
|
|
242
|
+
return hashObject(pruneObject(this.data));
|
|
243
|
+
}
|
|
207
244
|
}
|
|
208
245
|
|
|
209
246
|
export function _findCol<T extends DataCubeQuerySnapshotColumn>(
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
import type { DataCubeQuery } from '../../../server/models/DataCubeQuery.js';
|
|
37
37
|
import {
|
|
38
38
|
DataCubeQuerySnapshot,
|
|
39
|
-
|
|
39
|
+
DataCubeQuerySnapshotSortOperation,
|
|
40
40
|
type DataCubeQuerySnapshotColumn,
|
|
41
41
|
} from './DataCubeQuerySnapshot.js';
|
|
42
42
|
import {
|
|
@@ -50,6 +50,8 @@ import {
|
|
|
50
50
|
DataCubeFunction,
|
|
51
51
|
type DataCubeQueryFunctionMap,
|
|
52
52
|
} from './DataCubeQueryEngine.js';
|
|
53
|
+
import { DataCubeConfiguration } from './DataCubeConfiguration.js';
|
|
54
|
+
import { buildDefaultConfiguration } from './DataCubeConfigurationBuilder.js';
|
|
53
55
|
|
|
54
56
|
// --------------------------------- UTILITIES ---------------------------------
|
|
55
57
|
|
|
@@ -133,12 +135,12 @@ const _FUNCTION_SEQUENCE_COMPOSITION_PATTERN: {
|
|
|
133
135
|
required?: boolean | undefined;
|
|
134
136
|
}[] = [
|
|
135
137
|
{ func: DataCubeFunction.EXTEND },
|
|
138
|
+
{ func: DataCubeFunction.SELECT },
|
|
136
139
|
{ func: DataCubeFunction.FILTER },
|
|
137
140
|
{ func: DataCubeFunction.GROUP_BY },
|
|
138
141
|
{ func: DataCubeFunction.PIVOT },
|
|
139
142
|
{ func: DataCubeFunction.CAST },
|
|
140
143
|
{ func: DataCubeFunction.EXTEND },
|
|
141
|
-
{ func: DataCubeFunction.SELECT },
|
|
142
144
|
{ func: DataCubeFunction.SORT },
|
|
143
145
|
{ func: DataCubeFunction.LIMIT },
|
|
144
146
|
];
|
|
@@ -269,19 +271,19 @@ function extractFunctionMap(
|
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
273
|
|
|
274
|
+
const select = sequence.find((func) =>
|
|
275
|
+
matchFunctionName(func.function, DataCubeFunction.SELECT),
|
|
276
|
+
);
|
|
272
277
|
const filter = sequence.find((func) =>
|
|
273
278
|
matchFunctionName(func.function, DataCubeFunction.FILTER),
|
|
274
279
|
);
|
|
275
280
|
const groupBy = sequence.find((func) =>
|
|
276
281
|
matchFunctionName(func.function, DataCubeFunction.GROUP_BY),
|
|
277
282
|
);
|
|
278
|
-
const select = sequence.find((func) =>
|
|
279
|
-
matchFunctionName(func.function, DataCubeFunction.SELECT),
|
|
280
|
-
);
|
|
281
283
|
const pivot = sequence.find((func) =>
|
|
282
284
|
matchFunctionName(func.function, DataCubeFunction.PIVOT),
|
|
283
285
|
);
|
|
284
|
-
const
|
|
286
|
+
const pivotCast = sequence.find((func) =>
|
|
285
287
|
matchFunctionName(func.function, DataCubeFunction.CAST),
|
|
286
288
|
);
|
|
287
289
|
const sort = sequence.find((func) =>
|
|
@@ -292,12 +294,12 @@ function extractFunctionMap(
|
|
|
292
294
|
);
|
|
293
295
|
return {
|
|
294
296
|
leafExtend,
|
|
297
|
+
select,
|
|
295
298
|
filter,
|
|
296
299
|
groupBy,
|
|
297
300
|
pivot,
|
|
298
|
-
pivotCast
|
|
301
|
+
pivotCast,
|
|
299
302
|
groupExtend,
|
|
300
|
-
select,
|
|
301
303
|
sort,
|
|
302
304
|
limit,
|
|
303
305
|
};
|
|
@@ -326,7 +328,7 @@ export function validateAndBuildQuerySnapshot(
|
|
|
326
328
|
baseQuery.name,
|
|
327
329
|
baseQuery.source.runtime,
|
|
328
330
|
V1_serializeValueSpecification(sourceQuery, []),
|
|
329
|
-
|
|
331
|
+
{},
|
|
330
332
|
);
|
|
331
333
|
const data = snapshot.data;
|
|
332
334
|
const colsMap = new Map<string, DataCubeQuerySnapshotColumn>();
|
|
@@ -335,12 +337,25 @@ export function validateAndBuildQuerySnapshot(
|
|
|
335
337
|
|
|
336
338
|
// --------------------------------- SOURCE ---------------------------------
|
|
337
339
|
|
|
338
|
-
data.originalColumns = baseQuery.source.columns
|
|
340
|
+
data.originalColumns = baseQuery.source.columns.map((col) => ({
|
|
341
|
+
name: col.name,
|
|
342
|
+
type: col.type,
|
|
343
|
+
}));
|
|
339
344
|
data.originalColumns.map((col) => colsMap.set(col.name, col));
|
|
340
345
|
|
|
341
346
|
// --------------------------------- LEAF EXTEND ---------------------------------
|
|
342
347
|
// TODO: @akphi - implement this
|
|
343
348
|
|
|
349
|
+
// --------------------------------- SELECT ---------------------------------
|
|
350
|
+
|
|
351
|
+
if (funcMap.select) {
|
|
352
|
+
data.selectColumns = _colSpecArrayParam(funcMap.select, 0).colSpecs.map(
|
|
353
|
+
(colSpec) => ({
|
|
354
|
+
..._col(colSpec),
|
|
355
|
+
}),
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
344
359
|
// --------------------------------- FILTER ---------------------------------
|
|
345
360
|
// TODO: @akphi - implement this
|
|
346
361
|
|
|
@@ -367,25 +382,15 @@ export function validateAndBuildQuerySnapshot(
|
|
|
367
382
|
]);
|
|
368
383
|
return {
|
|
369
384
|
..._col(_colSpecParam(sortColFunc, 0)),
|
|
370
|
-
|
|
385
|
+
operation:
|
|
371
386
|
_name(sortColFunc.function) === DataCubeFunction.ASC
|
|
372
|
-
?
|
|
373
|
-
:
|
|
387
|
+
? DataCubeQuerySnapshotSortOperation.ASCENDING
|
|
388
|
+
: DataCubeQuerySnapshotSortOperation.DESCENDING,
|
|
374
389
|
};
|
|
375
390
|
},
|
|
376
391
|
);
|
|
377
392
|
}
|
|
378
393
|
|
|
379
|
-
// --------------------------------- SELECT ---------------------------------
|
|
380
|
-
|
|
381
|
-
if (funcMap.select) {
|
|
382
|
-
data.selectColumns = _colSpecArrayParam(funcMap.select, 0).colSpecs.map(
|
|
383
|
-
(colSpec) => ({
|
|
384
|
-
..._col(colSpec),
|
|
385
|
-
}),
|
|
386
|
-
);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
394
|
// --------------------------------- LIMIT ---------------------------------
|
|
390
395
|
|
|
391
396
|
if (funcMap.limit) {
|
|
@@ -394,5 +399,21 @@ export function validateAndBuildQuerySnapshot(
|
|
|
394
399
|
data.limit = value.value;
|
|
395
400
|
}
|
|
396
401
|
|
|
397
|
-
|
|
402
|
+
// --------------------------------- CONFIGURATION ---------------------------------
|
|
403
|
+
// The data query takes precedence over the configuration, we do this for 2 reasons
|
|
404
|
+
// 1. The purpose of the configuration is to provide the layout and styling
|
|
405
|
+
// customization on top of the data query result grid. If conflicts happen between
|
|
406
|
+
// the configuration and the query, we will reconciliate by modifying the configuration
|
|
407
|
+
// 2. The configuration when missing, can be generated from default presets. This helps
|
|
408
|
+
// helps with use cases where the query might comes from a different source, such as
|
|
409
|
+
// Studio or Query, or another part of Engine.
|
|
410
|
+
|
|
411
|
+
const configuration = baseQuery.configuration
|
|
412
|
+
? DataCubeConfiguration.serialization.fromJson(baseQuery.configuration)
|
|
413
|
+
: buildDefaultConfiguration(baseQuery.source.columns);
|
|
414
|
+
// TODO: @akphi - implement this
|
|
415
|
+
data.configuration =
|
|
416
|
+
DataCubeConfiguration.serialization.toJson(configuration);
|
|
417
|
+
|
|
418
|
+
return snapshot.finalize();
|
|
398
419
|
}
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from '@finos/legend-shared';
|
|
27
27
|
import type { DataCubeQuery } from '../../../server/models/DataCubeQuery.js';
|
|
28
28
|
|
|
29
|
-
// TODO:
|
|
29
|
+
// TODO: set a stack depth when we implement undo/redo
|
|
30
30
|
// const DATA_CUBE_MAX_SNAPSHOT_COUNT = 100;
|
|
31
31
|
|
|
32
32
|
export class DataCubeQuerySnapshotManager {
|
|
@@ -77,6 +77,13 @@ export class DataCubeQuerySnapshotManager {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
broadcastSnapshot(snapshot: DataCubeQuerySnapshot): void {
|
|
80
|
+
if (!snapshot.isFinalized()) {
|
|
81
|
+
this.dataCube.application.logService.error(
|
|
82
|
+
LogEvent.create(APPLICATION_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED),
|
|
83
|
+
`Snapshot must be finalized before broadcasting`,
|
|
84
|
+
);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
80
87
|
this.snapshots.push(snapshot);
|
|
81
88
|
this.subscribers.forEach((subscriber) => {
|
|
82
89
|
const currentSnapshot = subscriber.getLatestSnapshot();
|
|
@@ -87,7 +94,7 @@ export class DataCubeQuerySnapshotManager {
|
|
|
87
94
|
LogEvent.create(
|
|
88
95
|
APPLICATION_EVENT.ILLEGAL_APPLICATION_STATE_OCCURRED,
|
|
89
96
|
),
|
|
90
|
-
`
|
|
97
|
+
`Error occured while subscribers receiving and applying new snapshot should be handled gracefully`,
|
|
91
98
|
error,
|
|
92
99
|
);
|
|
93
100
|
});
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
SourceInformation,
|
|
30
30
|
V1_ParserError,
|
|
31
31
|
} from '@finos/legend-graph';
|
|
32
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
32
33
|
|
|
33
34
|
class DataCubeQueryEditorState {
|
|
34
35
|
uuid = uuid();
|
|
@@ -79,11 +80,12 @@ class DataCubeQueryEditorState {
|
|
|
79
80
|
|
|
80
81
|
export class DataCubeEditorCodePanelState {
|
|
81
82
|
readonly dataCube!: DataCubeState;
|
|
83
|
+
readonly editor: DataCubeEditorState;
|
|
82
84
|
|
|
83
85
|
queryEditorState!: DataCubeQueryEditorState;
|
|
84
86
|
currentSubQuery?: string | undefined;
|
|
85
87
|
|
|
86
|
-
constructor(
|
|
88
|
+
constructor(editor: DataCubeEditorState) {
|
|
87
89
|
makeObservable(this, {
|
|
88
90
|
currentSubQuery: observable,
|
|
89
91
|
queryEditorState: observable,
|
|
@@ -91,7 +93,8 @@ export class DataCubeEditorCodePanelState {
|
|
|
91
93
|
parseQuery: flow,
|
|
92
94
|
});
|
|
93
95
|
|
|
94
|
-
this.
|
|
96
|
+
this.editor = editor;
|
|
97
|
+
this.dataCube = editor.dataCube;
|
|
95
98
|
this.queryEditorState = new DataCubeQueryEditorState('');
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { action, computed, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { DataCubeState } from '../DataCubeState.js';
|
|
19
|
+
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
20
|
+
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
21
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
22
|
+
import { DataCubeMutableColumnConfiguration } from './DataCubeMutableConfiguration.js';
|
|
23
|
+
import { getNonNullableEntry, type PlainObject } from '@finos/legend-shared';
|
|
24
|
+
|
|
25
|
+
export class DataCubeEditorColumnPropertiesPanelState
|
|
26
|
+
implements DataCubeQueryEditorPanelState
|
|
27
|
+
{
|
|
28
|
+
readonly dataCube!: DataCubeState;
|
|
29
|
+
readonly editor!: DataCubeEditorState;
|
|
30
|
+
|
|
31
|
+
columns: DataCubeMutableColumnConfiguration[] = [];
|
|
32
|
+
selectedColumnName?: string | undefined;
|
|
33
|
+
|
|
34
|
+
constructor(editor: DataCubeEditorState) {
|
|
35
|
+
makeObservable(this, {
|
|
36
|
+
columns: observable,
|
|
37
|
+
setColumns: action,
|
|
38
|
+
|
|
39
|
+
selectedColumnName: observable,
|
|
40
|
+
setSelectedColumnName: action,
|
|
41
|
+
selectedColumn: computed,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
this.editor = editor;
|
|
45
|
+
this.dataCube = editor.dataCube;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
setColumns(val: DataCubeMutableColumnConfiguration[]): void {
|
|
49
|
+
this.columns = val;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setSelectedColumnName(val: string | undefined): void {
|
|
53
|
+
this.selectedColumnName = val;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get selectedColumn(): DataCubeMutableColumnConfiguration | undefined {
|
|
57
|
+
return this.columns.find(
|
|
58
|
+
(column) => column.name === this.selectedColumnName,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
applySnaphot(snapshot: DataCubeQuerySnapshot): void {
|
|
63
|
+
this.setColumns(
|
|
64
|
+
(snapshot.data.configuration as { columns: PlainObject[] }).columns.map(
|
|
65
|
+
(column) => DataCubeMutableColumnConfiguration.create(column),
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
if (!this.selectedColumn && this.columns.length) {
|
|
69
|
+
this.setSelectedColumnName(getNonNullableEntry(this.columns, 0).name);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
buildSnapshot(
|
|
74
|
+
newSnapshot: DataCubeQuerySnapshot,
|
|
75
|
+
baseSnapshot: DataCubeQuerySnapshot,
|
|
76
|
+
): void {
|
|
77
|
+
newSnapshot.data.configuration = {
|
|
78
|
+
...newSnapshot.data.configuration,
|
|
79
|
+
columns: this.columns.map((column) => column.serialize()),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -18,6 +18,9 @@ import { makeObservable, observable, action } from 'mobx';
|
|
|
18
18
|
|
|
19
19
|
export abstract class DataCubeEditorColumnsSelectorColumnState {
|
|
20
20
|
abstract get name(): string;
|
|
21
|
+
resetWhenMadeAvailable(): void {
|
|
22
|
+
// do nothing
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export class DataCubeEditorColumnsSelectorState<
|
|
@@ -45,6 +48,7 @@ export class DataCubeEditorColumnsSelectorState<
|
|
|
45
48
|
this.availableColumns = val
|
|
46
49
|
.slice()
|
|
47
50
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
51
|
+
this.availableColumns.forEach((column) => column.resetWhenMadeAvailable());
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
setSelectedColumns(val: T[]): void {
|
|
@@ -58,4 +62,12 @@ export class DataCubeEditorColumnsSelectorState<
|
|
|
58
62
|
setSelectedColumnsSearchText(val: string): void {
|
|
59
63
|
this.selectedColumnsSearchText = val;
|
|
60
64
|
}
|
|
65
|
+
|
|
66
|
+
getAvailableColumn(colName: string): T | undefined {
|
|
67
|
+
return this.availableColumns.find((col) => col.name === colName);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getSelectedColumn(colName: string): T | undefined {
|
|
71
|
+
return this.selectedColumns.find((col) => col.name === colName);
|
|
72
|
+
}
|
|
61
73
|
}
|
|
@@ -18,63 +18,66 @@ import { action, makeObservable, observable } from 'mobx';
|
|
|
18
18
|
import type { DataCubeState } from '../DataCubeState.js';
|
|
19
19
|
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
20
20
|
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
21
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
22
|
+
import { DataCubeMutableConfiguration } from './DataCubeMutableConfiguration.js';
|
|
21
23
|
|
|
22
24
|
export class DataCubeEditorGeneralPropertiesPanelState
|
|
23
25
|
implements DataCubeQueryEditorPanelState
|
|
24
26
|
{
|
|
25
27
|
readonly dataCube!: DataCubeState;
|
|
28
|
+
readonly editor!: DataCubeEditorState;
|
|
29
|
+
|
|
26
30
|
name = '';
|
|
27
31
|
limit = -1;
|
|
32
|
+
configuration = new DataCubeMutableConfiguration();
|
|
28
33
|
|
|
29
|
-
constructor(
|
|
30
|
-
this.dataCube = dataCube;
|
|
31
|
-
|
|
34
|
+
constructor(editor: DataCubeEditorState) {
|
|
32
35
|
makeObservable(this, {
|
|
33
36
|
name: observable,
|
|
34
37
|
setName: action,
|
|
35
38
|
|
|
36
39
|
limit: observable,
|
|
37
40
|
setLimit: action,
|
|
41
|
+
|
|
42
|
+
configuration: observable,
|
|
43
|
+
setConfiguration: action,
|
|
38
44
|
});
|
|
45
|
+
|
|
46
|
+
this.editor = editor;
|
|
47
|
+
this.dataCube = editor.dataCube;
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
setName(val: string): void {
|
|
42
51
|
this.name = val;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
|
-
setLimit(val: number
|
|
46
|
-
this.limit =
|
|
54
|
+
setLimit(val: number): void {
|
|
55
|
+
this.limit = val;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setConfiguration(val: DataCubeMutableConfiguration): void {
|
|
59
|
+
this.configuration = val;
|
|
47
60
|
}
|
|
48
61
|
|
|
49
62
|
applySnaphot(snapshot: DataCubeQuerySnapshot): void {
|
|
50
63
|
this.setName(snapshot.data.name);
|
|
51
|
-
this.setLimit(
|
|
64
|
+
this.setLimit(
|
|
65
|
+
snapshot.data.limit !== undefined && snapshot.data.limit > 0
|
|
66
|
+
? snapshot.data.limit
|
|
67
|
+
: -1,
|
|
68
|
+
);
|
|
69
|
+
this.setConfiguration(
|
|
70
|
+
DataCubeMutableConfiguration.create(snapshot.data.configuration),
|
|
71
|
+
);
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
buildSnapshot(
|
|
55
75
|
newSnapshot: DataCubeQuerySnapshot,
|
|
56
76
|
baseSnapshot: DataCubeQuerySnapshot,
|
|
57
|
-
):
|
|
58
|
-
const data =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// limit
|
|
66
|
-
if (data.limit === undefined) {
|
|
67
|
-
if (this.limit !== -1) {
|
|
68
|
-
data.limit = this.limit;
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
if (this.limit !== data.limit) {
|
|
73
|
-
data.limit = this.limit;
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return false;
|
|
77
|
+
): void {
|
|
78
|
+
const data = newSnapshot.data;
|
|
79
|
+
data.name = this.name;
|
|
80
|
+
data.limit = this.limit <= 0 ? undefined : this.limit;
|
|
81
|
+
data.configuration = this.configuration.serialize();
|
|
79
82
|
}
|
|
80
83
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 type { DataCubeState } from '../DataCubeState.js';
|
|
18
|
+
import type { DataCubeQuerySnapshot } from '../core/DataCubeQuerySnapshot.js';
|
|
19
|
+
import type { DataCubeQueryEditorPanelState } from './DataCubeEditorPanelState.js';
|
|
20
|
+
import type { DataCubeEditorState } from './DataCubeEditorState.js';
|
|
21
|
+
|
|
22
|
+
export class DataCubeEditorGeneralPropertiesPanelState
|
|
23
|
+
implements DataCubeQueryEditorPanelState
|
|
24
|
+
{
|
|
25
|
+
readonly dataCube!: DataCubeState;
|
|
26
|
+
readonly editor!: DataCubeEditorState;
|
|
27
|
+
|
|
28
|
+
constructor(editor: DataCubeEditorState) {
|
|
29
|
+
this.editor = editor;
|
|
30
|
+
this.dataCube = editor.dataCube;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
applySnaphot(snapshot: DataCubeQuerySnapshot): void {
|
|
34
|
+
// TODO
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
buildSnapshot(
|
|
38
|
+
newSnapshot: DataCubeQuerySnapshot,
|
|
39
|
+
baseSnapshot: DataCubeQuerySnapshot,
|
|
40
|
+
): void {
|
|
41
|
+
// TODO
|
|
42
|
+
}
|
|
43
|
+
}
|