@finos/legend-application-query 9.0.37 → 10.0.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.
- package/lib/components/Core_LegendQueryApplicationPlugin.js +2 -2
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/LegendQueryApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryApplication.js +11 -1
- package/lib/components/LegendQueryApplication.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +3 -3
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.js +3 -1
- package/lib/components/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +5 -5
- package/lib/stores/LegendQueryAppEvent.d.ts +3 -2
- package/lib/stores/LegendQueryAppEvent.d.ts.map +1 -1
- package/lib/stores/LegendQueryAppEvent.js +3 -2
- package/lib/stores/LegendQueryAppEvent.js.map +1 -1
- package/lib/stores/LegendQueryApplicationNavigationContext.d.ts +19 -0
- package/lib/stores/LegendQueryApplicationNavigationContext.d.ts.map +1 -0
- package/lib/stores/LegendQueryApplicationNavigationContext.js +21 -0
- package/lib/stores/LegendQueryApplicationNavigationContext.js.map +1 -0
- package/lib/stores/LegendQueryBaseStore.d.ts +7 -4
- package/lib/stores/LegendQueryBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendQueryBaseStore.js +39 -0
- package/lib/stores/LegendQueryBaseStore.js.map +1 -1
- package/lib/stores/LegendQueryEventService.d.ts.map +1 -1
- package/lib/stores/LegendQueryEventService.js +1 -1
- package/lib/stores/LegendQueryEventService.js.map +1 -1
- package/lib/stores/LegendQueryTelemetry.d.ts +4 -2
- package/lib/stores/LegendQueryTelemetry.d.ts.map +1 -1
- package/lib/stores/LegendQueryTelemetry.js +8 -2
- package/lib/stores/LegendQueryTelemetry.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +43 -17
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/package.json +13 -13
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +2 -2
- package/src/components/LegendQueryApplication.tsx +21 -0
- package/src/components/QueryEditor.tsx +63 -52
- package/src/components/QueryEditorComponentTestUtils.tsx +7 -1
- package/src/stores/LegendQueryAppEvent.ts +3 -2
- package/src/stores/LegendQueryApplicationNavigationContext.ts +20 -0
- package/src/stores/LegendQueryBaseStore.ts +72 -4
- package/src/stores/LegendQueryEventService.ts +4 -1
- package/src/stores/LegendQueryTelemetry.ts +24 -4
- package/src/stores/QueryEditorStore.ts +80 -32
- package/tsconfig.json +1 -0
@@ -15,9 +15,21 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import type { DepotServerClient } from '@finos/legend-server-depot';
|
18
|
-
import
|
18
|
+
import {
|
19
|
+
type ApplicationStore,
|
20
|
+
ApplicationTelemetry,
|
21
|
+
APPLICATION_EVENT,
|
22
|
+
} from '@finos/legend-application';
|
19
23
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
20
24
|
import type { LegendQueryApplicationConfig } from '../application/LegendQueryApplicationConfig.js';
|
25
|
+
import {
|
26
|
+
ActionState,
|
27
|
+
assertErrorThrown,
|
28
|
+
LogEvent,
|
29
|
+
NetworkClient,
|
30
|
+
type GeneratorFn,
|
31
|
+
} from '@finos/legend-shared';
|
32
|
+
import { flow, makeObservable } from 'mobx';
|
21
33
|
|
22
34
|
export type LegendQueryApplicationStore = ApplicationStore<
|
23
35
|
LegendQueryApplicationConfig,
|
@@ -25,14 +37,20 @@ export type LegendQueryApplicationStore = ApplicationStore<
|
|
25
37
|
>;
|
26
38
|
|
27
39
|
export class LegendQueryBaseStore {
|
28
|
-
applicationStore: LegendQueryApplicationStore;
|
29
|
-
depotServerClient: DepotServerClient;
|
30
|
-
pluginManager: LegendQueryPluginManager;
|
40
|
+
readonly applicationStore: LegendQueryApplicationStore;
|
41
|
+
readonly depotServerClient: DepotServerClient;
|
42
|
+
readonly pluginManager: LegendQueryPluginManager;
|
43
|
+
|
44
|
+
readonly initState = ActionState.create();
|
31
45
|
|
32
46
|
constructor(
|
33
47
|
applicationStore: LegendQueryApplicationStore,
|
34
48
|
depotServerClient: DepotServerClient,
|
35
49
|
) {
|
50
|
+
makeObservable(this, {
|
51
|
+
initialize: flow,
|
52
|
+
});
|
53
|
+
|
36
54
|
this.applicationStore = applicationStore;
|
37
55
|
this.depotServerClient = depotServerClient;
|
38
56
|
this.pluginManager = applicationStore.pluginManager;
|
@@ -42,4 +60,54 @@ export class LegendQueryBaseStore {
|
|
42
60
|
this.applicationStore.tracerService,
|
43
61
|
);
|
44
62
|
}
|
63
|
+
|
64
|
+
*initialize(): GeneratorFn<void> {
|
65
|
+
if (!this.initState.isInInitialState) {
|
66
|
+
this.applicationStore.notifyIllegalState('Base store is re-initialized');
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
this.initState.inProgress();
|
70
|
+
|
71
|
+
try {
|
72
|
+
this.applicationStore.setCurrentUser(
|
73
|
+
(yield new NetworkClient().get(
|
74
|
+
`${this.applicationStore.config.engineServerUrl}/server/v1/currentUser`,
|
75
|
+
)) as string,
|
76
|
+
);
|
77
|
+
} catch (error) {
|
78
|
+
assertErrorThrown(error);
|
79
|
+
this.applicationStore.log.error(
|
80
|
+
LogEvent.create(
|
81
|
+
APPLICATION_EVENT.APPLICATION_IDENTITY_AUTO_FETCH__FAILURE,
|
82
|
+
),
|
83
|
+
error,
|
84
|
+
);
|
85
|
+
this.applicationStore.notifyWarning(error.message);
|
86
|
+
}
|
87
|
+
|
88
|
+
// setup telemetry service
|
89
|
+
this.applicationStore.telemetryService.setUserId(
|
90
|
+
this.applicationStore.currentUser,
|
91
|
+
);
|
92
|
+
|
93
|
+
ApplicationTelemetry.logEvent_ApplicationInitializationSucceeded(
|
94
|
+
this.applicationStore.telemetryService,
|
95
|
+
{
|
96
|
+
application: {
|
97
|
+
name: this.applicationStore.config.appName,
|
98
|
+
version: this.applicationStore.config.appVersion,
|
99
|
+
env: this.applicationStore.config.env,
|
100
|
+
},
|
101
|
+
browser: {
|
102
|
+
userAgent: navigator.userAgent,
|
103
|
+
},
|
104
|
+
screen: {
|
105
|
+
height: window.screen.height,
|
106
|
+
width: window.screen.width,
|
107
|
+
},
|
108
|
+
},
|
109
|
+
);
|
110
|
+
|
111
|
+
this.initState.complete();
|
112
|
+
}
|
45
113
|
}
|
@@ -33,6 +33,9 @@ export class LegendQueryEventService {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
notify_QueryCreated(data: QueryCreated_EventData): void {
|
36
|
-
this.eventService.notify(
|
36
|
+
this.eventService.notify(
|
37
|
+
LEGEND_QUERY_APP_EVENT.CREATE_QUERY__SUCCESS,
|
38
|
+
data,
|
39
|
+
);
|
37
40
|
}
|
38
41
|
}
|
@@ -17,7 +17,7 @@
|
|
17
17
|
import type { TelemetryService } from '@finos/legend-shared';
|
18
18
|
import { LEGEND_QUERY_APP_EVENT } from './LegendQueryAppEvent.js';
|
19
19
|
|
20
|
-
type
|
20
|
+
type Query_TelemetryData = {
|
21
21
|
query: {
|
22
22
|
name: string;
|
23
23
|
id: string;
|
@@ -28,10 +28,30 @@ type QueryViewed_TelemetryData = {
|
|
28
28
|
};
|
29
29
|
|
30
30
|
export class LegendQueryTelemetry {
|
31
|
-
static
|
31
|
+
static logEvent_ViewQuerySucceeded(
|
32
32
|
telemetryService: TelemetryService,
|
33
|
-
data:
|
33
|
+
data: Query_TelemetryData,
|
34
34
|
): void {
|
35
|
-
telemetryService.logEvent(LEGEND_QUERY_APP_EVENT.
|
35
|
+
telemetryService.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_QUERY__SUCCESS, data);
|
36
|
+
}
|
37
|
+
|
38
|
+
static logEvent_CreateQuerySucceeded(
|
39
|
+
telemetryService: TelemetryService,
|
40
|
+
data: Query_TelemetryData,
|
41
|
+
): void {
|
42
|
+
telemetryService.logEvent(
|
43
|
+
LEGEND_QUERY_APP_EVENT.CREATE_QUERY__SUCCESS,
|
44
|
+
data,
|
45
|
+
);
|
46
|
+
}
|
47
|
+
|
48
|
+
static logEvent_UpdateQuerySucceeded(
|
49
|
+
telemetryService: TelemetryService,
|
50
|
+
data: Query_TelemetryData,
|
51
|
+
): void {
|
52
|
+
telemetryService.logEvent(
|
53
|
+
LEGEND_QUERY_APP_EVENT.UPDATE_QUERY__SUCCESS,
|
54
|
+
data,
|
55
|
+
);
|
36
56
|
}
|
37
57
|
}
|
@@ -44,13 +44,13 @@ import {
|
|
44
44
|
PackageableElementExplicitReference,
|
45
45
|
RuntimePointer,
|
46
46
|
GRAPH_MANAGER_EVENT,
|
47
|
-
type GraphBuilderReport,
|
48
47
|
GraphManagerTelemetry,
|
49
48
|
extractElementNameFromPath,
|
50
49
|
QuerySearchSpecification,
|
51
50
|
Mapping,
|
52
51
|
type Runtime,
|
53
52
|
type Service,
|
53
|
+
createGraphBuilderReport,
|
54
54
|
} from '@finos/legend-graph';
|
55
55
|
import {
|
56
56
|
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
|
@@ -64,10 +64,12 @@ import {
|
|
64
64
|
type Entity,
|
65
65
|
type ProjectGAVCoordinates,
|
66
66
|
parseProjectIdentifier,
|
67
|
+
LegendSDLC,
|
67
68
|
} from '@finos/legend-storage';
|
68
69
|
import {
|
69
70
|
type DepotServerClient,
|
70
71
|
ProjectData,
|
72
|
+
resolveVersion,
|
71
73
|
} from '@finos/legend-server-depot';
|
72
74
|
import {
|
73
75
|
TAB_SIZE,
|
@@ -85,6 +87,7 @@ import {
|
|
85
87
|
ServiceQueryBuilderState,
|
86
88
|
} from '@finos/legend-query-builder';
|
87
89
|
import { LegendQueryTelemetry } from './LegendQueryTelemetry.js';
|
90
|
+
import { LEGEND_QUERY_APPLICATION_NAVIGATION_CONTEXT_KEY } from './LegendQueryApplicationNavigationContext.js';
|
88
91
|
|
89
92
|
export const createViewProjectHandler =
|
90
93
|
(applicationStore: LegendQueryApplicationStore) =>
|
@@ -231,9 +234,24 @@ export class QueryExportState {
|
|
231
234
|
this.editorStore.applicationStore.notifySuccess(
|
232
235
|
`Successfully created query!`,
|
233
236
|
);
|
237
|
+
|
234
238
|
LegendQueryEventService.create(
|
235
239
|
this.editorStore.applicationStore.eventService,
|
236
240
|
).notify_QueryCreated({ queryId: newQuery.id });
|
241
|
+
|
242
|
+
LegendQueryTelemetry.logEvent_CreateQuerySucceeded(
|
243
|
+
this.editorStore.applicationStore.telemetryService,
|
244
|
+
{
|
245
|
+
query: {
|
246
|
+
id: query.id,
|
247
|
+
name: query.name,
|
248
|
+
groupId: query.groupId,
|
249
|
+
artifactId: query.artifactId,
|
250
|
+
versionId: query.versionId,
|
251
|
+
},
|
252
|
+
},
|
253
|
+
);
|
254
|
+
|
237
255
|
this.editorStore.applicationStore.navigator.goToLocation(
|
238
256
|
generateExistingQueryEditorRoute(newQuery.id),
|
239
257
|
);
|
@@ -246,6 +264,20 @@ export class QueryExportState {
|
|
246
264
|
this.editorStore.applicationStore.notifySuccess(
|
247
265
|
`Successfully updated query!`,
|
248
266
|
);
|
267
|
+
|
268
|
+
LegendQueryTelemetry.logEvent_UpdateQuerySucceeded(
|
269
|
+
this.editorStore.applicationStore.telemetryService,
|
270
|
+
{
|
271
|
+
query: {
|
272
|
+
id: query.id,
|
273
|
+
name: query.name,
|
274
|
+
groupId: query.groupId,
|
275
|
+
artifactId: query.artifactId,
|
276
|
+
versionId: query.versionId,
|
277
|
+
},
|
278
|
+
},
|
279
|
+
);
|
280
|
+
|
249
281
|
this.onQueryUpdate?.(updatedQuery);
|
250
282
|
}
|
251
283
|
} catch (error) {
|
@@ -442,7 +474,7 @@ export abstract class QueryEditorStore {
|
|
442
474
|
// initialize system
|
443
475
|
stopWatch.record();
|
444
476
|
yield this.graphManagerState.initializeSystem();
|
445
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.
|
477
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS);
|
446
478
|
|
447
479
|
// fetch entities
|
448
480
|
stopWatch.record();
|
@@ -452,7 +484,7 @@ export abstract class QueryEditorStore {
|
|
452
484
|
versionId,
|
453
485
|
)) as Entity[];
|
454
486
|
this.initState.setMessage(undefined);
|
455
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.
|
487
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS);
|
456
488
|
|
457
489
|
// fetch and build dependencies
|
458
490
|
stopWatch.record();
|
@@ -465,49 +497,61 @@ export abstract class QueryEditorStore {
|
|
465
497
|
const dependencyEntitiesIndex = (yield flowResult(
|
466
498
|
this.depotServerClient.getIndexedDependencyEntities(project, versionId),
|
467
499
|
)) as Map<string, Entity[]>;
|
468
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.
|
469
|
-
|
470
|
-
const dependency_buildReport =
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
500
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS);
|
501
|
+
|
502
|
+
const dependency_buildReport = createGraphBuilderReport();
|
503
|
+
yield this.graphManagerState.graphManager.buildDependencies(
|
504
|
+
this.graphManagerState.coreModel,
|
505
|
+
this.graphManagerState.systemModel,
|
506
|
+
dependencyManager,
|
507
|
+
dependencyEntitiesIndex,
|
508
|
+
this.graphManagerState.dependenciesBuildState,
|
509
|
+
{},
|
510
|
+
dependency_buildReport,
|
511
|
+
);
|
478
512
|
dependency_buildReport.timings[
|
479
|
-
GRAPH_MANAGER_EVENT.
|
480
|
-
] = stopWatch.getRecord(
|
513
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS
|
514
|
+
] = stopWatch.getRecord(
|
515
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_DEPENDENCIES__SUCCESS,
|
516
|
+
);
|
481
517
|
|
482
518
|
// build graph
|
483
|
-
const graph_buildReport =
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
519
|
+
const graph_buildReport = createGraphBuilderReport();
|
520
|
+
yield this.graphManagerState.graphManager.buildGraph(
|
521
|
+
this.graphManagerState.graph,
|
522
|
+
entities,
|
523
|
+
this.graphManagerState.graphBuildState,
|
524
|
+
{
|
525
|
+
sdlc: new LegendSDLC(groupId, artifactId, resolveVersion(versionId)),
|
526
|
+
},
|
527
|
+
graph_buildReport,
|
528
|
+
);
|
529
|
+
graph_buildReport.timings[
|
530
|
+
GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS
|
531
|
+
] = stopWatch.getRecord(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS);
|
491
532
|
|
492
533
|
// report
|
493
|
-
stopWatch.record(GRAPH_MANAGER_EVENT.
|
534
|
+
stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
|
494
535
|
const graphBuilderReportData = {
|
495
536
|
timings: {
|
496
|
-
[GRAPH_MANAGER_EVENT.
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
537
|
+
[GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS]:
|
538
|
+
stopWatch.getRecord(
|
539
|
+
GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS,
|
540
|
+
),
|
541
|
+
[GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS]: stopWatch.getRecord(
|
542
|
+
GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS,
|
501
543
|
),
|
502
544
|
},
|
503
545
|
dependencies: dependency_buildReport,
|
546
|
+
dependenciesCount:
|
547
|
+
this.graphManagerState.graph.dependencyManager.numberOfDependencies,
|
504
548
|
graph: graph_buildReport,
|
505
549
|
};
|
506
550
|
this.applicationStore.log.info(
|
507
|
-
LogEvent.create(GRAPH_MANAGER_EVENT.
|
551
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS),
|
508
552
|
graphBuilderReportData,
|
509
553
|
);
|
510
|
-
GraphManagerTelemetry.
|
554
|
+
GraphManagerTelemetry.logEvent_GraphInitializationSucceeded(
|
511
555
|
this.applicationStore.telemetryService,
|
512
556
|
graphBuilderReportData,
|
513
557
|
);
|
@@ -757,6 +801,9 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
757
801
|
queryBuilderState ??
|
758
802
|
new ClassQueryBuilderState(this.applicationStore, this.graphManagerState);
|
759
803
|
|
804
|
+
queryBuilderState.applicationContext =
|
805
|
+
LEGEND_QUERY_APPLICATION_NAVIGATION_CONTEXT_KEY.EDITOR;
|
806
|
+
|
760
807
|
queryBuilderState.setMapping(query.mapping.value);
|
761
808
|
queryBuilderState.setRuntimeValue(
|
762
809
|
new RuntimePointer(
|
@@ -770,7 +817,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
770
817
|
);
|
771
818
|
|
772
819
|
// send analytics
|
773
|
-
LegendQueryTelemetry.
|
820
|
+
LegendQueryTelemetry.logEvent_ViewQuerySucceeded(
|
774
821
|
this.applicationStore.telemetryService,
|
775
822
|
{
|
776
823
|
query: {
|
@@ -783,6 +830,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
783
830
|
},
|
784
831
|
);
|
785
832
|
|
833
|
+
queryBuilderState.setTitleOfQuery(this.query.name);
|
786
834
|
return queryBuilderState;
|
787
835
|
}
|
788
836
|
|
package/tsconfig.json
CHANGED
@@ -40,6 +40,7 @@
|
|
40
40
|
"./src/stores/CreateMappingQuerySetupStore.ts",
|
41
41
|
"./src/stores/EditExistingQuerySetupStore.ts",
|
42
42
|
"./src/stores/LegendQueryAppEvent.ts",
|
43
|
+
"./src/stores/LegendQueryApplicationNavigationContext.ts",
|
43
44
|
"./src/stores/LegendQueryApplicationPlugin.ts",
|
44
45
|
"./src/stores/LegendQueryBaseStore.ts",
|
45
46
|
"./src/stores/LegendQueryEventService.ts",
|