@finos/legend-application-data-cube 0.3.11 → 0.3.13
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/__lib__/LegendDataCubeEvent.d.ts +28 -0
- package/lib/__lib__/LegendDataCubeEvent.d.ts.map +1 -0
- package/lib/__lib__/LegendDataCubeEvent.js +29 -0
- package/lib/__lib__/LegendDataCubeEvent.js.map +1 -0
- package/lib/components/builder/LegendDataCubeBuilder.d.ts.map +1 -1
- package/lib/components/builder/LegendDataCubeBuilder.js +19 -7
- package/lib/components/builder/LegendDataCubeBuilder.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/LegendDataCubeBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendDataCubeBaseStore.js +2 -1
- package/lib/stores/LegendDataCubeBaseStore.js.map +1 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts +4 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.d.ts.map +1 -1
- package/lib/stores/LegendDataCubeDataCubeEngine.js +157 -0
- package/lib/stores/LegendDataCubeDataCubeEngine.js.map +1 -1
- package/lib/stores/builder/LegendDataCubeBuilderStore.d.ts.map +1 -1
- package/lib/stores/builder/LegendDataCubeBuilderStore.js +36 -16
- package/lib/stores/builder/LegendDataCubeBuilderStore.js.map +1 -1
- package/lib/stores/builder/LegendDataCubeCreatorState.d.ts +1 -3
- package/lib/stores/builder/LegendDataCubeCreatorState.d.ts.map +1 -1
- package/lib/stores/builder/LegendDataCubeCreatorState.js +5 -158
- package/lib/stores/builder/LegendDataCubeCreatorState.js.map +1 -1
- package/package.json +5 -5
- package/src/__lib__/LegendDataCubeEvent.ts +28 -0
- package/src/components/builder/LegendDataCubeBuilder.tsx +23 -6
- package/src/stores/LegendDataCubeBaseStore.ts +5 -0
- package/src/stores/LegendDataCubeDataCubeEngine.ts +187 -0
- package/src/stores/builder/LegendDataCubeBuilderStore.tsx +60 -38
- package/src/stores/builder/LegendDataCubeCreatorState.tsx +11 -253
- package/tsconfig.json +1 -1
- package/lib/__lib__/DataCubeEvent.d.ts +0 -28
- package/lib/__lib__/DataCubeEvent.d.ts.map +0 -1
- package/lib/__lib__/DataCubeEvent.js +0 -29
- package/lib/__lib__/DataCubeEvent.js.map +0 -1
- package/src/__lib__/DataCubeEvent.ts +0 -28
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import {
|
|
18
18
|
APPLICATION_EVENT,
|
|
19
19
|
DEFAULT_TAB_SIZE,
|
|
20
|
+
LegendApplicationTelemetryHelper,
|
|
20
21
|
type ApplicationStore,
|
|
21
22
|
} from '@finos/legend-application';
|
|
22
23
|
import type { LegendDataCubePluginManager } from '../application/LegendDataCubePluginManager.js';
|
|
@@ -211,6 +212,10 @@ export class LegendDataCubeBaseStore {
|
|
|
211
212
|
},
|
|
212
213
|
);
|
|
213
214
|
this.initializeState.pass();
|
|
215
|
+
LegendApplicationTelemetryHelper.logEvent_ApplicationInitializationSucceeded(
|
|
216
|
+
this.application.telemetryService,
|
|
217
|
+
this.application,
|
|
218
|
+
);
|
|
214
219
|
} catch (error) {
|
|
215
220
|
assertErrorThrown(error);
|
|
216
221
|
this.application.logService.error(
|
|
@@ -112,6 +112,7 @@ import {
|
|
|
112
112
|
LogEvent,
|
|
113
113
|
UnsupportedOperationError,
|
|
114
114
|
type PlainObject,
|
|
115
|
+
type StopWatch,
|
|
115
116
|
assertErrorThrown,
|
|
116
117
|
NetworkClientError,
|
|
117
118
|
HttpStatus,
|
|
@@ -120,6 +121,7 @@ import {
|
|
|
120
121
|
guaranteeType,
|
|
121
122
|
guaranteeNonNullable,
|
|
122
123
|
filterByType,
|
|
124
|
+
type TimingsRecord,
|
|
123
125
|
} from '@finos/legend-shared';
|
|
124
126
|
import type { LegendDataCubeApplicationStore } from './LegendDataCubeBaseStore.js';
|
|
125
127
|
import { LegendDataCubeDuckDBEngine } from './LegendDataCubeDuckDBEngine.js';
|
|
@@ -173,6 +175,191 @@ export class LegendDataCubeDataCubeEngine extends DataCubeEngine {
|
|
|
173
175
|
|
|
174
176
|
// ---------------------------------- IMPLEMENTATION ----------------------------------
|
|
175
177
|
|
|
178
|
+
override getDataFromSource(source?: DataCubeSource): PlainObject {
|
|
179
|
+
if (source instanceof LegendQueryDataCubeSource) {
|
|
180
|
+
const queryInfo = source.info;
|
|
181
|
+
return {
|
|
182
|
+
project: {
|
|
183
|
+
groupId: queryInfo.groupId,
|
|
184
|
+
artifactId: queryInfo.artifactId,
|
|
185
|
+
versionId: queryInfo.versionId,
|
|
186
|
+
},
|
|
187
|
+
query: {
|
|
188
|
+
id: queryInfo.id,
|
|
189
|
+
name: queryInfo.name,
|
|
190
|
+
},
|
|
191
|
+
sourceType: LEGEND_QUERY_DATA_CUBE_SOURCE_TYPE,
|
|
192
|
+
};
|
|
193
|
+
} else if (source instanceof UserDefinedFunctionDataCubeSource) {
|
|
194
|
+
const deserializedModel = V1_deserializePureModelContext(source.model);
|
|
195
|
+
|
|
196
|
+
const sdlcInfo =
|
|
197
|
+
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
198
|
+
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
199
|
+
? deserializedModel.sdlcInfo
|
|
200
|
+
: undefined;
|
|
201
|
+
return {
|
|
202
|
+
project:
|
|
203
|
+
sdlcInfo !== undefined
|
|
204
|
+
? {
|
|
205
|
+
groupId: sdlcInfo.groupId,
|
|
206
|
+
artifactId: sdlcInfo.artifactId,
|
|
207
|
+
versionId: sdlcInfo.version,
|
|
208
|
+
}
|
|
209
|
+
: undefined,
|
|
210
|
+
function: {
|
|
211
|
+
path: source.functionPath,
|
|
212
|
+
runtime: source.runtime,
|
|
213
|
+
},
|
|
214
|
+
sourceType: ADHOC_FUNCTION_DATA_CUBE_SOURCE_TYPE,
|
|
215
|
+
};
|
|
216
|
+
} else if (source instanceof LocalFileDataCubeSource) {
|
|
217
|
+
const deserializedModel = V1_deserializePureModelContext(source.model);
|
|
218
|
+
|
|
219
|
+
const sdlcInfo =
|
|
220
|
+
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
221
|
+
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
222
|
+
? deserializedModel.sdlcInfo
|
|
223
|
+
: undefined;
|
|
224
|
+
return {
|
|
225
|
+
project:
|
|
226
|
+
sdlcInfo !== undefined
|
|
227
|
+
? {
|
|
228
|
+
groupId: sdlcInfo.groupId,
|
|
229
|
+
artifactId: sdlcInfo.artifactId,
|
|
230
|
+
versionId: sdlcInfo.version,
|
|
231
|
+
}
|
|
232
|
+
: undefined,
|
|
233
|
+
file: {
|
|
234
|
+
name: source.fileName,
|
|
235
|
+
format: source.fileFormat,
|
|
236
|
+
runtime: source.runtime,
|
|
237
|
+
db: source.db,
|
|
238
|
+
schema: source.schema,
|
|
239
|
+
table: source.table,
|
|
240
|
+
},
|
|
241
|
+
sourceType: LOCAL_FILE_QUERY_DATA_CUBE_SOURCE_TYPE,
|
|
242
|
+
};
|
|
243
|
+
} else if (source instanceof AdhocQueryDataCubeSource) {
|
|
244
|
+
const deserializedModel = V1_deserializePureModelContext(source.model);
|
|
245
|
+
|
|
246
|
+
const sdlcInfo =
|
|
247
|
+
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
248
|
+
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
249
|
+
? deserializedModel.sdlcInfo
|
|
250
|
+
: undefined;
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
project:
|
|
254
|
+
sdlcInfo !== undefined
|
|
255
|
+
? {
|
|
256
|
+
groupId: sdlcInfo.groupId,
|
|
257
|
+
artifactId: sdlcInfo.artifactId,
|
|
258
|
+
versionId: sdlcInfo.version,
|
|
259
|
+
}
|
|
260
|
+
: undefined,
|
|
261
|
+
adhocQuery: {
|
|
262
|
+
mapping: source.mapping,
|
|
263
|
+
runtime: source.runtime,
|
|
264
|
+
},
|
|
265
|
+
sourceType: ADHOC_QUERY_DATA_CUBE_SOURCE_TYPE,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
return {};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
getDataFromRawSource(source?: PlainObject): PlainObject {
|
|
272
|
+
if (!source) {
|
|
273
|
+
return {};
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (source._type === LEGEND_QUERY_DATA_CUBE_SOURCE_TYPE) {
|
|
277
|
+
const rawSource =
|
|
278
|
+
RawLegendQueryDataCubeSource.serialization.fromJson(source);
|
|
279
|
+
|
|
280
|
+
return {
|
|
281
|
+
query: {
|
|
282
|
+
id: rawSource.queryId,
|
|
283
|
+
},
|
|
284
|
+
sourceType: source._type,
|
|
285
|
+
};
|
|
286
|
+
} else if (source._type === ADHOC_FUNCTION_DATA_CUBE_SOURCE_TYPE) {
|
|
287
|
+
const rawSource =
|
|
288
|
+
RawUserDefinedFunctionDataCubeSource.serialization.fromJson(source);
|
|
289
|
+
const deserializedModel = V1_deserializePureModelContext(rawSource.model);
|
|
290
|
+
|
|
291
|
+
const sdlcInfo =
|
|
292
|
+
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
293
|
+
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
294
|
+
? deserializedModel.sdlcInfo
|
|
295
|
+
: undefined;
|
|
296
|
+
|
|
297
|
+
return {
|
|
298
|
+
project:
|
|
299
|
+
sdlcInfo !== undefined
|
|
300
|
+
? {
|
|
301
|
+
groupId: sdlcInfo.groupId,
|
|
302
|
+
artifactId: sdlcInfo.artifactId,
|
|
303
|
+
versionId: sdlcInfo.version,
|
|
304
|
+
}
|
|
305
|
+
: undefined,
|
|
306
|
+
function: {
|
|
307
|
+
path: rawSource.functionPath,
|
|
308
|
+
runtime: rawSource.runtime,
|
|
309
|
+
},
|
|
310
|
+
sourceType: source._type,
|
|
311
|
+
};
|
|
312
|
+
} else if (source._type === LOCAL_FILE_QUERY_DATA_CUBE_SOURCE_TYPE) {
|
|
313
|
+
const rawSource =
|
|
314
|
+
RawLocalFileQueryDataCubeSource.serialization.fromJson(source);
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
file: {
|
|
318
|
+
name: rawSource.fileName,
|
|
319
|
+
format: rawSource.fileFormat,
|
|
320
|
+
},
|
|
321
|
+
sourceType: source._type,
|
|
322
|
+
};
|
|
323
|
+
} else if (source._type === ADHOC_QUERY_DATA_CUBE_SOURCE_TYPE) {
|
|
324
|
+
const rawSource =
|
|
325
|
+
RawAdhocQueryDataCubeSource.serialization.fromJson(source);
|
|
326
|
+
const deserializedModel = V1_deserializePureModelContext(rawSource.model);
|
|
327
|
+
|
|
328
|
+
const sdlcInfo =
|
|
329
|
+
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
330
|
+
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
331
|
+
? deserializedModel.sdlcInfo
|
|
332
|
+
: undefined;
|
|
333
|
+
|
|
334
|
+
return {
|
|
335
|
+
project:
|
|
336
|
+
sdlcInfo !== undefined
|
|
337
|
+
? {
|
|
338
|
+
groupId: sdlcInfo.groupId,
|
|
339
|
+
artifactId: sdlcInfo.artifactId,
|
|
340
|
+
versionId: sdlcInfo.version,
|
|
341
|
+
}
|
|
342
|
+
: undefined,
|
|
343
|
+
adhocQuery: {
|
|
344
|
+
mapping: rawSource.mapping,
|
|
345
|
+
runtime: rawSource.runtime,
|
|
346
|
+
},
|
|
347
|
+
sourceType: source._type,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
return {};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
override finalizeTimingRecord(
|
|
354
|
+
stopWatch: StopWatch,
|
|
355
|
+
timings?: TimingsRecord,
|
|
356
|
+
): TimingsRecord | undefined {
|
|
357
|
+
return this._application.timeService.finalizeTimingsRecord(
|
|
358
|
+
stopWatch,
|
|
359
|
+
timings,
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
|
|
176
363
|
override async processSource(value: PlainObject): Promise<DataCubeSource> {
|
|
177
364
|
switch (value._type) {
|
|
178
365
|
case ADHOC_QUERY_DATA_CUBE_SOURCE_TYPE: {
|
|
@@ -68,8 +68,7 @@ import { LegendDataCubeSourceViewer } from '../../components/builder/LegendDataC
|
|
|
68
68
|
import { LOCAL_FILE_QUERY_DATA_CUBE_SOURCE_TYPE } from '../model/LocalFileDataCubeSource.js';
|
|
69
69
|
import type { LegendDataCubeSourceLoaderState } from './source/LegendDataCubeSourceLoaderState.js';
|
|
70
70
|
import { LocalFileDataCubeSourceLoaderState } from './source/LocalFileDataCubeSourceLoaderState.js';
|
|
71
|
-
import {
|
|
72
|
-
import { LegendApplicationTelemetryHelper } from '@finos/legend-application';
|
|
71
|
+
import { LEGEND_DATACUBE_APP_EVENT } from '../../__lib__/LegendDataCubeEvent.js';
|
|
73
72
|
|
|
74
73
|
export class LegendDataCubeBuilderState {
|
|
75
74
|
readonly uuid = uuid();
|
|
@@ -384,17 +383,25 @@ export class LegendDataCubeBuilderStore {
|
|
|
384
383
|
|
|
385
384
|
this.finalizeLoad(specification, persistentDataCube, dataCubeId);
|
|
386
385
|
this.loadState.pass();
|
|
387
|
-
this.
|
|
388
|
-
|
|
389
|
-
|
|
386
|
+
this.engine.sendTelemetry(
|
|
387
|
+
LEGEND_DATACUBE_APP_EVENT.LOAD_DATACUBE__SUCCESS,
|
|
388
|
+
{
|
|
389
|
+
...this.engine.getDataFromRawSource(specification.source),
|
|
390
|
+
dataCubeId: dataCubeId,
|
|
391
|
+
},
|
|
390
392
|
);
|
|
391
393
|
} catch (error) {
|
|
392
394
|
assertErrorThrown(error);
|
|
393
395
|
const message = `DataCube Load Failure: ${error.message}`;
|
|
394
|
-
this.
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
this.engine.sendTelemetry(
|
|
397
|
+
LEGEND_DATACUBE_APP_EVENT.LOAD_DATACUBE__FAILURE,
|
|
398
|
+
{
|
|
399
|
+
...this.engine.getDataFromRawSource(
|
|
400
|
+
this.builder?.initialSpecification.source,
|
|
401
|
+
),
|
|
402
|
+
dataCubeId: dataCubeId,
|
|
403
|
+
error: message,
|
|
404
|
+
},
|
|
398
405
|
);
|
|
399
406
|
this.alertService.alertError(error, {
|
|
400
407
|
message: message,
|
|
@@ -408,11 +415,6 @@ export class LegendDataCubeBuilderStore {
|
|
|
408
415
|
this.taskService.endTask(task);
|
|
409
416
|
}
|
|
410
417
|
}
|
|
411
|
-
|
|
412
|
-
LegendApplicationTelemetryHelper.logEvent_ApplicationInitializationSucceeded(
|
|
413
|
-
this.application.telemetryService,
|
|
414
|
-
this.application,
|
|
415
|
-
);
|
|
416
418
|
}
|
|
417
419
|
|
|
418
420
|
private finalizeLoad(
|
|
@@ -513,9 +515,11 @@ export class LegendDataCubeBuilderStore {
|
|
|
513
515
|
|
|
514
516
|
this.saverDisplay.close();
|
|
515
517
|
this.saveState.pass();
|
|
516
|
-
this.
|
|
517
|
-
|
|
518
|
-
this.
|
|
518
|
+
this.engine.sendTelemetry(
|
|
519
|
+
LEGEND_DATACUBE_APP_EVENT.CREATE_DATACUBE__SUCCESS,
|
|
520
|
+
this.engine.getDataFromSource(
|
|
521
|
+
this.builder.dataCube.getProcessedSource(),
|
|
522
|
+
),
|
|
519
523
|
);
|
|
520
524
|
} catch (error) {
|
|
521
525
|
assertErrorThrown(error);
|
|
@@ -524,10 +528,14 @@ export class LegendDataCubeBuilderStore {
|
|
|
524
528
|
message: message,
|
|
525
529
|
});
|
|
526
530
|
this.saveState.fail();
|
|
527
|
-
this.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
+
this.engine.sendTelemetry(
|
|
532
|
+
LEGEND_DATACUBE_APP_EVENT.CREATE_DATACUBE__FAILURE,
|
|
533
|
+
{
|
|
534
|
+
...this.engine.getDataFromSource(
|
|
535
|
+
this.builder.dataCube.getProcessedSource(),
|
|
536
|
+
),
|
|
537
|
+
error: message,
|
|
538
|
+
},
|
|
531
539
|
);
|
|
532
540
|
} finally {
|
|
533
541
|
this.taskService.endTask(task);
|
|
@@ -581,21 +589,31 @@ export class LegendDataCubeBuilderStore {
|
|
|
581
589
|
|
|
582
590
|
this.saverDisplay.close();
|
|
583
591
|
this.saveState.pass();
|
|
584
|
-
this.
|
|
592
|
+
this.engine.sendTelemetry(
|
|
585
593
|
options?.saveAsNew
|
|
586
|
-
?
|
|
587
|
-
:
|
|
588
|
-
|
|
594
|
+
? LEGEND_DATACUBE_APP_EVENT.CREATE_DATACUBE__SUCCESS
|
|
595
|
+
: LEGEND_DATACUBE_APP_EVENT.UPDATE_DATACUBE__SUCCESS,
|
|
596
|
+
{
|
|
597
|
+
...this.engine.getDataFromSource(
|
|
598
|
+
this.builder.dataCube.getProcessedSource(),
|
|
599
|
+
),
|
|
600
|
+
autoEnableCache: !!options?.autoEnableCache,
|
|
601
|
+
},
|
|
589
602
|
);
|
|
590
603
|
} catch (error) {
|
|
591
604
|
assertErrorThrown(error);
|
|
592
605
|
const message = `DataCube Update Failure: ${error.message}`;
|
|
593
|
-
this.
|
|
606
|
+
this.engine.sendTelemetry(
|
|
594
607
|
options?.saveAsNew
|
|
595
|
-
?
|
|
596
|
-
:
|
|
597
|
-
|
|
598
|
-
|
|
608
|
+
? LEGEND_DATACUBE_APP_EVENT.CREATE_DATACUBE__FAILURE
|
|
609
|
+
: LEGEND_DATACUBE_APP_EVENT.UPDATE_DATACUBE__FAILURE,
|
|
610
|
+
{
|
|
611
|
+
...this.engine.getDataFromSource(
|
|
612
|
+
this.builder.dataCube.getProcessedSource(),
|
|
613
|
+
),
|
|
614
|
+
autoEnableCache: !!options?.autoEnableCache,
|
|
615
|
+
error: message,
|
|
616
|
+
},
|
|
599
617
|
);
|
|
600
618
|
this.alertService.alertError(error, {
|
|
601
619
|
message: message,
|
|
@@ -623,7 +641,9 @@ export class LegendDataCubeBuilderStore {
|
|
|
623
641
|
|
|
624
642
|
try {
|
|
625
643
|
const persistentDataCubeToDelete =
|
|
626
|
-
|
|
644
|
+
this.dataCubeToDelete instanceof PersistentDataCube
|
|
645
|
+
? this.dataCubeToDelete
|
|
646
|
+
: await this.baseStore.graphManager.getDataCube(dataCubeId);
|
|
627
647
|
const specification = DataCubeSpecification.serialization.fromJson(
|
|
628
648
|
persistentDataCubeToDelete.content,
|
|
629
649
|
);
|
|
@@ -655,17 +675,19 @@ export class LegendDataCubeBuilderStore {
|
|
|
655
675
|
this.setDataCubeToDelete(undefined);
|
|
656
676
|
this.deleteConfirmationDisplay.close();
|
|
657
677
|
this.deleteState.pass();
|
|
658
|
-
this.
|
|
659
|
-
|
|
660
|
-
|
|
678
|
+
this.engine.sendTelemetry(
|
|
679
|
+
LEGEND_DATACUBE_APP_EVENT.DELETE_DATACUBE__SUCCESS,
|
|
680
|
+
{
|
|
681
|
+
...this.engine.getDataFromRawSource(specification.source),
|
|
682
|
+
dataCubeDeletedId: dataCubeId,
|
|
683
|
+
},
|
|
661
684
|
);
|
|
662
685
|
} catch (error) {
|
|
663
686
|
assertErrorThrown(error);
|
|
664
687
|
const message = `DataCube Delete Failure: ${error.message}`;
|
|
665
|
-
this.
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
message,
|
|
688
|
+
this.engine.sendTelemetry(
|
|
689
|
+
LEGEND_DATACUBE_APP_EVENT.DELETE_DATACUBE__FAILURE,
|
|
690
|
+
{ error: message, dataCubeFailedToDeleteId: this.dataCubeToDelete.id },
|
|
669
691
|
);
|
|
670
692
|
this.alertService.alertError(error, {
|
|
671
693
|
message: message,
|
|
@@ -29,17 +29,9 @@ import {
|
|
|
29
29
|
type LegendDataCubeSourceBuilderState,
|
|
30
30
|
} from './source/LegendDataCubeSourceBuilderState.js';
|
|
31
31
|
import {
|
|
32
|
-
ADHOC_FUNCTION_DATA_CUBE_SOURCE_TYPE,
|
|
33
|
-
ADHOC_QUERY_DATA_CUBE_SOURCE_TYPE,
|
|
34
|
-
AdhocQueryDataCubeSource,
|
|
35
32
|
type DataCubeAlertService,
|
|
36
|
-
type DataCubeSource,
|
|
37
|
-
DataCubeTelemetryHelper,
|
|
38
33
|
DEFAULT_TOOL_PANEL_WINDOW_CONFIG,
|
|
39
34
|
type DisplayState,
|
|
40
|
-
RawAdhocQueryDataCubeSource,
|
|
41
|
-
RawUserDefinedFunctionDataCubeSource,
|
|
42
|
-
UserDefinedFunctionDataCubeSource,
|
|
43
35
|
} from '@finos/legend-data-cube';
|
|
44
36
|
import type { LegendDataCubeDataCubeEngine } from '../LegendDataCubeDataCubeEngine.js';
|
|
45
37
|
import { LegendDataCubeCreator } from '../../components/builder/LegendDataCubeCreator.js';
|
|
@@ -51,22 +43,7 @@ import {
|
|
|
51
43
|
import { generateBuilderRoute } from '../../__lib__/LegendDataCubeNavigation.js';
|
|
52
44
|
import { LocalFileDataCubeSourceBuilderState } from './source/LocalFileDataCubeSourceBuilderState.js';
|
|
53
45
|
import { UserDefinedFunctionDataCubeSourceBuilderState } from './source/UserDefinedFunctionDataCubeSourceBuilderState.js';
|
|
54
|
-
import {
|
|
55
|
-
LEGEND_QUERY_DATA_CUBE_SOURCE_TYPE,
|
|
56
|
-
LegendQueryDataCubeSource,
|
|
57
|
-
RawLegendQueryDataCubeSource,
|
|
58
|
-
} from '../model/LegendQueryDataCubeSource.js';
|
|
59
|
-
import {
|
|
60
|
-
V1_deserializePureModelContext,
|
|
61
|
-
V1_PureModelContextPointer,
|
|
62
|
-
V1_LegendSDLC,
|
|
63
|
-
} from '@finos/legend-graph';
|
|
64
|
-
import {
|
|
65
|
-
LOCAL_FILE_QUERY_DATA_CUBE_SOURCE_TYPE,
|
|
66
|
-
LocalFileDataCubeSource,
|
|
67
|
-
RawLocalFileQueryDataCubeSource,
|
|
68
|
-
} from '../model/LocalFileDataCubeSource.js';
|
|
69
|
-
import { DATACUBE_APP_EVENT } from '../../__lib__/DataCubeEvent.js';
|
|
46
|
+
import { LEGEND_DATACUBE_APP_EVENT } from '../../__lib__/LegendDataCubeEvent.js';
|
|
70
47
|
|
|
71
48
|
const DEFAULT_SOURCE_TYPE = LegendDataCubeSourceBuilderType.LEGEND_QUERY;
|
|
72
49
|
|
|
@@ -153,226 +130,6 @@ export class LegendDataCubeCreatorState {
|
|
|
153
130
|
}
|
|
154
131
|
}
|
|
155
132
|
|
|
156
|
-
logFromSource(
|
|
157
|
-
eventType: string,
|
|
158
|
-
source?: DataCubeSource,
|
|
159
|
-
errorMessage?: string,
|
|
160
|
-
) {
|
|
161
|
-
if (!source) {
|
|
162
|
-
DataCubeTelemetryHelper.logEvent_Datacube(
|
|
163
|
-
this._application.telemetryService,
|
|
164
|
-
{
|
|
165
|
-
error: errorMessage,
|
|
166
|
-
},
|
|
167
|
-
eventType,
|
|
168
|
-
);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (source instanceof LegendQueryDataCubeSource) {
|
|
173
|
-
const queryInfo = source.info;
|
|
174
|
-
|
|
175
|
-
DataCubeTelemetryHelper.logEvent_Datacube_LegendQuery(
|
|
176
|
-
this._application.telemetryService,
|
|
177
|
-
{
|
|
178
|
-
project: {
|
|
179
|
-
groupId: queryInfo.groupId,
|
|
180
|
-
artifactId: queryInfo.artifactId,
|
|
181
|
-
versionId: queryInfo.versionId,
|
|
182
|
-
},
|
|
183
|
-
query: {
|
|
184
|
-
id: queryInfo.id,
|
|
185
|
-
name: queryInfo.name,
|
|
186
|
-
},
|
|
187
|
-
error: errorMessage,
|
|
188
|
-
},
|
|
189
|
-
eventType,
|
|
190
|
-
);
|
|
191
|
-
} else if (source instanceof UserDefinedFunctionDataCubeSource) {
|
|
192
|
-
const deserializedModel = V1_deserializePureModelContext(source.model);
|
|
193
|
-
|
|
194
|
-
const sdlcInfo =
|
|
195
|
-
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
196
|
-
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
197
|
-
? deserializedModel.sdlcInfo
|
|
198
|
-
: undefined;
|
|
199
|
-
|
|
200
|
-
DataCubeTelemetryHelper.logEvent_Datacube_AdhocFunction(
|
|
201
|
-
this._application.telemetryService,
|
|
202
|
-
{
|
|
203
|
-
project:
|
|
204
|
-
sdlcInfo !== undefined
|
|
205
|
-
? {
|
|
206
|
-
groupId: sdlcInfo.groupId,
|
|
207
|
-
artifactId: sdlcInfo.artifactId,
|
|
208
|
-
versionId: sdlcInfo.version,
|
|
209
|
-
}
|
|
210
|
-
: undefined,
|
|
211
|
-
function: {
|
|
212
|
-
path: source.functionPath,
|
|
213
|
-
runtime: source.runtime,
|
|
214
|
-
},
|
|
215
|
-
error: errorMessage,
|
|
216
|
-
},
|
|
217
|
-
eventType,
|
|
218
|
-
);
|
|
219
|
-
} else if (source instanceof LocalFileDataCubeSource) {
|
|
220
|
-
DataCubeTelemetryHelper.logEvent_Datacube_LocalFile(
|
|
221
|
-
this._application.telemetryService,
|
|
222
|
-
{
|
|
223
|
-
file: {
|
|
224
|
-
name: source.fileName,
|
|
225
|
-
format: source.fileFormat,
|
|
226
|
-
},
|
|
227
|
-
error: errorMessage,
|
|
228
|
-
},
|
|
229
|
-
eventType,
|
|
230
|
-
);
|
|
231
|
-
} else if (source instanceof AdhocQueryDataCubeSource) {
|
|
232
|
-
const deserializedModel = V1_deserializePureModelContext(source.model);
|
|
233
|
-
|
|
234
|
-
const sdlcInfo =
|
|
235
|
-
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
236
|
-
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
237
|
-
? deserializedModel.sdlcInfo
|
|
238
|
-
: undefined;
|
|
239
|
-
|
|
240
|
-
DataCubeTelemetryHelper.logEvent_Datacube_AdhocQuery(
|
|
241
|
-
this._application.telemetryService,
|
|
242
|
-
{
|
|
243
|
-
project:
|
|
244
|
-
sdlcInfo !== undefined
|
|
245
|
-
? {
|
|
246
|
-
groupId: sdlcInfo.groupId,
|
|
247
|
-
artifactId: sdlcInfo.artifactId,
|
|
248
|
-
versionId: sdlcInfo.version,
|
|
249
|
-
}
|
|
250
|
-
: undefined,
|
|
251
|
-
adhocQuery: {
|
|
252
|
-
mapping: source.mapping,
|
|
253
|
-
runtime: source.runtime,
|
|
254
|
-
},
|
|
255
|
-
error: errorMessage,
|
|
256
|
-
},
|
|
257
|
-
eventType,
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
logFromRawSource(
|
|
263
|
-
eventType: string,
|
|
264
|
-
source?: PlainObject,
|
|
265
|
-
errorMessage?: string,
|
|
266
|
-
dataCubeId?: string,
|
|
267
|
-
) {
|
|
268
|
-
if (!source) {
|
|
269
|
-
DataCubeTelemetryHelper.logEvent_Datacube(
|
|
270
|
-
this._application.telemetryService,
|
|
271
|
-
{
|
|
272
|
-
dataCubeId: dataCubeId,
|
|
273
|
-
error: errorMessage,
|
|
274
|
-
},
|
|
275
|
-
eventType,
|
|
276
|
-
);
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (source._type === LEGEND_QUERY_DATA_CUBE_SOURCE_TYPE) {
|
|
281
|
-
const rawSource =
|
|
282
|
-
RawLegendQueryDataCubeSource.serialization.fromJson(source);
|
|
283
|
-
|
|
284
|
-
DataCubeTelemetryHelper.logEvent_Datacube_LegendQuery(
|
|
285
|
-
this._application.telemetryService,
|
|
286
|
-
{
|
|
287
|
-
query: {
|
|
288
|
-
id: rawSource.queryId,
|
|
289
|
-
},
|
|
290
|
-
dataCubeId: dataCubeId,
|
|
291
|
-
error: errorMessage,
|
|
292
|
-
},
|
|
293
|
-
eventType,
|
|
294
|
-
);
|
|
295
|
-
} else if (source._type === ADHOC_FUNCTION_DATA_CUBE_SOURCE_TYPE) {
|
|
296
|
-
const rawSource =
|
|
297
|
-
RawUserDefinedFunctionDataCubeSource.serialization.fromJson(source);
|
|
298
|
-
const deserializedModel = V1_deserializePureModelContext(rawSource.model);
|
|
299
|
-
|
|
300
|
-
const sdlcInfo =
|
|
301
|
-
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
302
|
-
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
303
|
-
? deserializedModel.sdlcInfo
|
|
304
|
-
: undefined;
|
|
305
|
-
|
|
306
|
-
DataCubeTelemetryHelper.logEvent_Datacube_AdhocFunction(
|
|
307
|
-
this._application.telemetryService,
|
|
308
|
-
{
|
|
309
|
-
project:
|
|
310
|
-
sdlcInfo !== undefined
|
|
311
|
-
? {
|
|
312
|
-
groupId: sdlcInfo.groupId,
|
|
313
|
-
artifactId: sdlcInfo.artifactId,
|
|
314
|
-
versionId: sdlcInfo.version,
|
|
315
|
-
}
|
|
316
|
-
: undefined,
|
|
317
|
-
function: {
|
|
318
|
-
path: rawSource.functionPath,
|
|
319
|
-
runtime: rawSource.runtime,
|
|
320
|
-
},
|
|
321
|
-
dataCubeId: dataCubeId,
|
|
322
|
-
error: errorMessage,
|
|
323
|
-
},
|
|
324
|
-
eventType,
|
|
325
|
-
);
|
|
326
|
-
} else if (source._type === LOCAL_FILE_QUERY_DATA_CUBE_SOURCE_TYPE) {
|
|
327
|
-
const rawSource =
|
|
328
|
-
RawLocalFileQueryDataCubeSource.serialization.fromJson(source);
|
|
329
|
-
|
|
330
|
-
DataCubeTelemetryHelper.logEvent_Datacube_LocalFile(
|
|
331
|
-
this._application.telemetryService,
|
|
332
|
-
{
|
|
333
|
-
file: {
|
|
334
|
-
name: rawSource.fileName,
|
|
335
|
-
format: rawSource.fileFormat,
|
|
336
|
-
},
|
|
337
|
-
dataCubeId: dataCubeId,
|
|
338
|
-
error: errorMessage,
|
|
339
|
-
},
|
|
340
|
-
eventType,
|
|
341
|
-
);
|
|
342
|
-
} else if (source._type === ADHOC_QUERY_DATA_CUBE_SOURCE_TYPE) {
|
|
343
|
-
const rawSource =
|
|
344
|
-
RawAdhocQueryDataCubeSource.serialization.fromJson(source);
|
|
345
|
-
const deserializedModel = V1_deserializePureModelContext(rawSource.model);
|
|
346
|
-
|
|
347
|
-
const sdlcInfo =
|
|
348
|
-
deserializedModel instanceof V1_PureModelContextPointer &&
|
|
349
|
-
deserializedModel.sdlcInfo instanceof V1_LegendSDLC
|
|
350
|
-
? deserializedModel.sdlcInfo
|
|
351
|
-
: undefined;
|
|
352
|
-
|
|
353
|
-
DataCubeTelemetryHelper.logEvent_Datacube_AdhocQuery(
|
|
354
|
-
this._application.telemetryService,
|
|
355
|
-
{
|
|
356
|
-
project:
|
|
357
|
-
sdlcInfo !== undefined
|
|
358
|
-
? {
|
|
359
|
-
groupId: sdlcInfo.groupId,
|
|
360
|
-
artifactId: sdlcInfo.artifactId,
|
|
361
|
-
versionId: sdlcInfo.version,
|
|
362
|
-
}
|
|
363
|
-
: undefined,
|
|
364
|
-
adhocQuery: {
|
|
365
|
-
mapping: rawSource.mapping,
|
|
366
|
-
runtime: rawSource.runtime,
|
|
367
|
-
},
|
|
368
|
-
dataCubeId: dataCubeId,
|
|
369
|
-
error: errorMessage,
|
|
370
|
-
},
|
|
371
|
-
eventType,
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
133
|
async finalize(sourceData?: PlainObject) {
|
|
377
134
|
if (!sourceData && !this.sourceBuilder.isValid) {
|
|
378
135
|
throw new IllegalStateError(
|
|
@@ -404,14 +161,16 @@ export class LegendDataCubeCreatorState {
|
|
|
404
161
|
this.changeSourceBuilder(DEFAULT_SOURCE_TYPE, true);
|
|
405
162
|
this.display.close();
|
|
406
163
|
this.finalizeState.pass();
|
|
407
|
-
this.
|
|
164
|
+
this._engine.sendTelemetry(
|
|
165
|
+
LEGEND_DATACUBE_APP_EVENT.NEW_DATACUBE__SUCCESS,
|
|
166
|
+
this._engine.getDataFromSource(source),
|
|
167
|
+
);
|
|
408
168
|
} catch (error) {
|
|
409
169
|
assertErrorThrown(error);
|
|
410
170
|
const message = `DataCube Creation Failure: ${error.message}`;
|
|
411
|
-
this.
|
|
412
|
-
|
|
413
|
-
sourceData,
|
|
414
|
-
message,
|
|
171
|
+
this._engine.sendTelemetry(
|
|
172
|
+
LEGEND_DATACUBE_APP_EVENT.NEW_DATACUBE__FAILURE,
|
|
173
|
+
{ ...this._engine.getDataFromRawSource(sourceData), error: message },
|
|
415
174
|
);
|
|
416
175
|
this._alertService.alertError(error, {
|
|
417
176
|
message: message,
|
|
@@ -421,10 +180,9 @@ export class LegendDataCubeCreatorState {
|
|
|
421
180
|
} catch (error) {
|
|
422
181
|
assertErrorThrown(error);
|
|
423
182
|
const message = `DataCube Creation Failure: ${error.message}`;
|
|
424
|
-
this.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
message,
|
|
183
|
+
this._engine.sendTelemetry(
|
|
184
|
+
LEGEND_DATACUBE_APP_EVENT.NEW_DATACUBE__FAILURE,
|
|
185
|
+
{ error: message },
|
|
428
186
|
);
|
|
429
187
|
this._alertService.alertError(error, {
|
|
430
188
|
message: message,
|
package/tsconfig.json
CHANGED