@finos/legend-query-builder 3.2.6 → 3.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.d.ts +3 -0
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.d.ts.map +1 -1
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.js +18 -3
- package/lib/stores/entitlements/QueryBuilderCheckEntitlementsState.js.map +1 -1
- package/package.json +1 -1
- package/src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts +38 -3
package/lib/index.css
CHANGED
package/lib/package.json
CHANGED
@@ -16,12 +16,15 @@
|
|
16
16
|
import { type Hashable } from '@finos/legend-shared';
|
17
17
|
import type { QueryBuilderState } from '../QueryBuilderState.js';
|
18
18
|
import { DataAccessState } from '../data-access/DataAccessState.js';
|
19
|
+
import { type GraphManagerState, type RawLambda } from '@finos/legend-graph';
|
20
|
+
import { type LambdaParameterState } from '../shared/LambdaParameterState.js';
|
19
21
|
export declare class QueryBuilderCheckEntitlementsState implements Hashable {
|
20
22
|
readonly queryBuilderState: QueryBuilderState;
|
21
23
|
dataAccessState?: DataAccessState | undefined;
|
22
24
|
showCheckEntitlementsViewer: boolean;
|
23
25
|
constructor(queryBuilderState: QueryBuilderState);
|
24
26
|
setShowCheckEntitlementsViewer(val: boolean): void;
|
27
|
+
createExecutableQuery(rawLambda: RawLambda, parameterStates: LambdaParameterState[], graphManagerState: GraphManagerState): RawLambda;
|
25
28
|
get hashCode(): string;
|
26
29
|
}
|
27
30
|
//# sourceMappingURL=QueryBuilderCheckEntitlementsState.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderCheckEntitlementsState.d.ts","sourceRoot":"","sources":["../../../src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAa,MAAM,sBAAsB,CAAC;AAGhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;
|
1
|
+
{"version":3,"file":"QueryBuilderCheckEntitlementsState.d.ts","sourceRoot":"","sources":["../../../src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,QAAQ,EAAa,MAAM,sBAAsB,CAAC;AAGhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EAIf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,mCAAmC,CAAC;AAE3C,qBAAa,kCAAmC,YAAW,QAAQ;IACjE,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAE9C,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,2BAA2B,UAAS;gBAExB,iBAAiB,EAAE,iBAAiB;IAWhD,8BAA8B,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IA6BlD,qBAAqB,CACnB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,oBAAoB,EAAE,EACvC,iBAAiB,EAAE,iBAAiB,GACnC,SAAS;IAsBZ,IAAI,QAAQ,IAAI,MAAM,CAKrB;CACF"}
|
@@ -17,8 +17,8 @@ import { hashArray } from '@finos/legend-shared';
|
|
17
17
|
import { makeObservable, observable, action, computed } from 'mobx';
|
18
18
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../QueryBuilderStateHashUtils.js';
|
19
19
|
import { DataAccessState } from '../data-access/DataAccessState.js';
|
20
|
-
import { RuntimePointer, InMemoryGraphData } from '@finos/legend-graph';
|
21
|
-
import {
|
20
|
+
import { RuntimePointer, InMemoryGraphData, buildRawLambdaFromLambdaFunction, } from '@finos/legend-graph';
|
21
|
+
import { buildParametersLetLambdaFunc, } from '../shared/LambdaParameterState.js';
|
22
22
|
export class QueryBuilderCheckEntitlementsState {
|
23
23
|
queryBuilderState;
|
24
24
|
dataAccessState;
|
@@ -40,11 +40,26 @@ export class QueryBuilderCheckEntitlementsState {
|
|
40
40
|
this.dataAccessState = new DataAccessState(this.queryBuilderState.applicationStore, this.queryBuilderState.graphManagerState, {
|
41
41
|
mapping: this.queryBuilderState.mapping.path,
|
42
42
|
runtime: this.queryBuilderState.runtimeValue.packageableRuntime.value.path,
|
43
|
-
getQuery: async () =>
|
43
|
+
getQuery: async () => this.createExecutableQuery(this.queryBuilderState.buildQuery(), this.queryBuilderState.parametersState.parameterStates, this.queryBuilderState.graphManagerState),
|
44
44
|
graphData: new InMemoryGraphData(this.queryBuilderState.graphManagerState.graph),
|
45
45
|
});
|
46
46
|
}
|
47
47
|
}
|
48
|
+
createExecutableQuery(rawLambda, parameterStates, graphManagerState) {
|
49
|
+
if (parameterStates.length > 0) {
|
50
|
+
const execLambdaFunction = buildParametersLetLambdaFunc(graphManagerState.graph, parameterStates);
|
51
|
+
const execQuery = buildRawLambdaFromLambdaFunction(execLambdaFunction, graphManagerState);
|
52
|
+
//reset Parameters
|
53
|
+
if (Array.isArray(rawLambda.body) && Array.isArray(execQuery.body)) {
|
54
|
+
execQuery.body = [
|
55
|
+
...execQuery.body,
|
56
|
+
...rawLambda.body,
|
57
|
+
];
|
58
|
+
return execQuery;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return rawLambda;
|
62
|
+
}
|
48
63
|
get hashCode() {
|
49
64
|
return hashArray([
|
50
65
|
QUERY_BUILDER_STATE_HASH_STRUCTURE.CHECK_ENTITLEMENTS_STATE,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryBuilderCheckEntitlementsState.js","sourceRoot":"","sources":["../../../src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAiB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,
|
1
|
+
{"version":3,"file":"QueryBuilderCheckEntitlementsState.js","sourceRoot":"","sources":["../../../src/stores/entitlements/QueryBuilderCheckEntitlementsState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAiB,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAGL,cAAc,EACd,iBAAiB,EACjB,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC;AAE3C,MAAM,OAAO,kCAAkC;IACpC,iBAAiB,CAAoB;IAE9C,eAAe,CAA+B;IAC9C,2BAA2B,GAAG,KAAK,CAAC;IAEpC,YAAY,iBAAoC;QAC9C,cAAc,CAAC,IAAI,EAAE;YACnB,2BAA2B,EAAE,UAAU;YACvC,eAAe,EAAE,UAAU;YAC3B,8BAA8B,EAAE,MAAM;YACtC,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;QAEH,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED,8BAA8B,CAAC,GAAY;QACzC,IAAI,CAAC,2BAA2B,GAA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oBAC/B,GAAI,SAAS,CAAC,IAAiB;iBAChC,CAAC;gBACF,OAAO,SAAS,CAAC;aAClB;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,SAAS,CAAC;YACf,kCAAkC,CAAC,wBAAwB;YAC3D,IAAI,CAAC,2BAA2B;SACjC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/package.json
CHANGED
@@ -19,8 +19,17 @@ import { makeObservable, observable, action, computed } from 'mobx';
|
|
19
19
|
import { QUERY_BUILDER_STATE_HASH_STRUCTURE } from '../QueryBuilderStateHashUtils.js';
|
20
20
|
import type { QueryBuilderState } from '../QueryBuilderState.js';
|
21
21
|
import { DataAccessState } from '../data-access/DataAccessState.js';
|
22
|
-
import {
|
23
|
-
|
22
|
+
import {
|
23
|
+
type GraphManagerState,
|
24
|
+
type RawLambda,
|
25
|
+
RuntimePointer,
|
26
|
+
InMemoryGraphData,
|
27
|
+
buildRawLambdaFromLambdaFunction,
|
28
|
+
} from '@finos/legend-graph';
|
29
|
+
import {
|
30
|
+
type LambdaParameterState,
|
31
|
+
buildParametersLetLambdaFunc,
|
32
|
+
} from '../shared/LambdaParameterState.js';
|
24
33
|
|
25
34
|
export class QueryBuilderCheckEntitlementsState implements Hashable {
|
26
35
|
readonly queryBuilderState: QueryBuilderState;
|
@@ -55,7 +64,7 @@ export class QueryBuilderCheckEntitlementsState implements Hashable {
|
|
55
64
|
runtime:
|
56
65
|
this.queryBuilderState.runtimeValue.packageableRuntime.value.path,
|
57
66
|
getQuery: async () =>
|
58
|
-
|
67
|
+
this.createExecutableQuery(
|
59
68
|
this.queryBuilderState.buildQuery(),
|
60
69
|
this.queryBuilderState.parametersState.parameterStates,
|
61
70
|
this.queryBuilderState.graphManagerState,
|
@@ -68,6 +77,32 @@ export class QueryBuilderCheckEntitlementsState implements Hashable {
|
|
68
77
|
}
|
69
78
|
}
|
70
79
|
|
80
|
+
createExecutableQuery(
|
81
|
+
rawLambda: RawLambda,
|
82
|
+
parameterStates: LambdaParameterState[],
|
83
|
+
graphManagerState: GraphManagerState,
|
84
|
+
): RawLambda {
|
85
|
+
if (parameterStates.length > 0) {
|
86
|
+
const execLambdaFunction = buildParametersLetLambdaFunc(
|
87
|
+
graphManagerState.graph,
|
88
|
+
parameterStates,
|
89
|
+
);
|
90
|
+
const execQuery = buildRawLambdaFromLambdaFunction(
|
91
|
+
execLambdaFunction,
|
92
|
+
graphManagerState,
|
93
|
+
);
|
94
|
+
//reset Parameters
|
95
|
+
if (Array.isArray(rawLambda.body) && Array.isArray(execQuery.body)) {
|
96
|
+
execQuery.body = [
|
97
|
+
...(execQuery.body as object[]),
|
98
|
+
...(rawLambda.body as object[]),
|
99
|
+
];
|
100
|
+
return execQuery;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
return rawLambda;
|
104
|
+
}
|
105
|
+
|
71
106
|
get hashCode(): string {
|
72
107
|
return hashArray([
|
73
108
|
QUERY_BUILDER_STATE_HASH_STRUCTURE.CHECK_ENTITLEMENTS_STATE,
|