@finos/legend-query-builder 4.11.2 → 4.11.4

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.
Files changed (42) hide show
  1. package/lib/__lib__/QueryBuilderTelemetryHelper.d.ts +3 -0
  2. package/lib/__lib__/QueryBuilderTelemetryHelper.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderTelemetryHelper.js.map +1 -1
  4. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  5. package/lib/components/filter/QueryBuilderFilterPanel.js +0 -6
  6. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  7. package/lib/components/shared/LambdaEditor.js +2 -2
  8. package/lib/components/shared/LambdaEditor.js.map +1 -1
  9. package/lib/index.css +1 -1
  10. package/lib/index.d.ts +1 -1
  11. package/lib/index.d.ts.map +1 -1
  12. package/lib/index.js +1 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib/package.json +10 -10
  15. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  16. package/lib/stores/QueryBuilderResultState.js +5 -3
  17. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  18. package/lib/stores/QueryBuilderState.d.ts +14 -1
  19. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  20. package/lib/stores/QueryBuilderState.js +29 -1
  21. package/lib/stores/QueryBuilderState.js.map +1 -1
  22. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  23. package/lib/stores/explorer/QueryBuilderExplorerState.js +2 -1
  24. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  25. package/lib/stores/workflows/MappingQueryBuilderState.d.ts +1 -1
  26. package/lib/stores/workflows/MappingQueryBuilderState.d.ts.map +1 -1
  27. package/lib/stores/workflows/MappingQueryBuilderState.js +2 -2
  28. package/lib/stores/workflows/MappingQueryBuilderState.js.map +1 -1
  29. package/lib/stores/workflows/ServiceQueryBuilderState.d.ts +1 -1
  30. package/lib/stores/workflows/ServiceQueryBuilderState.d.ts.map +1 -1
  31. package/lib/stores/workflows/ServiceQueryBuilderState.js +2 -2
  32. package/lib/stores/workflows/ServiceQueryBuilderState.js.map +1 -1
  33. package/package.json +18 -18
  34. package/src/__lib__/QueryBuilderTelemetryHelper.ts +3 -0
  35. package/src/components/filter/QueryBuilderFilterPanel.tsx +0 -12
  36. package/src/components/shared/LambdaEditor.tsx +4 -4
  37. package/src/index.ts +4 -1
  38. package/src/stores/QueryBuilderResultState.ts +13 -3
  39. package/src/stores/QueryBuilderState.ts +40 -0
  40. package/src/stores/explorer/QueryBuilderExplorerState.ts +6 -1
  41. package/src/stores/workflows/MappingQueryBuilderState.ts +2 -1
  42. package/src/stores/workflows/ServiceQueryBuilderState.ts +2 -1
@@ -102,6 +102,14 @@ import {
102
102
  import type { QueryBuilderConfig } from '../graph-manager/QueryBuilderConfig.js';
103
103
  import { QUERY_BUILDER_EVENT } from '../__lib__/QueryBuilderEvent.js';
104
104
 
105
+ export interface QuerySDLC {}
106
+
107
+ export type QueryStateInfo = QuerySDLC & {
108
+ class: string;
109
+ mapping: string;
110
+ runtime: string;
111
+ };
112
+
105
113
  export abstract class QueryBuilderState implements CommandRegistrar {
106
114
  readonly applicationStore: GenericLegendApplicationStore;
107
115
  readonly graphManagerState: GraphManagerState;
@@ -137,6 +145,11 @@ export abstract class QueryBuilderState implements CommandRegistrar {
137
145
  executionContextState: QueryBuilderExecutionContextState;
138
146
  internalizeState?: QueryBuilderInternalizeState | undefined;
139
147
 
148
+ // NOTE: This property contains information about workflow used
149
+ // to create this state. This should only be used to add additional
150
+ // information to query builder analytics.
151
+ sourceInfo?: QuerySDLC | undefined;
152
+
140
153
  // NOTE: this makes it so that we need to import components in stores code,
141
154
  // we probably want to refactor to an extension mechanism
142
155
  TEMPORARY__setupPanelContentRenderer?: (() => React.ReactNode) | undefined;
@@ -145,6 +158,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
145
158
  applicationStore: GenericLegendApplicationStore,
146
159
  graphManagerState: GraphManagerState,
147
160
  config: QueryBuilderConfig | undefined,
161
+ sourceInfo?: QuerySDLC | undefined,
148
162
  ) {
149
163
  makeObservable(this, {
150
164
  explorerState: observable,
@@ -215,6 +229,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
215
229
  );
216
230
  this.changeDetectionState = new QueryBuilderChangeDetectionState(this);
217
231
  this.config = config;
232
+ this.sourceInfo = sourceInfo;
218
233
  }
219
234
 
220
235
  get isMappingReadOnly(): boolean {
@@ -259,6 +274,31 @@ export abstract class QueryBuilderState implements CommandRegistrar {
259
274
  return this.allVariables.map((e) => e.name);
260
275
  }
261
276
 
277
+ /**
278
+ * Gets information about the current queryBuilderState.
279
+ * This information can be used as a part of analytics
280
+ */
281
+ getStateInfo(): QueryStateInfo | undefined {
282
+ if (this.sourceInfo) {
283
+ const classPath = this.class?.path;
284
+ const mappingPath = this.executionContextState.mapping?.path;
285
+ const runtimePath =
286
+ this.executionContextState.runtimeValue instanceof RuntimePointer
287
+ ? this.executionContextState.runtimeValue.packageableRuntime.value
288
+ .path
289
+ : undefined;
290
+ if (classPath && mappingPath && runtimePath) {
291
+ const contextInfo = {
292
+ class: classPath,
293
+ mapping: mappingPath,
294
+ runtime: runtimePath,
295
+ };
296
+ return Object.assign({}, this.sourceInfo, contextInfo);
297
+ }
298
+ }
299
+ return undefined;
300
+ }
301
+
262
302
  setIsQueryChatOpened(val: boolean): void {
263
303
  this.isQueryChatOpened = val;
264
304
  }
@@ -748,9 +748,14 @@ export class QueryBuilderExplorerState {
748
748
  stopWatch,
749
749
  report.timings,
750
750
  );
751
+ const reportWithState = Object.assign(
752
+ {},
753
+ report,
754
+ this.queryBuilderState.getStateInfo(),
755
+ );
751
756
  QueryBuilderTelemetryHelper.logEvent_QueryMappingModelCoverageAnalysisSucceeded(
752
757
  this.queryBuilderState.applicationStore.telemetryService,
753
- report,
758
+ reportWithState,
754
759
  );
755
760
  } catch (error) {
756
761
  assertErrorThrown(error);
@@ -42,8 +42,9 @@ export class MappingQueryBuilderState extends QueryBuilderState {
42
42
  onMappingChange?: ((val: Mapping) => void) | undefined,
43
43
  onRuntimeChange?: ((val: Runtime) => void) | undefined,
44
44
  config?: QueryBuilderConfig | undefined,
45
+ sourceInfo?: object | undefined,
45
46
  ) {
46
- super(applicationStore, graphManagerState, config);
47
+ super(applicationStore, graphManagerState, config, sourceInfo);
47
48
 
48
49
  this.onMappingChange = onMappingChange;
49
50
  this.onRuntimeChange = onRuntimeChange;
@@ -66,8 +66,9 @@ export class ServiceQueryBuilderState extends QueryBuilderState {
66
66
  | ((val: ServiceExecutionContext) => void)
67
67
  | undefined,
68
68
  config?: QueryBuilderConfig | undefined,
69
+ sourceInfo?: object | undefined,
69
70
  ) {
70
- super(applicationStore, graphManagerState, config);
71
+ super(applicationStore, graphManagerState, config, sourceInfo);
71
72
 
72
73
  makeObservable(this, {
73
74
  selectedExecutionContext: observable,