@finos/legend-query-builder 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (329) hide show
  1. package/lib/components/QueryBuilder.d.ts.map +1 -1
  2. package/lib/components/QueryBuilder.js +1 -1
  3. package/lib/components/QueryBuilder.js.map +1 -1
  4. package/lib/components/QueryBuilderComponentTestUtils.d.ts.map +1 -1
  5. package/lib/components/QueryBuilderComponentTestUtils.js +1 -3
  6. package/lib/components/QueryBuilderComponentTestUtils.js.map +1 -1
  7. package/lib/components/QueryBuilderDiffPanel.js +1 -2
  8. package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
  9. package/lib/components/QueryBuilderParametersPanel.d.ts +1 -1
  10. package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
  11. package/lib/components/QueryBuilderParametersPanel.js +10 -7
  12. package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
  13. package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
  14. package/lib/components/QueryBuilderPropertyExpressionEditor.js +11 -8
  15. package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
  16. package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
  17. package/lib/components/QueryBuilderResultPanel.js +6 -4
  18. package/lib/components/QueryBuilderResultPanel.js.map +1 -1
  19. package/lib/components/QueryBuilderTextEditor.js +2 -2
  20. package/lib/components/QueryBuilderTextEditor.js.map +1 -1
  21. package/lib/components/QueryBuilder_TestID.d.ts +1 -0
  22. package/lib/components/QueryBuilder_TestID.d.ts.map +1 -1
  23. package/lib/components/QueryBuilder_TestID.js +1 -0
  24. package/lib/components/QueryBuilder_TestID.js.map +1 -1
  25. package/lib/components/explorer/QueryBuilderExplorerPanel.js +2 -2
  26. package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
  27. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  28. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +5 -4
  29. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  30. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
  31. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +4 -2
  32. package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
  33. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +1 -1
  34. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  35. package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
  36. package/lib/components/filter/QueryBuilderFilterPanel.js +7 -4
  37. package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
  38. package/lib/components/shared/BasicValueSpecificationEditor.d.ts +53 -0
  39. package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -0
  40. package/lib/components/shared/BasicValueSpecificationEditor.js +323 -0
  41. package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -0
  42. package/lib/components/shared/CustomDatePicker.d.ts +39 -0
  43. package/lib/components/shared/CustomDatePicker.d.ts.map +1 -0
  44. package/lib/components/shared/CustomDatePicker.js +622 -0
  45. package/lib/components/shared/CustomDatePicker.js.map +1 -0
  46. package/lib/components/shared/LambdaEditor.d.ts +92 -0
  47. package/lib/components/shared/LambdaEditor.d.ts.map +1 -0
  48. package/lib/components/shared/LambdaEditor.js +432 -0
  49. package/lib/components/shared/LambdaEditor.js.map +1 -0
  50. package/lib/{graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.d.ts → components/shared/LambdaParameterValuesEditor.d.ts} +11 -3
  51. package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -0
  52. package/lib/components/shared/LambdaParameterValuesEditor.js +52 -0
  53. package/lib/components/shared/LambdaParameterValuesEditor.js.map +1 -0
  54. package/lib/components/shared/QueryBuilderLambdaEditor.d.ts +1 -1
  55. package/lib/components/shared/QueryBuilderLambdaEditor.d.ts.map +1 -1
  56. package/lib/components/shared/QueryBuilderLambdaEditor.js +3 -2
  57. package/lib/components/shared/QueryBuilderLambdaEditor.js.map +1 -1
  58. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  59. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +1 -2
  60. package/lib/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  61. package/lib/graphManager/protocol/pure/v1/{V1_QueryBuilder_FunctionExpressionBuilder.d.ts → V1_QueryValueSpecificationBuilderHelper.d.ts} +3 -2
  62. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -0
  63. package/lib/graphManager/protocol/pure/v1/{V1_QueryBuilder_FunctionExpressionBuilder.js → V1_QueryValueSpecificationBuilderHelper.js} +7 -6
  64. package/lib/graphManager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -0
  65. package/lib/index.css +2 -2
  66. package/lib/index.css.map +1 -1
  67. package/lib/index.d.ts +7 -0
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/index.js +8 -0
  70. package/lib/index.js.map +1 -1
  71. package/lib/package.json +7 -10
  72. package/lib/stores/QueryBuilderMilestoningState.d.ts.map +1 -1
  73. package/lib/stores/QueryBuilderMilestoningState.js +6 -6
  74. package/lib/stores/QueryBuilderMilestoningState.js.map +1 -1
  75. package/lib/stores/QueryBuilderParametersState.d.ts +1 -1
  76. package/lib/stores/QueryBuilderParametersState.d.ts.map +1 -1
  77. package/lib/stores/QueryBuilderParametersState.js +1 -1
  78. package/lib/stores/QueryBuilderParametersState.js.map +1 -1
  79. package/lib/stores/QueryBuilderPropertyEditorState.d.ts.map +1 -1
  80. package/lib/stores/QueryBuilderPropertyEditorState.js +35 -38
  81. package/lib/stores/QueryBuilderPropertyEditorState.js.map +1 -1
  82. package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
  83. package/lib/stores/QueryBuilderResultState.js +2 -1
  84. package/lib/stores/QueryBuilderResultState.js.map +1 -1
  85. package/lib/stores/QueryBuilderState.d.ts +2 -2
  86. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  87. package/lib/stores/QueryBuilderState.js +7 -6
  88. package/lib/stores/QueryBuilderState.js.map +1 -1
  89. package/lib/stores/QueryBuilderStateBuilder.js +1 -1
  90. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  91. package/lib/stores/QueryBuilderTextEditorState.d.ts +1 -1
  92. package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
  93. package/lib/stores/QueryBuilderTextEditorState.js +2 -1
  94. package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
  95. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  96. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +2 -2
  97. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  98. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.d.ts.map +1 -1
  99. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js +23 -20
  100. package/lib/stores/QueryBuilderValueSpecificationBuilderHelper.js.map +1 -1
  101. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts +1 -1
  102. package/lib/stores/QueryBuilderValueSpecificationHelper.d.ts.map +1 -1
  103. package/lib/stores/QueryBuilderValueSpecificationHelper.js +10 -9
  104. package/lib/stores/QueryBuilderValueSpecificationHelper.js.map +1 -1
  105. package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
  106. package/lib/stores/explorer/QueryBuilderExplorerState.js +4 -3
  107. package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
  108. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +1 -1
  109. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
  110. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +1 -1
  111. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
  112. package/lib/stores/fetch-structure/graph-fetch/{QueryBuilderGraphFetchValueSpecificationBuilder.d.ts → QueryBuilderGraphFetchTreeValueSpecificationBuilder.d.ts} +1 -1
  113. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeValueSpecificationBuilder.d.ts.map +1 -0
  114. package/lib/stores/fetch-structure/graph-fetch/{QueryBuilderGraphFetchValueSpecificationBuilder.js → QueryBuilderGraphFetchTreeValueSpecificationBuilder.js} +1 -1
  115. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeValueSpecificationBuilder.js.map +1 -0
  116. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.d.ts +1 -1
  117. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.d.ts.map +1 -1
  118. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js +3 -3
  119. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.js.map +1 -1
  120. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js +1 -1
  121. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionState.js.map +1 -1
  122. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js +4 -4
  123. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  124. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  125. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js +13 -13
  126. package/lib/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  127. package/lib/stores/fetch-structure/projection/aggregation/operators/{QueryBuilderAggregateOperatorHelper.d.ts → QueryBuilderAggregateOperatorValueSpecificationBuilder.d.ts} +2 -2
  128. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorValueSpecificationBuilder.d.ts.map +1 -0
  129. package/lib/stores/fetch-structure/projection/aggregation/operators/{QueryBuilderAggregateOperatorHelper.js → QueryBuilderAggregateOperatorValueSpecificationBuilder.js} +2 -2
  130. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorValueSpecificationBuilder.js.map +1 -0
  131. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Average.js +3 -3
  132. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Average.js.map +1 -1
  133. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Count.js +3 -3
  134. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Count.js.map +1 -1
  135. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Distinct.js +3 -3
  136. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Distinct.js.map +1 -1
  137. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js +1 -1
  138. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.js.map +1 -1
  139. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_JoinString.js +1 -1
  140. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_JoinString.js.map +1 -1
  141. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Max.js +5 -5
  142. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Max.js.map +1 -1
  143. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Min.js +5 -5
  144. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Min.js.map +1 -1
  145. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Population.js +3 -3
  146. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Population.js.map +1 -1
  147. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Sample.js +3 -3
  148. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Sample.js.map +1 -1
  149. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Sum.js +3 -3
  150. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Sum.js.map +1 -1
  151. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js +2 -2
  152. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.js.map +1 -1
  153. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts +1 -1
  154. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.d.ts.map +1 -1
  155. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js +10 -10
  156. package/lib/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.js.map +1 -1
  157. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts +1 -4
  158. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.d.ts.map +1 -1
  159. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js +3 -46
  160. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.js.map +1 -1
  161. package/{src/graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.ts → lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts} +5 -13
  162. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.d.ts.map +1 -0
  163. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js +61 -0
  164. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.js.map +1 -0
  165. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.d.ts.map +1 -1
  166. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js +5 -4
  167. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.js.map +1 -1
  168. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.d.ts.map +1 -1
  169. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js +5 -4
  170. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.js.map +1 -1
  171. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.d.ts.map +1 -1
  172. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js +10 -8
  173. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.js.map +1 -1
  174. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.d.ts.map +1 -1
  175. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js +5 -4
  176. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.js.map +1 -1
  177. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js +3 -3
  178. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.js.map +1 -1
  179. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js +3 -3
  180. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.js.map +1 -1
  181. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js +1 -1
  182. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.js.map +1 -1
  183. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.d.ts.map +1 -1
  184. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js +5 -4
  185. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.js.map +1 -1
  186. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js +3 -3
  187. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.js.map +1 -1
  188. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.d.ts.map +1 -1
  189. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js +5 -4
  190. package/lib/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.js.map +1 -1
  191. package/lib/stores/filter/operators/{QueryBuilderFilterOperatorHelper.d.ts → QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts} +1 -1
  192. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.d.ts.map +1 -0
  193. package/lib/stores/filter/operators/{QueryBuilderFilterOperatorHelper.js → QueryBuilderFilterOperatorValueSpecificationBuilder.js} +11 -13
  194. package/lib/stores/filter/operators/QueryBuilderFilterOperatorValueSpecificationBuilder.js.map +1 -0
  195. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.d.ts.map +1 -1
  196. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js +7 -6
  197. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Contain.js.map +1 -1
  198. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.d.ts.map +1 -1
  199. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js +7 -6
  200. package/lib/stores/filter/operators/QueryBuilderFilterOperator_EndWith.js.map +1 -1
  201. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.d.ts.map +1 -1
  202. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js +13 -11
  203. package/lib/stores/filter/operators/QueryBuilderFilterOperator_Equal.js.map +1 -1
  204. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.d.ts.map +1 -1
  205. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js +8 -7
  206. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.js.map +1 -1
  207. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.d.ts.map +1 -1
  208. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js +8 -7
  209. package/lib/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.js.map +1 -1
  210. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js +6 -6
  211. package/lib/stores/filter/operators/QueryBuilderFilterOperator_In.js.map +1 -1
  212. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js +4 -4
  213. package/lib/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.js.map +1 -1
  214. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.d.ts.map +1 -1
  215. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js +8 -7
  216. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThan.js.map +1 -1
  217. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.d.ts.map +1 -1
  218. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js +8 -7
  219. package/lib/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.js.map +1 -1
  220. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.d.ts.map +1 -1
  221. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js +7 -6
  222. package/lib/stores/filter/operators/QueryBuilderFilterOperator_StartWith.js.map +1 -1
  223. package/lib/stores/shared/LambdaEditorState.d.ts +40 -0
  224. package/lib/stores/shared/LambdaEditorState.d.ts.map +1 -0
  225. package/lib/stores/shared/LambdaEditorState.js +81 -0
  226. package/lib/stores/shared/LambdaEditorState.js.map +1 -0
  227. package/lib/stores/shared/LambdaParameterState.d.ts +62 -0
  228. package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -0
  229. package/lib/stores/shared/LambdaParameterState.js +157 -0
  230. package/lib/stores/shared/LambdaParameterState.js.map +1 -0
  231. package/lib/{graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.js → stores/shared/ValueSpecificationEditorHelper.d.ts} +5 -3
  232. package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -0
  233. package/lib/stores/shared/ValueSpecificationEditorHelper.js +77 -0
  234. package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -0
  235. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts +33 -0
  236. package/lib/stores/shared/ValueSpecificationModifierHelper.d.ts.map +1 -0
  237. package/lib/stores/shared/ValueSpecificationModifierHelper.js +71 -0
  238. package/lib/stores/shared/ValueSpecificationModifierHelper.js.map +1 -0
  239. package/package.json +14 -17
  240. package/src/components/QueryBuilder.tsx +4 -1
  241. package/src/components/QueryBuilderComponentTestUtils.tsx +2 -2
  242. package/src/components/QueryBuilderDiffPanel.tsx +1 -1
  243. package/src/components/QueryBuilderParametersPanel.tsx +9 -9
  244. package/src/components/QueryBuilderPropertyExpressionEditor.tsx +15 -12
  245. package/src/components/QueryBuilderResultPanel.tsx +8 -6
  246. package/src/components/QueryBuilderTextEditor.tsx +2 -2
  247. package/src/components/QueryBuilder_TestID.ts +2 -0
  248. package/src/components/explorer/QueryBuilderExplorerPanel.tsx +2 -2
  249. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +5 -3
  250. package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +6 -4
  251. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +1 -1
  252. package/src/components/filter/QueryBuilderFilterPanel.tsx +9 -6
  253. package/src/components/shared/BasicValueSpecificationEditor.tsx +837 -0
  254. package/src/components/shared/CustomDatePicker.tsx +1363 -0
  255. package/src/components/shared/LambdaEditor.tsx +858 -0
  256. package/src/components/shared/LambdaParameterValuesEditor.tsx +121 -0
  257. package/src/components/shared/QueryBuilderLambdaEditor.tsx +5 -5
  258. package/src/graphManager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +2 -2
  259. package/src/graphManager/protocol/pure/v1/{V1_QueryBuilder_FunctionExpressionBuilder.ts → V1_QueryValueSpecificationBuilderHelper.ts} +12 -5
  260. package/src/index.ts +11 -0
  261. package/src/stores/QueryBuilderMilestoningState.ts +7 -7
  262. package/src/stores/QueryBuilderParametersState.ts +4 -4
  263. package/src/stores/QueryBuilderPropertyEditorState.ts +49 -56
  264. package/src/stores/QueryBuilderResultState.ts +2 -4
  265. package/src/stores/QueryBuilderState.ts +7 -6
  266. package/src/stores/QueryBuilderStateBuilder.ts +1 -1
  267. package/src/stores/QueryBuilderTextEditorState.ts +2 -1
  268. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +5 -2
  269. package/src/stores/QueryBuilderValueSpecificationBuilderHelper.ts +30 -42
  270. package/src/stores/QueryBuilderValueSpecificationHelper.ts +13 -8
  271. package/src/stores/explorer/QueryBuilderExplorerState.ts +12 -2
  272. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +1 -1
  273. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +3 -3
  274. package/src/stores/fetch-structure/graph-fetch/{QueryBuilderGraphFetchValueSpecificationBuilder.ts → QueryBuilderGraphFetchTreeValueSpecificationBuilder.ts} +0 -1
  275. package/src/stores/fetch-structure/projection/QueryBuilderProjectionColumnState.ts +3 -3
  276. package/src/stores/fetch-structure/projection/QueryBuilderProjectionState.ts +1 -1
  277. package/src/stores/fetch-structure/projection/QueryBuilderProjectionStateBuilder.ts +4 -4
  278. package/src/stores/fetch-structure/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +16 -19
  279. package/src/stores/fetch-structure/projection/aggregation/operators/{QueryBuilderAggregateOperatorHelper.ts → QueryBuilderAggregateOperatorValueSpecificationBuilder.ts} +1 -1
  280. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Average.ts +3 -3
  281. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Count.ts +3 -3
  282. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Distinct.ts +3 -3
  283. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_DistinctCount.ts +1 -1
  284. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_JoinString.ts +1 -1
  285. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Max.ts +5 -5
  286. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Min.ts +5 -5
  287. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Population.ts +3 -3
  288. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_StdDev_Sample.ts +3 -3
  289. package/src/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperator_Sum.ts +3 -3
  290. package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterStateBuilder.ts +2 -2
  291. package/src/stores/fetch-structure/projection/post-filter/QueryBuilderPostFilterValueSpecificationBuilder.ts +12 -10
  292. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorHelper.ts +2 -86
  293. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperatorValueSpecificationBuilder.ts +104 -0
  294. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Contain.ts +3 -3
  295. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_EndWith.ts +3 -3
  296. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_Equal.ts +8 -7
  297. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThan.ts +4 -4
  298. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_GreaterThanEqual.ts +3 -3
  299. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_In.ts +2 -2
  300. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_IsEmpty.ts +1 -1
  301. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThan.ts +4 -4
  302. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_LessThanEqual.ts +3 -3
  303. package/src/stores/fetch-structure/projection/post-filter/operators/QueryBuilderPostFilterOperator_StartWith.ts +3 -3
  304. package/src/stores/filter/operators/{QueryBuilderFilterOperatorHelper.ts → QueryBuilderFilterOperatorValueSpecificationBuilder.ts} +10 -11
  305. package/src/stores/filter/operators/QueryBuilderFilterOperator_Contain.ts +5 -5
  306. package/src/stores/filter/operators/QueryBuilderFilterOperator_EndWith.ts +5 -5
  307. package/src/stores/filter/operators/QueryBuilderFilterOperator_Equal.ts +11 -10
  308. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThan.ts +7 -7
  309. package/src/stores/filter/operators/QueryBuilderFilterOperator_GreaterThanEqual.ts +7 -7
  310. package/src/stores/filter/operators/QueryBuilderFilterOperator_In.ts +5 -5
  311. package/src/stores/filter/operators/QueryBuilderFilterOperator_IsEmpty.ts +3 -3
  312. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThan.ts +7 -7
  313. package/src/stores/filter/operators/QueryBuilderFilterOperator_LessThanEqual.ts +7 -7
  314. package/src/stores/filter/operators/QueryBuilderFilterOperator_StartWith.ts +5 -5
  315. package/src/stores/shared/LambdaEditorState.ts +118 -0
  316. package/src/stores/shared/LambdaParameterState.ts +259 -0
  317. package/src/stores/shared/ValueSpecificationEditorHelper.ts +143 -0
  318. package/src/stores/shared/ValueSpecificationModifierHelper.ts +177 -0
  319. package/tsconfig.json +14 -7
  320. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.d.ts.map +0 -1
  321. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_FunctionExpressionBuilder.js.map +0 -1
  322. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.d.ts.map +0 -1
  323. package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_PropertyExpressionTypeInferenceBuilder.js.map +0 -1
  324. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.d.ts.map +0 -1
  325. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchValueSpecificationBuilder.js.map +0 -1
  326. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorHelper.d.ts.map +0 -1
  327. package/lib/stores/fetch-structure/projection/aggregation/operators/QueryBuilderAggregateOperatorHelper.js.map +0 -1
  328. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.d.ts.map +0 -1
  329. package/lib/stores/filter/operators/QueryBuilderFilterOperatorHelper.js.map +0 -1
@@ -23,7 +23,6 @@ import {
23
23
  PRIMITIVE_TYPE,
24
24
  type ValueSpecification,
25
25
  type SimpleFunctionExpression,
26
- buildPrimitiveInstanceValue,
27
26
  } from '@finos/legend-graph';
28
27
  import {
29
28
  type Hashable,
@@ -33,7 +32,7 @@ import {
33
32
  import {
34
33
  buildFilterConditionState,
35
34
  buildFilterConditionExpression,
36
- } from './QueryBuilderFilterOperatorHelper.js';
35
+ } from './QueryBuilderFilterOperatorValueSpecificationBuilder.js';
37
36
  import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../../../graphManager/QueryBuilderSupportedFunctions.js';
38
37
  import {
39
38
  buildNotExpression,
@@ -42,6 +41,7 @@ import {
42
41
  unwrapNotExpression,
43
42
  } from '../../QueryBuilderValueSpecificationHelper.js';
44
43
  import { QUERY_BUILDER_HASH_STRUCTURE } from '../../../graphManager/QueryBuilderHashUtils.js';
44
+ import { buildPrimitiveInstanceValue } from '../../shared/ValueSpecificationEditorHelper.js';
45
45
 
46
46
  export class QueryBuilderFilterOperator_StartWith
47
47
  extends QueryBuilderFilterOperator
@@ -55,7 +55,7 @@ export class QueryBuilderFilterOperator_StartWith
55
55
  filterConditionState: FilterConditionState,
56
56
  ): boolean {
57
57
  const propertyType =
58
- filterConditionState.propertyExpressionState.propertyExpression.func
58
+ filterConditionState.propertyExpressionState.propertyExpression.func.value
59
59
  .genericType.value.rawType;
60
60
  return PRIMITIVE_TYPE.STRING === propertyType.path;
61
61
  }
@@ -73,7 +73,7 @@ export class QueryBuilderFilterOperator_StartWith
73
73
  filterConditionState: FilterConditionState,
74
74
  ): ValueSpecification | undefined {
75
75
  const propertyType =
76
- filterConditionState.propertyExpressionState.propertyExpression.func
76
+ filterConditionState.propertyExpressionState.propertyExpression.func.value
77
77
  .genericType.value.rawType;
78
78
  switch (propertyType.path) {
79
79
  case PRIMITIVE_TYPE.STRING: {
@@ -128,9 +128,9 @@ export class QueryBuilderFilterOperator_NotStartWith extends QueryBuilderFilterO
128
128
  filterConditionState: FilterConditionState,
129
129
  ): ValueSpecification {
130
130
  return buildNotExpression(
131
+ super.buildFilterConditionExpression(filterConditionState),
131
132
  filterConditionState.filterState.queryBuilderState.graphManagerState
132
133
  .graph,
133
- super.buildFilterConditionExpression(filterConditionState),
134
134
  );
135
135
  }
136
136
 
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { observable, action, computed, makeObservable, flow } from 'mobx';
18
+ import { type GeneratorFn, uuid } from '@finos/legend-shared';
19
+ import {
20
+ type ParserError,
21
+ type CompilationError,
22
+ SourceInformation,
23
+ } from '@finos/legend-graph';
24
+
25
+ /**
26
+ * This is not strictly meant for lambda. The idea is to create an editor that allows
27
+ * editing _something_ but allows user to edit via text.
28
+ */
29
+ export abstract class LambdaEditorState {
30
+ readonly uuid = uuid();
31
+ lambdaPrefix: string;
32
+ lambdaString: string; // value shown in lambda editor which can be edited
33
+ parserError?: ParserError | undefined;
34
+ compilationError?: CompilationError | undefined;
35
+
36
+ constructor(lambdaString: string, lambdaPrefix: string) {
37
+ makeObservable(this, {
38
+ lambdaString: observable,
39
+ parserError: observable,
40
+ compilationError: observable,
41
+ lambdaId: computed,
42
+ fullLambdaString: computed,
43
+ setLambdaString: action,
44
+ clearErrors: action,
45
+ setCompilationError: action,
46
+ setParserError: action,
47
+ convertLambdaGrammarStringToObject: flow,
48
+ convertLambdaObjectToGrammarString: flow,
49
+ });
50
+
51
+ this.lambdaString = lambdaString;
52
+ this.lambdaPrefix = lambdaPrefix;
53
+ }
54
+
55
+ abstract get lambdaId(): string;
56
+
57
+ // value shown in lambda editor with the prefix, used to send to the server to transformation from text to JSON
58
+ get fullLambdaString(): string {
59
+ return `${this.lambdaPrefix}${this.lambdaString}`;
60
+ }
61
+
62
+ setLambdaString(val: string): void {
63
+ this.lambdaString = val;
64
+ }
65
+
66
+ clearErrors(): void {
67
+ this.setCompilationError(undefined);
68
+ this.setParserError(undefined);
69
+ }
70
+
71
+ setCompilationError(compilationError: CompilationError | undefined): void {
72
+ // account for the lambda prefix offset in source information
73
+ if (compilationError?.sourceInformation) {
74
+ compilationError.sourceInformation = this.processSourceInformation(
75
+ compilationError.sourceInformation,
76
+ );
77
+ }
78
+ this.compilationError = compilationError;
79
+ }
80
+
81
+ setParserError(parserError: ParserError | undefined): void {
82
+ // account for the lambda prefix offset in source information
83
+ if (parserError?.sourceInformation) {
84
+ parserError.sourceInformation = this.processSourceInformation(
85
+ parserError.sourceInformation,
86
+ );
87
+ }
88
+ this.parserError = parserError;
89
+ }
90
+
91
+ processSourceInformation(
92
+ sourceInformation: SourceInformation,
93
+ ): SourceInformation {
94
+ const { sourceId, startLine, startColumn, endLine, endColumn } =
95
+ sourceInformation;
96
+ const lineOffset = 0;
97
+ const columnOffset = this.lambdaPrefix.length;
98
+ return new SourceInformation(
99
+ sourceId,
100
+ startLine + lineOffset,
101
+ startColumn - (startLine === 1 ? columnOffset : 0),
102
+ endLine + lineOffset,
103
+ endColumn - (endLine === 1 ? columnOffset : 0),
104
+ );
105
+ }
106
+
107
+ extractLambdaString(fullLambdaString: string): string {
108
+ return fullLambdaString.substring(
109
+ fullLambdaString.indexOf(this.lambdaPrefix) + this.lambdaPrefix.length,
110
+ fullLambdaString.length,
111
+ );
112
+ }
113
+
114
+ abstract convertLambdaGrammarStringToObject(): GeneratorFn<void>;
115
+ abstract convertLambdaObjectToGrammarString(
116
+ pretty: boolean,
117
+ ): GeneratorFn<void>;
118
+ }
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ type ObserverContext,
19
+ type Type,
20
+ type ValueSpecification,
21
+ type PureModel,
22
+ GenericType,
23
+ GenericTypeExplicitReference,
24
+ observe_ValueSpecification,
25
+ observe_VariableExpression,
26
+ PrimitiveInstanceValue,
27
+ PRIMITIVE_TYPE,
28
+ VariableExpression,
29
+ LambdaFunction,
30
+ TYPICAL_MULTIPLICITY_TYPE,
31
+ CORE_PURE_PATH,
32
+ FunctionType,
33
+ SimpleFunctionExpression,
34
+ SUPPORTED_FUNCTIONS,
35
+ extractElementNameFromPath,
36
+ PackageableElementExplicitReference,
37
+ } from '@finos/legend-graph';
38
+ import {
39
+ addUniqueEntry,
40
+ deleteEntry,
41
+ type Hashable,
42
+ hashArray,
43
+ IllegalStateError,
44
+ isNonNullable,
45
+ uuid,
46
+ } from '@finos/legend-shared';
47
+ import { makeObservable, observable, action, computed } from 'mobx';
48
+ import { generateVariableExpressionMockValue } from './ValueSpecificationEditorHelper.js';
49
+ import {
50
+ valueSpecification_setGenericType,
51
+ valueSpecification_setMultiplicity,
52
+ } from './ValueSpecificationModifierHelper.js';
53
+
54
+ export enum PARAMETER_SUBMIT_ACTION {
55
+ EXECUTE = 'EXECUTE',
56
+ EXPORT = 'EXPORT',
57
+ }
58
+
59
+ enum LAMABA_PARAMETER_HASH_STRUCTURE {
60
+ LAMBDA_PARAMETER_STATE = 'LAMBDA_PARAMETER_STATE',
61
+ LAMBDA_PARAMETERS_STATE = 'LAMBDA_PARAMETERS_STATE',
62
+ }
63
+
64
+ export const buildParametersLetLambdaFunc = (
65
+ graph: PureModel,
66
+ lambdaParametersStates: LambdaParameterState[],
67
+ ): LambdaFunction => {
68
+ const multiplicityOne = graph.getTypicalMultiplicity(
69
+ TYPICAL_MULTIPLICITY_TYPE.ONE,
70
+ );
71
+ const typeString = graph.getPrimitiveType(PRIMITIVE_TYPE.STRING);
72
+ const typeAny = graph.getType(CORE_PURE_PATH.ANY);
73
+ const letlambdaFunction = new LambdaFunction(
74
+ new FunctionType(
75
+ PackageableElementExplicitReference.create(typeAny),
76
+ multiplicityOne,
77
+ ),
78
+ );
79
+ letlambdaFunction.expressionSequence = lambdaParametersStates
80
+ .map((queryParamState) => {
81
+ if (queryParamState.value) {
82
+ const letFunc = new SimpleFunctionExpression(
83
+ extractElementNameFromPath(SUPPORTED_FUNCTIONS.LET),
84
+ multiplicityOne,
85
+ );
86
+ const letVar = new PrimitiveInstanceValue(
87
+ GenericTypeExplicitReference.create(new GenericType(typeString)),
88
+ multiplicityOne,
89
+ );
90
+ letVar.values = [queryParamState.variableName];
91
+ letFunc.parametersValues.push(letVar);
92
+ letFunc.parametersValues.push(queryParamState.value);
93
+ return letFunc;
94
+ }
95
+ return undefined;
96
+ })
97
+ .filter(isNonNullable);
98
+ return letlambdaFunction;
99
+ };
100
+
101
+ export class LambdaParameterState implements Hashable {
102
+ readonly uuid = uuid();
103
+ readonly parameter: VariableExpression;
104
+ readonly graph: PureModel;
105
+ readonly observableContext: ObserverContext;
106
+
107
+ value: ValueSpecification | undefined;
108
+
109
+ constructor(
110
+ variableExpression: VariableExpression,
111
+ observableContext: ObserverContext,
112
+ graph: PureModel,
113
+ ) {
114
+ makeObservable(this, {
115
+ value: observable,
116
+ setValue: action,
117
+ mockParameterValue: action,
118
+ hashCode: computed,
119
+ });
120
+ this.observableContext = observableContext;
121
+ this.parameter = observe_VariableExpression(variableExpression);
122
+ this.graph = graph;
123
+ }
124
+
125
+ get hashCode(): string {
126
+ return hashArray([
127
+ LAMABA_PARAMETER_HASH_STRUCTURE.LAMBDA_PARAMETER_STATE,
128
+ this.parameter,
129
+ ]);
130
+ }
131
+
132
+ mockParameterValue(): void {
133
+ this.setValue(
134
+ generateVariableExpressionMockValue(this.parameter, this.graph),
135
+ );
136
+ }
137
+
138
+ setValue(value: ValueSpecification | undefined): void {
139
+ if (value instanceof VariableExpression) {
140
+ throw new IllegalStateError(
141
+ 'Can not assign a parameter to another parameter',
142
+ );
143
+ }
144
+ this.value = value
145
+ ? observe_ValueSpecification(value, this.observableContext)
146
+ : undefined;
147
+ }
148
+
149
+ changeVariableType(type: Type): void {
150
+ if (type !== this.variableType) {
151
+ valueSpecification_setGenericType(
152
+ this.parameter,
153
+ GenericTypeExplicitReference.create(new GenericType(type)),
154
+ );
155
+ this.mockParameterValue();
156
+ }
157
+ }
158
+
159
+ changeMultiplicity(
160
+ variableExpression: VariableExpression,
161
+ lowerBound: number,
162
+ uppderBound: number | undefined,
163
+ ): void {
164
+ const current = this.parameter.multiplicity;
165
+ if (
166
+ current.lowerBound !== lowerBound ||
167
+ current.upperBound !== uppderBound
168
+ ) {
169
+ valueSpecification_setMultiplicity(
170
+ variableExpression,
171
+ this.graph.getMultiplicity(lowerBound, uppderBound),
172
+ );
173
+ this.mockParameterValue();
174
+ }
175
+ }
176
+
177
+ get variableName(): string {
178
+ return this.parameter.name;
179
+ }
180
+
181
+ get variableType(): Type | undefined {
182
+ return this.parameter.genericType?.value.rawType;
183
+ }
184
+ }
185
+
186
+ export class ParameterInstanceValuesEditorState {
187
+ showModal = false;
188
+ submitAction:
189
+ | {
190
+ handler: () => Promise<void>;
191
+ label: string;
192
+ }
193
+ | undefined;
194
+
195
+ constructor() {
196
+ makeObservable(this, {
197
+ showModal: observable,
198
+ submitAction: observable,
199
+ setShowModal: action,
200
+ open: action,
201
+ setSubmitAction: action,
202
+ });
203
+ }
204
+
205
+ setShowModal(val: boolean): void {
206
+ this.showModal = val;
207
+ }
208
+
209
+ setSubmitAction(
210
+ val:
211
+ | {
212
+ handler: () => Promise<void>;
213
+ label: string;
214
+ }
215
+ | undefined,
216
+ ): void {
217
+ this.submitAction = val;
218
+ }
219
+
220
+ open(handler: () => Promise<void>, label: string): void {
221
+ this.setSubmitAction({ handler, label });
222
+ this.setShowModal(true);
223
+ }
224
+
225
+ close(): void {
226
+ this.setSubmitAction(undefined);
227
+ this.setShowModal(false);
228
+ }
229
+ }
230
+
231
+ export abstract class LambdaParametersState implements Hashable {
232
+ parameterStates: LambdaParameterState[] = [];
233
+ parameterValuesEditorState = new ParameterInstanceValuesEditorState();
234
+
235
+ constructor() {
236
+ makeObservable(this, {
237
+ hashCode: computed,
238
+ });
239
+ }
240
+
241
+ get hashCode(): string {
242
+ return hashArray([
243
+ LAMABA_PARAMETER_HASH_STRUCTURE.LAMBDA_PARAMETERS_STATE,
244
+ hashArray(this.parameterStates),
245
+ ]);
246
+ }
247
+
248
+ addParameter(val: LambdaParameterState): void {
249
+ addUniqueEntry(this.parameterStates, val);
250
+ }
251
+
252
+ removeParameter(val: LambdaParameterState): void {
253
+ deleteEntry(this.parameterStates, val);
254
+ }
255
+
256
+ setParameters(val: LambdaParameterState[]): void {
257
+ this.parameterStates = val;
258
+ }
259
+ }
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ type PureModel,
19
+ type InstanceValue,
20
+ type VariableExpression,
21
+ CollectionInstanceValue,
22
+ DATE_FORMAT,
23
+ DATE_TIME_FORMAT,
24
+ Enumeration,
25
+ EnumValueExplicitReference,
26
+ EnumValueInstanceValue,
27
+ GenericType,
28
+ GenericTypeExplicitReference,
29
+ getEnumValue,
30
+ PrimitiveInstanceValue,
31
+ PrimitiveType,
32
+ PRIMITIVE_TYPE,
33
+ TYPICAL_MULTIPLICITY_TYPE,
34
+ } from '@finos/legend-graph';
35
+ import { Randomizer } from '@finos/legend-shared';
36
+ import { addDays, format } from 'date-fns';
37
+ import { instanceValue_setValues } from './ValueSpecificationModifierHelper.js';
38
+
39
+ const createMockPrimitiveProperty = (
40
+ primitiveType: PrimitiveType,
41
+ propertyName: string,
42
+ ): string | number | boolean => {
43
+ const randomizer = new Randomizer();
44
+ switch (primitiveType.name) {
45
+ case PRIMITIVE_TYPE.BOOLEAN:
46
+ return randomizer.getRandomItemInCollection([true, false]) ?? true;
47
+ case PRIMITIVE_TYPE.FLOAT:
48
+ return randomizer.getRandomFloat();
49
+ case PRIMITIVE_TYPE.DECIMAL:
50
+ return randomizer.getRandomDouble();
51
+ case PRIMITIVE_TYPE.NUMBER:
52
+ case PRIMITIVE_TYPE.INTEGER:
53
+ return randomizer.getRandomWholeNumber(100);
54
+ // NOTE that `Date` is the umbrella type that comprises `StrictDate` and `DateTime`, but for simplicity, we will generate `Date` as `StrictDate`
55
+ case PRIMITIVE_TYPE.DATE:
56
+ case PRIMITIVE_TYPE.STRICTDATE:
57
+ return format(
58
+ randomizer.getRandomDate(
59
+ new Date(Date.now()),
60
+ addDays(Date.now(), 100),
61
+ ),
62
+ DATE_FORMAT,
63
+ );
64
+ case PRIMITIVE_TYPE.DATETIME:
65
+ return format(
66
+ randomizer.getRandomDate(
67
+ new Date(Date.now()),
68
+ addDays(Date.now(), 100),
69
+ ),
70
+ DATE_TIME_FORMAT,
71
+ );
72
+ case PRIMITIVE_TYPE.STRING:
73
+ default:
74
+ return `${propertyName} ${randomizer.getRandomWholeNumber(100)}`;
75
+ }
76
+ };
77
+
78
+ export const createMockEnumerationProperty = (
79
+ enumeration: Enumeration,
80
+ ): string =>
81
+ new Randomizer().getRandomItemInCollection(enumeration.values)?.name ?? '';
82
+
83
+ export const buildPrimitiveInstanceValue = (
84
+ graph: PureModel,
85
+ type: PRIMITIVE_TYPE,
86
+ value: unknown,
87
+ ): PrimitiveInstanceValue => {
88
+ const multiplicityOne = graph.getTypicalMultiplicity(
89
+ TYPICAL_MULTIPLICITY_TYPE.ONE,
90
+ );
91
+ const instance = new PrimitiveInstanceValue(
92
+ GenericTypeExplicitReference.create(
93
+ new GenericType(graph.getPrimitiveType(type)),
94
+ ),
95
+ multiplicityOne,
96
+ );
97
+ instanceValue_setValues(instance, [value]);
98
+ return instance;
99
+ };
100
+
101
+ export const generateVariableExpressionMockValue = (
102
+ parameter: VariableExpression,
103
+ graph: PureModel,
104
+ ): InstanceValue | undefined => {
105
+ const varType = parameter.genericType?.value.rawType;
106
+ const multiplicity = parameter.multiplicity;
107
+ if ((!multiplicity.upperBound || multiplicity.upperBound > 1) && varType) {
108
+ return new CollectionInstanceValue(
109
+ multiplicity,
110
+ GenericTypeExplicitReference.create(new GenericType(varType)),
111
+ );
112
+ }
113
+ if (varType instanceof PrimitiveType) {
114
+ const primitiveInstanceValue = new PrimitiveInstanceValue(
115
+ GenericTypeExplicitReference.create(
116
+ varType.name === PRIMITIVE_TYPE.DATE
117
+ ? new GenericType(graph.getPrimitiveType(PRIMITIVE_TYPE.STRICTDATE))
118
+ : new GenericType(varType),
119
+ ),
120
+ multiplicity,
121
+ );
122
+ instanceValue_setValues(primitiveInstanceValue, [
123
+ createMockPrimitiveProperty(
124
+ varType,
125
+ parameter.name === '' ? 'myVar' : parameter.name,
126
+ ),
127
+ ]);
128
+ return primitiveInstanceValue;
129
+ } else if (varType instanceof Enumeration) {
130
+ const enumValueInstance = new EnumValueInstanceValue(
131
+ GenericTypeExplicitReference.create(new GenericType(varType)),
132
+ multiplicity,
133
+ );
134
+ const mock = createMockEnumerationProperty(varType);
135
+ if (mock !== '') {
136
+ instanceValue_setValues(enumValueInstance, [
137
+ EnumValueExplicitReference.create(getEnumValue(varType, mock)),
138
+ ]);
139
+ }
140
+ return enumValueInstance;
141
+ }
142
+ return undefined;
143
+ };