@finos/legend-query-builder 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilder.d.ts +0 -1
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilderDiffPanel.d.ts +0 -1
- package/lib/components/QueryBuilderDiffPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.d.ts +0 -1
- package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.js +2 -4
- package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts +0 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderResultPanel.d.ts +0 -1
- package/lib/components/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderSideBar.d.ts +0 -1
- package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
- package/lib/components/QueryBuilderTextEditor.d.ts +0 -1
- package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts +0 -1
- package/lib/components/QueryBuilderUnsupportedQueryEditor.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts +0 -1
- package/lib/components/explorer/QueryBuilderFunctionsExplorerPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +0 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts +0 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderFetchStructurePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderGraphFetchTreePanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderOLAPGroupByPanel_.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderPostTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts +0 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts +0 -1
- package/lib/components/filter/QueryBuilderFilterPanel.d.ts.map +1 -1
- package/lib/components/shared/LambdaEditor.d.ts +0 -1
- package/lib/components/shared/LambdaEditor.d.ts.map +1 -1
- package/lib/components/shared/LambdaParameterValuesEditor.d.ts +0 -1
- package/lib/components/shared/LambdaParameterValuesEditor.d.ts.map +1 -1
- package/lib/components/watermark/QueryBuilderWatermark.d.ts +0 -1
- package/lib/components/watermark/QueryBuilderWatermark.d.ts.map +1 -1
- package/lib/index.css +16 -0
- package/lib/package.json +6 -6
- package/lib/stores/QueryBuilderResultState.d.ts +1 -2
- package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderResultState.js +7 -12
- package/lib/stores/QueryBuilderResultState.js.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.d.ts.map +1 -1
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js +9 -4
- package/lib/stores/QueryBuilderValueSpecificationBuilder.js.map +1 -1
- package/lib/stores/shared/LambdaParameterState.d.ts +14 -2
- package/lib/stores/shared/LambdaParameterState.d.ts.map +1 -1
- package/lib/stores/shared/LambdaParameterState.js +79 -6
- package/lib/stores/shared/LambdaParameterState.js.map +1 -1
- package/package.json +13 -13
- package/src/components/QueryBuilderParametersPanel.tsx +2 -7
- package/src/stores/QueryBuilderResultState.ts +19 -17
- package/src/stores/QueryBuilderValueSpecificationBuilder.ts +14 -7
- package/src/stores/shared/LambdaParameterState.ts +151 -10
package/lib/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-query-builder",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.4",
|
4
4
|
"description": "Legend query builder core",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"@finos/legend-storage": "workspace:*",
|
53
53
|
"@testing-library/react": "13.4.0",
|
54
54
|
"@types/papaparse": "5.3.5",
|
55
|
-
"@types/react": "18.0.
|
55
|
+
"@types/react": "18.0.25",
|
56
56
|
"@types/react-dom": "18.0.8",
|
57
57
|
"mobx": "6.6.2",
|
58
58
|
"mobx-react-lite": "3.4.0",
|
@@ -65,13 +65,13 @@
|
|
65
65
|
},
|
66
66
|
"devDependencies": {
|
67
67
|
"@finos/legend-dev-utils": "workspace:*",
|
68
|
-
"@jest/globals": "29.
|
68
|
+
"@jest/globals": "29.3.0",
|
69
69
|
"cross-env": "7.0.3",
|
70
|
-
"eslint": "8.
|
71
|
-
"jest": "29.
|
70
|
+
"eslint": "8.27.0",
|
71
|
+
"jest": "29.3.0",
|
72
72
|
"npm-run-all": "4.1.5",
|
73
73
|
"rimraf": "3.0.2",
|
74
|
-
"sass": "1.
|
74
|
+
"sass": "1.56.0",
|
75
75
|
"typescript": "4.8.4"
|
76
76
|
},
|
77
77
|
"peerDependencies": {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
import { type GeneratorFn, ActionState } from '@finos/legend-shared';
|
17
17
|
import type { QueryBuilderState } from './QueryBuilderState.js';
|
18
|
-
import { type ExecutionResult, type RawLambda, EXECUTION_SERIALIZATION_FORMAT
|
18
|
+
import { type ExecutionResult, type RawLambda, EXECUTION_SERIALIZATION_FORMAT } from '@finos/legend-graph';
|
19
19
|
import { ExecutionPlanState } from '@finos/legend-application';
|
20
20
|
export declare class QueryBuilderResultState {
|
21
21
|
readonly queryBuilderState: QueryBuilderState;
|
@@ -36,7 +36,6 @@ export declare class QueryBuilderResultState {
|
|
36
36
|
setQueryRunPromise: (promise: Promise<ExecutionResult> | undefined) => void;
|
37
37
|
get checkForStaleResults(): boolean;
|
38
38
|
buildExecutionRawLambda(): RawLambda;
|
39
|
-
buildExecutionParameterValues(): ParameterValue[];
|
40
39
|
exportData(serializationFormat: EXECUTION_SERIALIZATION_FORMAT): GeneratorFn<void>;
|
41
40
|
runQuery(): GeneratorFn<void>;
|
42
41
|
generatePlan(debug: boolean): GeneratorFn<void>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderResultState.d.ts","sourceRoot":"","sources":["../../src/stores/QueryBuilderResultState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,KAAK,WAAW,EAQhB,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEd,8BAA8B,
|
1
|
+
{"version":3,"file":"QueryBuilderResultState.d.ts","sourceRoot":"","sources":["../../src/stores/QueryBuilderResultState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,KAAK,WAAW,EAQhB,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEd,8BAA8B,EAG/B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAQ/D,qBAAa,uBAAuB;IAClC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,eAAe,cAAwB;IAChD,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAEhD,YAAY,SAAiB;IAC7B,cAAc,UAAS;IACvB,gBAAgB,UAAS;IACzB,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,CAAa;gBAEtD,iBAAiB,EAAE,iBAAiB;IA0BhD,iBAAiB,QAAS,OAAO,KAAG,IAAI,CAEtC;IAEF,kBAAkB,QAAS,eAAe,GAAG,SAAS,KAAG,IAAI,CAE3D;IAEF,oBAAoB,QAAS,MAAM,GAAG,SAAS,KAAG,IAAI,CAEpD;IAEF,eAAe,QAAS,MAAM,KAAG,IAAI,CAEnC;IAEF,kBAAkB,YACP,QAAQ,eAAe,CAAC,GAAG,SAAS,KAC5C,IAAI,CAEL;IAEF,IAAI,oBAAoB,IAAI,OAAO,CAKlC;IAED,uBAAuB,IAAI,SAAS;IA0BnC,UAAU,CACT,mBAAmB,EAAE,8BAA8B,GAClD,WAAW,CAAC,IAAI,CAAC;IAwDnB,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC;IA8C7B,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC;CAsDjD"}
|
@@ -15,9 +15,10 @@
|
|
15
15
|
*/
|
16
16
|
import { action, flow, makeObservable, observable } from 'mobx';
|
17
17
|
import { assertErrorThrown, LogEvent, guaranteeNonNullable, ContentType, guaranteeType, downloadFileUsingDataURI, UnsupportedOperationError, ActionState, } from '@finos/legend-shared';
|
18
|
-
import { GRAPH_MANAGER_EVENT, EXECUTION_SERIALIZATION_FORMAT, RawExecutionResult, buildRawLambdaFromLambdaFunction,
|
18
|
+
import { GRAPH_MANAGER_EVENT, EXECUTION_SERIALIZATION_FORMAT, RawExecutionResult, buildRawLambdaFromLambdaFunction, } from '@finos/legend-graph';
|
19
19
|
import { buildLambdaFunction } from './QueryBuilderValueSpecificationBuilder.js';
|
20
20
|
import { ExecutionPlanState } from '@finos/legend-application';
|
21
|
+
import { buildExecutionParameterValues, getExecutionQueryFromRawLambda, } from './shared/LambdaParameterState.js';
|
21
22
|
const DEFAULT_LIMIT = 1000;
|
22
23
|
export class QueryBuilderResultState {
|
23
24
|
queryBuilderState;
|
@@ -82,18 +83,12 @@ export class QueryBuilderResultState {
|
|
82
83
|
}
|
83
84
|
else {
|
84
85
|
query = guaranteeNonNullable(this.queryBuilderState.unsupportedQueryState.rawLambda, 'Lambda is required to execute query');
|
86
|
+
if (!this.queryBuilderState.isParameterSupportDisabled) {
|
87
|
+
return getExecutionQueryFromRawLambda(query, this.queryBuilderState.parametersState.parameterStates, this.queryBuilderState.graphManagerState);
|
88
|
+
}
|
85
89
|
}
|
86
90
|
return query;
|
87
91
|
}
|
88
|
-
buildExecutionParameterValues() {
|
89
|
-
return this.queryBuilderState.parametersState.parameterStates.map((queryParamState) => {
|
90
|
-
const paramValue = new ParameterValue();
|
91
|
-
paramValue.name = queryParamState.parameter.name;
|
92
|
-
paramValue.value =
|
93
|
-
this.queryBuilderState.graphManagerState.graphManager.serializeValueSpecification(guaranteeNonNullable(queryParamState.value));
|
94
|
-
return paramValue;
|
95
|
-
});
|
96
|
-
}
|
97
92
|
*exportData(serializationFormat) {
|
98
93
|
try {
|
99
94
|
this.exportDataState.inProgress();
|
@@ -102,6 +97,7 @@ export class QueryBuilderResultState {
|
|
102
97
|
const query = this.buildExecutionRawLambda();
|
103
98
|
const result = (yield this.queryBuilderState.graphManagerState.graphManager.executeMapping(query, mapping, runtime, this.queryBuilderState.graphManagerState.graph, {
|
104
99
|
serializationFormat,
|
100
|
+
parameterValues: buildExecutionParameterValues(this.queryBuilderState.parametersState.parameterStates, this.queryBuilderState.graphManagerState),
|
105
101
|
}));
|
106
102
|
let contentType;
|
107
103
|
let fileName = 'result';
|
@@ -135,10 +131,9 @@ export class QueryBuilderResultState {
|
|
135
131
|
const mapping = guaranteeNonNullable(this.queryBuilderState.mapping, 'Mapping is required to execute query');
|
136
132
|
const runtime = guaranteeNonNullable(this.queryBuilderState.runtimeValue, `Runtime is required to execute query`);
|
137
133
|
const query = this.buildExecutionRawLambda();
|
138
|
-
const parameterValues = this.buildExecutionParameterValues();
|
139
134
|
const startTime = Date.now();
|
140
135
|
const promise = this.queryBuilderState.graphManagerState.graphManager.executeMapping(query, mapping, runtime, this.queryBuilderState.graphManagerState.graph, {
|
141
|
-
parameterValues:
|
136
|
+
parameterValues: buildExecutionParameterValues(this.queryBuilderState.parametersState.parameterStates, this.queryBuilderState.graphManagerState),
|
142
137
|
});
|
143
138
|
this.setQueryRunPromise(promise);
|
144
139
|
const result = (yield promise);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderResultState.js","sourceRoot":"","sources":["../../src/stores/QueryBuilderResultState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAChE,OAAO,EAEL,iBAAiB,EACjB,QAAQ,EACR,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAIL,mBAAmB,EACnB,8BAA8B,EAC9B,kBAAkB,EAClB,gCAAgC,
|
1
|
+
{"version":3,"file":"QueryBuilderResultState.js","sourceRoot":"","sources":["../../src/stores/QueryBuilderResultState.ts"],"names":[],"mappings":"AA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C,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAC/C,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EACtD,KAAK,CACN,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC5D;gBAAS;YACR,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;SAC/B;IACH,CAAC;CACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderValueSpecificationBuilder.d.ts","sourceRoot":"","sources":["../../src/stores/QueryBuilderValueSpecificationBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAWL,cAAc,EAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;
|
1
|
+
{"version":3,"file":"QueryBuilderValueSpecificationBuilder.d.ts","sourceRoot":"","sources":["../../src/stores/QueryBuilderValueSpecificationBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAWL,cAAc,EAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAiCpG,eAAO,MAAM,mBAAmB,sBACX,iBAAiB,YAC1B,2BAA2B,KACpC,cAuGF,CAAC"}
|
@@ -18,6 +18,7 @@ import { Multiplicity, getMilestoneTemporalStereotype, extractElementNameFromPat
|
|
18
18
|
import { buildFilterExpression } from './filter/QueryBuilderFilterValueSpecificationBuilder.js';
|
19
19
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../graphManager/QueryBuilderSupportedFunctions.js';
|
20
20
|
import { buildWatermarkExpression } from './watermark/QueryBuilderWatermarkValueSpecificationBuilder.js';
|
21
|
+
import { buildExecutionQueryFromLambdaFunction } from './shared/LambdaParameterState.js';
|
21
22
|
const buildGetAllFunction = (_class, multiplicity) => {
|
22
23
|
const _func = new SimpleFunctionExpression(extractElementNameFromPath(QUERY_BUILDER_SUPPORTED_FUNCTIONS.GET_ALL));
|
23
24
|
const classInstance = new InstanceValue(multiplicity, GenericTypeExplicitReference.create(new GenericType(_class)));
|
@@ -67,10 +68,14 @@ export const buildLambdaFunction = (queryBuilderState, options) => {
|
|
67
68
|
// build fetch-structure
|
68
69
|
buildFetchStructure(queryBuilderState.fetchStructureState, lambdaFunction, options);
|
69
70
|
// build parameters
|
70
|
-
if (
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
if (queryBuilderState.parametersState.parameterStates.length) {
|
72
|
+
if (options?.isBuildingExecutionQuery) {
|
73
|
+
buildExecutionQueryFromLambdaFunction(lambdaFunction, queryBuilderState.parametersState.parameterStates, queryBuilderState.graphManagerState);
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
lambdaFunction.functionType.parameters =
|
77
|
+
queryBuilderState.parametersState.parameterStates.map((e) => e.parameter);
|
78
|
+
}
|
74
79
|
}
|
75
80
|
return lambdaFunction;
|
76
81
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderValueSpecificationBuilder.js","sourceRoot":"","sources":["../../src/stores/QueryBuilderValueSpecificationBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAEL,YAAY,EACZ,8BAA8B,EAC9B,0BAA0B,EAC1B,aAAa,EACb,mCAAmC,EACnC,cAAc,EACd,YAAY,EACZ,WAAW,EACX,4BAA4B,EAC5B,cAAc,EACd,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAGhG,OAAO,EAAE,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+DAA+D,CAAC;
|
1
|
+
{"version":3,"file":"QueryBuilderValueSpecificationBuilder.js","sourceRoot":"","sources":["../../src/stores/QueryBuilderValueSpecificationBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAEL,YAAY,EACZ,8BAA8B,EAC9B,0BAA0B,EAC1B,aAAa,EACb,mCAAmC,EACnC,cAAc,EACd,YAAY,EACZ,WAAW,EACX,4BAA4B,EAC5B,cAAc,EACd,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAGhG,OAAO,EAAE,iCAAiC,EAAE,MAAM,mDAAmD,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+DAA+D,CAAC;AACzG,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AAEzF,MAAM,mBAAmB,GAAG,CAC1B,MAAa,EACb,YAA0B,EACA,EAAE;IAC5B,MAAM,KAAK,GAAG,IAAI,wBAAwB,CACxC,0BAA0B,CAAC,iCAAiC,CAAC,OAAO,CAAC,CACtE,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,aAAa,CACrC,YAAY,EACZ,4BAA4B,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAC7D,CAAC;IACF,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,mCAAmC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7E,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,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L;KACF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC"}
|
@@ -13,12 +13,24 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { type ObserverContext, type Type, type ValueSpecification, type PureModel, VariableExpression } from '@finos/legend-graph';
|
16
|
+
import { type ObserverContext, type Type, type ValueSpecification, type PureModel, type GraphManagerState, type RawLambda, VariableExpression, LambdaFunction, Multiplicity, ParameterValue } from '@finos/legend-graph';
|
17
17
|
import { type Hashable } from '@finos/legend-shared';
|
18
18
|
export declare enum PARAMETER_SUBMIT_ACTION {
|
19
19
|
EXECUTE = "EXECUTE",
|
20
20
|
EXPORT = "EXPORT"
|
21
21
|
}
|
22
|
+
export declare const buildParametersLetLambdaFunc: (graph: PureModel, lambdaParametersStates: LambdaParameterState[]) => LambdaFunction;
|
23
|
+
/**
|
24
|
+
* For most query executions we will use the stragtical method of sending in `paramValues` as part of the execution input payload.
|
25
|
+
* However when the user wants to use a function value as the parameter value, engine does not understand this i.e for date param the functions `now()`, `today()`.
|
26
|
+
* Engine Does not support this because those functions require a building of execution nodes inside the execution plan.
|
27
|
+
* To continue supporting this execution flow , we will add let statements for parameter values with function values so that they can be evaluated to constants in the execution plan.
|
28
|
+
*/
|
29
|
+
export declare const doesLambdaParameterStateContainFunctionValues: (parameterState: LambdaParameterState) => boolean;
|
30
|
+
export declare const getParameterStatesWithFunctionValues: (parameterStates: LambdaParameterState[]) => LambdaParameterState[];
|
31
|
+
export declare const buildExecutionParameterValues: (paramStates: LambdaParameterState[], graphState: GraphManagerState) => ParameterValue[];
|
32
|
+
export declare const getExecutionQueryFromRawLambda: (rawLambda: RawLambda, parameterStates: LambdaParameterState[], graphManagerState: GraphManagerState) => RawLambda;
|
33
|
+
export declare const buildExecutionQueryFromLambdaFunction: (lambdaFunction: LambdaFunction, parameterStates: LambdaParameterState[], graphManagerState: GraphManagerState) => LambdaFunction;
|
22
34
|
export declare class LambdaParameterState implements Hashable {
|
23
35
|
readonly uuid: string;
|
24
36
|
readonly parameter: VariableExpression;
|
@@ -30,7 +42,7 @@ export declare class LambdaParameterState implements Hashable {
|
|
30
42
|
mockParameterValue(): void;
|
31
43
|
setValue(value: ValueSpecification | undefined): void;
|
32
44
|
changeVariableType(type: Type): void;
|
33
|
-
changeMultiplicity(variableExpression: VariableExpression,
|
45
|
+
changeMultiplicity(variableExpression: VariableExpression, mul: Multiplicity): void;
|
34
46
|
get variableName(): string;
|
35
47
|
get variableType(): Type | undefined;
|
36
48
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LambdaParameterState.d.ts","sourceRoot":"","sources":["../../../src/stores/shared/LambdaParameterState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,kBAAkB,EACvB,KAAK,SAAS,EAKd,kBAAkB,
|
1
|
+
{"version":3,"file":"LambdaParameterState.d.ts","sourceRoot":"","sources":["../../../src/stores/shared/LambdaParameterState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,IAAI,EACT,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAKd,kBAAkB,EAGlB,cAAc,EAId,YAAY,EAKZ,cAAc,EAEf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,QAAQ,EAMd,MAAM,sBAAsB,CAAC;AAQ9B,oBAAY,uBAAuB;IACjC,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAOD,eAAO,MAAM,4BAA4B,UAChC,SAAS,0BACQ,oBAAoB,EAAE,KAC7C,cA6BF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6CAA6C,mBACxC,oBAAoB,KACnC,OAIA,CAAC;AAEJ,eAAO,MAAM,oCAAoC,oBAC9B,oB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G,EACC;QACE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B,KAAK,EAAE,MAAM,CAAC;KACf,GACD,SAAS,GACZ,IAAI;IAIP,IAAI,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAKvD,KAAK,IAAI,IAAI;CAId;AAED,8BAAsB,qBAAsB,YAAW,QAAQ;IAC7D,eAAe,EAAE,oBAAoB,EAAE,CAAM;IAC7C,0BAA0B,qCAA4C;;IAQtE,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,YAAY,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI;IAI7C,eAAe,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI;IAIhD,aAAa,CAAC,GAAG,EAAE,oBAAoB,EAAE,GAAG,IAAI;CAGjD"}
|
@@ -13,8 +13,8 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { GenericType, GenericTypeExplicitReference, observe_ValueSpecification, observe_VariableExpression, VariableExpression, } from '@finos/legend-graph';
|
17
|
-
import { addUniqueEntry, deleteEntry, hashArray, IllegalStateError, uuid, } from '@finos/legend-shared';
|
16
|
+
import { GenericType, GenericTypeExplicitReference, observe_ValueSpecification, observe_VariableExpression, VariableExpression, SimpleFunctionExpression, PackageableElementExplicitReference, LambdaFunction, FunctionType, CORE_PURE_PATH, extractElementNameFromPath, Multiplicity, PrimitiveInstanceValue, PrimitiveType, SUPPORTED_FUNCTIONS, areMultiplicitiesEqual, ParameterValue, buildRawLambdaFromLambdaFunction, } from '@finos/legend-graph';
|
17
|
+
import { addUniqueEntry, deleteEntry, hashArray, IllegalStateError, uuid, isNonNullable, guaranteeNonNullable, } from '@finos/legend-shared';
|
18
18
|
import { makeObservable, observable, action, computed } from 'mobx';
|
19
19
|
import { generateVariableExpressionMockValue } from './ValueSpecificationEditorHelper.js';
|
20
20
|
import { valueSpecification_setGenericType, valueSpecification_setMultiplicity, } from './ValueSpecificationModifierHelper.js';
|
@@ -28,6 +28,80 @@ var LAMABA_PARAMETER_HASH_STRUCTURE;
|
|
28
28
|
LAMABA_PARAMETER_HASH_STRUCTURE["LAMBDA_PARAMETER_STATE"] = "LAMBDA_PARAMETER_STATE";
|
29
29
|
LAMABA_PARAMETER_HASH_STRUCTURE["LAMBDA_PARAMETERS_STATE"] = "LAMBDA_PARAMETERS_STATE";
|
30
30
|
})(LAMABA_PARAMETER_HASH_STRUCTURE || (LAMABA_PARAMETER_HASH_STRUCTURE = {}));
|
31
|
+
export const buildParametersLetLambdaFunc = (graph, lambdaParametersStates) => {
|
32
|
+
const letlambdaFunction = new LambdaFunction(new FunctionType(PackageableElementExplicitReference.create(graph.getType(CORE_PURE_PATH.ANY)), Multiplicity.ONE));
|
33
|
+
letlambdaFunction.expressionSequence = lambdaParametersStates
|
34
|
+
.map((queryParamState) => {
|
35
|
+
if (queryParamState.value) {
|
36
|
+
const letFunc = new SimpleFunctionExpression(extractElementNameFromPath(SUPPORTED_FUNCTIONS.LET));
|
37
|
+
const letVar = new PrimitiveInstanceValue(GenericTypeExplicitReference.create(new GenericType(PrimitiveType.STRING)));
|
38
|
+
letVar.values = [queryParamState.variableName];
|
39
|
+
letFunc.parametersValues.push(letVar);
|
40
|
+
letFunc.parametersValues.push(queryParamState.value);
|
41
|
+
return letFunc;
|
42
|
+
}
|
43
|
+
return undefined;
|
44
|
+
})
|
45
|
+
.filter(isNonNullable);
|
46
|
+
return letlambdaFunction;
|
47
|
+
};
|
48
|
+
/**
|
49
|
+
* For most query executions we will use the stragtical method of sending in `paramValues` as part of the execution input payload.
|
50
|
+
* However when the user wants to use a function value as the parameter value, engine does not understand this i.e for date param the functions `now()`, `today()`.
|
51
|
+
* Engine Does not support this because those functions require a building of execution nodes inside the execution plan.
|
52
|
+
* To continue supporting this execution flow , we will add let statements for parameter values with function values so that they can be evaluated to constants in the execution plan.
|
53
|
+
*/
|
54
|
+
export const doesLambdaParameterStateContainFunctionValues = (parameterState) => parameterState.value instanceof SimpleFunctionExpression &&
|
55
|
+
[Multiplicity.ONE, Multiplicity.ZERO_ONE].some((p) => areMultiplicitiesEqual(p, parameterState.parameter.multiplicity));
|
56
|
+
export const getParameterStatesWithFunctionValues = (parameterStates) => parameterStates.filter(doesLambdaParameterStateContainFunctionValues);
|
57
|
+
export const buildExecutionParameterValues = (paramStates, graphState) => paramStates
|
58
|
+
.filter((ps) => !doesLambdaParameterStateContainFunctionValues(ps))
|
59
|
+
.map((queryParamState) => {
|
60
|
+
const paramValue = new ParameterValue();
|
61
|
+
paramValue.name = queryParamState.parameter.name;
|
62
|
+
paramValue.value = graphState.graphManager.serializeValueSpecification(guaranteeNonNullable(queryParamState.value));
|
63
|
+
return paramValue;
|
64
|
+
});
|
65
|
+
export const getExecutionQueryFromRawLambda = (rawLambda, parameterStates, graphManagerState) => {
|
66
|
+
const paramsWithLetStatements = getParameterStatesWithFunctionValues(parameterStates);
|
67
|
+
if (paramsWithLetStatements.length > 0) {
|
68
|
+
const execuLambdaFunction = buildParametersLetLambdaFunc(graphManagerState.graph, paramsWithLetStatements);
|
69
|
+
// remove parameters added as let statements from lambda parameters
|
70
|
+
execuLambdaFunction.functionType.parameters = parameterStates
|
71
|
+
.filter((ps) => !paramsWithLetStatements.includes(ps))
|
72
|
+
.map((e) => e.parameter);
|
73
|
+
const execQuery = buildRawLambdaFromLambdaFunction(execuLambdaFunction, graphManagerState);
|
74
|
+
// reset paramaters
|
75
|
+
if (Array.isArray(rawLambda.body) && Array.isArray(execQuery.body)) {
|
76
|
+
execQuery.body = [
|
77
|
+
...execQuery.body,
|
78
|
+
...rawLambda.body,
|
79
|
+
];
|
80
|
+
return execQuery;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
return rawLambda;
|
84
|
+
};
|
85
|
+
export const buildExecutionQueryFromLambdaFunction = (lambdaFunction, parameterStates, graphManagerState) => {
|
86
|
+
const funcParameterStates = getParameterStatesWithFunctionValues(parameterStates);
|
87
|
+
if (funcParameterStates.length) {
|
88
|
+
// To handle parameter value with function calls we
|
89
|
+
// 1. remove those parameters from parameter list
|
90
|
+
// 2. add let statements with parameter values
|
91
|
+
lambdaFunction.functionType.parameters = parameterStates
|
92
|
+
.filter((ps) => !funcParameterStates.includes(ps))
|
93
|
+
.map((e) => e.parameter);
|
94
|
+
const letsFuncs = buildParametersLetLambdaFunc(graphManagerState.graph, funcParameterStates);
|
95
|
+
lambdaFunction.expressionSequence = [
|
96
|
+
...letsFuncs.expressionSequence,
|
97
|
+
...lambdaFunction.expressionSequence,
|
98
|
+
];
|
99
|
+
}
|
100
|
+
else {
|
101
|
+
lambdaFunction.functionType.parameters = parameterStates.map((e) => e.parameter);
|
102
|
+
}
|
103
|
+
return lambdaFunction;
|
104
|
+
};
|
31
105
|
export class LambdaParameterState {
|
32
106
|
uuid = uuid();
|
33
107
|
parameter;
|
@@ -68,11 +142,10 @@ export class LambdaParameterState {
|
|
68
142
|
this.mockParameterValue();
|
69
143
|
}
|
70
144
|
}
|
71
|
-
changeMultiplicity(variableExpression,
|
145
|
+
changeMultiplicity(variableExpression, mul) {
|
72
146
|
const current = this.parameter.multiplicity;
|
73
|
-
if (current
|
74
|
-
|
75
|
-
valueSpecification_setMultiplicity(variableExpression, this.graph.getMultiplicity(lowerBound, uppderBound));
|
147
|
+
if (!areMultiplicitiesEqual(current, mul)) {
|
148
|
+
valueSpecification_setMultiplicity(variableExpression, mul);
|
76
149
|
this.mockParameterValue();
|
77
150
|
}
|
78
151
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LambdaParameterState.js","sourceRoot":"","sources":["../../../src/stores/shared/LambdaParameterState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
1
|
+
{"version":3,"file":"LambdaParameterState.js","sourceRoot":"","sources":["../../../src/stores/shared/LambdaParameterState.ts"],"names":[],"mappings":"AAAA;;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AC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,eAAe,CAAC,GAAyB;QACvC,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,aAAa,CAAC,GAA2B;QACvC,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;IAC7B,CAAC;CACF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-query-builder",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.4",
|
4
4
|
"description": "Legend query builder core",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -44,15 +44,15 @@
|
|
44
44
|
"@ag-grid-community/client-side-row-model": "28.2.1",
|
45
45
|
"@ag-grid-community/core": "28.2.1",
|
46
46
|
"@ag-grid-community/react": "28.2.1",
|
47
|
-
"@finos/legend-application": "10.0.
|
48
|
-
"@finos/legend-art": "5.0.
|
49
|
-
"@finos/legend-graph": "20.0.
|
50
|
-
"@finos/legend-server-depot": "4.1.
|
51
|
-
"@finos/legend-shared": "6.2.
|
52
|
-
"@finos/legend-storage": "3.0.
|
47
|
+
"@finos/legend-application": "10.0.8",
|
48
|
+
"@finos/legend-art": "5.0.5",
|
49
|
+
"@finos/legend-graph": "20.0.2",
|
50
|
+
"@finos/legend-server-depot": "4.1.6",
|
51
|
+
"@finos/legend-shared": "6.2.2",
|
52
|
+
"@finos/legend-storage": "3.0.17",
|
53
53
|
"@testing-library/react": "13.4.0",
|
54
54
|
"@types/papaparse": "5.3.5",
|
55
|
-
"@types/react": "18.0.
|
55
|
+
"@types/react": "18.0.25",
|
56
56
|
"@types/react-dom": "18.0.8",
|
57
57
|
"mobx": "6.6.2",
|
58
58
|
"mobx-react-lite": "3.4.0",
|
@@ -64,14 +64,14 @@
|
|
64
64
|
"serializr": "3.0.1"
|
65
65
|
},
|
66
66
|
"devDependencies": {
|
67
|
-
"@finos/legend-dev-utils": "2.0.
|
68
|
-
"@jest/globals": "29.
|
67
|
+
"@finos/legend-dev-utils": "2.0.25",
|
68
|
+
"@jest/globals": "29.3.0",
|
69
69
|
"cross-env": "7.0.3",
|
70
|
-
"eslint": "8.
|
71
|
-
"jest": "29.
|
70
|
+
"eslint": "8.27.0",
|
71
|
+
"jest": "29.3.0",
|
72
72
|
"npm-run-all": "4.1.5",
|
73
73
|
"rimraf": "3.0.2",
|
74
|
-
"sass": "1.
|
74
|
+
"sass": "1.56.0",
|
75
75
|
"typescript": "4.8.4"
|
76
76
|
},
|
77
77
|
"peerDependencies": {
|
@@ -55,10 +55,7 @@ import {
|
|
55
55
|
import { useDrag } from 'react-dnd';
|
56
56
|
import { generateEnumerableNameFromToken } from '@finos/legend-shared';
|
57
57
|
import { DEFAULT_VARIABLE_NAME } from '../stores/QueryBuilderConfig.js';
|
58
|
-
import {
|
59
|
-
valueSpecification_setMultiplicity,
|
60
|
-
variableExpression_setName,
|
61
|
-
} from '../stores/shared/ValueSpecificationModifierHelper.js';
|
58
|
+
import { variableExpression_setName } from '../stores/shared/ValueSpecificationModifierHelper.js';
|
62
59
|
import { LambdaParameterState } from '../stores/shared/LambdaParameterState.js';
|
63
60
|
import { LambdaParameterValuesEditor } from './shared/LambdaParameterValuesEditor.js';
|
64
61
|
|
@@ -125,9 +122,7 @@ const VariableExpressionEditor = observer(
|
|
125
122
|
const multilicityOptions: MultiplicityOption[] =
|
126
123
|
validParamMultiplicityList.map(buildMultiplicityOption);
|
127
124
|
const changeMultiplicity = (val: MultiplicityOption): void => {
|
128
|
-
|
129
|
-
valueSpecification_setMultiplicity(varState, val.value);
|
130
|
-
}
|
125
|
+
lambdaParameterState.changeMultiplicity(varState, val.value);
|
131
126
|
};
|
132
127
|
|
133
128
|
const close = (): void => {
|
@@ -35,10 +35,13 @@ import {
|
|
35
35
|
EXECUTION_SERIALIZATION_FORMAT,
|
36
36
|
RawExecutionResult,
|
37
37
|
buildRawLambdaFromLambdaFunction,
|
38
|
-
ParameterValue,
|
39
38
|
} from '@finos/legend-graph';
|
40
39
|
import { buildLambdaFunction } from './QueryBuilderValueSpecificationBuilder.js';
|
41
40
|
import { ExecutionPlanState } from '@finos/legend-application';
|
41
|
+
import {
|
42
|
+
buildExecutionParameterValues,
|
43
|
+
getExecutionQueryFromRawLambda,
|
44
|
+
} from './shared/LambdaParameterState.js';
|
42
45
|
|
43
46
|
const DEFAULT_LIMIT = 1000;
|
44
47
|
|
@@ -125,24 +128,17 @@ export class QueryBuilderResultState {
|
|
125
128
|
this.queryBuilderState.unsupportedQueryState.rawLambda,
|
126
129
|
'Lambda is required to execute query',
|
127
130
|
);
|
131
|
+
if (!this.queryBuilderState.isParameterSupportDisabled) {
|
132
|
+
return getExecutionQueryFromRawLambda(
|
133
|
+
query,
|
134
|
+
this.queryBuilderState.parametersState.parameterStates,
|
135
|
+
this.queryBuilderState.graphManagerState,
|
136
|
+
);
|
137
|
+
}
|
128
138
|
}
|
129
139
|
return query;
|
130
140
|
}
|
131
141
|
|
132
|
-
buildExecutionParameterValues(): ParameterValue[] {
|
133
|
-
return this.queryBuilderState.parametersState.parameterStates.map(
|
134
|
-
(queryParamState) => {
|
135
|
-
const paramValue = new ParameterValue();
|
136
|
-
paramValue.name = queryParamState.parameter.name;
|
137
|
-
paramValue.value =
|
138
|
-
this.queryBuilderState.graphManagerState.graphManager.serializeValueSpecification(
|
139
|
-
guaranteeNonNullable(queryParamState.value),
|
140
|
-
);
|
141
|
-
return paramValue;
|
142
|
-
},
|
143
|
-
);
|
144
|
-
}
|
145
|
-
|
146
142
|
*exportData(
|
147
143
|
serializationFormat: EXECUTION_SERIALIZATION_FORMAT,
|
148
144
|
): GeneratorFn<void> {
|
@@ -165,6 +161,10 @@ export class QueryBuilderResultState {
|
|
165
161
|
this.queryBuilderState.graphManagerState.graph,
|
166
162
|
{
|
167
163
|
serializationFormat,
|
164
|
+
parameterValues: buildExecutionParameterValues(
|
165
|
+
this.queryBuilderState.parametersState.parameterStates,
|
166
|
+
this.queryBuilderState.graphManagerState,
|
167
|
+
),
|
168
168
|
},
|
169
169
|
)) as ExecutionResult;
|
170
170
|
let contentType: ContentType;
|
@@ -210,7 +210,6 @@ export class QueryBuilderResultState {
|
|
210
210
|
`Runtime is required to execute query`,
|
211
211
|
);
|
212
212
|
const query = this.buildExecutionRawLambda();
|
213
|
-
const parameterValues = this.buildExecutionParameterValues();
|
214
213
|
const startTime = Date.now();
|
215
214
|
const promise =
|
216
215
|
this.queryBuilderState.graphManagerState.graphManager.executeMapping(
|
@@ -219,7 +218,10 @@ export class QueryBuilderResultState {
|
|
219
218
|
runtime,
|
220
219
|
this.queryBuilderState.graphManagerState.graph,
|
221
220
|
{
|
222
|
-
parameterValues:
|
221
|
+
parameterValues: buildExecutionParameterValues(
|
222
|
+
this.queryBuilderState.parametersState.parameterStates,
|
223
|
+
this.queryBuilderState.graphManagerState,
|
224
|
+
),
|
223
225
|
},
|
224
226
|
);
|
225
227
|
this.setQueryRunPromise(promise);
|
@@ -36,6 +36,7 @@ import type { LambdaFunctionBuilderOption } from './QueryBuilderValueSpecificati
|
|
36
36
|
import type { QueryBuilderFetchStructureState } from './fetch-structure/QueryBuilderFetchStructureState.js';
|
37
37
|
import { QUERY_BUILDER_SUPPORTED_FUNCTIONS } from '../graphManager/QueryBuilderSupportedFunctions.js';
|
38
38
|
import { buildWatermarkExpression } from './watermark/QueryBuilderWatermarkValueSpecificationBuilder.js';
|
39
|
+
import { buildExecutionQueryFromLambdaFunction } from './shared/LambdaParameterState.js';
|
39
40
|
|
40
41
|
const buildGetAllFunction = (
|
41
42
|
_class: Class,
|
@@ -155,13 +156,19 @@ export const buildLambdaFunction = (
|
|
155
156
|
);
|
156
157
|
|
157
158
|
// build parameters
|
158
|
-
if (
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
159
|
+
if (queryBuilderState.parametersState.parameterStates.length) {
|
160
|
+
if (options?.isBuildingExecutionQuery) {
|
161
|
+
buildExecutionQueryFromLambdaFunction(
|
162
|
+
lambdaFunction,
|
163
|
+
queryBuilderState.parametersState.parameterStates,
|
164
|
+
queryBuilderState.graphManagerState,
|
165
|
+
);
|
166
|
+
} else {
|
167
|
+
lambdaFunction.functionType.parameters =
|
168
|
+
queryBuilderState.parametersState.parameterStates.map(
|
169
|
+
(e) => e.parameter,
|
170
|
+
);
|
171
|
+
}
|
164
172
|
}
|
165
|
-
|
166
173
|
return lambdaFunction;
|
167
174
|
};
|