@finos/legend-query-builder 4.14.46 → 4.14.48

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. package/lib/__lib__/QueryBuilderDocumentation.d.ts +3 -1
  2. package/lib/__lib__/QueryBuilderDocumentation.d.ts.map +1 -1
  3. package/lib/__lib__/QueryBuilderDocumentation.js +2 -0
  4. package/lib/__lib__/QueryBuilderDocumentation.js.map +1 -1
  5. package/lib/components/QueryBuilder.d.ts.map +1 -1
  6. package/lib/components/QueryBuilder.js +14 -2
  7. package/lib/components/QueryBuilder.js.map +1 -1
  8. package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
  9. package/lib/components/QueryBuilderSideBar.js +1 -5
  10. package/lib/components/QueryBuilderSideBar.js.map +1 -1
  11. package/lib/components/explorer/{QueryBuilderMilestoningEditor.d.ts → QueryBuilderMilestoningParameterEditor.d.ts} +5 -2
  12. package/lib/components/explorer/QueryBuilderMilestoningParameterEditor.d.ts.map +1 -0
  13. package/lib/components/explorer/QueryBuilderMilestoningParameterEditor.js +52 -0
  14. package/lib/components/explorer/QueryBuilderMilestoningParameterEditor.js.map +1 -0
  15. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  16. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +192 -21
  17. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  18. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  19. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +13 -3
  20. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  21. package/lib/components/result/tds/QueryBuilderTDSGridResult.d.ts.map +1 -1
  22. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +4 -1
  23. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  24. package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts.map +1 -1
  25. package/lib/components/result/tds/QueryBuilderTDSResultShared.js +2 -5
  26. package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -1
  27. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -1
  28. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +4 -1
  29. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
  30. package/lib/graph-manager/QueryBuilderConfig.d.ts +4 -0
  31. package/lib/graph-manager/QueryBuilderConfig.d.ts.map +1 -1
  32. package/lib/graph-manager/QueryBuilderConfig.js +5 -0
  33. package/lib/graph-manager/QueryBuilderConfig.js.map +1 -1
  34. package/lib/index.css +1 -17
  35. package/lib/index.css.map +1 -1
  36. package/lib/package.json +1 -1
  37. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +2 -1
  38. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  39. package/lib/stores/QueryBuilderValueSpecificationHelper.js +2 -2
  40. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  41. package/lib/stores/QueryLoaderState.d.ts +1 -0
  42. package/lib/stores/QueryLoaderState.d.ts.map +1 -1
  43. package/lib/stores/QueryLoaderState.js +1 -0
  44. package/lib/stores/QueryLoaderState.js.map +1 -1
  45. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +1 -0
  46. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
  47. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +8 -0
  48. package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
  49. package/lib/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.d.ts.map +1 -1
  50. package/lib/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.js +4 -2
  51. package/lib/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.js.map +1 -1
  52. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  53. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +1 -1
  54. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  55. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
  56. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +1 -1
  57. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
  58. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +2 -0
  59. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -1
  60. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +13 -2
  61. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -1
  62. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +2 -0
  63. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -1
  64. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +8 -1
  65. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -1
  66. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts +1 -1
  67. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -1
  68. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +25 -1
  69. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -1
  70. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +2 -0
  71. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -1
  72. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -1
  73. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts +2 -0
  74. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
  75. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +22 -3
  76. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  77. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +2 -0
  78. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -1
  79. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +8 -1
  80. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -1
  81. package/package.json +4 -4
  82. package/src/__lib__/QueryBuilderDocumentation.ts +2 -0
  83. package/src/components/QueryBuilder.tsx +44 -0
  84. package/src/components/QueryBuilderSideBar.tsx +0 -22
  85. package/src/components/explorer/QueryBuilderMilestoningParameterEditor.tsx +114 -0
  86. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +445 -19
  87. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +118 -21
  88. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +3 -0
  89. package/src/components/result/tds/QueryBuilderTDSResultShared.tsx +1 -6
  90. package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +8 -1
  91. package/src/graph-manager/QueryBuilderConfig.ts +6 -0
  92. package/src/stores/QueryBuilderValueSpecificationHelper.ts +3 -0
  93. package/src/stores/QueryLoaderState.ts +1 -0
  94. package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +11 -0
  95. package/src/stores/fetch-structure/tds/aggregation/operators/QueryBuilderAggregateOperator_Percentile.ts +6 -2
  96. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +1 -0
  97. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +1 -0
  98. package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +23 -0
  99. package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +13 -0
  100. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +45 -0
  101. package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +3 -0
  102. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +41 -7
  103. package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +13 -0
  104. package/tsconfig.json +1 -1
  105. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +0 -1
  106. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +0 -102
  107. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +0 -1
  108. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +0 -364
@@ -700,7 +700,7 @@ const QueryBuilderProjectionColumnEditor = observer(
700
700
  aggregateColumnState.operator instanceof
701
701
  QueryBuilderAggregateOperator_Percentile &&
702
702
  aggregateColumnState.operator.percentile !== undefined
703
- ? (aggregateColumnState.operator.percentile * 100).toString()
703
+ ? aggregateColumnState.operator.percentile.toString()
704
704
  : '',
705
705
  );
706
706
  const [acending, setAcending] = useState(
@@ -904,7 +904,7 @@ const QueryBuilderProjectionColumnEditor = observer(
904
904
  percentileOperator.setPercentile(undefined);
905
905
  } else {
906
906
  percentileOperator.setPercentile(
907
- Number(percentileValue) / 100,
907
+ Number(percentileValue),
908
908
  );
909
909
  }
910
910
  if (acending !== undefined && continuous !== undefined) {
@@ -1342,27 +1342,118 @@ export const QueryBuilderTDSPanel = observer(
1342
1342
  >
1343
1343
  <div className="query-builder__projection__result-modifier-prompt__header">
1344
1344
  <button
1345
- className="query-builder__projection__result-modifier-prompt__header__label"
1345
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1346
1346
  onClick={openResultSetModifierEditor}
1347
- title="Configure result set modifiers..."
1347
+ title="Configure Query Options..."
1348
1348
  >
1349
1349
  <CogIcon className="query-builder__projection__result-modifier-prompt__header__label__icon" />
1350
1350
  <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1351
- Query Options
1351
+ {tdsState.isQueryOptionsSet
1352
+ ? 'Query Options'
1353
+ : 'Set Query Options'}
1352
1354
  </div>
1353
1355
  </button>
1356
+ <div className="query-builder__projection__result-modifier-prompt__divider">
1357
+ {tdsState.isQueryOptionsSet && ' - '}
1358
+ </div>
1359
+ {tdsState.queryBuilderState.milestoningState
1360
+ .isAllVersionsEnabled &&
1361
+ !tdsState.queryBuilderState.milestoningState
1362
+ .isAllVersionsInRangeEnabled && (
1363
+ <div className="query-builder__projection__result-modifier-prompt__group">
1364
+ <div className="query-builder__projection__result-modifier-prompt__group__label">
1365
+ All Versions
1366
+ </div>
1367
+ <button
1368
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1369
+ onClick={openResultSetModifierEditor}
1370
+ >
1371
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1372
+ Yes
1373
+ </div>
1374
+ </button>
1375
+ </div>
1376
+ )}
1377
+ {tdsState.queryBuilderState.milestoningState
1378
+ .isAllVersionsInRangeEnabled &&
1379
+ tdsState.queryBuilderState.milestoningState.startDate &&
1380
+ tdsState.queryBuilderState.milestoningState.endDate && (
1381
+ <div className="query-builder__projection__result-modifier-prompt__group">
1382
+ <div className="query-builder__projection__result-modifier-prompt__group__label">
1383
+ All Versions
1384
+ </div>
1385
+ <button
1386
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1387
+ onClick={openResultSetModifierEditor}
1388
+ >
1389
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1390
+ (
1391
+ {getNameOfValueSpecification(
1392
+ tdsState.queryBuilderState.milestoningState.startDate,
1393
+ tdsState.queryBuilderState,
1394
+ )}{' '}
1395
+ -{' '}
1396
+ {getNameOfValueSpecification(
1397
+ tdsState.queryBuilderState.milestoningState.endDate,
1398
+ tdsState.queryBuilderState,
1399
+ )}
1400
+ )
1401
+ </div>
1402
+ </button>
1403
+ </div>
1404
+ )}
1405
+ {tdsState.queryBuilderState.milestoningState.businessDate && (
1406
+ <div className="query-builder__projection__result-modifier-prompt__group">
1407
+ <div className="query-builder__projection__result-modifier-prompt__group__label">
1408
+ Business Date
1409
+ </div>
1410
+ <button
1411
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1412
+ onClick={openResultSetModifierEditor}
1413
+ >
1414
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1415
+ {getNameOfValueSpecification(
1416
+ tdsState.queryBuilderState.milestoningState
1417
+ .businessDate,
1418
+ tdsState.queryBuilderState,
1419
+ )}
1420
+ </div>
1421
+ </button>
1422
+ </div>
1423
+ )}
1424
+ {tdsState.queryBuilderState.milestoningState.processingDate && (
1425
+ <div className="query-builder__projection__result-modifier-prompt__group">
1426
+ <div className="query-builder__projection__result-modifier-prompt__group__label">
1427
+ Processing Date
1428
+ </div>
1429
+ <button
1430
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1431
+ onClick={openResultSetModifierEditor}
1432
+ >
1433
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1434
+ {getNameOfValueSpecification(
1435
+ tdsState.queryBuilderState.milestoningState
1436
+ .processingDate,
1437
+ tdsState.queryBuilderState,
1438
+ )}
1439
+ </div>
1440
+ </button>
1441
+ </div>
1442
+ )}
1354
1443
  </div>
1355
1444
  {tdsState.resultSetModifierState.limit && (
1356
1445
  <div className="query-builder__projection__result-modifier-prompt__group">
1357
1446
  <div className="query-builder__projection__result-modifier-prompt__group__label">
1358
1447
  Max Rows
1359
1448
  </div>
1360
- <div
1361
- className="query-builder__projection__result-modifier-prompt__group__content"
1449
+ <button
1450
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1362
1451
  onClick={openResultSetModifierEditor}
1363
1452
  >
1364
- {tdsState.resultSetModifierState.limit}
1365
- </div>
1453
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1454
+ {tdsState.resultSetModifierState.limit}
1455
+ </div>
1456
+ </button>
1366
1457
  </div>
1367
1458
  )}
1368
1459
  {tdsState.resultSetModifierState.distinct && (
@@ -1370,12 +1461,14 @@ export const QueryBuilderTDSPanel = observer(
1370
1461
  <div className="query-builder__projection__result-modifier-prompt__group__label">
1371
1462
  Eliminate Duplicate Rows
1372
1463
  </div>
1373
- <div
1374
- className="query-builder__projection__result-modifier-prompt__group__content"
1464
+ <button
1465
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1375
1466
  onClick={openResultSetModifierEditor}
1376
1467
  >
1377
- Yes
1378
- </div>
1468
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1469
+ Yes
1470
+ </div>
1471
+ </button>
1379
1472
  </div>
1380
1473
  )}
1381
1474
  {tdsState.resultSetModifierState.sortColumns.length > 0 && (
@@ -1385,13 +1478,15 @@ export const QueryBuilderTDSPanel = observer(
1385
1478
  </div>
1386
1479
  {tdsState.resultSetModifierState.sortColumns.map(
1387
1480
  (columnState) => (
1388
- <div
1389
- className="query-builder__projection__result-modifier-prompt__group__content"
1481
+ <button
1390
1482
  key={columnState.columnState.uuid}
1483
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1391
1484
  onClick={openResultSetModifierEditor}
1392
1485
  >
1393
- {`${columnState.columnState.columnName} ${columnState.sortType}`}
1394
- </div>
1486
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1487
+ {`${columnState.columnState.columnName} ${columnState.sortType}`}
1488
+ </div>
1489
+ </button>
1395
1490
  ),
1396
1491
  )}
1397
1492
  </div>
@@ -1401,12 +1496,14 @@ export const QueryBuilderTDSPanel = observer(
1401
1496
  <div className="query-builder__projection__result-modifier-prompt__group__label">
1402
1497
  Slice
1403
1498
  </div>
1404
- <div
1405
- className="query-builder__projection__result-modifier-prompt__group__content"
1499
+ <button
1500
+ className="query-builder__projection__result-modifier-prompt__header__label editable-value"
1406
1501
  onClick={openResultSetModifierEditor}
1407
1502
  >
1408
- {`${tdsState.resultSetModifierState.slice[0]},${tdsState.resultSetModifierState.slice[1]}`}
1409
- </div>
1503
+ <div className="query-builder__projection__result-modifier-prompt__header__label__title">
1504
+ {`${tdsState.resultSetModifierState.slice[0]},${tdsState.resultSetModifierState.slice[1]}`}
1505
+ </div>
1506
+ </button>
1410
1507
  </div>
1411
1508
  )}
1412
1509
  {tdsState.queryBuilderState.watermarkState.value && (
@@ -45,6 +45,7 @@ import { QueryBuilderTDSState } from '../../../stores/fetch-structure/tds/QueryB
45
45
  import { DEFAULT_LOCALE } from '../../../graph-manager/QueryBuilderConst.js';
46
46
  import {
47
47
  assertErrorThrown,
48
+ isBoolean,
48
49
  isNumber,
49
50
  isString,
50
51
  isValidURL,
@@ -147,6 +148,8 @@ const QueryResultCellRenderer = observer(
147
148
  return Intl.NumberFormat(DEFAULT_LOCALE, {
148
149
  maximumFractionDigits: 4,
149
150
  }).format(Number(cellValue));
151
+ } else if (isBoolean(cellValue)) {
152
+ return String(cellValue);
150
153
  }
151
154
  return cellValue;
152
155
  };
@@ -42,7 +42,6 @@ import {
42
42
  assertErrorThrown,
43
43
  guaranteeNonNullable,
44
44
  filterByType,
45
- isBoolean,
46
45
  } from '@finos/legend-shared';
47
46
  import { forwardRef } from 'react';
48
47
  import {
@@ -127,12 +126,8 @@ export const getRowDataFromExecutionResult = (
127
126
  const row: QueryBuilderTDSRowDataType = {};
128
127
  const cols = executionResult.result.columns;
129
128
  _row.values.forEach((value, colIdx) => {
130
- // `ag-grid` shows `false` value as empty string so we have
131
- // call `.toString()` to avoid this behavior.
132
- // See https://github.com/finos/legend-studio/issues/1008
133
- row[cols[colIdx] as string] = isBoolean(value) ? String(value) : value;
129
+ row[cols[colIdx] as string] = value;
134
130
  });
135
-
136
131
  row.rowNumber = rowIdx;
137
132
  return row;
138
133
  });
@@ -32,7 +32,12 @@ import {
32
32
  } from './QueryBuilderTDSResultShared.js';
33
33
  import { QueryBuilderTDSState } from '../../../stores/fetch-structure/tds/QueryBuilderTDSState.js';
34
34
  import { DEFAULT_LOCALE } from '../../../graph-manager/QueryBuilderConst.js';
35
- import { isNumber, isString, isValidURL } from '@finos/legend-shared';
35
+ import {
36
+ isBoolean,
37
+ isNumber,
38
+ isString,
39
+ isValidURL,
40
+ } from '@finos/legend-shared';
36
41
  import type {
37
42
  QueryBuilderTDSResultCellCoordinate,
38
43
  QueryBuilderTDSResultCellData,
@@ -57,6 +62,8 @@ const QueryResultCellRenderer = observer(
57
62
  return Intl.NumberFormat(DEFAULT_LOCALE, {
58
63
  maximumFractionDigits: 4,
59
64
  }).format(Number(cellValue));
65
+ } else if (isBoolean(cellValue)) {
66
+ return String(cellValue);
60
67
  }
61
68
  return cellValue;
62
69
  };
@@ -28,10 +28,16 @@ export class QueryBuilderConfig {
28
28
  */
29
29
  TEMPORARY__enableGridEnterpriseMode = false;
30
30
 
31
+ /**
32
+ * This is the URL of the LegendAI service
33
+ */
34
+ legendAIServiceURL = '';
35
+
31
36
  static readonly serialization = new SerializationFactory(
32
37
  createModelSchema(QueryBuilderConfig, {
33
38
  TEMPORARY__disableQueryBuilderChat: optional(primitive()),
34
39
  TEMPORARY__enableGridEnterpriseMode: optional(primitive()),
40
+ legendAIServiceURL: optional(primitive()),
35
41
  }),
36
42
  );
37
43
  }
@@ -63,6 +63,7 @@ import {
63
63
  validateMilestoningPropertyExpressionChain,
64
64
  } from './milestoning/QueryBuilderMilestoningHelper.js';
65
65
  import { instanceValue_setValues } from './shared/ValueSpecificationModifierHelper.js';
66
+ import type { QueryBuilderState } from './QueryBuilderState.js';
66
67
 
67
68
  export const getNonCollectionValueSpecificationType = (
68
69
  valueSpecification: ValueSpecification,
@@ -329,6 +330,7 @@ export const buildGenericLambdaFunctionInstanceValue = (
329
330
  export const validatePropertyExpressionChain = (
330
331
  propertyExpression: AbstractPropertyExpression,
331
332
  graph: PureModel,
333
+ queryBuilderState: QueryBuilderState,
332
334
  ): void => {
333
335
  if (
334
336
  propertyExpression.func.value.genericType.value.rawType instanceof Class &&
@@ -355,6 +357,7 @@ export const validatePropertyExpressionChain = (
355
357
  sourceStereotype,
356
358
  targetStereotype,
357
359
  propertyExpression,
360
+ queryBuilderState,
358
361
  );
359
362
  }
360
363
  }
@@ -43,6 +43,7 @@ import type {
43
43
  } from './QueryBuilder_LegendApplicationPlugin_Extension.js';
44
44
 
45
45
  export const QUERY_LOADER_TYPEAHEAD_SEARCH_LIMIT = 50;
46
+ export const QUERY_LOADER_DEFAULT_QUERY_SEARCH_LIMIT = 10;
46
47
 
47
48
  export class QueryLoaderState {
48
49
  readonly applicationStore: GenericLegendApplicationStore;
@@ -147,6 +147,7 @@ export class QueryBuilderTDSState
147
147
  TEMPORARY__showPostFetchStructurePanel: computed,
148
148
  derivations: computed,
149
149
  hasParserError: computed,
150
+ isQueryOptionsSet: computed,
150
151
  addColumn: action,
151
152
  moveColumn: action,
152
153
  removeAllColumns: action,
@@ -361,6 +362,16 @@ export class QueryBuilderTDSState
361
362
  return fetchStructureValidationIssues;
362
363
  }
363
364
 
365
+ get isQueryOptionsSet(): boolean {
366
+ return (
367
+ this.resultSetModifierState.limit !== undefined ||
368
+ this.queryBuilderState.milestoningState.isMilestonedQuery ||
369
+ this.resultSetModifierState.slice !== undefined ||
370
+ this.resultSetModifierState.sortColumns.length > 0 ||
371
+ this.resultSetModifierState.distinct
372
+ );
373
+ }
374
+
364
375
  get tdsColumns(): QueryBuilderTDSColumnState[] {
365
376
  const aggregationStateCols = this.aggregationState.columns.map(
366
377
  (c) => c.projectionColumnState,
@@ -107,7 +107,9 @@ export class QueryBuilderAggregateOperator_Percentile
107
107
  variableName: string,
108
108
  graph: PureModel,
109
109
  ): ValueSpecification {
110
- const percentileValue = this.percentile ?? 0;
110
+ const percentileValue = this.percentile
111
+ ? Number((this.percentile / 100).toFixed(10))
112
+ : 0;
111
113
  const expression = new SimpleFunctionExpression(
112
114
  extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.PERCENTILE),
113
115
  );
@@ -193,7 +195,9 @@ export class QueryBuilderAggregateOperator_Percentile
193
195
  PrimitiveInstanceValue,
194
196
  `Can't process percentile() expression: percentile() expects arugment #2 to be a primitive instance value`,
195
197
  );
196
- currentOperator.percentile = percentile.values[0] as number;
198
+ currentOperator.percentile = parseFloat(
199
+ ((percentile.values[0] as number) * 100).toFixed(10),
200
+ );
197
201
 
198
202
  if (expression.parametersValues.length === 4) {
199
203
  const acending = guaranteeType(
@@ -159,6 +159,7 @@ export const processTDSProjectionColumnPropertyExpression = (
159
159
  validatePropertyExpressionChain(
160
160
  currentPropertyExpression,
161
161
  queryBuilderState.graphManagerState.graph,
162
+ queryBuilderState,
162
163
  );
163
164
  currentPropertyExpression = guaranteeNonNullable(
164
165
  currentPropertyExpression.parametersValues[0],
@@ -309,6 +309,7 @@ const processFilterTree = (
309
309
  validatePropertyExpressionChain(
310
310
  currentPropertyExpression,
311
311
  filterState.queryBuilderState.graphManagerState.graph,
312
+ filterState.queryBuilderState,
312
313
  );
313
314
  }
314
315
  }
@@ -23,18 +23,21 @@ import {
23
23
  MILESTONING_STEREOTYPE,
24
24
  INTERNAL__PropagatedValue,
25
25
  PrimitiveType,
26
+ VariableExpression,
26
27
  } from '@finos/legend-graph';
27
28
  import {
28
29
  UnsupportedOperationError,
29
30
  assertTrue,
30
31
  guaranteeNonNullable,
31
32
  guaranteeType,
33
+ isNonNullable,
32
34
  } from '@finos/legend-shared';
33
35
  import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
34
36
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
35
37
  import type { QueryBuilderDerivedPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
36
38
  import { createSupportedFunctionExpression } from '../shared/ValueSpecificationEditorHelper.js';
37
39
  import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
40
+ import type { LambdaParameterState } from '../shared/LambdaParameterState.js';
38
41
 
39
42
  export class QueryBuilderBitemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
40
43
  getMilestoningDate(index?: number): ValueSpecification | undefined {
@@ -70,6 +73,26 @@ export class QueryBuilderBitemporalMilestoningImplementation extends QueryBuilde
70
73
  this.milestoningState.queryBuilderState.setShowParametersPanel(true);
71
74
  }
72
75
 
76
+ buildParameterStatesFromMilestoningParameters(): LambdaParameterState[] {
77
+ const businessState =
78
+ this.milestoningState.buildParameterStateFromMilestoningParameter(
79
+ this.milestoningState.businessDate &&
80
+ this.milestoningState.businessDate instanceof VariableExpression
81
+ ? this.milestoningState.businessDate.name
82
+ : BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
83
+ );
84
+
85
+ const processingState =
86
+ this.milestoningState.buildParameterStateFromMilestoningParameter(
87
+ this.milestoningState.processingDate &&
88
+ this.milestoningState.processingDate instanceof VariableExpression
89
+ ? this.milestoningState.processingDate.name
90
+ : PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
91
+ );
92
+
93
+ return [businessState, processingState].filter(isNonNullable);
94
+ }
95
+
73
96
  processGetAllParamaters(parameterValues: ValueSpecification[]): void {
74
97
  assertTrue(
75
98
  parameterValues.length === 3,
@@ -22,6 +22,7 @@ import {
22
22
  MILESTONING_STEREOTYPE,
23
23
  INTERNAL__PropagatedValue,
24
24
  PrimitiveType,
25
+ VariableExpression,
25
26
  } from '@finos/legend-graph';
26
27
  import {
27
28
  UnsupportedOperationError,
@@ -32,6 +33,7 @@ import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
32
33
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
33
34
  import { createSupportedFunctionExpression } from '../shared/ValueSpecificationEditorHelper.js';
34
35
  import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
36
+ import type { LambdaParameterState } from '../shared/LambdaParameterState.js';
35
37
 
36
38
  export class QueryBuilderBusinessTemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
37
39
  getMilestoningDate(): ValueSpecification | undefined {
@@ -54,6 +56,17 @@ export class QueryBuilderBusinessTemporalMilestoningImplementation extends Query
54
56
  this.milestoningState.queryBuilderState.setShowParametersPanel(true);
55
57
  }
56
58
 
59
+ buildParameterStatesFromMilestoningParameters(): LambdaParameterState[] {
60
+ const state =
61
+ this.milestoningState.buildParameterStateFromMilestoningParameter(
62
+ this.milestoningState.businessDate &&
63
+ this.milestoningState.businessDate instanceof VariableExpression
64
+ ? this.milestoningState.businessDate.name
65
+ : BUSINESS_DATE_MILESTONING_PROPERTY_NAME,
66
+ );
67
+ return state ? [state] : [];
68
+ }
69
+
57
70
  processGetAllParamaters(parameterValues: ValueSpecification[]): void {
58
71
  assertTrue(
59
72
  parameterValues.length === 2,
@@ -294,6 +294,7 @@ export const validateMilestoningPropertyExpressionChain = (
294
294
  sourceStereotype: MILESTONING_STEREOTYPE | undefined,
295
295
  targetStereotype: MILESTONING_STEREOTYPE,
296
296
  propertyExpression: AbstractPropertyExpression,
297
+ queryBuilderState: QueryBuilderState,
297
298
  ): void => {
298
299
  if (
299
300
  sourceStereotype !== MILESTONING_STEREOTYPE.BITEMPORAL &&
@@ -316,10 +317,54 @@ export const validateMilestoningPropertyExpressionChain = (
316
317
  `Property of milestoning sterotype '${MILESTONING_STEREOTYPE.BITEMPORAL}' should not have more than two parameters`,
317
318
  );
318
319
  }
320
+ queryBuilderState.milestoningState.setProcessingDate(
321
+ propertyExpression.parametersValues[1],
322
+ );
323
+ queryBuilderState.milestoningState.setBusinessDate(
324
+ propertyExpression.parametersValues[2],
325
+ );
319
326
  } else if (propertyExpression.parametersValues.length !== 2) {
320
327
  throw new UnsupportedOperationError(
321
328
  `Property of milestoning sterotype '${targetStereotype}' should have exactly one parameter`,
322
329
  );
323
330
  }
331
+ if (targetStereotype === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL) {
332
+ queryBuilderState.milestoningState.setBusinessDate(
333
+ propertyExpression.parametersValues[1],
334
+ );
335
+ } else if (
336
+ targetStereotype === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL
337
+ ) {
338
+ queryBuilderState.milestoningState.setProcessingDate(
339
+ propertyExpression.parametersValues[1],
340
+ );
341
+ }
342
+ }
343
+ // we still need to do a loose milestoningState initialization for other cases e.g. the getAllVersion is used
344
+ else {
345
+ if (
346
+ propertyExpression.parametersValues.length === 3 &&
347
+ targetStereotype === MILESTONING_STEREOTYPE.BITEMPORAL
348
+ ) {
349
+ queryBuilderState.milestoningState.setProcessingDate(
350
+ propertyExpression.parametersValues[1],
351
+ );
352
+ queryBuilderState.milestoningState.setBusinessDate(
353
+ propertyExpression.parametersValues[2],
354
+ );
355
+ }
356
+ if (propertyExpression.parametersValues.length === 2) {
357
+ if (targetStereotype === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL) {
358
+ queryBuilderState.milestoningState.setBusinessDate(
359
+ propertyExpression.parametersValues[1],
360
+ );
361
+ } else if (
362
+ targetStereotype === MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL
363
+ ) {
364
+ queryBuilderState.milestoningState.setProcessingDate(
365
+ propertyExpression.parametersValues[1],
366
+ );
367
+ }
368
+ }
324
369
  }
325
370
  };
@@ -22,6 +22,7 @@ import type {
22
22
  } from '@finos/legend-graph';
23
23
  import type { QueryBuilderDerivedPropertyExpressionState } from '../QueryBuilderPropertyEditorState.js';
24
24
  import type { QueryBuilderMilestoningState } from './QueryBuilderMilestoningState.js';
25
+ import type { LambdaParameterState } from '../shared/LambdaParameterState.js';
25
26
 
26
27
  export abstract class QueryBuilderMilestoningImplementation {
27
28
  milestoningState: QueryBuilderMilestoningState;
@@ -88,4 +89,6 @@ export abstract class QueryBuilderMilestoningImplementation {
88
89
  idx?: number,
89
90
  derivedPropertyExpressionState?: QueryBuilderDerivedPropertyExpressionState,
90
91
  ): ValueSpecification;
92
+
93
+ abstract buildParameterStatesFromMilestoningParameters(): LambdaParameterState[];
91
94
  }
@@ -75,7 +75,7 @@ export class QueryBuilderMilestoningState implements Hashable {
75
75
  startDate: observable,
76
76
  endDate: observable,
77
77
  showMilestoningEditor: observable,
78
- isMilestonedQuery: computed,
78
+
79
79
  setProcessingDate: action,
80
80
  setBusinessDate: action,
81
81
  setStartDate: action,
@@ -87,6 +87,10 @@ export class QueryBuilderMilestoningState implements Hashable {
87
87
  initializeAllVersionsInRangeParameters: action,
88
88
  clearAllVersionsInRangeParameters: action,
89
89
  clearGetAllParameters: action,
90
+
91
+ isAllVersionsEnabled: computed,
92
+ isAllVersionsInRangeEnabled: computed,
93
+ isMilestonedQuery: computed,
90
94
  hashCode: computed,
91
95
  });
92
96
 
@@ -380,9 +384,9 @@ export class QueryBuilderMilestoningState implements Hashable {
380
384
  this.queryBuilderState.parametersState.parameterStates.find(
381
385
  (p) => p.parameter === this.startDate,
382
386
  );
383
- this.queryBuilderState.parametersState.removeParameter(
384
- guaranteeNonNullable(paramState),
385
- );
387
+ if (paramState) {
388
+ this.queryBuilderState.parametersState.removeParameter(paramState);
389
+ }
386
390
  }
387
391
  if (
388
392
  this.endDate instanceof VariableExpression &&
@@ -394,9 +398,9 @@ export class QueryBuilderMilestoningState implements Hashable {
394
398
  this.queryBuilderState.parametersState.parameterStates.find(
395
399
  (p) => p.parameter === this.endDate,
396
400
  );
397
- this.queryBuilderState.parametersState.removeParameter(
398
- guaranteeNonNullable(paramState),
399
- );
401
+ if (paramState) {
402
+ this.queryBuilderState.parametersState.removeParameter(paramState);
403
+ }
400
404
  }
401
405
  this.setStartDate(undefined);
402
406
  this.setEndDate(undefined);
@@ -422,6 +426,36 @@ export class QueryBuilderMilestoningState implements Hashable {
422
426
  }
423
427
  }
424
428
 
429
+ buildParameterStateFromMilestoningParameter(
430
+ parameterName: string,
431
+ ): LambdaParameterState | undefined {
432
+ const milestoningParameter = new VariableExpression(
433
+ parameterName,
434
+ Multiplicity.ONE,
435
+ GenericTypeExplicitReference.create(new GenericType(PrimitiveType.DATE)),
436
+ );
437
+ const paramState =
438
+ this.queryBuilderState.parametersState.parameterStates.find(
439
+ (p) => p.variableName === parameterName,
440
+ );
441
+ if (paramState) {
442
+ return paramState;
443
+ } else if (
444
+ !this.queryBuilderState.constantState.constants.find(
445
+ (c) => c.variable.name === parameterName,
446
+ )
447
+ ) {
448
+ const variableState = new LambdaParameterState(
449
+ milestoningParameter,
450
+ this.queryBuilderState.observerContext,
451
+ this.queryBuilderState.graphManagerState.graph,
452
+ );
453
+ variableState.mockParameterValue();
454
+ return variableState;
455
+ }
456
+ return undefined;
457
+ }
458
+
425
459
  buildMilestoningParameter(parameterName: string): ValueSpecification {
426
460
  const milestoningParameter = new VariableExpression(
427
461
  parameterName,
@@ -21,6 +21,7 @@ import {
21
21
  type AbstractPropertyExpression,
22
22
  INTERNAL__PropagatedValue,
23
23
  PrimitiveType,
24
+ VariableExpression,
24
25
  } from '@finos/legend-graph';
25
26
  import {
26
27
  UnsupportedOperationError,
@@ -31,6 +32,7 @@ import { getParameterValue } from '../../components/QueryBuilderSideBar.js';
31
32
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../graph/QueryBuilderMetaModelConst.js';
32
33
  import { createSupportedFunctionExpression } from '../shared/ValueSpecificationEditorHelper.js';
33
34
  import { QueryBuilderMilestoningImplementation } from './QueryBuilderMilestoningImplementation.js';
35
+ import type { LambdaParameterState } from '../shared/LambdaParameterState.js';
34
36
 
35
37
  export class QueryBuilderProcessingTemporalMilestoningImplementation extends QueryBuilderMilestoningImplementation {
36
38
  getMilestoningDate(): ValueSpecification | undefined {
@@ -53,6 +55,17 @@ export class QueryBuilderProcessingTemporalMilestoningImplementation extends Que
53
55
  this.milestoningState.queryBuilderState.setShowParametersPanel(true);
54
56
  }
55
57
 
58
+ buildParameterStatesFromMilestoningParameters(): LambdaParameterState[] {
59
+ const state =
60
+ this.milestoningState.buildParameterStateFromMilestoningParameter(
61
+ this.milestoningState.processingDate &&
62
+ this.milestoningState.processingDate instanceof VariableExpression
63
+ ? this.milestoningState.processingDate.name
64
+ : PROCESSING_DATE_MILESTONING_PROPERTY_NAME,
65
+ );
66
+ return state ? [state] : [];
67
+ }
68
+
56
69
  processGetAllParamaters(parameterValues: ValueSpecification[]): void {
57
70
  assertTrue(
58
71
  parameterValues.length === 2,