From 250117a217961075ef26d3bd4d5f2fe02104432c Mon Sep 17 00:00:00 2001 From: Gayathri Rallapalle <87973126+gayathrir11@users.noreply.github.com> Date: Wed, 24 May 2023 03:46:34 +0530 Subject: [PATCH] Support calendar aggregations for derivation columns (#2253) --- .changeset/silver-ears-change.md | 5 + .../__tests__/QueryBuilderCalendar.test.tsx | 89 +++++- ...V1_QueryValueSpecificationBuilderHelper.ts | 288 +++++++++++++----- .../src/stores/QueryBuilderStateBuilder.ts | 34 +-- .../QueryBuilderBuildLambdaRoundtrip.test.tsx | 21 ++ .../TEST_DATA__QueryBuilder_Calendar.ts | 181 +++++++++++ .../QueryBuilderAggregateCalendarFunction.ts | 56 +++- ...lendarFunctionValueSpecificationBuilder.ts | 17 +- ...derAggregateCalendarFunction_Annualized.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Cme.ts | 3 +- ...ueryBuilderAggregateCalendarFunction_Cw.ts | 3 +- ...yBuilderAggregateCalendarFunction_Cw_Fm.ts | 3 +- ...lderAggregateCalendarFunction_Cy_Minus2.ts | 3 +- ...lderAggregateCalendarFunction_Cy_Minus3.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Mtd.ts | 3 +- ...yBuilderAggregateCalendarFunction_P12Wa.ts | 3 +- ...BuilderAggregateCalendarFunction_P12Wtd.ts | 3 +- ...ryBuilderAggregateCalendarFunction_P4Wa.ts | 3 +- ...yBuilderAggregateCalendarFunction_P4Wtd.ts | 3 +- ...yBuilderAggregateCalendarFunction_P52Wa.ts | 3 +- ...BuilderAggregateCalendarFunction_P52Wtd.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Pma.ts | 3 +- ...ryBuilderAggregateCalendarFunction_Pmtd.ts | 3 +- ...ryBuilderAggregateCalendarFunction_Pqtd.ts | 3 +- ...ilderAggregateCalendarFunction_PriorDay.ts | 3 +- ...lderAggregateCalendarFunction_PriorYear.ts | 3 +- ...ueryBuilderAggregateCalendarFunction_Pw.ts | 3 +- ...yBuilderAggregateCalendarFunction_Pw_Fm.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Pwa.ts | 3 +- ...ryBuilderAggregateCalendarFunction_Pwtd.ts | 3 +- ...yBuilderAggregateCalendarFunction_Pymtd.ts | 3 +- ...yBuilderAggregateCalendarFunction_Pyqtd.ts | 3 +- ...ryBuilderAggregateCalendarFunction_Pytd.ts | 3 +- ...ryBuilderAggregateCalendarFunction_Pywa.ts | 3 +- ...yBuilderAggregateCalendarFunction_Pywtd.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Qtd.ts | 3 +- ...rAggregateCalendarFunction_ReportEndDay.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Wtd.ts | 3 +- ...eryBuilderAggregateCalendarFunction_Ytd.ts | 3 +- ...lderProjectionValueSpecificationBuilder.ts | 3 +- 40 files changed, 628 insertions(+), 159 deletions(-) create mode 100644 .changeset/silver-ears-change.md diff --git a/.changeset/silver-ears-change.md b/.changeset/silver-ears-change.md new file mode 100644 index 0000000000..431420598f --- /dev/null +++ b/.changeset/silver-ears-change.md @@ -0,0 +1,5 @@ +--- +'@finos/legend-query-builder': patch +--- + +Support calendar aggregations for derivation columns diff --git a/packages/legend-query-builder/src/components/__tests__/QueryBuilderCalendar.test.tsx b/packages/legend-query-builder/src/components/__tests__/QueryBuilderCalendar.test.tsx index 4dba44b0a7..6964ac7692 100644 --- a/packages/legend-query-builder/src/components/__tests__/QueryBuilderCalendar.test.tsx +++ b/packages/legend-query-builder/src/components/__tests__/QueryBuilderCalendar.test.tsx @@ -18,11 +18,12 @@ import { test, expect } from '@jest/globals'; import { guaranteeNonNullable, guaranteeType } from '@finos/legend-shared'; import TEST_DATA_SimpleCalendarModel from '../../stores/__tests__/TEST_DATA__QueryBuilder_Model_Calendar.json'; import { stub_RawLambda, create_RawLambda } from '@finos/legend-graph'; -import { integrationTest } from '@finos/legend-shared/test'; +import { createMock, integrationTest } from '@finos/legend-shared/test'; import { waitFor, getAllByText } from '@testing-library/react'; import { act } from 'react-dom/test-utils'; import { TEST_DATA__ModelCoverageAnalysisResult_Calendar, + TEST_DATA__simpleDerivationWithCalendarAggregation, TEST_DATA__simpleProjectionWithCalendarAggregation, } from '../../stores/__tests__/TEST_DATA__QueryBuilder_Calendar.js'; import { QueryBuilderExplorerTreeRootNodeData } from '../../stores/explorer/QueryBuilderExplorerState.js'; @@ -31,6 +32,11 @@ import { TEST__setUpQueryBuilder } from '../__test-utils__/QueryBuilderComponent import { QUERY_BUILDER_CALENDAR_TYPE } from '../../graph-manager/QueryBuilderConst.js'; import { QueryBuilderAggregateCalendarFunction_Ytd } from '../../stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Ytd.js'; import { QUERY_BUILDER_TEST_ID } from '../../__lib__/QueryBuilderTesting.js'; +import { QueryBuilderAggregateCalendarFunction_Cme } from '../../stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cme.js'; +import { + MockedMonacoEditorInstance, + MockedMonacoEditorAPI, +} from '@finos/legend-lego/code-editor/test'; test( integrationTest( @@ -174,3 +180,84 @@ test( ).toBeUndefined(); }, ); + +test( + integrationTest( + 'Query builder state is properly set after processing a lambda with calendar aggregation having derivation column', + ), + async () => { + const { renderResult, queryBuilderState } = await TEST__setUpQueryBuilder( + TEST_DATA_SimpleCalendarModel, + stub_RawLambda(), + 'test::mapping', + 'test::runtime', + TEST_DATA__ModelCoverageAnalysisResult_Calendar, + ); + const employeeClass = + queryBuilderState.graphManagerState.graph.getClass('test::Employee'); + await act(async () => { + queryBuilderState.changeClass(employeeClass); + }); + const queryBuilderSetup = await waitFor(() => + renderResult.getByTestId(QUERY_BUILDER_TEST_ID.QUERY_BUILDER_SETUP), + ); + await waitFor(() => getAllByText(queryBuilderSetup, 'Employee')); + await waitFor(() => getAllByText(queryBuilderSetup, 'mapping')); + const treeData = guaranteeNonNullable( + queryBuilderState.explorerState.treeData, + ); + const rootNode = guaranteeType( + treeData.nodes.get(treeData.rootIds[0] as string), + QueryBuilderExplorerTreeRootNodeData, + ); + + expect(rootNode.mappingData.mapped).toBe(true); + + // mock monaco editor + MockedMonacoEditorInstance.getRawOptions.mockReturnValue({ + readOnly: true, + }); + MockedMonacoEditorAPI.removeAllMarkers.mockReturnValue(null); + MockedMonacoEditorInstance.onDidFocusEditorWidget.mockReturnValue(null); + const MOCK__pureCodeToLambda = createMock(); + const MOCK__lambdaToPureCode = createMock(); + queryBuilderState.graphManagerState.graphManager.pureCodeToLambda = + MOCK__pureCodeToLambda; + queryBuilderState.graphManagerState.graphManager.lambdasToPureCode = + MOCK__lambdaToPureCode; + const mockValue = new Map(); + mockValue.set('query-builder', 'test'); + MOCK__lambdaToPureCode.mockResolvedValue(mockValue); + + await act(async () => { + queryBuilderState.initializeWithQuery( + create_RawLambda( + TEST_DATA__simpleDerivationWithCalendarAggregation.parameters, + TEST_DATA__simpleDerivationWithCalendarAggregation.body, + ), + ); + }); + + const tdsStateOne = guaranteeType( + queryBuilderState.fetchStructureState.implementation, + QueryBuilderTDSState, + ); + + // check calendar aggregation function + expect(tdsStateOne.aggregationState.columns.length).toBe(1); + expect( + tdsStateOne.aggregationState.columns[0]?.calendarFunction, + ).toBeDefined(); + expect( + tdsStateOne.aggregationState.columns[0]?.calendarFunction?.calendarType, + ).toBe(QUERY_BUILDER_CALENDAR_TYPE.LDN); + expect( + tdsStateOne.aggregationState.columns[0]?.calendarFunction instanceof + QueryBuilderAggregateCalendarFunction_Cme, + ).toBe(true); + expect( + tdsStateOne.aggregationState.columns[0]?.calendarFunction?.dateColumn + ?.func.value.name, + ).toBe('hireDate'); + }, +); diff --git a/packages/legend-query-builder/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts b/packages/legend-query-builder/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts index c8e80d1964..19020f9d42 100644 --- a/packages/legend-query-builder/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts +++ b/packages/legend-query-builder/src/graph-manager/protocol/pure/v1/V1_QueryValueSpecificationBuilderHelper.ts @@ -52,6 +52,11 @@ import { PrimitiveType, V1_CStrictDate, V1_CString, + CORE_PURE_PATH, + FunctionType, + LambdaFunction, + LambdaFunctionInstanceValue, + PackageableElementExplicitReference, } from '@finos/legend-graph'; import { QUERY_BUILDER_PURE_PATH, @@ -91,81 +96,41 @@ const buildProjectionColumnLambda = ( let currentPropertyExpression: V1_ValueSpecification = valueSpecification .body[0] as V1_ValueSpecification; - // calendar - if ( - currentPropertyExpression instanceof V1_AppliedFunction && - matchFunctionName( - currentPropertyExpression.function, - Object.values(QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS), - ) - ) { - assertTrue( - currentPropertyExpression.parameters.length === 4, - `Can't build projection column: only support calendar function with four parameters`, - ); - assertType( - currentPropertyExpression.parameters[0], - V1_AppliedProperty, - `Can't build projection column: only support first parameter of calendar function as property expression`, - ); - const calendarType = guaranteeType( - currentPropertyExpression.parameters[1], - V1_CString, - `Can't build projection column: only support second parameter of calendar function as String`, - ); + assertType( + currentPropertyExpression, + V1_AppliedProperty, + `Can't build projection column: only support lambda body as property expression`, + ); + while (currentPropertyExpression instanceof V1_AppliedProperty) { assertTrue( - Object.values(QUERY_BUILDER_CALENDAR_TYPE).find( - (val) => val === calendarType.value, - ) !== undefined, - `Can't build projection column: ${calendarType.value} is not a supported calendar type`, - ); - guaranteeType( - currentPropertyExpression.parameters[2], - V1_CStrictDate, - `Can't build projection column: only support third parameter of calendar function as StrictDate`, - ); - assertType( - currentPropertyExpression.parameters[3], - V1_AppliedProperty, - `Can't build projection column: only support fourth parameter of calendar function as property expression`, - ); - } else { - assertType( - currentPropertyExpression, - V1_AppliedProperty, + currentPropertyExpression.parameters.length >= 1, `Can't build projection column: only support lambda body as property expression`, ); - while (currentPropertyExpression instanceof V1_AppliedProperty) { - assertTrue( - currentPropertyExpression.parameters.length >= 1, - `Can't build projection column: only support lambda body as property expression`, - ); + currentPropertyExpression = currentPropertyExpression + .parameters[0] as V1_ValueSpecification; + // Take care of chains of subtype (a pattern that is not useful, but we want to support and rectify) + // $x.employees->subType(@Person)->subType(@Staff) + while ( + currentPropertyExpression instanceof V1_AppliedFunction && + matchFunctionName( + currentPropertyExpression.function, + QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUBTYPE, + ) + ) { currentPropertyExpression = currentPropertyExpression .parameters[0] as V1_ValueSpecification; - // Take care of chains of subtype (a pattern that is not useful, but we want to support and rectify) - // $x.employees->subType(@Person)->subType(@Staff) - while ( - currentPropertyExpression instanceof V1_AppliedFunction && - matchFunctionName( - currentPropertyExpression.function, - QUERY_BUILDER_SUPPORTED_FUNCTIONS.SUBTYPE, - ) - ) { - currentPropertyExpression = currentPropertyExpression - .parameters[0] as V1_ValueSpecification; - } } - // check lambda variable and parameter match - assertType( - currentPropertyExpression, - V1_Variable, - `Can't build projection column: only support lambda body as property expression`, - ); - assertTrue( - columnLambdaParameter.name === currentPropertyExpression.name, - `Can't build column lambda: expects variable used in lambda body '${currentPropertyExpression.name}' to match lambda parameter '${columnLambdaParameter.name}'`, - ); } + // check lambda variable and parameter match + assertType( + currentPropertyExpression, + V1_Variable, + `Can't build projection column: only support lambda body as property expression`, + ); + assertTrue( + columnLambdaParameter.name === currentPropertyExpression.name, + `Can't build column lambda: expects variable used in lambda body '${currentPropertyExpression.name}' to match lambda parameter '${columnLambdaParameter.name}'`, + ); return valueSpecification.accept_ValueSpecificationVisitor( new V1_ValueSpecificationBuilder( compileContext, @@ -175,6 +140,138 @@ const buildProjectionColumnLambda = ( ); }; +const buildCalendarFunctionExpression = ( + valueSpecification: V1_ValueSpecification, + openVariables: string[], + compileContext: V1_GraphBuilderContext, + processingContext: V1_ProcessingContext, +): ValueSpecification => { + assertType( + valueSpecification, + V1_Lambda, + `Can't build calendar aggregation column: only support lambda`, + ); + + // lambda parameter + assertTrue( + valueSpecification.parameters.length === 1, + `Can't build calendar aggregation column: only support lambda with 1 parameter`, + ); + + // lambda body + assertTrue( + valueSpecification.body.length === 1, + `Can't build calendar aggregation column: only support lambda body with 1 expression`, + ); + const columnLambdaParameter = guaranteeType( + valueSpecification.parameters[0], + V1_Variable, + `Can't build calendar aggregation column: only support lambda with 1 parameter`, + ); + const currentPropertyExpression = guaranteeType( + valueSpecification.body[0], + V1_AppliedFunction, + `Can't build calendar aggregation column: only support applied function`, + ); + assertTrue( + matchFunctionName( + currentPropertyExpression.function, + Object.values(QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS), + ), + `Can't build calendar aggregation columnn: unsupported calenddar function`, + ); + + assertTrue( + currentPropertyExpression.parameters.length === 4, + `Can't build calendar aggregation column: only support calendar function with four parameters`, + ); + assertType( + currentPropertyExpression.parameters[0], + V1_AppliedProperty, + `Can't build calendar aggregation column: only support first parameter of calendar function as property expression`, + ); + const calendarType = guaranteeType( + currentPropertyExpression.parameters[1], + V1_CString, + `Can't build calendar aggregation column: only support second parameter of calendar function as String`, + ); + assertTrue( + Object.values(QUERY_BUILDER_CALENDAR_TYPE).find( + (val) => val === calendarType.value, + ) !== undefined, + `Can't build calendar aggregation column: ${calendarType.value} is not a supported calendar type`, + ); + guaranteeType( + currentPropertyExpression.parameters[2], + V1_CStrictDate, + `Can't build calendar aggregation column: only support third parameter of calendar function as StrictDate`, + ); + const dateColumn = + currentPropertyExpression.parameters[0].accept_ValueSpecificationVisitor( + new V1_ValueSpecificationBuilder( + compileContext, + processingContext, + openVariables, + ), + ); + const calendarTypeValueSpec = guaranteeNonNullable( + currentPropertyExpression.parameters[1], + ).accept_ValueSpecificationVisitor( + new V1_ValueSpecificationBuilder( + compileContext, + processingContext, + openVariables, + ), + ); + const endDate = guaranteeNonNullable( + currentPropertyExpression.parameters[2], + ).accept_ValueSpecificationVisitor( + new V1_ValueSpecificationBuilder( + compileContext, + processingContext, + openVariables, + ), + ); + const columnLambda = guaranteeNonNullable( + currentPropertyExpression.parameters[3], + ); + const targetColumn = + returnUndefOnError(() => + columnLambda.accept_ValueSpecificationVisitor( + new V1_ValueSpecificationBuilder( + compileContext, + processingContext, + openVariables, + ), + ), + ) ?? + new INTERNAL__UnknownValueSpecification( + V1_serializeValueSpecification( + columnLambda, + compileContext.extensions.plugins, + ), + ); + const calendarFunctionExpression = V1_buildBaseSimpleFunctionExpression( + [dateColumn, calendarTypeValueSpec, endDate, targetColumn], + currentPropertyExpression.function, + compileContext, + ); + const functionInstanceValue = new LambdaFunctionInstanceValue(); + const functionType = new FunctionType( + PackageableElementExplicitReference.create( + compileContext.graph.getType(CORE_PURE_PATH.ANY), + ), + Multiplicity.ONE, + ); + functionType.parameters.push( + new VariableExpression(columnLambdaParameter.name, Multiplicity.ONE), + ); + const lambdaFunction = new LambdaFunction(functionType); + lambdaFunction.expressionSequence = [calendarFunctionExpression]; + functionInstanceValue.values.push(lambdaFunction); + return functionInstanceValue; +}; + const buildAggregationExpression = ( valueSpecification: V1_ValueSpecification, openVariables: string[], @@ -205,21 +302,46 @@ const buildAggregationExpression = ( V1_Lambda, `Can't build agg() expression: agg() expects argument #1 as a lambda`, ); - const processedColumnLambda = - returnUndefOnError(() => - buildProjectionColumnLambda( - columnLambda, - openVariables, - compileContext, - processingContext, - ), - ) ?? - new INTERNAL__UnknownValueSpecification( - V1_serializeValueSpecification( - columnLambda, - compileContext.extensions.plugins, - ), - ); + let processedColumnLambda; + if ( + columnLambda.body[0] instanceof V1_AppliedFunction && + matchFunctionName( + columnLambda.body[0].function, + Object.values(QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS), + ) + ) { + processedColumnLambda = + returnUndefOnError(() => + buildCalendarFunctionExpression( + columnLambda, + openVariables, + compileContext, + processingContext, + ), + ) ?? + new INTERNAL__UnknownValueSpecification( + V1_serializeValueSpecification( + columnLambda, + compileContext.extensions.plugins, + ), + ); + } else { + processedColumnLambda = + returnUndefOnError(() => + buildProjectionColumnLambda( + columnLambda, + openVariables, + compileContext, + processingContext, + ), + ) ?? + new INTERNAL__UnknownValueSpecification( + V1_serializeValueSpecification( + columnLambda, + compileContext.extensions.plugins, + ), + ); + } // aggregate lambda const aggregateLambda = guaranteeType( diff --git a/packages/legend-query-builder/src/stores/QueryBuilderStateBuilder.ts b/packages/legend-query-builder/src/stores/QueryBuilderStateBuilder.ts index 8a61d5b17e..ce54732052 100644 --- a/packages/legend-query-builder/src/stores/QueryBuilderStateBuilder.ts +++ b/packages/legend-query-builder/src/stores/QueryBuilderStateBuilder.ts @@ -40,7 +40,7 @@ import { PrimitiveInstanceValue, SimpleFunctionExpression, type VariableExpression, - AbstractPropertyExpression, + type AbstractPropertyExpression, getMilestoneTemporalStereotype, type INTERNAL__PropagatedValue, type ValueSpecification, @@ -143,22 +143,6 @@ const processLetExpression = ( queryBuilderState.constantState.addConstant(constantExpression); }; -const processCalendarFunction = ( - expression: SimpleFunctionExpression, - queryBuilderState: QueryBuilderState, - parentLambda: LambdaFunction, -): void => { - queryBuilderState.isCalendarEnabled = true; - assertTrue( - expression.parametersValues.length === 4, - 'Calendar function expected to have four parameters', - ); - processTDSProjectionColumnPropertyExpression( - guaranteeType(expression.parametersValues[3], AbstractPropertyExpression), - queryBuilderState, - ); -}; - /** * This is the value specification processor (a.k.a state builder) for query builder. * @@ -297,6 +281,9 @@ export class QueryBuilderValueSpecificationProcessor QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_AGG, + ...Object.values( + QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS, + ), ]) ) { processTDSProjectionDerivationExpression( @@ -561,10 +548,16 @@ export class QueryBuilderValueSpecificationProcessor Object.values(QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS), ) ) { - processCalendarFunction( + this.queryBuilderState.isCalendarEnabled = true; + assertTrue( + valueSpecification.parametersValues.length === 4, + 'Calendar function expected to have four parameters', + ); + QueryBuilderValueSpecificationProcessor.processChild( + guaranteeNonNullable(valueSpecification.parametersValues[3]), valueSpecification, - this.queryBuilderState, this.parentLambda, + this.queryBuilderState, ); return; } @@ -590,6 +583,9 @@ export class QueryBuilderValueSpecificationProcessor QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_PROJECT, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_GROUP_BY, QUERY_BUILDER_SUPPORTED_FUNCTIONS.TDS_AGG, + ...Object.values( + QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS, + ), ]) ) { processTDSProjectionColumnPropertyExpression( diff --git a/packages/legend-query-builder/src/stores/__tests__/QueryBuilderBuildLambdaRoundtrip.test.tsx b/packages/legend-query-builder/src/stores/__tests__/QueryBuilderBuildLambdaRoundtrip.test.tsx index 56cfad8e0a..3e7e0db8cb 100644 --- a/packages/legend-query-builder/src/stores/__tests__/QueryBuilderBuildLambdaRoundtrip.test.tsx +++ b/packages/legend-query-builder/src/stores/__tests__/QueryBuilderBuildLambdaRoundtrip.test.tsx @@ -124,6 +124,11 @@ import { TEST__LegendApplicationPluginManager, TEST__getGenericApplicationConfig, } from '../__test-utils__/QueryBuilderStateTestUtils.js'; +import TEST_DATA_SimpleCalendarModel from '../../stores/__tests__/TEST_DATA__QueryBuilder_Model_Calendar.json'; +import { + TEST_DATA__simpleDerivationWithCalendarAggregation, + TEST_DATA__simpleProjectionWithCalendarAggregation, +} from './TEST_DATA__QueryBuilder_Calendar.js'; type RoundtripTestCase = [ string, @@ -174,6 +179,10 @@ const identitfyM2MCtx = { entities: TEST_DATA__QueryBuilder_Model_SimpleIdentityM2M, }; +const calendarAggregationCtx = { + entities: TEST_DATA_SimpleCalendarModel, +}; + const cases: RoundtripTestCase[] = [ // projection ['Simple projection', projectionCtx, TEST_DATA__simpleProjection, undefined], @@ -597,6 +606,18 @@ const cases: RoundtripTestCase[] = [ TEST_DATA__lambda_Externalize_externalize_graphFetchChecked, undefined, ], + [ + 'Simple relational projection column with calendar aggregation', + calendarAggregationCtx, + TEST_DATA__simpleProjectionWithCalendarAggregation, + undefined, + ], + [ + 'Simple relational derivation column with calendar aggregation', + calendarAggregationCtx, + TEST_DATA__simpleDerivationWithCalendarAggregation, + undefined, + ], ]; describe( diff --git a/packages/legend-query-builder/src/stores/__tests__/TEST_DATA__QueryBuilder_Calendar.ts b/packages/legend-query-builder/src/stores/__tests__/TEST_DATA__QueryBuilder_Calendar.ts index e5e7e6558d..37de2b6ca3 100644 --- a/packages/legend-query-builder/src/stores/__tests__/TEST_DATA__QueryBuilder_Calendar.ts +++ b/packages/legend-query-builder/src/stores/__tests__/TEST_DATA__QueryBuilder_Calendar.ts @@ -240,6 +240,187 @@ export const TEST_DATA__simpleProjectionWithCalendarAggregation = { parameters: [], }; +export const TEST_DATA__simpleDerivationWithCalendarAggregation = { + _type: 'lambda', + body: [ + { + _type: 'func', + function: 'groupBy', + parameters: [ + { + _type: 'func', + function: 'getAll', + parameters: [ + { + _type: 'packageableElementPtr', + fullPath: 'test::Employee', + }, + ], + }, + { + _type: 'collection', + multiplicity: { + lowerBound: 1, + upperBound: 1, + }, + values: [ + { + _type: 'lambda', + body: [ + { + _type: 'property', + parameters: [ + { + _type: 'var', + name: 'p', + }, + ], + property: 'hireDate', + }, + ], + parameters: [ + { + _type: 'var', + name: 'p', + }, + ], + }, + ], + }, + { + _type: 'collection', + multiplicity: { + lowerBound: 1, + upperBound: 1, + }, + values: [ + { + _type: 'func', + function: 'agg', + parameters: [ + { + _type: 'lambda', + body: [ + { + _type: 'func', + function: 'cme', + parameters: [ + { + _type: 'property', + parameters: [ + { + _type: 'var', + name: 'p', + }, + ], + property: 'hireDate', + }, + { + _type: 'string', + value: 'LDN', + }, + { + _type: 'strictDate', + value: '2022-11-16', + }, + { + _type: 'lambda', + body: [ + { + _type: 'func', + function: 'plus', + parameters: [ + { + _type: 'collection', + multiplicity: { + lowerBound: 2, + upperBound: 2, + }, + values: [ + { + _type: 'property', + parameters: [ + { + _type: 'var', + name: 'p', + }, + ], + property: 'fteFactor', + }, + { + _type: 'integer', + value: 1, + }, + ], + }, + ], + }, + ], + parameters: [ + { + _type: 'var', + name: 'p', + }, + ], + }, + ], + }, + ], + parameters: [ + { + _type: 'var', + name: 'p', + }, + ], + }, + { + _type: 'lambda', + body: [ + { + _type: 'func', + function: 'sum', + parameters: [ + { + _type: 'var', + name: 'y', + }, + ], + }, + ], + parameters: [ + { + _type: 'var', + name: 'y', + }, + ], + }, + ], + }, + ], + }, + { + _type: 'collection', + multiplicity: { + lowerBound: 2, + upperBound: 2, + }, + values: [ + { + _type: 'string', + value: 'includedDate', + }, + { + _type: 'string', + value: 'ytd', + }, + ], + }, + ], + }, + ], + parameters: [], +}; + export const TEST_DATA__ModelCoverageAnalysisResult_Calendar = { mappedEntities: [ { diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.ts index e1bd268e30..442e5dec34 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/QueryBuilderAggregateCalendarFunction.ts @@ -14,16 +14,23 @@ * limitations under the License. */ -import { type Hashable, guaranteeType } from '@finos/legend-shared'; -import type { +import { + type Hashable, + guaranteeType, + UnsupportedOperationError, +} from '@finos/legend-shared'; +import { AbstractPropertyExpression, - PrimitiveInstanceValue, - SimpleFunctionExpression, - ValueSpecification, + INTERNAL__UnknownValueSpecification, + LambdaFunctionInstanceValue, + type PrimitiveInstanceValue, + type SimpleFunctionExpression, + type ValueSpecification, } from '@finos/legend-graph'; import { type QueryBuilderProjectionColumnState, QueryBuilderSimpleProjectionColumnState, + QueryBuilderDerivationProjectionColumnState, } from '../projection/QueryBuilderProjectionColumnState.js'; import type { QueryBuilderAggregateColumnState } from './QueryBuilderAggregationState.js'; import { computed, makeObservable, observable, action } from 'mobx'; @@ -59,18 +66,43 @@ export abstract class QueryBuilderAggregateCalendarFunction ): boolean; abstract buildCalendarFunctionExpression( - propertyExpression: AbstractPropertyExpression, + propertyExpression: + | AbstractPropertyExpression + | INTERNAL__UnknownValueSpecification, ): ValueSpecification; buildCalendarFunctionExpressionFromState( aggregateColumnState: QueryBuilderAggregateColumnState, + columnLambda: ValueSpecification, ): ValueSpecification { - return this.buildCalendarFunctionExpression( - guaranteeType( - aggregateColumnState.projectionColumnState, - QueryBuilderSimpleProjectionColumnState, - ).propertyExpressionState.propertyExpression, - ); + let targetColumn: + | AbstractPropertyExpression + | INTERNAL__UnknownValueSpecification + | undefined; + if ( + aggregateColumnState.projectionColumnState instanceof + QueryBuilderSimpleProjectionColumnState && + columnLambda instanceof LambdaFunctionInstanceValue + ) { + targetColumn = guaranteeType( + columnLambda.values[0]?.expressionSequence[0], + AbstractPropertyExpression, + ); + } else if ( + aggregateColumnState.projectionColumnState instanceof + QueryBuilderDerivationProjectionColumnState + ) { + targetColumn = guaranteeType( + columnLambda, + INTERNAL__UnknownValueSpecification, + ); + } + if (!targetColumn) { + throw new UnsupportedOperationError( + "Can't build calendar aggregation column: target column should be defined", + ); + } + return this.buildCalendarFunctionExpression(targetColumn); } abstract updateAggregateColumnState( diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.ts index 56e868c9b3..ee805ed79d 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunctionValueSpecificationBuilder.ts @@ -26,6 +26,7 @@ import { PrimitiveType, PRIMITIVE_TYPE, VariableExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import { guaranteeType, @@ -41,7 +42,9 @@ export const buildCalendarFunctionExpression = ( dateColumn: AbstractPropertyExpression | undefined, calendarType: QUERY_BUILDER_CALENDAR_TYPE, endDate: PrimitiveInstanceValue, - targetColumn: AbstractPropertyExpression, + targetColumn: + | AbstractPropertyExpression + | INTERNAL__UnknownValueSpecification, ): ValueSpecification => { const expression = new SimpleFunctionExpression( extractElementNameFromPath(calendarFunctionFullPath), @@ -50,7 +53,7 @@ export const buildCalendarFunctionExpression = ( expression.parametersValues.push(dateColumn); } else { throw new UnsupportedOperationError( - `Please specify date column for calendar Function for column ${targetColumn.func.value.name}`, + `Please specify date column for calendar function for column`, ); } const calendarTypeParameter = new PrimitiveInstanceValue( @@ -147,16 +150,6 @@ export const updateAggregateColumnState = ( )}() with third parameter of type StrictDate`, ); - guaranteeType( - expression.parametersValues[3], - AbstractPropertyExpression, - `Can't process ${extractElementNameFromPath( - calendarFunctionFullPath, - )}() expression: only support ${extractElementNameFromPath( - calendarFunctionFullPath, - )}() fourth parameter as property expression`, - ); - calendarFunction.calendarType = calendarTypeParameter .values[0] as QUERY_BUILDER_CALENDAR_TYPE; calendarFunction.endDate = endDate; diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Annualized.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Annualized.ts index 66b8ce3de8..943b0dc396 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Annualized.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Annualized.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Annualized } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_ANNUALIZED, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cme.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cme.ts index e7cb1dd2e7..157d3e641c 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cme.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cme.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Cme } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_CME, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw.ts index 3219e67982..cc35dc88ac 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Cw } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_CW, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw_Fm.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw_Fm.ts index 5ae28ee277..cca7b2933e 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw_Fm.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cw_Fm.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -65,7 +66,7 @@ export class QueryBuilderAggregateCalendarFunction_Cw_Fm } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_CW_FM, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus2.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus2.ts index 7f31e0c94a..1608cbd45a 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus2.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus2.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Cy_Minus2 } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_CY_MINUS2, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus3.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus3.ts index 6df77fefaf..450a0b85a9 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus3.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Cy_Minus3.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Cy_Minus3 } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_CY_MINUS3, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Mtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Mtd.ts index b980dde00f..7a2ccb8d22 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Mtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Mtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Mtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_MTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wa.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wa.ts index 45d1132491..7dfdc6eead 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wa.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wa.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_P12Wa } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_P12WA, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wtd.ts index f3bfe5d991..a410929e1b 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P12Wtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_P12Wtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_P12WTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wa.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wa.ts index f63333dc6f..de866d23e9 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wa.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wa.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_P4Wa } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_P4WA, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wtd.ts index 1d189ff577..3e40392b54 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P4Wtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_P4Wtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_P4WTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wa.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wa.ts index 16e03c5308..04d73215b6 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wa.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wa.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_P52Wa } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_P52WA, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wtd.ts index 49f43fd234..3fecf66251 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_P52Wtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_P52Wtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_P52WTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pma.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pma.ts index f6e36e304c..c525e9e810 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pma.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pma.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pma } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PMA, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pmtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pmtd.ts index dd8e87c5b9..e6afb3ef3b 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pmtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pmtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pmtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PMTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pqtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pqtd.ts index 193b2b2f48..3bb7509fd0 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pqtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pqtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pqtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PQTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorDay.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorDay.ts index e8fb432141..21dbcd247b 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorDay.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorDay.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_PriorDay } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PRIOR_DAY, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorYear.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorYear.ts index d34a07164c..a0c9bb0b85 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorYear.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_PriorYear.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_PriorYear } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PRIOR_YEAR, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw.ts index 6f8384c5d5..a14398ab05 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pw } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PW, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw_Fm.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw_Fm.ts index 0c9e062559..84e5370ad0 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw_Fm.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pw_Fm.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pw_Fm } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PW_FM, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwa.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwa.ts index b4776ef326..08d7e2ebff 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwa.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwa.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pwa } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PWA, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwtd.ts index b54bb174b3..3bd7fde392 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pwtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pwtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PWTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pymtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pymtd.ts index ce2d60a5cd..9c8b5f0e6c 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pymtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pymtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pymtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PYMTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pyqtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pyqtd.ts index f835b67c79..0cdbeb878f 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pyqtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pyqtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pyqtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PYQTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pytd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pytd.ts index 40f7dd1cb5..763924938f 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pytd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pytd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pytd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PYTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywa.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywa.ts index b3b1f16d8f..4585d34c8b 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywa.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywa.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pywa } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PYWA, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywtd.ts index 6b5ed4d854..89ca503161 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Pywtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Pywtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_PYWTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Qtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Qtd.ts index ef0c51a17d..d30aac6cd3 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Qtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Qtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Qtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_QTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_ReportEndDay.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_ReportEndDay.ts index a80f4ce799..17ecaa4f7a 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_ReportEndDay.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_ReportEndDay.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_ReportEndDay } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_REPORT_END_DAY, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Wtd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Wtd.ts index 1526cb8e5d..7e0ec3bc62 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Wtd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Wtd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Wtd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_WTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Ytd.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Ytd.ts index 82925f731b..0159edd62e 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Ytd.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/aggregation/calendarFunctions/QueryBuilderAggregateCalendarFunction_Ytd.ts @@ -19,6 +19,7 @@ import { type ValueSpecification, type SimpleFunctionExpression, type AbstractPropertyExpression, + type INTERNAL__UnknownValueSpecification, } from '@finos/legend-graph'; import type { QueryBuilderAggregateColumnState } from '../QueryBuilderAggregationState.js'; import { @@ -64,7 +65,7 @@ export class QueryBuilderAggregateCalendarFunction_Ytd } buildCalendarFunctionExpression( - p: AbstractPropertyExpression, + p: AbstractPropertyExpression | INTERNAL__UnknownValueSpecification, ): ValueSpecification { return buildCalendarFunctionExpression( QUERY_BUILDER_SUPPORTED_CALENDAR_AGGREGATION_FUNCTIONS.CALENDAR_YTD, diff --git a/packages/legend-query-builder/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts b/packages/legend-query-builder/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts index 15ec6df48c..01dc11281b 100644 --- a/packages/legend-query-builder/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts +++ b/packages/legend-query-builder/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionValueSpecificationBuilder.ts @@ -279,10 +279,11 @@ export const appendProjection = ( const aggregateCalendarLambdaState = aggregateColumnState.calendarFunction?.buildCalendarFunctionExpressionFromState( aggregateColumnState, + columnLambda, ); if ( queryBuilderState.isCalendarEnabled && - aggregateCalendarLambdaState !== undefined + aggregateCalendarLambdaState instanceof SimpleFunctionExpression ) { aggregateCalendarLambda = buildGenericLambdaFunctionInstanceValue( guaranteeNonNullable(aggregateColumnState.calendarFunction)