@finos/legend-application-query 13.8.52 → 13.8.53
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__/LegendQueryEvent.d.ts +6 -0
- package/lib/__lib__/LegendQueryEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryEvent.js +6 -0
- package/lib/__lib__/LegendQueryEvent.js.map +1 -1
- package/lib/__lib__/LegendQueryLifecycleTelemetry.d.ts +58 -0
- package/lib/__lib__/LegendQueryLifecycleTelemetry.d.ts.map +1 -0
- package/lib/__lib__/LegendQueryLifecycleTelemetry.js +90 -0
- package/lib/__lib__/LegendQueryLifecycleTelemetry.js.map +1 -0
- package/lib/__lib__/LegendQueryNavigation.d.ts +1 -1
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +11 -1
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/__lib__/LegendQuerySourceInfo.d.ts +137 -0
- package/lib/__lib__/LegendQuerySourceInfo.d.ts.map +1 -0
- package/lib/__lib__/LegendQuerySourceInfo.js +33 -0
- package/lib/__lib__/LegendQuerySourceInfo.js.map +1 -0
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts +73 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.js +18 -0
- package/lib/__lib__/LegendQueryTelemetryHelper.js.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +2 -0
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +2 -0
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +13 -2
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -1
- package/lib/stores/EditExistingQuerySetupStore.js +4 -13
- package/lib/stores/EditExistingQuerySetupStore.js.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +2 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js +23 -0
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +30 -2
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +123 -79
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.d.ts.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.js +4 -13
- package/lib/stores/QueryProductionizerSetupStore.js.map +1 -1
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +1 -0
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.d.ts +2 -0
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.js +12 -1
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.d.ts +10 -0
- package/lib/stores/data-space/DataProductQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataProductQueryCreatorStore.js +63 -19
- package/lib/stores/data-space/DataProductQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataProductSelectorState.d.ts +4 -2
- package/lib/stores/data-space/DataProductSelectorState.d.ts.map +1 -1
- package/lib/stores/data-space/DataProductSelectorState.js +30 -9
- package/lib/stores/data-space/DataProductSelectorState.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +2 -0
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +13 -7
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js.map +1 -1
- package/lib/stores/ingest/IngestQueryCreatorStore.d.ts +2 -0
- package/lib/stores/ingest/IngestQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/ingest/IngestQueryCreatorStore.js +10 -3
- package/lib/stores/ingest/IngestQueryCreatorStore.js.map +1 -1
- package/package.json +13 -13
- package/src/__lib__/LegendQueryEvent.ts +7 -0
- package/src/__lib__/LegendQueryLifecycleTelemetry.ts +132 -0
- package/src/__lib__/LegendQueryNavigation.ts +20 -1
- package/src/__lib__/LegendQuerySourceInfo.ts +162 -0
- package/src/__lib__/LegendQueryTelemetryHelper.ts +120 -1
- package/src/application/LegendQueryApplicationConfig.ts +5 -1
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +21 -2
- package/src/index.ts +6 -1
- package/src/stores/EditExistingQuerySetupStore.ts +8 -20
- package/src/stores/LegendQueryApplicationPlugin.tsx +38 -0
- package/src/stores/QueryEditorStore.ts +178 -86
- package/src/stores/QueryProductionizerSetupStore.ts +8 -20
- package/src/stores/QuerySetupStore.ts +2 -0
- package/src/stores/data-product/DataProductSampleQueryCreatorStore.ts +17 -0
- package/src/stores/data-space/DataProductQueryCreatorStore.ts +99 -33
- package/src/stores/data-space/DataProductSelectorState.ts +58 -13
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +17 -6
- package/src/stores/data-space/LegendQueryBareQueryBuilderState.ts +5 -1
- package/src/stores/ingest/IngestQueryCreatorStore.ts +16 -5
- package/tsconfig.json +2 -0
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { action, computed, flow, flowResult, makeObservable, observable, override, } from 'mobx';
|
|
17
|
-
import { LogEvent, assertErrorThrown, uuid, assertType, guaranteeNonNullable, ActionState, StopWatch, guaranteeType, quantifyList, assertNonNullable, returnUndefOnError, UnsupportedOperationError, filterByType, } from '@finos/legend-shared';
|
|
17
|
+
import { LogEvent, assertErrorThrown, uuid, assertType, guaranteeNonNullable, ActionState, StopWatch, guaranteeType, quantifyList, assertNonNullable, returnUndefOnError, UnsupportedOperationError, filterByType, buildTelemetryErrorFields, } from '@finos/legend-shared';
|
|
18
18
|
import { PackageableRuntime, createPath, GraphManagerState, Query, PureExecution, PackageableElementExplicitReference, RuntimePointer, GRAPH_MANAGER_EVENT, extractElementNameFromPath, Mapping, createGraphBuilderReport, LegendSDLC, QuerySearchSpecification, toLightQuery, QueryParameterValue, reportGraphAnalytics, cloneQueryStereotype, cloneQueryTaggedValue, QueryProjectCoordinates, CORE_PURE_PATH, INTERNAL_ELEMENT_PATH, isValidFullPath, QUERY_PROFILE_PATH, QueryDataSpaceExecutionContextInfo, QueryExplicitExecutionContextInfo, QueryDataProductNativeExecutionContextInfo, QueryDataProductModelAccessExecutionContextInfo, QueryDataProductLakehouseExecutionContextInfo, QueryIngestExecutionContextInfo, ModelAccessPointGroup, IngestDefinition, LakehouseRuntime, V1_DATA_PRODUCT_ELEMENT_PROTOCOL_TYPE, V1_DataProductArtifact, V1_ModelAccessPointGroupInfo, DataProductAccessType, LakehouseAccessPoint, } from '@finos/legend-graph';
|
|
19
19
|
import { generateExistingQueryEditorRoute, generateMappingQueryCreatorRoute, generateServiceQueryCreatorRoute, } from '../__lib__/LegendQueryNavigation.js';
|
|
20
20
|
import { LEGEND_QUERY_APP_EVENT } from '../__lib__/LegendQueryEvent.js';
|
|
@@ -22,9 +22,11 @@ import { parseGACoordinates, StoredFileGeneration, } from '@finos/legend-storage
|
|
|
22
22
|
import { resolveVersion, StoreProjectData, LATEST_VERSION_ALIAS, VersionedProjectData, retrieveProjectEntitiesWithClassifier, isSnapshotVersion, SNAPSHOT_VERSION_ALIAS, } from '@finos/legend-server-depot';
|
|
23
23
|
import { ActionAlertActionType, ActionAlertType, DEFAULT_TAB_SIZE, DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH, } from '@finos/legend-application';
|
|
24
24
|
import { LegendQueryEventHelper } from '../__lib__/LegendQueryEventHelper.js';
|
|
25
|
-
import { ClassQueryBuilderState, MappingQueryBuilderState, ServiceQueryBuilderState, QueryLoaderState, QueryBuilderDataBrowserWorkflow, QueryBuilderActionConfig, QUERY_LOADER_DEFAULT_QUERY_SEARCH_LIMIT, ModelAccessPointDataProductExecutionState, LakehouseDataProductExecutionState, resolveDataProductAccessor, } from '@finos/legend-query-builder';
|
|
25
|
+
import { ClassQueryBuilderState, MappingQueryBuilderState, ServiceQueryBuilderState, QueryLoaderState, QueryBuilderDataBrowserWorkflow, QueryBuilderActionConfig, QUERY_LOADER_DEFAULT_QUERY_SEARCH_LIMIT, ModelAccessPointDataProductExecutionState, LakehouseDataProductExecutionState, resolveDataProductAccessor, QUERY_BUILDER_OPENED_FROM, } from '@finos/legend-query-builder';
|
|
26
26
|
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
|
27
|
-
import {
|
|
27
|
+
import { buildQueryCreateFailureData, buildQueryIdentity, buildQueryLifecycleFailureData, buildQueryLoaderLifecycleTelemetryHandlers, } from '../__lib__/LegendQueryLifecycleTelemetry.js';
|
|
28
|
+
import { LegendQueryTelemetryHelper, } from '../__lib__/LegendQueryTelemetryHelper.js';
|
|
29
|
+
import { LegendQuerySourceType, } from '../__lib__/LegendQuerySourceInfo.js';
|
|
28
30
|
import {} from '@finos/legend-extension-dsl-data-space/application';
|
|
29
31
|
import { DSL_DataSpace_getGraphManagerExtension, getOwnDataSpace, QUERY_PROFILE_TAG_DATA_SPACE, resolveExecutionContextMapping, retrieveAnalyticsResultCache, retrieveDataspaceArtifactsCache, } from '@finos/legend-extension-dsl-data-space/graph';
|
|
30
32
|
import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
|
@@ -98,13 +100,7 @@ export class QueryCreatorState {
|
|
|
98
100
|
this.editorStore.applicationStore.notificationService.notifySuccess(`Successfully created query!`);
|
|
99
101
|
LegendQueryEventHelper.notify_QueryCreateSucceeded(this.editorStore.applicationStore.eventService, { queryId: newQuery.id });
|
|
100
102
|
LegendQueryTelemetryHelper.logEvent_CreateQuerySucceeded(this.editorStore.applicationStore.telemetryService, {
|
|
101
|
-
query
|
|
102
|
-
id: query.id,
|
|
103
|
-
name: query.name,
|
|
104
|
-
groupId: query.groupId,
|
|
105
|
-
artifactId: query.artifactId,
|
|
106
|
-
versionId: query.versionId,
|
|
107
|
-
},
|
|
103
|
+
...buildQueryIdentity(query),
|
|
108
104
|
...queryBuilderState.getExtraTelemetryMetadata(),
|
|
109
105
|
});
|
|
110
106
|
queryBuilderState.changeDetectionState.initialize(rawLambda);
|
|
@@ -117,6 +113,7 @@ export class QueryCreatorState {
|
|
|
117
113
|
assertErrorThrown(error);
|
|
118
114
|
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE), error);
|
|
119
115
|
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
116
|
+
LegendQueryTelemetryHelper.logEvent_CreateQueryFailed(this.editorStore.applicationStore.telemetryService, buildQueryCreateFailureData(this.queryName, error));
|
|
120
117
|
}
|
|
121
118
|
finally {
|
|
122
119
|
this.createQueryState.reset();
|
|
@@ -205,18 +202,9 @@ export class QueryEditorStore {
|
|
|
205
202
|
generateDefaultQueriesSummaryText: (queries) => queries.length
|
|
206
203
|
? `Showing ${quantifyList(queries, 'recently viewed query', 'recently viewed queries')}`
|
|
207
204
|
: `No recently viewed queries`,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
query: {
|
|
212
|
-
id: query.id,
|
|
213
|
-
name: query.name,
|
|
214
|
-
groupId: query.groupId,
|
|
215
|
-
artifactId: query.artifactId,
|
|
216
|
-
versionId: query.versionId,
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
},
|
|
205
|
+
...buildQueryLoaderLifecycleTelemetryHandlers(this.applicationStore, {
|
|
206
|
+
onQueryDeleted: (queryId) => LegendQueryUserDataHelper.removeRecentlyViewedQuery(this.applicationStore.userDataService, queryId),
|
|
207
|
+
}),
|
|
220
208
|
handleFetchDefaultQueriesFailure: () => LegendQueryUserDataHelper.removeRecentlyViewedQueries(this.applicationStore.userDataService),
|
|
221
209
|
});
|
|
222
210
|
this.queryCreatorState = new QueryCreatorState(this, undefined);
|
|
@@ -315,9 +303,9 @@ export class QueryEditorStore {
|
|
|
315
303
|
this.enableMinialGraphForDataSpaceLoadingPerformance) {
|
|
316
304
|
return;
|
|
317
305
|
}
|
|
306
|
+
const stopWatch = new StopWatch();
|
|
318
307
|
try {
|
|
319
308
|
this.initState.inProgress();
|
|
320
|
-
const stopWatch = new StopWatch();
|
|
321
309
|
// TODO: when we genericize the way to initialize an application page
|
|
322
310
|
this.applicationStore.assistantService.setIsHidden(true);
|
|
323
311
|
// initialize the graph manager
|
|
@@ -328,6 +316,7 @@ export class QueryEditorStore {
|
|
|
328
316
|
baseUrl: this.applicationStore.config.engineServerUrl,
|
|
329
317
|
queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
|
|
330
318
|
enableCompression: true,
|
|
319
|
+
useCookieAuthOnly: this.applicationStore.config.engineUseCookieAuthOnly,
|
|
331
320
|
},
|
|
332
321
|
}, {
|
|
333
322
|
tracerService: this.applicationStore.tracerService,
|
|
@@ -337,11 +326,22 @@ export class QueryEditorStore {
|
|
|
337
326
|
this.queryBuilderState = (yield this.initializeQueryBuilderState(stopWatch));
|
|
338
327
|
this.queryLoaderState.initialize(this.queryBuilderState);
|
|
339
328
|
this.initState.pass();
|
|
329
|
+
// the canonical "a query builder is loaded" signal, emitted for every
|
|
330
|
+
// route — creator and saved alike. Reported here rather than from each
|
|
331
|
+
// route's own load event so that counting opens does not require a union
|
|
332
|
+
// of differently shaped, half-covering events.
|
|
333
|
+
this.queryBuilderState.logOpened(this.getOpenedFrom(), {
|
|
334
|
+
...this.getInitializeTelemetrySource(),
|
|
335
|
+
timings: this.applicationStore.timeService.finalizeTimingsRecord(stopWatch),
|
|
336
|
+
});
|
|
340
337
|
}
|
|
341
338
|
catch (error) {
|
|
342
339
|
assertErrorThrown(error);
|
|
343
340
|
this.applicationStore.logService.error(LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE), error);
|
|
344
341
|
this.applicationStore.notificationService.notifyError(error);
|
|
342
|
+
// NOTE: log before handling the failure, which may reset the editor
|
|
343
|
+
// state that the telemetry source is derived from
|
|
344
|
+
this.logInitializeFailureMetrics(stopWatch, error);
|
|
345
345
|
this.onInitializeFailure();
|
|
346
346
|
this.initState.fail();
|
|
347
347
|
}
|
|
@@ -349,6 +349,45 @@ export class QueryEditorStore {
|
|
|
349
349
|
onInitializeFailure() {
|
|
350
350
|
// Do Nothing
|
|
351
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Where the query was started from, used as the source info of the query
|
|
354
|
+
* builder state. Since this is derived from the editor state (e.g. the
|
|
355
|
+
* route) rather than the query builder state, it is also available when
|
|
356
|
+
* the editor fails to initialize.
|
|
357
|
+
*/
|
|
358
|
+
getSourceInfo() {
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Which surface opened the query builder, reported as `openedFrom` on
|
|
363
|
+
* `query-builder.opened`. Creator routes inherit this; only
|
|
364
|
+
* `ExistingQueryEditorStore` overrides it.
|
|
365
|
+
*
|
|
366
|
+
* Note this names the surface only — what is being queried is already carried
|
|
367
|
+
* by `getSourceInfo()` on the same payload.
|
|
368
|
+
*/
|
|
369
|
+
getOpenedFrom() {
|
|
370
|
+
return QUERY_BUILDER_OPENED_FROM.QUERY_CREATOR;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Where the query was started from, reported when the query creator is
|
|
374
|
+
* initialized
|
|
375
|
+
*/
|
|
376
|
+
getInitializeTelemetrySource() {
|
|
377
|
+
return {
|
|
378
|
+
// spread flat, matching how `sourceInfo` is reported on every other query
|
|
379
|
+
// telemetry event — see `QueryBuilderTelemetryContext`
|
|
380
|
+
...this.getSourceInfo(),
|
|
381
|
+
restoredFromRecent: false,
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
logInitializeFailureMetrics(stopWatch, error) {
|
|
385
|
+
LegendQueryTelemetryHelper.logEvent_InitializeQueryCreatorFailed(this.applicationStore.telemetryService, {
|
|
386
|
+
...this.getInitializeTelemetrySource(),
|
|
387
|
+
...buildTelemetryErrorFields(error),
|
|
388
|
+
timings: this.applicationStore.timeService.finalizeTimingsRecord(stopWatch),
|
|
389
|
+
});
|
|
390
|
+
}
|
|
352
391
|
*searchExistingQueryName(searchText) {
|
|
353
392
|
const isValidSearchString = searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
|
354
393
|
try {
|
|
@@ -675,7 +714,7 @@ export class QueryEditorStore {
|
|
|
675
714
|
* creates `LegendQueryDataProductQueryBuilderState`, and wires in
|
|
676
715
|
* mapping coverage results.
|
|
677
716
|
*/
|
|
678
|
-
async buildDataProductQueryBuilderState(groupId, artifactId, versionId, dataProductPath, artifact, accessId, dataProductAccessType, onDataProductChange, onLegacyDataSpaceChange, productSelectorState) {
|
|
717
|
+
async buildDataProductQueryBuilderState(groupId, artifactId, versionId, dataProductPath, artifact, accessId, dataProductAccessType, onDataProductChange, onLegacyDataSpaceChange, productSelectorState, sourceInfo) {
|
|
679
718
|
// 3. Build minimal graph and get analysis result
|
|
680
719
|
const dataProductAnalysisResult = await this.buildGraphAndDataproductAnalyticsResult(groupId, artifactId, versionId, dataProductPath, dataProductAccessType, accessId, artifact);
|
|
681
720
|
// 4. Get the data product from the built graph
|
|
@@ -696,16 +735,18 @@ export class QueryEditorStore {
|
|
|
696
735
|
}
|
|
697
736
|
// 6. Create query builder state
|
|
698
737
|
const projectInfo = { groupId, artifactId, versionId };
|
|
699
|
-
const
|
|
738
|
+
const queryBuilderState = new LegendQueryDataProductQueryBuilderState(this.applicationStore, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE,
|
|
739
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
740
|
+
new QueryBuilderActionConfig_QueryApplication(this), dataProduct, artifact, resolvedState, this.depotServerClient, projectInfo, onDataProductChange, (path, gav) => this.createLakehousePackageableRuntime(path, gav), productSelectorState ??
|
|
741
|
+
new DataProductSelectorState(this.depotServerClient, this.applicationStore, this.lakehouseState?.contractServerClient), onLegacyDataSpaceChange, undefined, this.applicationStore.config.options.queryBuilderConfig, sourceInfo ?? {
|
|
742
|
+
sourceType: LegendQuerySourceType.DATA_PRODUCT,
|
|
700
743
|
groupId,
|
|
701
744
|
artifactId,
|
|
702
745
|
versionId,
|
|
703
746
|
dataProduct: dataProductPath,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
new QueryBuilderActionConfig_QueryApplication(this), dataProduct, artifact, resolvedState, this.depotServerClient, projectInfo, onDataProductChange, (path, gav) => this.createLakehousePackageableRuntime(path, gav), productSelectorState ??
|
|
708
|
-
new DataProductSelectorState(this.depotServerClient, this.applicationStore), onLegacyDataSpaceChange, undefined, this.applicationStore.config.options.queryBuilderConfig, sourceInfo);
|
|
747
|
+
accessType: dataProductAccessType,
|
|
748
|
+
accessId,
|
|
749
|
+
});
|
|
709
750
|
if (dataProductAnalysisResult.dataProductAnalysis
|
|
710
751
|
.mappingToMappingCoverageResult) {
|
|
711
752
|
queryBuilderState.mappingToMappingCoverageResult =
|
|
@@ -764,13 +805,18 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
|
|
|
764
805
|
versionId: this.versionId,
|
|
765
806
|
};
|
|
766
807
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
groupId:
|
|
771
|
-
artifactId:
|
|
772
|
-
versionId:
|
|
808
|
+
getSourceInfo() {
|
|
809
|
+
return {
|
|
810
|
+
sourceType: LegendQuerySourceType.MAPPING,
|
|
811
|
+
groupId: this.groupId,
|
|
812
|
+
artifactId: this.artifactId,
|
|
813
|
+
versionId: this.versionId,
|
|
814
|
+
mapping: this.mappingPath,
|
|
815
|
+
runtime: this.runtimePath,
|
|
773
816
|
};
|
|
817
|
+
}
|
|
818
|
+
async initializeQueryBuilderState() {
|
|
819
|
+
const sourceInfo = this.getSourceInfo();
|
|
774
820
|
const queryBuilderState = new MappingQueryBuilderState(this.applicationStore, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE, new QueryBuilderActionConfig_QueryApplication(this), (val) => {
|
|
775
821
|
this.applicationStore.navigationService.navigator.updateCurrentLocation(generateMappingQueryCreatorRoute(this.groupId, this.artifactId, this.versionId, val.path, guaranteeType(queryBuilderState.executionContextState.runtimeValue, RuntimePointer).packageableRuntime.value.path));
|
|
776
822
|
}, (val) => {
|
|
@@ -832,16 +878,19 @@ export class ServiceQueryCreatorStore extends QueryEditorStore {
|
|
|
832
878
|
versionId: this.versionId,
|
|
833
879
|
};
|
|
834
880
|
}
|
|
881
|
+
getSourceInfo() {
|
|
882
|
+
return {
|
|
883
|
+
sourceType: LegendQuerySourceType.SERVICE,
|
|
884
|
+
groupId: this.groupId,
|
|
885
|
+
artifactId: this.artifactId,
|
|
886
|
+
versionId: this.versionId,
|
|
887
|
+
service: this.servicePath,
|
|
888
|
+
};
|
|
889
|
+
}
|
|
835
890
|
async initializeQueryBuilderState() {
|
|
836
891
|
const service = this.graphManagerState.graph.getService(this.servicePath);
|
|
837
892
|
assertType(service.execution, PureExecution, `Can't process service execution: only Pure execution is supported`);
|
|
838
|
-
const
|
|
839
|
-
const sourceInfo = {
|
|
840
|
-
groupId: projectInfo.groupId,
|
|
841
|
-
artifactId: projectInfo.artifactId,
|
|
842
|
-
versionId: projectInfo.versionId,
|
|
843
|
-
service: service.path,
|
|
844
|
-
};
|
|
893
|
+
const sourceInfo = this.getSourceInfo();
|
|
845
894
|
const queryBuilderState = new ServiceQueryBuilderState(this.applicationStore, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE, new QueryBuilderActionConfig_QueryApplication(this), service, this.graphManagerState.usableServices, this.executionKey, (val) => {
|
|
846
895
|
this.applicationStore.navigationService.navigator.goToLocation(generateServiceQueryCreatorRoute(this.groupId, this.artifactId, this.versionId, val.path));
|
|
847
896
|
}, (val) => {
|
|
@@ -971,13 +1020,7 @@ export class ExistingQueryUpdateState {
|
|
|
971
1020
|
const updatedQuery = (yield this.editorStore.graphManagerState.graphManager.updateQuery(query, this.editorStore.graphManagerState.graph));
|
|
972
1021
|
this.editorStore.applicationStore.notificationService.notifySuccess(`Successfully updated query!`);
|
|
973
1022
|
LegendQueryTelemetryHelper.logEvent_UpdateQuerySucceeded(this.editorStore.applicationStore.telemetryService, {
|
|
974
|
-
query
|
|
975
|
-
id: query.id,
|
|
976
|
-
name: query.name,
|
|
977
|
-
groupId: query.groupId,
|
|
978
|
-
artifactId: query.artifactId,
|
|
979
|
-
versionId: query.versionId,
|
|
980
|
-
},
|
|
1023
|
+
...buildQueryIdentity(query),
|
|
981
1024
|
...queryBuilderState.getExtraTelemetryMetadata(),
|
|
982
1025
|
});
|
|
983
1026
|
config.onQueryUpdate?.(updatedQuery);
|
|
@@ -988,6 +1031,7 @@ export class ExistingQueryUpdateState {
|
|
|
988
1031
|
assertErrorThrown(error);
|
|
989
1032
|
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE), error);
|
|
990
1033
|
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
1034
|
+
LegendQueryTelemetryHelper.logEvent_UpdateQueryFailed(this.editorStore.applicationStore.telemetryService, buildQueryLifecycleFailureData(this.editorStore.id, error));
|
|
991
1035
|
}
|
|
992
1036
|
finally {
|
|
993
1037
|
this.updateQueryState.complete();
|
|
@@ -1004,13 +1048,7 @@ export class ExistingQueryUpdateState {
|
|
|
1004
1048
|
this.editorStore.applicationStore.notificationService.notifySuccess(`Successfully updated query!`);
|
|
1005
1049
|
const extraTelemetryMetadata = this.editorStore.queryBuilderState?.getExtraTelemetryMetadata() ?? {};
|
|
1006
1050
|
LegendQueryTelemetryHelper.logEvent_UpdateQuerySucceeded(this.editorStore.applicationStore.telemetryService, {
|
|
1007
|
-
|
|
1008
|
-
id: updatedQuery.id,
|
|
1009
|
-
name: updatedQuery.name,
|
|
1010
|
-
groupId: updatedQuery.groupId,
|
|
1011
|
-
artifactId: updatedQuery.artifactId,
|
|
1012
|
-
versionId: updatedQuery.versionId,
|
|
1013
|
-
},
|
|
1051
|
+
...buildQueryIdentity(updatedQuery),
|
|
1014
1052
|
...extraTelemetryMetadata,
|
|
1015
1053
|
});
|
|
1016
1054
|
}
|
|
@@ -1018,6 +1056,7 @@ export class ExistingQueryUpdateState {
|
|
|
1018
1056
|
assertErrorThrown(error);
|
|
1019
1057
|
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE), error);
|
|
1020
1058
|
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
1059
|
+
LegendQueryTelemetryHelper.logEvent_UpdateQueryFailed(this.editorStore.applicationStore.telemetryService, buildQueryLifecycleFailureData(queryId, error));
|
|
1021
1060
|
}
|
|
1022
1061
|
finally {
|
|
1023
1062
|
this.updateQueryState.complete();
|
|
@@ -1114,15 +1153,15 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1114
1153
|
const currentQuery = guaranteeNonNullable(this._lightQuery);
|
|
1115
1154
|
LegendQueryTelemetryHelper.logEvent_GraphInitializationSucceeded(this.applicationStore.telemetryService, {
|
|
1116
1155
|
graph: graphBuilderReportData,
|
|
1117
|
-
|
|
1118
|
-
id: currentQuery.id,
|
|
1119
|
-
name: currentQuery.name,
|
|
1120
|
-
groupId: currentQuery.groupId,
|
|
1121
|
-
artifactId: currentQuery.artifactId,
|
|
1122
|
-
versionId: currentQuery.versionId,
|
|
1123
|
-
},
|
|
1156
|
+
...buildQueryIdentity(currentQuery),
|
|
1124
1157
|
});
|
|
1125
1158
|
}
|
|
1159
|
+
getOpenedFrom() {
|
|
1160
|
+
return QUERY_BUILDER_OPENED_FROM.QUERY_SAVED;
|
|
1161
|
+
}
|
|
1162
|
+
logInitializeFailureMetrics() {
|
|
1163
|
+
// Do nothing: an existing query is not a query creator
|
|
1164
|
+
}
|
|
1126
1165
|
setLightQuery(val) {
|
|
1127
1166
|
this._lightQuery = val;
|
|
1128
1167
|
}
|
|
@@ -1207,11 +1246,13 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1207
1246
|
const matchingExecutionContext = resolveExecutionContext(dataSpace, exec.executionKey, mapping, runtime);
|
|
1208
1247
|
if (matchingExecutionContext) {
|
|
1209
1248
|
const sourceInfo = {
|
|
1249
|
+
sourceType: LegendQuerySourceType.DATA_SPACE,
|
|
1210
1250
|
groupId: queryInfo.groupId,
|
|
1211
1251
|
artifactId: queryInfo.artifactId,
|
|
1212
1252
|
versionId: queryInfo.versionId,
|
|
1213
1253
|
queryId: queryInfo.id,
|
|
1214
1254
|
dataSpace: dataSpace.path,
|
|
1255
|
+
executionContext: exec.executionKey,
|
|
1215
1256
|
};
|
|
1216
1257
|
const visitedDataSpaces = LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(this.applicationStore.userDataService);
|
|
1217
1258
|
const dataSpaceQueryBuilderState = new LegendQueryDataSpaceQueryBuilderState(this.applicationStore, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE, new QueryBuilderActionConfig_QueryApplication(this), dataSpace, matchingExecutionContext, isLightGraphEnabled, this.depotServerClient, {
|
|
@@ -1264,7 +1305,7 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1264
1305
|
else {
|
|
1265
1306
|
this.applicationStore.notificationService.notifyWarning(`Can't switch data product: default execution context not specified`);
|
|
1266
1307
|
}
|
|
1267
|
-
}, new DataProductSelectorState(this.depotServerClient, this.applicationStore), () => {
|
|
1308
|
+
}, new DataProductSelectorState(this.depotServerClient, this.applicationStore, this.lakehouseState?.contractServerClient), () => {
|
|
1268
1309
|
this.applicationStore.notificationService.notifyWarning('Switching data products is not supported from the existing query editor. Please open a new query instead.');
|
|
1269
1310
|
}, dataSpaceAnalysisResult, undefined, undefined, undefined, this.applicationStore.config.options.queryBuilderConfig, sourceInfo);
|
|
1270
1311
|
const matchingExecutionContextMapping = resolveExecutionContextMapping(matchingExecutionContext);
|
|
@@ -1295,10 +1336,13 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1295
1336
|
else if (exec instanceof QueryExplicitExecutionContextInfo) {
|
|
1296
1337
|
const projectInfo = this.getProjectInfo();
|
|
1297
1338
|
const sourceInfo = {
|
|
1339
|
+
sourceType: LegendQuerySourceType.MAPPING,
|
|
1298
1340
|
groupId: projectInfo.groupId,
|
|
1299
1341
|
artifactId: projectInfo.artifactId,
|
|
1300
1342
|
versionId: projectInfo.versionId,
|
|
1301
1343
|
queryId: queryInfo.id,
|
|
1344
|
+
mapping: exec.mapping,
|
|
1345
|
+
runtime: exec.runtime,
|
|
1302
1346
|
};
|
|
1303
1347
|
const classQueryBuilderState = new ClassQueryBuilderState(this.applicationStore, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE, this.applicationStore.config.options.queryBuilderConfig, sourceInfo);
|
|
1304
1348
|
classQueryBuilderState.workflowState.updateActionConfig(new QueryBuilderActionConfig_QueryApplication(this));
|
|
@@ -1330,6 +1374,15 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1330
1374
|
const artifact = await this.fetchDataProductArtifact(queryInfo.groupId, queryInfo.artifactId, queryInfo.versionId, exec.dataProductPath);
|
|
1331
1375
|
const queryBuilderState = await this.buildDataProductQueryBuilderState(queryInfo.groupId, queryInfo.artifactId, queryInfo.versionId, exec.dataProductPath, artifact, executionContextId, accessType, async () => {
|
|
1332
1376
|
this.applicationStore.notificationService.notifyWarning('Switching data products is not supported from the existing query editor. Please open a new query instead.');
|
|
1377
|
+
}, undefined, undefined, {
|
|
1378
|
+
sourceType: LegendQuerySourceType.DATA_PRODUCT,
|
|
1379
|
+
groupId: queryInfo.groupId,
|
|
1380
|
+
artifactId: queryInfo.artifactId,
|
|
1381
|
+
versionId: queryInfo.versionId,
|
|
1382
|
+
queryId: queryInfo.id,
|
|
1383
|
+
dataProduct: exec.dataProductPath,
|
|
1384
|
+
accessType,
|
|
1385
|
+
accessId: executionContextId,
|
|
1333
1386
|
});
|
|
1334
1387
|
return queryBuilderState;
|
|
1335
1388
|
}
|
|
@@ -1363,10 +1416,13 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1363
1416
|
return next;
|
|
1364
1417
|
};
|
|
1365
1418
|
const ingestQueryBuilderState = new IngestLegendQueryBuilderState(this.applicationStore, undefined, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE, new QueryBuilderActionConfig_QueryApplication(this), ingestDefinition, Array.from(this._ingestEntitiesByPath.keys()), swapIngest, adhocRuntime, projectInfo, this.applicationStore.config.options.queryBuilderConfig, {
|
|
1419
|
+
sourceType: LegendQuerySourceType.INGEST,
|
|
1366
1420
|
groupId: projectInfo.groupId,
|
|
1367
1421
|
artifactId: projectInfo.artifactId,
|
|
1368
1422
|
versionId: projectInfo.versionId,
|
|
1369
1423
|
queryId: queryInfo.id,
|
|
1424
|
+
ingestDefinitionPath: exec.ingestDefinitionPath,
|
|
1425
|
+
dataSet: exec.dataSet,
|
|
1370
1426
|
});
|
|
1371
1427
|
await ingestQueryBuilderState.changeAccessorOwner(ingestDefinition);
|
|
1372
1428
|
await ingestQueryBuilderState.changeAccessor({
|
|
@@ -1411,23 +1467,11 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
|
1411
1467
|
// send analytics
|
|
1412
1468
|
LegendQueryTelemetryHelper.logEvent_InitializeQueryStateSucceeded(this.applicationStore.telemetryService, {
|
|
1413
1469
|
...initailizeQueryStateReport,
|
|
1414
|
-
query
|
|
1415
|
-
id: query.id,
|
|
1416
|
-
name: query.name,
|
|
1417
|
-
groupId: query.groupId,
|
|
1418
|
-
artifactId: query.artifactId,
|
|
1419
|
-
versionId: query.versionId,
|
|
1420
|
-
},
|
|
1470
|
+
...buildQueryIdentity(query),
|
|
1421
1471
|
});
|
|
1422
1472
|
LegendQueryTelemetryHelper.logEvent_ViewQuerySucceeded(this.applicationStore.telemetryService, {
|
|
1423
1473
|
...report,
|
|
1424
|
-
query
|
|
1425
|
-
id: query.id,
|
|
1426
|
-
name: query.name,
|
|
1427
|
-
groupId: query.groupId,
|
|
1428
|
-
artifactId: query.artifactId,
|
|
1429
|
-
versionId: query.versionId,
|
|
1430
|
-
},
|
|
1474
|
+
...buildQueryIdentity(query),
|
|
1431
1475
|
});
|
|
1432
1476
|
return queryBuilderState;
|
|
1433
1477
|
}
|