@finos/legend-query-builder 4.14.75 → 4.14.76

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 (64) hide show
  1. package/lib/components/QueryBuilder_LegendApplicationPlugin.js +1 -1
  2. package/lib/components/QueryBuilder_LegendApplicationPlugin.js.map +1 -1
  3. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  4. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +10 -3
  5. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  6. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  7. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +2 -2
  8. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  9. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  10. package/lib/components/filter/QueryBuilderFilterPanel.js +5 -1
  11. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  12. package/lib/components/result/tds/QueryBuilderTDSGridResult.js +2 -2
  13. package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
  14. package/lib/components/result/tds/QueryBuilderTDSResultShared.d.ts.map +1 -1
  15. package/lib/components/result/tds/QueryBuilderTDSResultShared.js +6 -3
  16. package/lib/components/result/tds/QueryBuilderTDSResultShared.js.map +1 -1
  17. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +1 -1
  18. package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
  19. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  20. package/lib/components/shared/CustomDatePicker.js +6 -3
  21. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  22. package/lib/graph-manager/QueryBuilder_GraphManagerPreset.js +1 -1
  23. package/lib/graph-manager/QueryBuilder_GraphManagerPreset.js.map +1 -1
  24. package/lib/graph-manager/QueryBuilder_PureGraphManagerPlugin.js +1 -1
  25. package/lib/graph-manager/QueryBuilder_PureGraphManagerPlugin.js.map +1 -1
  26. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +1 -1
  27. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  28. package/lib/index.css +2 -2
  29. package/lib/index.css.map +1 -1
  30. package/lib/package.json +2 -2
  31. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  32. package/lib/stores/QueryBuilderState.js.map +1 -1
  33. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +1 -1
  34. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  35. package/lib/stores/QueryBuilderValueSpecificationHelper.js +1 -0
  36. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  37. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts +4 -1
  38. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.map +1 -1
  39. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +22 -11
  40. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  41. package/lib/stores/filter/QueryBuilderFilterState.d.ts +1 -1
  42. package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
  43. package/lib/stores/filter/QueryBuilderFilterState.js +8 -4
  44. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  45. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts.map +1 -1
  46. package/lib/stores/shared/ValueSpecificationModifierHelper.js +1 -3
  47. package/lib/stores/shared/ValueSpecificationModifierHelper.js.map +1 -1
  48. package/package.json +10 -10
  49. package/src/components/QueryBuilder_LegendApplicationPlugin.ts +1 -1
  50. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +24 -2
  51. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +5 -2
  52. package/src/components/filter/QueryBuilderFilterPanel.tsx +10 -1
  53. package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +2 -2
  54. package/src/components/result/tds/QueryBuilderTDSResultShared.tsx +18 -16
  55. package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +1 -1
  56. package/src/components/shared/CustomDatePicker.tsx +17 -15
  57. package/src/graph-manager/QueryBuilder_GraphManagerPreset.ts +1 -1
  58. package/src/graph-manager/QueryBuilder_PureGraphManagerPlugin.ts +1 -1
  59. package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +1 -1
  60. package/src/stores/QueryBuilderState.ts +1 -0
  61. package/src/stores/QueryBuilderValueSpecificationHelper.ts +2 -1
  62. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +39 -10
  63. package/src/stores/filter/QueryBuilderFilterState.ts +11 -3
  64. package/src/stores/shared/ValueSpecificationModifierHelper.ts +0 -1
@@ -1320,21 +1320,23 @@ export const CustomDatePicker: React.FC<{
1320
1320
  const theReservedCustomDateOption = reservedCustomDateOptions.filter(
1321
1321
  (d) => d.value === chosenDatePickerOption.value,
1322
1322
  );
1323
- theReservedCustomDateOption.length > 0
1324
- ? setValueSpecification(
1325
- buildPureAdjustDateFunction(
1326
- guaranteeNonNullable(theReservedCustomDateOption[0]),
1327
- graph,
1328
- observerContext,
1329
- ),
1330
- )
1331
- : setValueSpecification(
1332
- buildPureDateFunctionExpression(
1333
- chosenDatePickerOption,
1334
- graph,
1335
- observerContext,
1336
- ),
1337
- );
1323
+ if (theReservedCustomDateOption.length > 0) {
1324
+ setValueSpecification(
1325
+ buildPureAdjustDateFunction(
1326
+ guaranteeNonNullable(theReservedCustomDateOption[0]),
1327
+ graph,
1328
+ observerContext,
1329
+ ),
1330
+ );
1331
+ } else {
1332
+ setValueSpecification(
1333
+ buildPureDateFunctionExpression(
1334
+ chosenDatePickerOption,
1335
+ graph,
1336
+ observerContext,
1337
+ ),
1338
+ );
1339
+ }
1338
1340
  }
1339
1341
  setDatePickerOption(chosenDatePickerOption);
1340
1342
  };
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import packageJson from '../../package.json' assert { type: 'json' };
17
+ import packageJson from '../../package.json' with { type: 'json' };
18
18
  import { AbstractPreset } from '@finos/legend-shared';
19
19
  import { QueryBuilder_PureProtocolProcessorPlugin } from './protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js';
20
20
  import { QueryBuilder_PureGraphManagerPlugin } from './QueryBuilder_PureGraphManagerPlugin.js';
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import packageJson from '../../package.json' assert { type: 'json' };
17
+ import packageJson from '../../package.json' with { type: 'json' };
18
18
  import {
19
19
  PureGraphManagerPlugin,
20
20
  type PureGraphManagerExtensionBuilder,
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import packageJson from '../../../../package.json' assert { type: 'json' };
17
+ import packageJson from '../../../../package.json' with { type: 'json' };
18
18
  import {
19
19
  V1_buildExistsFunctionExpression,
20
20
  V1_buildFilterFunctionExpression,
@@ -111,6 +111,7 @@ import { QUERY_BUILDER_EVENT } from '../__lib__/QueryBuilderEvent.js';
111
111
  import { QueryBuilderChangeHistoryState } from './QueryBuilderChangeHistoryState.js';
112
112
  import { type QueryBuilderWorkflowState } from './query-workflow/QueryBuilderWorkFlowState.js';
113
113
 
114
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
114
115
  export interface QueryableSourceInfo {}
115
116
 
116
117
  export type QueryableClassMappingRuntimeInfo = QueryableSourceInfo & {
@@ -213,7 +213,7 @@ export const isPropertyExpressionChainOptional = (
213
213
 
214
214
  export const isTypeCompatibleForAssignment = (
215
215
  type: Type | undefined,
216
- assignmentType: Type,
216
+ assignmentType: Type | undefined,
217
217
  ): boolean => {
218
218
  const NUMERIC_PRIMITIVE_TYPES = [
219
219
  PRIMITIVE_TYPE.NUMBER,
@@ -231,6 +231,7 @@ export const isTypeCompatibleForAssignment = (
231
231
  // When changing the return type for LHS, the RHS value should be adjusted accordingly.
232
232
  return (
233
233
  type !== undefined &&
234
+ assignmentType !== undefined &&
234
235
  // Numeric value is handled loosely because of autoboxing
235
236
  // e.g. LHS (integer) = RHS (float) is acceptable
236
237
  ((NUMERIC_PRIMITIVE_TYPES.includes(type.path) &&
@@ -19,13 +19,13 @@ import {
19
19
  type PureModel,
20
20
  type Type,
21
21
  type ValueSpecification,
22
- type VariableExpression,
23
22
  type SimpleFunctionExpression,
24
23
  type ExecutionResultWithMetadata,
25
24
  observe_ValueSpecification,
26
25
  PrimitiveType,
27
26
  CollectionInstanceValue,
28
27
  InstanceValue,
28
+ VariableExpression,
29
29
  } from '@finos/legend-graph';
30
30
  import {
31
31
  type GeneratorFn,
@@ -74,11 +74,13 @@ import type { QueryBuilderTDSColumnState } from '../QueryBuilderTDSColumnState.j
74
74
  import {
75
75
  getCollectionValueSpecificationType,
76
76
  getNonCollectionValueSpecificationType,
77
+ isTypeCompatibleForAssignment,
77
78
  isValidInstanceValue,
78
79
  isValueExpressionReferencedInValue,
79
80
  } from '../../../QueryBuilderValueSpecificationHelper.js';
80
81
  import { buildtdsPropertyExpressionFromColState } from './operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js';
81
82
  import { TDS_COLUMN_GETTER } from '../../../../graph/QueryBuilderMetaModelConst.js';
83
+ import type { QueryBuilderFilterTreeNodeData } from '../../../filter/QueryBuilderFilterState.js';
82
84
 
83
85
  export enum QUERY_BUILDER_POST_FILTER_DND_TYPE {
84
86
  GROUP_CONDITION = 'QUERY_BUILDER_POST_FILTER_DND_TYPE.GROUP_CONDITION',
@@ -1012,15 +1014,45 @@ export class QueryBuilderPostFilterState
1012
1014
  );
1013
1015
  }
1014
1016
 
1017
+ isInvalidValueSpecPostFilterValue(
1018
+ node: QueryBuilderPostFilterTreeNodeData,
1019
+ ): boolean {
1020
+ return (
1021
+ node instanceof QueryBuilderPostFilterTreeConditionNodeData &&
1022
+ node.condition.rightConditionValue instanceof
1023
+ PostFilterValueSpecConditionValueState &&
1024
+ ((node.condition.rightConditionValue.value instanceof InstanceValue &&
1025
+ !isValidInstanceValue(node.condition.rightConditionValue.value)) ||
1026
+ (node.condition.rightConditionValue.value instanceof
1027
+ VariableExpression &&
1028
+ !isTypeCompatibleForAssignment(
1029
+ node.condition.leftConditionValue.getColumnType(),
1030
+ node.condition.rightConditionValue.type,
1031
+ )))
1032
+ );
1033
+ }
1034
+
1035
+ isInvalidTDSColumnPostFilterValue(
1036
+ node: QueryBuilderFilterTreeNodeData,
1037
+ ): boolean {
1038
+ return (
1039
+ node instanceof QueryBuilderPostFilterTreeConditionNodeData &&
1040
+ node.condition.rightConditionValue instanceof
1041
+ PostFilterTDSColumnValueConditionValueState &&
1042
+ !isTypeCompatibleForAssignment(
1043
+ node.condition.leftConditionValue.getColumnType(),
1044
+ node.condition.rightConditionValue.type,
1045
+ )
1046
+ );
1047
+ }
1048
+
1015
1049
  get allValidationIssues(): string[] {
1016
1050
  const validationIssues: string[] = [];
1017
1051
  Array.from(this.nodes.values()).forEach((node) => {
1018
1052
  if (node instanceof QueryBuilderPostFilterTreeConditionNodeData) {
1019
1053
  if (
1020
- node.condition.rightConditionValue instanceof
1021
- PostFilterValueSpecConditionValueState &&
1022
- node.condition.rightConditionValue.value instanceof InstanceValue &&
1023
- !isValidInstanceValue(node.condition.rightConditionValue.value)
1054
+ this.isInvalidValueSpecPostFilterValue(node) ||
1055
+ this.isInvalidTDSColumnPostFilterValue(node)
1024
1056
  ) {
1025
1057
  validationIssues.push(
1026
1058
  `Filter value for ${node.condition.leftConditionValue.columnName} is missing or invalid`,
@@ -1043,11 +1075,8 @@ export class QueryBuilderPostFilterState
1043
1075
  get hasInvalidFilterValues(): boolean {
1044
1076
  return Array.from(this.nodes.values()).some(
1045
1077
  (node) =>
1046
- node instanceof QueryBuilderPostFilterTreeConditionNodeData &&
1047
- node.condition.rightConditionValue instanceof
1048
- PostFilterValueSpecConditionValueState &&
1049
- node.condition.rightConditionValue.value instanceof InstanceValue &&
1050
- !isValidInstanceValue(node.condition.rightConditionValue.value),
1078
+ this.isInvalidValueSpecPostFilterValue(node) ||
1079
+ this.isInvalidTDSColumnPostFilterValue(node),
1051
1080
  );
1052
1081
  }
1053
1082
 
@@ -38,7 +38,6 @@ import { QueryBuilderPropertyExpressionState } from '../QueryBuilderPropertyEdit
38
38
  import type { QueryBuilderState } from '../QueryBuilderState.js';
39
39
  import {
40
40
  type ValueSpecification,
41
- type VariableExpression,
42
41
  type Type,
43
42
  type ExecutionResultWithMetadata,
44
43
  AbstractPropertyExpression,
@@ -46,6 +45,7 @@ import {
46
45
  CollectionInstanceValue,
47
46
  InstanceValue,
48
47
  SimpleFunctionExpression,
48
+ VariableExpression,
49
49
  matchFunctionName,
50
50
  } from '@finos/legend-graph';
51
51
  import { DEFAULT_LAMBDA_VARIABLE_NAME } from '../QueryBuilderConfig.js';
@@ -61,6 +61,7 @@ import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../QueryBuilderStateHashUtil
61
61
  import {
62
62
  getCollectionValueSpecificationType,
63
63
  getNonCollectionValueSpecificationType,
64
+ isTypeCompatibleForAssignment,
64
65
  isValidInstanceValue,
65
66
  isValueExpressionReferencedInValue,
66
67
  } from '../QueryBuilderValueSpecificationHelper.js';
@@ -1186,8 +1187,15 @@ export class QueryBuilderFilterState
1186
1187
  node instanceof QueryBuilderFilterTreeConditionNodeData &&
1187
1188
  node.condition.rightConditionValue instanceof
1188
1189
  FilterValueSpecConditionValueState &&
1189
- node.condition.rightConditionValue.value instanceof InstanceValue &&
1190
- !isValidInstanceValue(node.condition.rightConditionValue.value)
1190
+ ((node.condition.rightConditionValue.value instanceof InstanceValue &&
1191
+ !isValidInstanceValue(node.condition.rightConditionValue.value)) ||
1192
+ (node.condition.rightConditionValue.value instanceof
1193
+ VariableExpression &&
1194
+ !isTypeCompatibleForAssignment(
1195
+ node.condition.propertyExpressionState.propertyExpression.func.value
1196
+ .genericType.value.rawType,
1197
+ node.condition.rightConditionValue.value.genericType?.value.rawType,
1198
+ )))
1191
1199
  );
1192
1200
  }
1193
1201
 
@@ -55,7 +55,6 @@ export const valueSpecification_setMultiplicity = action(
55
55
  export const simpleFunctionExpression_setFunc = action(
56
56
  (
57
57
  target: SimpleFunctionExpression,
58
- // eslint-disable-next-line @typescript-eslint/ban-types
59
58
  val: PackageableElementReference<Function> | undefined,
60
59
  ): void => {
61
60
  target.func = val ? observe_PackageableElementReference(val) : undefined;