@finos/legend-query-builder 4.11.17 → 4.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
  2. package/lib/components/explorer/QueryBuilderMilestoningEditor.js +19 -33
  3. package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
  4. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
  5. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +28 -2
  6. package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
  7. package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
  8. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +1 -1
  9. package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
  10. package/lib/graph/QueryBuilderMetaModelConst.d.ts +7 -3
  11. package/lib/graph/QueryBuilderMetaModelConst.d.ts.map +1 -1
  12. package/lib/graph/QueryBuilderMetaModelConst.js +8 -2
  13. package/lib/graph/QueryBuilderMetaModelConst.js.map +1 -1
  14. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.d.ts.map +1 -1
  15. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js +9 -3
  16. package/lib/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.js.map +1 -1
  17. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts +2 -0
  18. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.d.ts.map +1 -1
  19. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js +20 -0
  20. package/lib/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.js.map +1 -1
  21. package/lib/index.css +2 -2
  22. package/lib/index.css.map +1 -1
  23. package/lib/package.json +1 -1
  24. package/lib/stores/QueryBuilderState.d.ts +6 -1
  25. package/lib/stores/QueryBuilderState.d.ts.map +1 -1
  26. package/lib/stores/QueryBuilderState.js +15 -5
  27. package/lib/stores/QueryBuilderState.js.map +1 -1
  28. package/lib/stores/QueryBuilderStateBuilder.d.ts.map +1 -1
  29. package/lib/stores/QueryBuilderStateBuilder.js +50 -5
  30. package/lib/stores/QueryBuilderStateBuilder.js.map +1 -1
  31. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts +1 -0
  32. package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
  33. package/lib/stores/QueryBuilderValueSpecificationBuilder.js +49 -12
  34. package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
  35. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.d.ts.map +1 -1
  36. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js +4 -2
  37. package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.js.map +1 -1
  38. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts +2 -0
  39. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.d.ts.map +1 -1
  40. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js +6 -0
  41. package/lib/stores/fetch-structure/tds/QueryResultSetModifierState.js.map +1 -1
  42. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.d.ts.map +1 -1
  43. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js +4 -2
  44. package/lib/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.js.map +1 -1
  45. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts +1 -0
  46. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.d.ts.map +1 -1
  47. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js +30 -4
  48. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.js.map +1 -1
  49. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.d.ts.map +1 -1
  50. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js +16 -0
  51. package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.js.map +1 -1
  52. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts +1 -0
  53. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.d.ts.map +1 -1
  54. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js +4 -1
  55. package/lib/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.js.map +1 -1
  56. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts +1 -0
  57. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.d.ts.map +1 -1
  58. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js +10 -1
  59. package/lib/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.js.map +1 -1
  60. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.d.ts.map +1 -1
  61. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js +5 -0
  62. package/lib/stores/milestoning/QueryBuilderMilestoningHelper.js.map +1 -1
  63. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts +4 -0
  64. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.d.ts.map +1 -1
  65. package/lib/stores/milestoning/QueryBuilderMilestoningImplementation.js.map +1 -1
  66. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts +15 -0
  67. package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
  68. package/lib/stores/milestoning/QueryBuilderMilestoningState.js +191 -3
  69. package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
  70. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts +1 -0
  71. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.d.ts.map +1 -1
  72. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js +10 -1
  73. package/lib/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.js.map +1 -1
  74. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.d.ts.map +1 -1
  75. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js +4 -2
  76. package/lib/stores/watermark/QueryBuilderWatermarkStateBuilder.js.map +1 -1
  77. package/package.json +5 -5
  78. package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +106 -35
  79. package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +84 -0
  80. package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +13 -0
  81. package/src/graph/QueryBuilderMetaModelConst.ts +9 -2
  82. package/src/graph-manager/protocol/pure/QueryBuilder_PureProtocolProcessorPlugin.ts +30 -1
  83. package/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +65 -0
  84. package/src/stores/QueryBuilderState.ts +25 -6
  85. package/src/stores/QueryBuilderStateBuilder.ts +124 -5
  86. package/src/stores/QueryBuilderValueSpecificationBuilder.ts +76 -12
  87. package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeStateBuilder.ts +4 -1
  88. package/src/stores/fetch-structure/tds/QueryResultSetModifierState.ts +7 -0
  89. package/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregationStateBuilder.ts +7 -2
  90. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionStateBuilder.ts +68 -1
  91. package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +27 -0
  92. package/src/stores/milestoning/QueryBuilderBitemporalMilestoningImplementation.ts +9 -0
  93. package/src/stores/milestoning/QueryBuilderBusinessTemporalMilestoningImplementation.ts +22 -1
  94. package/src/stores/milestoning/QueryBuilderMilestoningHelper.ts +7 -0
  95. package/src/stores/milestoning/QueryBuilderMilestoningImplementation.ts +7 -0
  96. package/src/stores/milestoning/QueryBuilderMilestoningState.ts +279 -1
  97. package/src/stores/milestoning/QueryBuilderProcessingTemporalMilestoningImplementation.ts +22 -1
  98. package/src/stores/watermark/QueryBuilderWatermarkStateBuilder.ts +4 -2
@@ -22,7 +22,6 @@ import {
22
22
  type VariableExpression,
23
23
  GenericType,
24
24
  GenericTypeExplicitReference,
25
- MILESTONING_STEREOTYPE,
26
25
  observe_PrimitiveInstanceValue,
27
26
  PrimitiveInstanceValue,
28
27
  PRIMITIVE_TYPE,
@@ -38,6 +37,7 @@ import {
38
37
  ModalFooterButton,
39
38
  ModalHeader,
40
39
  PanelEntryDropZonePlaceholder,
40
+ PanelFormBooleanField,
41
41
  PanelFormSection,
42
42
  } from '@finos/legend-art';
43
43
  import { generateDefaultValueForPrimitiveType } from '../../stores/QueryBuilderValueSpecificationHelper.js';
@@ -52,18 +52,15 @@ import { VariableSelector } from '../shared/QueryBuilderVariableSelector.js';
52
52
  const MilestoningParameterEditor = observer(
53
53
  (props: {
54
54
  queryBuilderState: QueryBuilderState;
55
- stereotype: MILESTONING_STEREOTYPE;
55
+ parameter: ValueSpecification;
56
+ setParameter: (val: ValueSpecification) => void;
56
57
  }) => {
57
- const { queryBuilderState, stereotype } = props;
58
+ const { queryBuilderState, parameter, setParameter } = props;
58
59
  const handleDrop = useCallback(
59
60
  (item: QueryBuilderVariableDragSource): void => {
60
- if (stereotype === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL) {
61
- queryBuilderState.milestoningState.setBusinessDate(item.variable);
62
- } else {
63
- queryBuilderState.milestoningState.setProcessingDate(item.variable);
64
- }
61
+ setParameter(item.variable);
65
62
  },
66
- [queryBuilderState, stereotype],
63
+ [setParameter],
67
64
  );
68
65
  const [{ isDragOver }, dropConnector] = useDrop<
69
66
  QueryBuilderVariableDragSource,
@@ -85,18 +82,8 @@ const MilestoningParameterEditor = observer(
85
82
  }),
86
83
  [handleDrop],
87
84
  );
88
- let milestoningParameter;
89
- if (stereotype === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL) {
90
- milestoningParameter = guaranteeNonNullable(
91
- queryBuilderState.milestoningState.businessDate,
92
- );
93
- } else {
94
- milestoningParameter = guaranteeNonNullable(
95
- queryBuilderState.milestoningState.processingDate,
96
- );
97
- }
98
85
  const resetMilestoningParameter = (): void => {
99
- const parameter = observe_PrimitiveInstanceValue(
86
+ const param = observe_PrimitiveInstanceValue(
100
87
  new PrimitiveInstanceValue(
101
88
  GenericTypeExplicitReference.create(
102
89
  new GenericType(PrimitiveType.STRICTDATE),
@@ -105,15 +92,11 @@ const MilestoningParameterEditor = observer(
105
92
  queryBuilderState.observerContext,
106
93
  );
107
94
  instanceValue_setValues(
108
- parameter,
95
+ param,
109
96
  [generateDefaultValueForPrimitiveType(PRIMITIVE_TYPE.STRICTDATE)],
110
97
  queryBuilderState.observerContext,
111
98
  );
112
- if (stereotype === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL) {
113
- queryBuilderState.milestoningState.setBusinessDate(parameter);
114
- } else {
115
- queryBuilderState.milestoningState.setProcessingDate(parameter);
116
- }
99
+ setParameter(param);
117
100
  };
118
101
 
119
102
  return (
@@ -123,20 +106,18 @@ const MilestoningParameterEditor = observer(
123
106
  label="Change Milestoning Parameter Value"
124
107
  >
125
108
  <BasicValueSpecificationEditor
126
- valueSpecification={milestoningParameter}
109
+ valueSpecification={parameter}
127
110
  graph={queryBuilderState.graphManagerState.graph}
128
111
  obseverContext={queryBuilderState.observerContext}
129
112
  setValueSpecification={(val: ValueSpecification): void =>
130
- stereotype === MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL
131
- ? queryBuilderState.milestoningState.setBusinessDate(val)
132
- : queryBuilderState.milestoningState.setProcessingDate(val)
113
+ setParameter(val)
133
114
  }
134
115
  typeCheckOption={{
135
116
  expectedType: PrimitiveType.DATE,
136
117
  }}
137
118
  resetValue={resetMilestoningParameter}
138
119
  isConstant={queryBuilderState.constantState.isValueSpecConstant(
139
- milestoningParameter,
120
+ parameter,
140
121
  )}
141
122
  />
142
123
  </PanelEntryDropZonePlaceholder>
@@ -156,7 +137,12 @@ const BiTemporalMilestoningEditor = observer(
156
137
  </div>
157
138
  <MilestoningParameterEditor
158
139
  queryBuilderState={queryBuilderState}
159
- stereotype={MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL}
140
+ parameter={guaranteeNonNullable(
141
+ queryBuilderState.milestoningState.processingDate,
142
+ )}
143
+ setParameter={(val: ValueSpecification): void =>
144
+ queryBuilderState.milestoningState.setProcessingDate(val)
145
+ }
160
146
  />
161
147
  </PanelFormSection>
162
148
  <PanelFormSection>
@@ -165,7 +151,12 @@ const BiTemporalMilestoningEditor = observer(
165
151
  </div>
166
152
  <MilestoningParameterEditor
167
153
  queryBuilderState={queryBuilderState}
168
- stereotype={MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL}
154
+ parameter={guaranteeNonNullable(
155
+ queryBuilderState.milestoningState.businessDate,
156
+ )}
157
+ setParameter={(val: ValueSpecification): void =>
158
+ queryBuilderState.milestoningState.setBusinessDate(val)
159
+ }
169
160
  />
170
161
  </PanelFormSection>
171
162
  </>
@@ -184,7 +175,12 @@ const BusinessTemporalMilestoningEditor = observer(
184
175
  <MilestoningParameterEditor
185
176
  key="BusinessDate"
186
177
  queryBuilderState={queryBuilderState}
187
- stereotype={MILESTONING_STEREOTYPE.BUSINESS_TEMPORAL}
178
+ parameter={guaranteeNonNullable(
179
+ queryBuilderState.milestoningState.businessDate,
180
+ )}
181
+ setParameter={(val: ValueSpecification): void =>
182
+ queryBuilderState.milestoningState.setBusinessDate(val)
183
+ }
188
184
  />
189
185
  </PanelFormSection>
190
186
  );
@@ -202,7 +198,12 @@ const ProcessingTemporalMilestoningEditor = observer(
202
198
  <MilestoningParameterEditor
203
199
  key="BusinessDate"
204
200
  queryBuilderState={queryBuilderState}
205
- stereotype={MILESTONING_STEREOTYPE.PROCESSING_TEMPORAL}
201
+ parameter={guaranteeNonNullable(
202
+ queryBuilderState.milestoningState.processingDate,
203
+ )}
204
+ setParameter={(val: ValueSpecification): void =>
205
+ queryBuilderState.milestoningState.setProcessingDate(val)
206
+ }
206
207
  />
207
208
  </PanelFormSection>
208
209
  );
@@ -238,6 +239,45 @@ const TemporalMilestoningEditor: React.FC<{
238
239
  }
239
240
  };
240
241
 
242
+ const AllVersionsInRangelMilestoningParametersEditor = observer(
243
+ (props: { queryBuilderState: QueryBuilderState }) => {
244
+ const { queryBuilderState } = props;
245
+
246
+ return (
247
+ <div className="query-builder__milestoning-panel__all-versions-in-range-editor">
248
+ <PanelFormSection>
249
+ <div className="panel__content__form__section__header__label">
250
+ Start Date
251
+ </div>
252
+ <MilestoningParameterEditor
253
+ queryBuilderState={queryBuilderState}
254
+ parameter={guaranteeNonNullable(
255
+ queryBuilderState.milestoningState.startDate,
256
+ )}
257
+ setParameter={(val: ValueSpecification): void =>
258
+ queryBuilderState.milestoningState.setStartDate(val)
259
+ }
260
+ />
261
+ </PanelFormSection>
262
+ <PanelFormSection>
263
+ <div className="panel__content__form__section__header__label">
264
+ End Date
265
+ </div>
266
+ <MilestoningParameterEditor
267
+ queryBuilderState={queryBuilderState}
268
+ parameter={guaranteeNonNullable(
269
+ queryBuilderState.milestoningState.endDate,
270
+ )}
271
+ setParameter={(val: ValueSpecification): void =>
272
+ queryBuilderState.milestoningState.setEndDate(val)
273
+ }
274
+ />
275
+ </PanelFormSection>
276
+ </div>
277
+ );
278
+ },
279
+ );
280
+
241
281
  export const MilestoningParametersEditor = observer(
242
282
  (props: { queryBuilderState: QueryBuilderState }) => {
243
283
  const { queryBuilderState } = props;
@@ -267,6 +307,37 @@ export const MilestoningParametersEditor = observer(
267
307
  >
268
308
  <ModalHeader title="Milestoning Parameters" />
269
309
  <ModalBody className="query-builder__variables__modal__body">
310
+ {milestoningState.isCurrentClassMilestoned && (
311
+ <PanelFormBooleanField
312
+ isReadOnly={false}
313
+ value={milestoningState.isAllVersionsEnabled}
314
+ name="all Versions"
315
+ prompt="Query All Milestoned Versions of the Root Class"
316
+ update={(value: boolean | undefined): void =>
317
+ milestoningState.setAllVersions(value)
318
+ }
319
+ />
320
+ )}
321
+ {milestoningState.isAllVersionsEnabled &&
322
+ milestoningState.isCurrentClassSupportsVersionsInRange && (
323
+ <>
324
+ <PanelFormBooleanField
325
+ isReadOnly={false}
326
+ value={milestoningState.isAllVersionsInRangeEnabled}
327
+ name=" All Versions In Range"
328
+ prompt="Optionally apply a date range to get All Versions for"
329
+ update={(value: boolean | undefined): void =>
330
+ milestoningState.setAllVersionsInRange(value)
331
+ }
332
+ />
333
+
334
+ {milestoningState.isAllVersionsInRangeEnabled && (
335
+ <AllVersionsInRangelMilestoningParametersEditor
336
+ queryBuilderState={queryBuilderState}
337
+ />
338
+ )}
339
+ </>
340
+ )}
270
341
  <TemporalMilestoningEditor queryBuilderState={queryBuilderState} />
271
342
  <PanelFormSection>
272
343
  <div className="panel__content__form__section__header__label">
@@ -202,6 +202,40 @@ export const QueryResultModifierModal = observer(
202
202
  );
203
203
  };
204
204
 
205
+ const handleSliceStartChange = (start: number, end: number): void => {
206
+ const slice: [number, number] = [start, end];
207
+ resultSetModifierState.setSlice(slice);
208
+ };
209
+
210
+ const clearSlice = (): void => {
211
+ resultSetModifierState.setSlice(undefined);
212
+ };
213
+
214
+ const addSlice = (): void => {
215
+ resultSetModifierState.setSlice([0, 1]);
216
+ };
217
+
218
+ const changeSliceStart: React.ChangeEventHandler<HTMLInputElement> = (
219
+ event,
220
+ ) => {
221
+ const currentSlice = resultSetModifierState.slice;
222
+ const val = event.target.value;
223
+ const start = typeof val === 'number' ? val : parseInt(val, 10);
224
+ if (currentSlice) {
225
+ handleSliceStartChange(start, currentSlice[1]);
226
+ }
227
+ };
228
+ const changeSliceEnd: React.ChangeEventHandler<HTMLInputElement> = (
229
+ event,
230
+ ) => {
231
+ const currentSlice = resultSetModifierState.slice;
232
+ const val = event.target.value;
233
+ const end = typeof val === 'number' ? val : parseInt(val, 10);
234
+ if (currentSlice) {
235
+ handleSliceStartChange(currentSlice[0], end);
236
+ }
237
+ };
238
+
205
239
  return (
206
240
  <Dialog
207
241
  open={Boolean(resultSetModifierState.showModal)}
@@ -258,6 +292,56 @@ export const QueryResultModifierModal = observer(
258
292
  onChange={changeValue}
259
293
  />
260
294
  </div>
295
+ <div className="panel__content__form__section">
296
+ <div className="panel__content__form__section__header__label">
297
+ Slice
298
+ </div>
299
+ <div className="panel__content__form__section__header__prompt">
300
+ Reduce the number of rows in the provided TDS, selecting the
301
+ set of rows in the specified range between start and stop
302
+ </div>
303
+ {resultSetModifierState.slice ? (
304
+ <>
305
+ <div className="query-builder__result__slice">
306
+ <input
307
+ className="input--dark query-builder__result__slice__input"
308
+ spellCheck={false}
309
+ value={resultSetModifierState.slice[0]}
310
+ onChange={changeSliceStart}
311
+ type="number"
312
+ />
313
+ <div className="query-builder__result__slice__range">
314
+ ..
315
+ </div>
316
+ <input
317
+ className="input--dark query-builder__result__slice__input"
318
+ spellCheck={false}
319
+ value={resultSetModifierState.slice[1]}
320
+ onChange={changeSliceEnd}
321
+ type="number"
322
+ />
323
+ <button
324
+ className="query-builder__projection__options__sort__remove-btn btn--dark btn--caution"
325
+ onClick={clearSlice}
326
+ tabIndex={-1}
327
+ title="Remove"
328
+ >
329
+ <TimesIcon />
330
+ </button>
331
+ </div>
332
+ </>
333
+ ) : (
334
+ <div className="panel__content__form__section__list__new-item__add">
335
+ <button
336
+ className="panel__content__form__section__list__new-item__add-btn btn btn--dark"
337
+ onClick={addSlice}
338
+ tabIndex={-1}
339
+ >
340
+ Add Slice
341
+ </button>
342
+ </div>
343
+ )}
344
+ </div>
261
345
  </div>
262
346
  </ModalBody>
263
347
  <ModalFooter>
@@ -1142,6 +1142,19 @@ export const QueryBuilderTDSPanel = observer(
1142
1142
  )}
1143
1143
  </div>
1144
1144
  )}
1145
+ {tdsState.resultSetModifierState.slice && (
1146
+ <div className="query-builder__projection__result-modifier-prompt__group">
1147
+ <div className="query-builder__projection__result-modifier-prompt__group__label">
1148
+ Slice
1149
+ </div>
1150
+ <div
1151
+ className="query-builder__projection__result-modifier-prompt__group__content"
1152
+ onClick={openResultSetModifierEditor}
1153
+ >
1154
+ {`${tdsState.resultSetModifierState.slice[0]},${tdsState.resultSetModifierState.slice[1]}`}
1155
+ </div>
1156
+ </div>
1157
+ )}
1145
1158
  </div>
1146
1159
  <div className="query-builder__projection__toolbar__actions">
1147
1160
  <button
@@ -62,12 +62,16 @@ export enum QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS {
62
62
  CALENDAR_YTD = 'meta::pure::functions::date::calendar::ytd',
63
63
  }
64
64
 
65
+ export enum QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS {
66
+ GET_ALL = 'meta::pure::functions::collection::getAll',
67
+ GET_ALL_VERSIONS = 'meta::pure::functions::collection::getAllVersions',
68
+ GET_ALL_VERSIONS_IN_RANGE = 'meta::pure::functions::collection::getAllVersionsInRange',
69
+ }
70
+
65
71
  export enum QUERY_BUILDER_SUPPORTED_FUNCTIONS {
66
72
  AND = 'meta::pure::functions::boolean::and',
67
73
  EXISTS = 'meta::pure::functions::collection::exists',
68
74
  FILTER = 'meta::pure::functions::collection::filter',
69
- GET_ALL = 'meta::pure::functions::collection::getAll',
70
- GET_ALL_VERSIONS = 'meta::pure::functions::collection::getAllVersions',
71
75
  NOT = 'meta::pure::functions::boolean::not',
72
76
  OR = 'meta::pure::functions::boolean::or',
73
77
  TAKE = 'meta::pure::functions::collection::take',
@@ -154,6 +158,9 @@ export enum QUERY_BUILDER_SUPPORTED_FUNCTIONS {
154
158
  // TOTDS
155
159
  TABLE_TO_TDS = 'meta::pure::tds::tableToTDS',
156
160
  TABLE_REFERENCE = 'meta::relational::functions::database::tableReference',
161
+
162
+ // SLICE
163
+ SLICE = 'meta::pure::functions::collection::slice',
157
164
  }
158
165
 
159
166
  export enum TDS_COLUMN_GETTER {
@@ -19,6 +19,8 @@ import {
19
19
  V1_buildExistsFunctionExpression,
20
20
  V1_buildFilterFunctionExpression,
21
21
  V1_buildGetAllFunctionExpression,
22
+ V1_buildGetAllVersionsFunctionExpression,
23
+ V1_buildGetAllVersionsInRangeFunctionExpression,
22
24
  V1_buildGroupByFunctionExpression,
23
25
  V1_buildOLAPGroupByFunctionExpression,
24
26
  V1_buildProjectFunctionExpression,
@@ -45,6 +47,7 @@ import {
45
47
  import {
46
48
  QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS,
47
49
  QUERY_BUILDER_SUPPORTED_FUNCTIONS,
50
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
48
51
  } from '../../../graph/QueryBuilderMetaModelConst.js';
49
52
 
50
53
  export class QueryBuilder_PureProtocolProcessorPlugin extends PureProtocolProcessorPlugin {
@@ -67,7 +70,7 @@ export class QueryBuilder_PureProtocolProcessorPlugin extends PureProtocolProces
67
70
  if (
68
71
  matchFunctionName(
69
72
  functionName,
70
- QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_ALL,
73
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL,
71
74
  )
72
75
  ) {
73
76
  return V1_buildGetAllFunctionExpression(
@@ -77,6 +80,32 @@ export class QueryBuilder_PureProtocolProcessorPlugin extends PureProtocolProces
77
80
  compileContext,
78
81
  processingContext,
79
82
  );
83
+ } else if (
84
+ matchFunctionName(
85
+ functionName,
86
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS_IN_RANGE,
87
+ )
88
+ ) {
89
+ return V1_buildGetAllVersionsInRangeFunctionExpression(
90
+ functionName,
91
+ parameters,
92
+ openVariables,
93
+ compileContext,
94
+ processingContext,
95
+ );
96
+ } else if (
97
+ matchFunctionName(
98
+ functionName,
99
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL_VERSIONS,
100
+ )
101
+ ) {
102
+ return V1_buildGetAllVersionsFunctionExpression(
103
+ functionName,
104
+ parameters,
105
+ openVariables,
106
+ compileContext,
107
+ processingContext,
108
+ );
80
109
  } else if (
81
110
  matchFunctionName(functionName, [
82
111
  QUERY_BUILDER_SUPPORTED_FUNCTIONS.FILTER,
@@ -390,6 +390,71 @@ export const V1_buildGetAllFunctionExpression = (
390
390
  return expression;
391
391
  };
392
392
 
393
+ export const V1_buildGetAllVersionsInRangeFunctionExpression = (
394
+ functionName: string,
395
+ parameters: V1_ValueSpecification[],
396
+ openVariables: string[],
397
+ compileContext: V1_GraphBuilderContext,
398
+ processingContext: V1_ProcessingContext,
399
+ ): SimpleFunctionExpression => {
400
+ const expression = V1_buildGenericFunctionExpression(
401
+ functionName,
402
+ parameters,
403
+ openVariables,
404
+ compileContext,
405
+ processingContext,
406
+ );
407
+ const precedingExpression = expression.parametersValues[0];
408
+
409
+ assertType(
410
+ precedingExpression,
411
+ InstanceValue,
412
+ `Can't build getAllVersionsInRange() expression: only support getAllVersionsInRange() immediately following a class`,
413
+ );
414
+ const parameterValues = expression.parametersValues;
415
+ assertTrue(
416
+ parameterValues.length === 3,
417
+ `Can't build getAllVersionsInRange() expression: only support getAllVersionsRange() with start and end date`,
418
+ );
419
+ expression.genericType = precedingExpression.genericType;
420
+ expression.multiplicity = precedingExpression.multiplicity;
421
+
422
+ return expression;
423
+ };
424
+
425
+ export const V1_buildGetAllVersionsFunctionExpression = (
426
+ functionName: string,
427
+ parameters: V1_ValueSpecification[],
428
+ openVariables: string[],
429
+ compileContext: V1_GraphBuilderContext,
430
+ processingContext: V1_ProcessingContext,
431
+ ): SimpleFunctionExpression => {
432
+ const expression = V1_buildGenericFunctionExpression(
433
+ functionName,
434
+ parameters,
435
+ openVariables,
436
+ compileContext,
437
+ processingContext,
438
+ );
439
+ const precedingExpression = expression.parametersValues[0];
440
+
441
+ assertType(
442
+ precedingExpression,
443
+ InstanceValue,
444
+ `Can't build getAllVersions() expression: only support getAllVersions() immediately following a class`,
445
+ );
446
+
447
+ const parameterValues = expression.parametersValues;
448
+ assertTrue(
449
+ parameterValues.length === 1,
450
+ `Can't build getAllVersions() expression: only support getAllVersions() with no paremters`,
451
+ );
452
+ expression.genericType = precedingExpression.genericType;
453
+ expression.multiplicity = precedingExpression.multiplicity;
454
+
455
+ return expression;
456
+ };
457
+
393
458
  export const V1_buildExistsFunctionExpression = (
394
459
  functionName: string,
395
460
  parameters: V1_ValueSpecification[],
@@ -93,7 +93,10 @@ import { QueryBuilderWatermarkState } from './watermark/QueryBuilderWatermarkSta
93
93
  import { QueryBuilderConstantsState } from './QueryBuilderConstantsState.js';
94
94
  import { QueryBuilderCheckEntitlementsState } from './entitlements/QueryBuilderCheckEntitlementsState.js';
95
95
  import { QueryBuilderTDSState } from './fetch-structure/tds/QueryBuilderTDSState.js';
96
- import { QUERY_BUILDER_PURE_PATH } from '../graph/QueryBuilderMetaModelConst.js';
96
+ import {
97
+ QUERY_BUILDER_PURE_PATH,
98
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS,
99
+ } from '../graph/QueryBuilderMetaModelConst.js';
97
100
  import type { QueryBuilderInternalizeState } from './QueryBuilderInternalizeState.js';
98
101
  import {
99
102
  QueryBuilderExternalExecutionContextState,
@@ -142,6 +145,8 @@ export abstract class QueryBuilderState implements CommandRegistrar {
142
145
  isLocalModeEnabled = false;
143
146
 
144
147
  class?: Class | undefined;
148
+ getAllFunction: QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS =
149
+ QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL;
145
150
  executionContextState: QueryBuilderExecutionContextState;
146
151
  internalizeState?: QueryBuilderInternalizeState | undefined;
147
152
 
@@ -168,6 +173,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
168
173
  fetchStructureState: observable,
169
174
  filterState: observable,
170
175
  watermarkState: observable,
176
+ milestoningState: observable,
171
177
  checkEntitlementsState: observable,
172
178
  resultState: observable,
173
179
  textEditorState: observable,
@@ -182,6 +188,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
182
188
  class: observable,
183
189
  isQueryChatOpened: observable,
184
190
  isLocalModeEnabled: observable,
191
+ getAllFunction: observable,
185
192
 
186
193
  sideBarClassName: computed,
187
194
  isQuerySupported: computed,
@@ -195,6 +202,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
195
202
  setClass: action,
196
203
  setIsQueryChatOpened: action,
197
204
  setIsLocalModeEnabled: action,
205
+ setGetAllFunction: action,
198
206
 
199
207
  resetQueryResult: action,
200
208
  resetQueryContent: action,
@@ -339,6 +347,10 @@ export abstract class QueryBuilderState implements CommandRegistrar {
339
347
  this.executionContextState = val;
340
348
  }
341
349
 
350
+ setGetAllFunction(val: QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS): void {
351
+ this.getAllFunction = val;
352
+ }
353
+
342
354
  get isQuerySupported(): boolean {
343
355
  return !this.unsupportedQueryState.rawLambda;
344
356
  }
@@ -356,13 +368,19 @@ export abstract class QueryBuilderState implements CommandRegistrar {
356
368
 
357
369
  // Used to determine if variable is used within query
358
370
  // For places where we don't know, we will assume the variable is not used (i.e projection derivation column)
359
- isVariableUsed(variable: VariableExpression): boolean {
360
- return (
361
- this.milestoningState.isVariableUsed(variable) ||
371
+ isVariableUsed(
372
+ variable: VariableExpression,
373
+ options?: {
374
+ exculdeMilestoningState: boolean;
375
+ },
376
+ ): boolean {
377
+ const isVariableUsedInBody =
362
378
  this.filterState.isVariableUsed(variable) ||
363
379
  this.watermarkState.isVariableUsed(variable) ||
364
- this.fetchStructureState.implementation.isVariableUsed(variable)
365
- );
380
+ this.fetchStructureState.implementation.isVariableUsed(variable);
381
+ return options?.exculdeMilestoningState
382
+ ? isVariableUsedInBody
383
+ : this.milestoningState.isVariableUsed(variable) || isVariableUsedInBody;
366
384
  }
367
385
 
368
386
  deregisterCommands(): void {
@@ -418,6 +436,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
418
436
  changeClass(val: Class): void {
419
437
  this.resetQueryResult();
420
438
  this.resetQueryContent();
439
+ this.setGetAllFunction(QUERY_BUILDER_SUPPORTED_GET_ALL_FUNCTIONS.GET_ALL);
421
440
  this.setClass(val);
422
441
  this.explorerState.refreshTreeData();
423
442
  this.fetchStructureState.implementation.onClassChange(val);