@finos/legend-query-builder 1.0.3 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
  2. package/lib/components/QueryBuilderConstantExpressionPanel.js +3 -3
  3. package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
  4. package/lib/components/QueryBuilderParametersPanel.js +2 -2
  5. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  6. package/lib/components/QueryBuilderPropertyExpressionEditor.js +5 -6
  7. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  8. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  9. package/lib/components/QueryBuilderResultPanel.js +7 -12
  10. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  11. package/lib/components/QueryBuilder_LegendApplicationPlugin.d.ts.map +1 -1
  12. package/lib/components/QueryBuilder_LegendApplicationPlugin.js +1 -0
  13. package/lib/components/QueryBuilder_LegendApplicationPlugin.js.map +1 -1
  14. package/lib/components/explorer/QueryBuilderExplorerPanel.d.ts.map +1 -1
  15. package/lib/components/explorer/QueryBuilderExplorerPanel.js +6 -6
  16. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  17. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  18. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +3 -5
  19. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  20. package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
  21. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +5 -6
  22. package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
  23. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +1 -1
  24. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  25. package/lib/components/filter/QueryBuilderFilterPanel.js +1 -1
  26. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  27. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
  28. package/lib/components/shared/BasicValueSpecificationEditor.js +87 -76
  29. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
  30. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
  31. package/lib/components/shared/CustomDatePicker.js +13 -14
  32. package/lib/components/shared/CustomDatePicker.js.map +1 -1
  33. package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
  34. package/lib/components/watermark/QueryBuilderWatermark.js +1 -1
  35. package/lib/components/watermark/QueryBuilderWatermark.js.map +1 -1
  36. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts +1 -0
  37. package/lib/graphManager/QueryBuilderSupportedFunctions.d.ts.map +1 -1
  38. package/lib/graphManager/QueryBuilderSupportedFunctions.js +1 -0
  39. package/lib/graphManager/QueryBuilderSupportedFunctions.js.map +1 -1
  40. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  41. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +8 -8
  42. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  43. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +17 -26
  44. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  45. package/lib/index.css +1 -17
  46. package/lib/index.css.map +1 -1
  47. package/lib/package.json +12 -11
  48. package/lib/stores/QueryBuilderChangeDetectionState.d.ts +4 -4
  49. package/lib/stores/QueryBuilderChangeDetectionState.d.ts.map +1 -1
  50. package/lib/stores/QueryBuilderChangeDetectionState.js +9 -9
  51. package/lib/stores/QueryBuilderChangeDetectionState.js.map +1 -1
  52. package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
  53. package/lib/stores/QueryBuilderConstantsState.js +4 -4
  54. package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
  55. package/lib/stores/QueryBuilderPropertyEditorState.d.ts +2 -3
  56. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  57. package/lib/stores/QueryBuilderPropertyEditorState.js +9 -12
  58. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  59. package/lib/stores/QueryBuilderState.d.ts +4 -2
  60. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  61. package/lib/stores/QueryBuilderState.js +7 -7
  62. package/lib/stores/QueryBuilderState.js.map +1 -1
  63. package/lib/stores/QueryBuilderStateBuilder.d.ts +2 -2
  64. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  65. package/lib/stores/QueryBuilderStateBuilder.js +10 -12
  66. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  67. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +1 -1
  68. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
  69. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +9 -1
  70. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  71. package/lib/stores/QueryBuilderValueSpecificationHelper.js +22 -1
  72. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  73. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.d.ts.map +1 -1
  74. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +2 -2
  75. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
  76. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +1 -1
  77. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
  78. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts +1 -1
  79. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.d.ts.map +1 -1
  80. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js +22 -15
  81. package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
  82. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
  83. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +2 -1
  84. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
  85. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
  86. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +2 -1
  87. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  88. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
  89. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +6 -3
  90. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
  91. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
  92. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +4 -2
  93. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  94. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
  95. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +4 -2
  96. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  97. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
  98. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +2 -1
  99. package/lib/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  100. package/lib/stores/filter/QueryBuilderFilterState.js +2 -2
  101. package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
  102. package/lib/stores/filter/QueryBuilderFilterStateBuilder.d.ts.map +1 -1
  103. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js +1 -14
  104. package/lib/stores/filter/QueryBuilderFilterStateBuilder.js.map +1 -1
  105. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts.map +1 -1
  106. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js +9 -2
  107. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js.map +1 -1
  108. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
  109. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +1 -1
  110. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
  111. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
  112. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +1 -1
  113. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
  114. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
  115. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +4 -3
  116. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
  117. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
  118. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +2 -2
  119. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
  120. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
  121. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +2 -2
  122. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
  123. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
  124. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +2 -2
  125. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
  126. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
  127. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +2 -2
  128. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
  129. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
  130. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +1 -1
  131. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
  132. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
  133. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +3 -3
  134. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  135. package/lib/stores/shared/LambdaParameterState.d.ts +2 -2
  136. package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -1
  137. package/lib/stores/shared/LambdaParameterState.js +5 -5
  138. package/lib/stores/shared/LambdaParameterState.js.map +1 -1
  139. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +4 -4
  140. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
  141. package/lib/stores/shared/ValueSpecificationEditorHelper.js +11 -15
  142. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
  143. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts +8 -8
  144. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts.map +1 -1
  145. package/lib/stores/shared/ValueSpecificationModifierHelper.js +20 -17
  146. package/lib/stores/shared/ValueSpecificationModifierHelper.js.map +1 -1
  147. package/lib/stores/watermark/QueryBuilderWatermarkState.d.ts.map +1 -1
  148. package/lib/stores/watermark/QueryBuilderWatermarkState.js +1 -1
  149. package/lib/stores/watermark/QueryBuilderWatermarkState.js.map +1 -1
  150. package/package.json +19 -18
  151. package/src/components/QueryBuilderConstantExpressionPanel.tsx +3 -1
  152. package/src/components/QueryBuilderParametersPanel.tsx +2 -2
  153. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +6 -6
  154. package/src/components/QueryBuilderResultPanel.tsx +18 -14
  155. package/src/components/QueryBuilder_LegendApplicationPlugin.ts +1 -0
  156. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +10 -11
  157. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +7 -5
  158. package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +9 -6
  159. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +1 -1
  160. package/src/components/filter/QueryBuilderFilterPanel.tsx +1 -1
  161. package/src/components/shared/BasicValueSpecificationEditor.tsx +180 -106
  162. package/src/components/shared/CustomDatePicker.tsx +54 -26
  163. package/src/components/watermark/QueryBuilderWatermark.tsx +1 -3
  164. package/src/graphManager/QueryBuilderSupportedFunctions.ts +4 -0
  165. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +1 -1
  166. package/src/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +67 -68
  167. package/src/stores/QueryBuilderChangeDetectionState.ts +13 -11
  168. package/src/stores/QueryBuilderConstantsState.ts +4 -3
  169. package/src/stores/QueryBuilderPropertyEditorState.ts +17 -13
  170. package/src/stores/QueryBuilderState.ts +7 -9
  171. package/src/stores/QueryBuilderStateBuilder.ts +10 -12
  172. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +1 -1
  173. package/src/stores/QueryBuilderValueSpecificationHelper.ts +36 -0
  174. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +10 -2
  175. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +1 -1
  176. package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterStateBuilder.ts +26 -20
  177. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +2 -0
  178. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +2 -0
  179. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +14 -3
  180. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +4 -0
  181. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +4 -0
  182. package/src/stores/fetch-structure/tds/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +2 -0
  183. package/src/stores/filter/QueryBuilderFilterState.ts +2 -2
  184. package/src/stores/filter/QueryBuilderFilterStateBuilder.ts +0 -20
  185. package/src/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.ts +17 -4
  186. package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +1 -0
  187. package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +1 -0
  188. package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +12 -3
  189. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +2 -0
  190. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +2 -0
  191. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +2 -0
  192. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +2 -0
  193. package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +1 -0
  194. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +3 -9
  195. package/src/stores/shared/LambdaParameterState.ts +9 -5
  196. package/src/stores/shared/ValueSpecificationEditorHelper.ts +24 -9
  197. package/src/stores/shared/ValueSpecificationModifierHelper.ts +42 -20
  198. package/src/stores/watermark/QueryBuilderWatermarkState.ts +1 -4
@@ -298,10 +298,18 @@ export const addQueryBuilderPropertyNode = (
298
298
  treeData.nodes.set(childNode.id, childNode);
299
299
  if (parentNode) {
300
300
  addUniqueEntry(parentNode.childrenIds, childNode.id);
301
- graphFetchTree_addSubTree(parentNode.tree, childNode.tree);
301
+ graphFetchTree_addSubTree(
302
+ parentNode.tree,
303
+ childNode.tree,
304
+ queryBuilderState.observerContext,
305
+ );
302
306
  } else {
303
307
  addUniqueEntry(treeData.rootIds, childNode.id);
304
- graphFetchTree_addSubTree(treeData.tree, childNode.tree);
308
+ graphFetchTree_addSubTree(
309
+ treeData.tree,
310
+ childNode.tree,
311
+ queryBuilderState.observerContext,
312
+ );
305
313
  }
306
314
  }
307
315
  };
@@ -410,7 +410,7 @@ export class PostFilterConditionState implements Hashable {
410
410
  this.value = val
411
411
  ? observe_ValueSpecification(
412
412
  val,
413
- this.postFilterState.tdsState.queryBuilderState.observableContext,
413
+ this.postFilterState.tdsState.queryBuilderState.observerContext,
414
414
  )
415
415
  : undefined;
416
416
  }
@@ -22,8 +22,7 @@ import {
22
22
  matchFunctionName,
23
23
  VariableExpression,
24
24
  FunctionExpression,
25
- SimpleFunctionExpression,
26
- MINUS_STRING,
25
+ type SimpleFunctionExpression,
27
26
  } from '@finos/legend-graph';
28
27
  import {
29
28
  assertTrue,
@@ -50,6 +49,7 @@ import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../../graphManager/Quer
50
49
  import type { QueryBuilderState } from '../../../QueryBuilderState.js';
51
50
  import { QueryBuilderTDSState } from '../QueryBuilderTDSState.js';
52
51
  import { toGroupOperation } from '../../../QueryBuilderGroupOperationHelper.js';
52
+ import { simplifyValueExpression } from '../../../QueryBuilderValueSpecificationHelper.js';
53
53
 
54
54
  const findProjectionColumnState = (
55
55
  propertyExpression: AbstractPropertyExpression,
@@ -151,11 +151,17 @@ export const buildPostFilterConditionState = (
151
151
 
152
152
  // get operation value specification
153
153
  const value = expression.parametersValues[1];
154
+
154
155
  // create state
155
156
  postConditionState = new PostFilterConditionState(
156
157
  postFilterState,
157
158
  columnState,
158
- value,
159
+ value
160
+ ? simplifyValueExpression(
161
+ value,
162
+ postFilterState.tdsState.queryBuilderState.observerContext,
163
+ )
164
+ : undefined,
159
165
  operator,
160
166
  );
161
167
 
@@ -179,23 +185,23 @@ const processPostFilterTree = (
179
185
  postFilterState: QueryBuilderPostFilterState,
180
186
  parentPostFilterNodeId: string | undefined,
181
187
  ): void => {
182
- // NOTE: This checks if the expression is a simple function expression of Minus
183
- // since negative numbers are returned as a SimpleFunctionExpression of minus(number)
184
- // rather than a PrimitiveInstanceValue of -number, so here
185
- // we replace the parameter value of the expression directly with a PrimitiveInstanceValue
186
- if (
187
- expression.parametersValues[1] instanceof SimpleFunctionExpression &&
188
- expression.parametersValues[1].functionName === MINUS_STRING &&
189
- expression.parametersValues[1].parametersValues[0] instanceof
190
- PrimitiveInstanceValue
191
- ) {
192
- expression.parametersValues[1].parametersValues[0].values[0] =
193
- parseFloat(
194
- expression.parametersValues[1].parametersValues[0].values[0] as string,
195
- ) * -1;
196
- expression.parametersValues[1] =
197
- expression.parametersValues[1].parametersValues[0];
198
- }
188
+ // // NOTE: This checks if the expression is a simple function expression of Minus
189
+ // // since negative numbers are returned as a SimpleFunctionExpression of minus(number)
190
+ // // rather than a PrimitiveInstanceValue of -number, so here
191
+ // // we replace the parameter value of the expression directly with a PrimitiveInstanceValue
192
+ // if (
193
+ // expression.parametersValues[1] instanceof SimpleFunctionExpression &&
194
+ // expression.parametersValues[1].functionName === MINUS_STRING &&
195
+ // expression.parametersValues[1].parametersValues[0] instanceof
196
+ // PrimitiveInstanceValue
197
+ // ) {
198
+ // expression.parametersValues[1].parametersValues[0].values[0] =
199
+ // parseFloat(
200
+ // expression.parametersValues[1].parametersValues[0].values[0] as string,
201
+ // ) * -1;
202
+ // expression.parametersValues[1] =
203
+ // expression.parametersValues[1].parametersValues[0];
204
+ // }
199
205
 
200
206
  const parentNode = parentPostFilterNodeId
201
207
  ? postFilterState.getNode(parentPostFilterNodeId)
@@ -79,6 +79,8 @@ export class QueryBuilderPostFilterOperator_Contain
79
79
  .graphManagerState.graph,
80
80
  propertyType.path,
81
81
  generateDefaultValueForPrimitiveType(propertyType.path),
82
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
83
+ .observerContext,
82
84
  );
83
85
  }
84
86
  default:
@@ -75,6 +75,8 @@ export class QueryBuilderPostFilterOperator_EndWith
75
75
  .graphManagerState.graph,
76
76
  propertyType.path,
77
77
  generateDefaultValueForPrimitiveType(propertyType.path),
78
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
79
+ .observerContext,
78
80
  );
79
81
  }
80
82
  default:
@@ -117,6 +117,8 @@ export class QueryBuilderPostFilterOperator_Equal
117
117
  .graphManagerState.graph,
118
118
  propertyType.path,
119
119
  generateDefaultValueForPrimitiveType(propertyType.path),
120
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
121
+ .observerContext,
120
122
  );
121
123
  }
122
124
  case PRIMITIVE_TYPE.DATE: {
@@ -125,6 +127,8 @@ export class QueryBuilderPostFilterOperator_Equal
125
127
  .graphManagerState.graph,
126
128
  PRIMITIVE_TYPE.STRICTDATE,
127
129
  generateDefaultValueForPrimitiveType(propertyType.path),
130
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
131
+ .observerContext,
128
132
  );
129
133
  }
130
134
  default:
@@ -135,9 +139,16 @@ export class QueryBuilderPostFilterOperator_Equal
135
139
  new GenericType(propertyType),
136
140
  ),
137
141
  );
138
- instanceValue_setValues(enumValueInstanceValue, [
139
- EnumValueExplicitReference.create(propertyType.values[0] as Enum),
140
- ]);
142
+ instanceValue_setValues(
143
+ enumValueInstanceValue,
144
+ [
145
+ EnumValueExplicitReference.create(
146
+ propertyType.values[0] as Enum,
147
+ ),
148
+ ],
149
+ postFilterConditionState.postFilterState.tdsState
150
+ .queryBuilderState.observerContext,
151
+ );
141
152
  return enumValueInstanceValue;
142
153
  }
143
154
  throw new UnsupportedOperationError(
@@ -95,6 +95,8 @@ export class QueryBuilderPostFilterOperator_GreaterThan
95
95
  .graphManagerState.graph,
96
96
  propertyType.path,
97
97
  generateDefaultValueForPrimitiveType(propertyType.path),
98
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
99
+ .observerContext,
98
100
  );
99
101
  }
100
102
  case PRIMITIVE_TYPE.DATE: {
@@ -103,6 +105,8 @@ export class QueryBuilderPostFilterOperator_GreaterThan
103
105
  .graphManagerState.graph,
104
106
  PRIMITIVE_TYPE.STRICTDATE,
105
107
  generateDefaultValueForPrimitiveType(propertyType.path),
108
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
109
+ .observerContext,
106
110
  );
107
111
  }
108
112
  default:
@@ -95,6 +95,8 @@ export class QueryBuilderPostFilterOperator_LessThan
95
95
  .graphManagerState.graph,
96
96
  propertyType.path,
97
97
  generateDefaultValueForPrimitiveType(propertyType.path),
98
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
99
+ .observerContext,
98
100
  );
99
101
  }
100
102
  case PRIMITIVE_TYPE.DATE: {
@@ -103,6 +105,8 @@ export class QueryBuilderPostFilterOperator_LessThan
103
105
  .graphManagerState.graph,
104
106
  PRIMITIVE_TYPE.STRICTDATE,
105
107
  generateDefaultValueForPrimitiveType(propertyType.path),
108
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
109
+ .observerContext,
106
110
  );
107
111
  }
108
112
  default:
@@ -76,6 +76,8 @@ export class QueryBuilderPostFilterOperator_StartWith
76
76
  .graphManagerState.graph,
77
77
  propertyType.path,
78
78
  generateDefaultValueForPrimitiveType(propertyType.path),
79
+ postFilterConditionState.postFilterState.tdsState.queryBuilderState
80
+ .observerContext,
79
81
  );
80
82
  }
81
83
  default:
@@ -167,7 +167,7 @@ export class FilterConditionState implements Hashable {
167
167
  // observe the property expression
168
168
  observe_ValueSpecification(
169
169
  propertyExpression,
170
- this.filterState.queryBuilderState.observableContext,
170
+ this.filterState.queryBuilderState.observerContext,
171
171
  );
172
172
 
173
173
  this.propertyExpressionState = new QueryBuilderPropertyExpressionState(
@@ -204,7 +204,7 @@ export class FilterConditionState implements Hashable {
204
204
  this.value = val
205
205
  ? observe_ValueSpecification(
206
206
  val,
207
- this.filterState.queryBuilderState.observableContext,
207
+ this.filterState.queryBuilderState.observerContext,
208
208
  )
209
209
  : undefined;
210
210
  }
@@ -18,8 +18,6 @@ import {
18
18
  AbstractPropertyExpression,
19
19
  LambdaFunctionInstanceValue,
20
20
  matchFunctionName,
21
- MINUS_STRING,
22
- PrimitiveInstanceValue,
23
21
  SimpleFunctionExpression,
24
22
  VariableExpression,
25
23
  } from '@finos/legend-graph';
@@ -46,24 +44,6 @@ const processFilterTree = (
46
44
  filterState: QueryBuilderFilterState,
47
45
  parentFilterNodeId: string | undefined,
48
46
  ): void => {
49
- // NOTE: This checks if the expression is a simple function expression of Minus
50
- // since negative numbers are returned as a SimpleFunctionExpression of minus(number)
51
- // rather than a PrimitiveInstanceValue of -number, so here
52
- // we replace the parameter value of the expression directly with a PrimitiveInstanceValue
53
- if (
54
- expression.parametersValues[1] instanceof SimpleFunctionExpression &&
55
- expression.parametersValues[1].functionName === MINUS_STRING &&
56
- expression.parametersValues[1].parametersValues[0] instanceof
57
- PrimitiveInstanceValue
58
- ) {
59
- expression.parametersValues[1].parametersValues[0].values[0] =
60
- parseFloat(
61
- expression.parametersValues[1].parametersValues[0].values[0] as string,
62
- ) * -1;
63
- expression.parametersValues[1] =
64
- expression.parametersValues[1].parametersValues[0];
65
- }
66
-
67
47
  const parentNode = parentFilterNodeId
68
48
  ? filterState.getNode(parentFilterNodeId)
69
49
  : undefined;
@@ -35,7 +35,10 @@ import {
35
35
  type QueryBuilderFilterState,
36
36
  } from '../QueryBuilderFilterState.js';
37
37
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graphManager/QueryBuilderSupportedFunctions.js';
38
- import { buildGenericLambdaFunctionInstanceValue } from '../../QueryBuilderValueSpecificationHelper.js';
38
+ import {
39
+ buildGenericLambdaFunctionInstanceValue,
40
+ simplifyValueExpression,
41
+ } from '../../QueryBuilderValueSpecificationHelper.js';
39
42
  import type { QueryBuilderFilterOperator } from '../QueryBuilderFilterOperator.js';
40
43
  import { buildPropertyExpressionChain } from '../../QueryBuilderValueSpecificationBuilderHelper.js';
41
44
 
@@ -488,9 +491,19 @@ export const buildFilterConditionState = (
488
491
  )}() expression: property is not compatible with operator`,
489
492
  );
490
493
  filterConditionState.setOperator(operator);
491
- filterConditionState.setValue(
492
- hasNoValue ? undefined : mainExpressionWithOperator.parametersValues[1],
493
- );
494
+
495
+ // value
496
+ const value = mainExpressionWithOperator.parametersValues[1];
497
+ if (hasNoValue || !value) {
498
+ filterConditionState.setValue(undefined);
499
+ } else {
500
+ filterConditionState.setValue(
501
+ simplifyValueExpression(
502
+ value,
503
+ filterConditionState.filterState.queryBuilderState.observerContext,
504
+ ),
505
+ );
506
+ }
494
507
  if (!operator.isCompatibleWithFilterConditionValue(filterConditionState)) {
495
508
  filterConditionState.setValue(
496
509
  operator.getDefaultFilterConditionValue(filterConditionState),
@@ -84,6 +84,7 @@ export class QueryBuilderFilterOperator_Contain
84
84
  .graph,
85
85
  propertyType.path,
86
86
  generateDefaultValueForPrimitiveType(propertyType.path),
87
+ filterConditionState.filterState.queryBuilderState.observerContext,
87
88
  );
88
89
  }
89
90
  default:
@@ -84,6 +84,7 @@ export class QueryBuilderFilterOperator_EndWith
84
84
  .graph,
85
85
  propertyType.path,
86
86
  generateDefaultValueForPrimitiveType(propertyType.path),
87
+ filterConditionState.filterState.queryBuilderState.observerContext,
87
88
  );
88
89
  }
89
90
  default:
@@ -118,6 +118,7 @@ export class QueryBuilderFilterOperator_Equal
118
118
  .graph,
119
119
  propertyType.path,
120
120
  generateDefaultValueForPrimitiveType(propertyType.path),
121
+ filterConditionState.filterState.queryBuilderState.observerContext,
121
122
  );
122
123
  }
123
124
  case PRIMITIVE_TYPE.DATE: {
@@ -126,6 +127,7 @@ export class QueryBuilderFilterOperator_Equal
126
127
  .graph,
127
128
  PRIMITIVE_TYPE.STRICTDATE,
128
129
  generateDefaultValueForPrimitiveType(propertyType.path),
130
+ filterConditionState.filterState.queryBuilderState.observerContext,
129
131
  );
130
132
  }
131
133
  default:
@@ -136,9 +138,16 @@ export class QueryBuilderFilterOperator_Equal
136
138
  new GenericType(propertyType),
137
139
  ),
138
140
  );
139
- instanceValue_setValues(enumValueInstanceValue, [
140
- EnumValueExplicitReference.create(propertyType.values[0] as Enum),
141
- ]);
141
+ instanceValue_setValues(
142
+ enumValueInstanceValue,
143
+ [
144
+ EnumValueExplicitReference.create(
145
+ propertyType.values[0] as Enum,
146
+ ),
147
+ ],
148
+ filterConditionState.filterState.queryBuilderState
149
+ .observerContext,
150
+ );
142
151
  return enumValueInstanceValue;
143
152
  }
144
153
  throw new UnsupportedOperationError(
@@ -101,6 +101,7 @@ export class QueryBuilderFilterOperator_GreaterThan
101
101
  .graph,
102
102
  propertyType.path,
103
103
  generateDefaultValueForPrimitiveType(propertyType.path),
104
+ filterConditionState.filterState.queryBuilderState.observerContext,
104
105
  );
105
106
  }
106
107
  case PRIMITIVE_TYPE.DATE: {
@@ -109,6 +110,7 @@ export class QueryBuilderFilterOperator_GreaterThan
109
110
  .graph,
110
111
  PRIMITIVE_TYPE.STRICTDATE,
111
112
  generateDefaultValueForPrimitiveType(propertyType.path),
113
+ filterConditionState.filterState.queryBuilderState.observerContext,
112
114
  );
113
115
  }
114
116
  default:
@@ -101,6 +101,7 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
101
101
  .graph,
102
102
  propertyType.path,
103
103
  generateDefaultValueForPrimitiveType(propertyType.path),
104
+ filterConditionState.filterState.queryBuilderState.observerContext,
104
105
  );
105
106
  }
106
107
  case PRIMITIVE_TYPE.DATE: {
@@ -109,6 +110,7 @@ export class QueryBuilderFilterOperator_GreaterThanEqual
109
110
  .graph,
110
111
  PRIMITIVE_TYPE.STRICTDATE,
111
112
  generateDefaultValueForPrimitiveType(propertyType.path),
113
+ filterConditionState.filterState.queryBuilderState.observerContext,
112
114
  );
113
115
  }
114
116
  default:
@@ -101,6 +101,7 @@ export class QueryBuilderFilterOperator_LessThan
101
101
  .graph,
102
102
  propertyType.path,
103
103
  generateDefaultValueForPrimitiveType(propertyType.path),
104
+ filterConditionState.filterState.queryBuilderState.observerContext,
104
105
  );
105
106
  }
106
107
  case PRIMITIVE_TYPE.DATE: {
@@ -109,6 +110,7 @@ export class QueryBuilderFilterOperator_LessThan
109
110
  .graph,
110
111
  PRIMITIVE_TYPE.STRICTDATE,
111
112
  generateDefaultValueForPrimitiveType(propertyType.path),
113
+ filterConditionState.filterState.queryBuilderState.observerContext,
112
114
  );
113
115
  }
114
116
  default:
@@ -101,6 +101,7 @@ export class QueryBuilderFilterOperator_LessThanEqual
101
101
  .graph,
102
102
  propertyType.path,
103
103
  generateDefaultValueForPrimitiveType(propertyType.path),
104
+ filterConditionState.filterState.queryBuilderState.observerContext,
104
105
  );
105
106
  }
106
107
  case PRIMITIVE_TYPE.DATE: {
@@ -109,6 +110,7 @@ export class QueryBuilderFilterOperator_LessThanEqual
109
110
  .graph,
110
111
  PRIMITIVE_TYPE.STRICTDATE,
111
112
  generateDefaultValueForPrimitiveType(propertyType.path),
113
+ filterConditionState.filterState.queryBuilderState.observerContext,
112
114
  );
113
115
  }
114
116
  default:
@@ -84,6 +84,7 @@ export class QueryBuilderFilterOperator_StartWith
84
84
  .graph,
85
85
  propertyType.path,
86
86
  generateDefaultValueForPrimitiveType(propertyType.path),
87
+ filterConditionState.filterState.queryBuilderState.observerContext,
87
88
  );
88
89
  }
89
90
  default:
@@ -114,19 +114,13 @@ export class QueryBuilderMilestoningState implements Hashable {
114
114
 
115
115
  setProcessingDate(val: ValueSpecification | undefined): void {
116
116
  this.processingDate = val
117
- ? observe_ValueSpecification(
118
- val,
119
- this.queryBuilderState.observableContext,
120
- )
117
+ ? observe_ValueSpecification(val, this.queryBuilderState.observerContext)
121
118
  : val;
122
119
  }
123
120
 
124
121
  setBusinessDate(val: ValueSpecification | undefined): void {
125
122
  this.businessDate = val
126
- ? observe_ValueSpecification(
127
- val,
128
- this.queryBuilderState.observableContext,
129
- )
123
+ ? observe_ValueSpecification(val, this.queryBuilderState.observerContext)
130
124
  : val;
131
125
  }
132
126
 
@@ -165,7 +159,7 @@ export class QueryBuilderMilestoningState implements Hashable {
165
159
  ) {
166
160
  const variableState = new LambdaParameterState(
167
161
  milestoningParameter,
168
- this.queryBuilderState.observableContext,
162
+ this.queryBuilderState.observerContext,
169
163
  this.queryBuilderState.graphManagerState.graph,
170
164
  );
171
165
  variableState.mockParameterValue();
@@ -201,13 +201,13 @@ export class LambdaParameterState implements Hashable {
201
201
  readonly uuid = uuid();
202
202
  readonly parameter: VariableExpression;
203
203
  readonly graph: PureModel;
204
- readonly observableContext: ObserverContext;
204
+ readonly observerContext: ObserverContext;
205
205
 
206
206
  value: ValueSpecification | undefined;
207
207
 
208
208
  constructor(
209
209
  variableExpression: VariableExpression,
210
- observableContext: ObserverContext,
210
+ observerContext: ObserverContext,
211
211
  graph: PureModel,
212
212
  ) {
213
213
  makeObservable(this, {
@@ -217,7 +217,7 @@ export class LambdaParameterState implements Hashable {
217
217
  hashCode: computed,
218
218
  });
219
219
 
220
- this.observableContext = observableContext;
220
+ this.observerContext = observerContext;
221
221
  this.parameter = observe_VariableExpression(variableExpression);
222
222
  this.graph = graph;
223
223
  }
@@ -231,7 +231,11 @@ export class LambdaParameterState implements Hashable {
231
231
 
232
232
  mockParameterValue(): void {
233
233
  this.setValue(
234
- generateVariableExpressionMockValue(this.parameter, this.graph),
234
+ generateVariableExpressionMockValue(
235
+ this.parameter,
236
+ this.graph,
237
+ this.observerContext,
238
+ ),
235
239
  );
236
240
  }
237
241
 
@@ -242,7 +246,7 @@ export class LambdaParameterState implements Hashable {
242
246
  );
243
247
  }
244
248
  this.value = value
245
- ? observe_ValueSpecification(value, this.observableContext)
249
+ ? observe_ValueSpecification(value, this.observerContext)
246
250
  : undefined;
247
251
  }
248
252
 
@@ -33,6 +33,7 @@ import {
33
33
  INTERNAL__PropagatedValue,
34
34
  SimpleFunctionExpression,
35
35
  SUPPORTED_FUNCTIONS,
36
+ type ObserverContext,
36
37
  } from '@finos/legend-graph';
37
38
  import { Randomizer, UnsupportedOperationError } from '@finos/legend-shared';
38
39
  import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationHelper.js';
@@ -58,6 +59,7 @@ export const createSupportedFunctionExpression = (
58
59
  const createMockPrimitiveValueSpecification = (
59
60
  primitiveType: PrimitiveType,
60
61
  propertyName: string,
62
+ observerContext: ObserverContext,
61
63
  ): ValueSpecification => {
62
64
  const primitiveTypeName = primitiveType.name;
63
65
  if (
@@ -97,7 +99,7 @@ const createMockPrimitiveValueSpecification = (
97
99
  default:
98
100
  value = `${propertyName} ${randomizer.getRandomWholeNumber(100)}`;
99
101
  }
100
- instanceValue_setValues(primitiveInstanceValue, [value]);
102
+ instanceValue_setValues(primitiveInstanceValue, [value], observerContext);
101
103
  return primitiveInstanceValue;
102
104
  };
103
105
 
@@ -110,19 +112,21 @@ export const buildPrimitiveInstanceValue = (
110
112
  graph: PureModel,
111
113
  type: PRIMITIVE_TYPE,
112
114
  value: unknown,
115
+ observerContext: ObserverContext,
113
116
  ): PrimitiveInstanceValue => {
114
117
  const instance = new PrimitiveInstanceValue(
115
118
  GenericTypeExplicitReference.create(
116
119
  new GenericType(graph.getPrimitiveType(type)),
117
120
  ),
118
121
  );
119
- instanceValue_setValues(instance, [value]);
122
+ instanceValue_setValues(instance, [value], observerContext);
120
123
  return instance;
121
124
  };
122
125
 
123
126
  export const buildDefaultInstanceValue = (
124
127
  graph: PureModel,
125
128
  type: Type,
129
+ observerContext: ObserverContext,
126
130
  ): ValueSpecification => {
127
131
  const path = type.path;
128
132
  switch (path) {
@@ -139,6 +143,7 @@ export const buildDefaultInstanceValue = (
139
143
  graph,
140
144
  path,
141
145
  generateDefaultValueForPrimitiveType(path),
146
+ observerContext,
142
147
  );
143
148
  }
144
149
  case PRIMITIVE_TYPE.DATE: {
@@ -146,6 +151,7 @@ export const buildDefaultInstanceValue = (
146
151
  graph,
147
152
  PRIMITIVE_TYPE.STRICTDATE,
148
153
  generateDefaultValueForPrimitiveType(path),
154
+ observerContext,
149
155
  );
150
156
  }
151
157
  default:
@@ -154,9 +160,11 @@ export const buildDefaultInstanceValue = (
154
160
  const enumValueInstanceValue = new EnumValueInstanceValue(
155
161
  GenericTypeExplicitReference.create(new GenericType(type)),
156
162
  );
157
- instanceValue_setValues(enumValueInstanceValue, [
158
- EnumValueExplicitReference.create(type.values[0] as Enum),
159
- ]);
163
+ instanceValue_setValues(
164
+ enumValueInstanceValue,
165
+ [EnumValueExplicitReference.create(type.values[0] as Enum)],
166
+ observerContext,
167
+ );
160
168
  return enumValueInstanceValue;
161
169
  }
162
170
  throw new UnsupportedOperationError(
@@ -172,6 +180,7 @@ export const buildDefaultInstanceValue = (
172
180
  export const generateVariableExpressionMockValue = (
173
181
  parameter: VariableExpression,
174
182
  graph: PureModel,
183
+ observerContext: ObserverContext,
175
184
  ): ValueSpecification | undefined => {
176
185
  const varType = parameter.genericType?.value.rawType;
177
186
  const multiplicity = parameter.multiplicity;
@@ -182,16 +191,22 @@ export const generateVariableExpressionMockValue = (
182
191
  );
183
192
  }
184
193
  if (varType instanceof PrimitiveType) {
185
- return createMockPrimitiveValueSpecification(varType, VAR_DEFAULT_NAME);
194
+ return createMockPrimitiveValueSpecification(
195
+ varType,
196
+ VAR_DEFAULT_NAME,
197
+ observerContext,
198
+ );
186
199
  } else if (varType instanceof Enumeration) {
187
200
  const enumValueInstance = new EnumValueInstanceValue(
188
201
  GenericTypeExplicitReference.create(new GenericType(varType)),
189
202
  );
190
203
  const mock = createMockEnumerationProperty(varType);
191
204
  if (mock !== '') {
192
- instanceValue_setValues(enumValueInstance, [
193
- EnumValueExplicitReference.create(getEnumValue(varType, mock)),
194
- ]);
205
+ instanceValue_setValues(
206
+ enumValueInstance,
207
+ [EnumValueExplicitReference.create(getEnumValue(varType, mock))],
208
+ observerContext,
209
+ );
195
210
  }
196
211
  return enumValueInstance;
197
212
  }