@finos/legend-query-builder 4.16.51 → 4.16.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.
@@ -54,7 +54,6 @@ import type { DataGridColumnState } from '@finos/legend-lego/data-grid';
54
54
  import { downloadStream } from '@finos/legend-application';
55
55
  import { QueryBuilderDataGridCustomAggregationFunction } from '../components/result/tds/QueryBuilderTDSGridResult.js';
56
56
  import { QueryBuilderTDSState } from './fetch-structure/tds/QueryBuilderTDSState.js';
57
- import { QueryBuilderEmbeddedFromExecutionContextState } from './QueryBuilderExecutionContextState.js';
58
57
 
59
58
  export const DEFAULT_LIMIT = 1000;
60
59
 
@@ -409,8 +408,8 @@ export class QueryBuilderResultState {
409
408
  const result =
410
409
  (yield this.queryBuilderState.graphManagerState.graphManager.exportData(
411
410
  query,
412
- this.queryBuilderState.executionContextState.mapping,
413
- this.queryBuilderState.executionContextState.runtimeValue,
411
+ this.queryBuilderState.executionContextState.explicitMappingValue,
412
+ this.queryBuilderState.executionContextState.explicitRuntimeValue,
414
413
  this.queryBuilderState.graphManagerState.graph,
415
414
  {
416
415
  serializationFormat,
@@ -476,11 +475,11 @@ export class QueryBuilderResultState {
476
475
  try {
477
476
  this.setIsRunningQuery(true);
478
477
  const currentHashCode = this.queryBuilderState.hashCode;
479
- const mapping = guaranteeNonNullable(
478
+ guaranteeNonNullable(
480
479
  this.queryBuilderState.executionContextState.mapping,
481
480
  'Mapping is required to execute query',
482
481
  );
483
- const runtime = guaranteeNonNullable(
482
+ guaranteeNonNullable(
484
483
  this.queryBuilderState.executionContextState.runtimeValue,
485
484
  `Runtime is required to execute query`,
486
485
  );
@@ -503,12 +502,8 @@ export class QueryBuilderResultState {
503
502
  const contextstate = this.queryBuilderState.executionContextState;
504
503
  promise = this.queryBuilderState.graphManagerState.graphManager.runQuery(
505
504
  query,
506
- contextstate instanceof QueryBuilderEmbeddedFromExecutionContextState
507
- ? undefined
508
- : mapping,
509
- contextstate instanceof QueryBuilderEmbeddedFromExecutionContextState
510
- ? undefined
511
- : runtime,
505
+ contextstate.explicitMappingValue,
506
+ contextstate.explicitRuntimeValue,
512
507
  this.queryBuilderState.graphManagerState.graph,
513
508
  {
514
509
  parameterValues,
@@ -584,11 +579,11 @@ export class QueryBuilderResultState {
584
579
  *generatePlan(debug: boolean): GeneratorFn<void> {
585
580
  try {
586
581
  this.isGeneratingPlan = true;
587
- const mapping = guaranteeNonNullable(
582
+ guaranteeNonNullable(
588
583
  this.queryBuilderState.executionContextState.mapping,
589
584
  'Mapping is required to execute query',
590
585
  );
591
- const runtime = guaranteeNonNullable(
586
+ guaranteeNonNullable(
592
587
  this.queryBuilderState.executionContextState.runtimeValue,
593
588
  `Runtime is required to execute query`,
594
589
  );
@@ -600,14 +595,6 @@ export class QueryBuilderResultState {
600
595
  this.queryBuilderState.graphManagerState.graph,
601
596
  );
602
597
  const contextstate = this.queryBuilderState.executionContextState;
603
- const _mapping =
604
- contextstate instanceof QueryBuilderEmbeddedFromExecutionContextState
605
- ? undefined
606
- : mapping;
607
- const _runtime =
608
- contextstate instanceof QueryBuilderEmbeddedFromExecutionContextState
609
- ? undefined
610
- : runtime;
611
598
  if (debug) {
612
599
  QueryBuilderTelemetryHelper.logEvent_ExecutionPlanDebugLaunched(
613
600
  this.queryBuilderState.applicationStore.telemetryService,
@@ -615,8 +602,8 @@ export class QueryBuilderResultState {
615
602
  const debugResult =
616
603
  (yield this.queryBuilderState.graphManagerState.graphManager.debugExecutionPlanGeneration(
617
604
  query,
618
- _mapping,
619
- _runtime,
605
+ contextstate.explicitMappingValue,
606
+ contextstate.explicitRuntimeValue,
620
607
  this.queryBuilderState.graphManagerState.graph,
621
608
  report,
622
609
  )) as { plan: RawExecutionPlan; debug: string };
@@ -629,8 +616,8 @@ export class QueryBuilderResultState {
629
616
  rawPlan =
630
617
  (yield this.queryBuilderState.graphManagerState.graphManager.generateExecutionPlan(
631
618
  query,
632
- _mapping,
633
- _runtime,
619
+ contextstate.explicitMappingValue,
620
+ contextstate.explicitRuntimeValue,
634
621
  this.queryBuilderState.graphManagerState.graph,
635
622
  report,
636
623
  )) as object;
@@ -244,6 +244,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
244
244
  setGetAllFunction: action,
245
245
  setLambdaWriteMode: action,
246
246
  setINTERNAL__enableInitializingDefaultSimpleExpressionValue: action,
247
+ TEMPORARY_initializeExecContext: action,
247
248
 
248
249
  resetQueryResult: action,
249
250
  resetQueryContent: action,
@@ -259,14 +260,9 @@ export abstract class QueryBuilderState implements CommandRegistrar {
259
260
 
260
261
  this.applicationStore = applicationStore;
261
262
  this.graphManagerState = graphManagerState;
262
- this.executionContextState = config?.enableTypedTDS
263
- ? new QueryBuilderEmbeddedFromExecutionContextState(this)
264
- : new QueryBuilderExternalExecutionContextState(this);
265
- if (config?.enableTypedTDS) {
266
- this.setLambdaWriteMode(
267
- QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE,
268
- );
269
- }
263
+ this.executionContextState = this.TEMPORARY_initializeExecContext(
264
+ Boolean(config?.enableTypedTDS),
265
+ );
270
266
  this.milestoningState = new QueryBuilderMilestoningState(this);
271
267
  this.explorerState = new QueryBuilderExplorerState(this);
272
268
  this.parametersState = new QueryBuilderParametersState(this);
@@ -296,6 +292,19 @@ export abstract class QueryBuilderState implements CommandRegistrar {
296
292
  false;
297
293
  }
298
294
 
295
+ TEMPORARY_initializeExecContext(
296
+ isTypedTDS: boolean,
297
+ ): QueryBuilderExecutionContextState {
298
+ if (isTypedTDS) {
299
+ const context = new QueryBuilderEmbeddedFromExecutionContextState(this);
300
+ this.setLambdaWriteMode(
301
+ QUERY_BUILDER_LAMBDA_WRITER_MODE.TYPED_FETCH_STRUCTURE,
302
+ );
303
+ return context;
304
+ }
305
+ return new QueryBuilderExternalExecutionContextState(this);
306
+ }
307
+
299
308
  get isMappingReadOnly(): boolean {
300
309
  return false;
301
310
  }