@finos/legend-application-repl 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/LegendREPLGridClient.d.ts +0 -2
- package/lib/application/LegendREPLGridClient.d.ts.map +1 -1
- package/lib/application/LegendREPLGridClient.js +6 -33
- package/lib/application/LegendREPLGridClient.js.map +1 -1
- package/lib/components/AgGrid.d.ts +3 -2
- package/lib/components/AgGrid.d.ts.map +1 -1
- package/lib/components/AgGrid.js +1 -1
- package/lib/components/AgGrid.js.map +1 -1
- package/lib/components/LegendREPLGridClientApplication.d.ts +7 -0
- package/lib/components/LegendREPLGridClientApplication.d.ts.map +1 -1
- package/lib/components/LegendREPLGridClientApplication.js +12 -5
- package/lib/components/LegendREPLGridClientApplication.js.map +1 -1
- package/lib/components/REPLGridClient.d.ts +11 -2
- package/lib/components/REPLGridClient.d.ts.map +1 -1
- package/lib/components/REPLGridClient.js +107 -30
- package/lib/components/REPLGridClient.js.map +1 -1
- package/lib/components/dataCube/DataCubeGridEditor.d.ts +22 -0
- package/lib/components/dataCube/DataCubeGridEditor.d.ts.map +1 -0
- package/lib/components/dataCube/DataCubeGridEditor.js +37 -0
- package/lib/components/dataCube/DataCubeGridEditor.js.map +1 -0
- package/lib/components/dataCube/DataCubeQueryTextEditor.d.ts +22 -0
- package/lib/components/dataCube/DataCubeQueryTextEditor.d.ts.map +1 -0
- package/lib/components/{REPLQueryEditor.js → dataCube/DataCubeQueryTextEditor.js} +26 -44
- package/lib/components/dataCube/DataCubeQueryTextEditor.js.map +1 -0
- package/lib/components/grid/GridUtils.d.ts +4 -2
- package/lib/components/grid/GridUtils.d.ts.map +1 -1
- package/lib/components/grid/GridUtils.js +37 -2
- package/lib/components/grid/GridUtils.js.map +1 -1
- package/lib/components/grid/ServerSideDataSource.d.ts.map +1 -1
- package/lib/components/grid/ServerSideDataSource.js +8 -5
- package/lib/components/grid/ServerSideDataSource.js.map +1 -1
- package/lib/components/grid/TDSLambdaBuilder.d.ts.map +1 -1
- package/lib/components/grid/TDSLambdaBuilder.js +1 -1
- package/lib/components/grid/TDSLambdaBuilder.js.map +1 -1
- package/lib/components/grid/TDSQuery.d.ts +25 -0
- package/lib/components/grid/TDSQuery.d.ts.map +1 -0
- package/lib/components/grid/TDSQuery.js +32 -0
- package/lib/components/grid/TDSQuery.js.map +1 -0
- package/lib/components/grid/TDSRequest.d.ts +15 -2
- package/lib/components/grid/TDSRequest.d.ts.map +1 -1
- package/lib/components/grid/TDSRequest.js +52 -0
- package/lib/components/grid/TDSRequest.js.map +1 -1
- package/lib/grid.css +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +12 -12
- package/lib/repl.css +2 -2
- package/lib/repl.css.map +1 -1
- package/lib/server/REPLServerClient.d.ts +3 -0
- package/lib/server/REPLServerClient.d.ts.map +1 -1
- package/lib/server/REPLServerClient.js +2 -0
- package/lib/server/REPLServerClient.js.map +1 -1
- package/lib/stores/REPLGridClientStore.d.ts +2 -13
- package/lib/stores/REPLGridClientStore.d.ts.map +1 -1
- package/lib/stores/REPLGridClientStore.js +6 -144
- package/lib/stores/REPLGridClientStore.js.map +1 -1
- package/lib/stores/dataCube/DataCubeConfigState.d.ts +32 -0
- package/lib/stores/dataCube/DataCubeConfigState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubeConfigState.js +62 -0
- package/lib/stores/dataCube/DataCubeConfigState.js.map +1 -0
- package/lib/stores/{REPLGridState.d.ts → dataCube/DataCubeGridState.d.ts} +11 -12
- package/lib/stores/dataCube/DataCubeGridState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubeGridState.js +108 -0
- package/lib/stores/dataCube/DataCubeGridState.js.map +1 -0
- package/lib/stores/dataCube/DataCubePanelState.d.ts +23 -0
- package/lib/stores/dataCube/DataCubePanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubePanelState.js +22 -0
- package/lib/stores/dataCube/DataCubePanelState.js.map +1 -0
- package/lib/stores/dataCube/DataCubePropertiesPanelState.d.ts +34 -0
- package/lib/stores/dataCube/DataCubePropertiesPanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubePropertiesPanelState.js +57 -0
- package/lib/stores/dataCube/DataCubePropertiesPanelState.js.map +1 -0
- package/lib/{components/REPLQueryEditor.d.ts → stores/dataCube/DataCubeQueryEditorState.d.ts} +2 -5
- package/lib/stores/dataCube/DataCubeQueryEditorState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubeQueryEditorState.js +49 -0
- package/lib/stores/dataCube/DataCubeQueryEditorState.js.map +1 -0
- package/lib/stores/dataCube/DataCubeQueryTextEditorState.d.ts +25 -0
- package/lib/stores/dataCube/DataCubeQueryTextEditorState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubeQueryTextEditorState.js +35 -0
- package/lib/stores/dataCube/DataCubeQueryTextEditorState.js.map +1 -0
- package/lib/stores/dataCube/DataCubeState.d.ts +41 -0
- package/lib/stores/dataCube/DataCubeState.d.ts.map +1 -0
- package/lib/stores/dataCube/DataCubeState.js +208 -0
- package/lib/stores/dataCube/DataCubeState.js.map +1 -0
- package/lib/stores/dataCube/HPivotAndSortPanelState.d.ts +40 -0
- package/lib/stores/dataCube/HPivotAndSortPanelState.d.ts.map +1 -0
- package/lib/stores/dataCube/HPivotAndSortPanelState.js +130 -0
- package/lib/stores/dataCube/HPivotAndSortPanelState.js.map +1 -0
- package/package.json +18 -18
- package/src/application/LegendREPLGridClient.tsx +5 -55
- package/src/components/AgGrid.tsx +2 -6
- package/src/components/LegendREPLGridClientApplication.tsx +18 -1
- package/src/components/REPLGridClient.tsx +445 -111
- package/src/components/dataCube/DataCubeGridEditor.tsx +69 -0
- package/src/components/{REPLQueryEditor.tsx → dataCube/DataCubeQueryTextEditor.tsx} +87 -58
- package/src/components/grid/GridUtils.ts +47 -3
- package/src/components/grid/ServerSideDataSource.ts +17 -4
- package/src/components/grid/TDSLambdaBuilder.ts +5 -1
- package/src/components/grid/TDSQuery.ts +37 -0
- package/src/components/grid/TDSRequest.ts +80 -2
- package/src/server/REPLServerClient.ts +17 -0
- package/src/stores/REPLGridClientStore.ts +6 -248
- package/src/stores/dataCube/DataCubeConfigState.ts +79 -0
- package/src/stores/{REPLGridState.ts → dataCube/DataCubeGridState.ts} +65 -30
- package/src/stores/dataCube/DataCubePanelState.ts +28 -0
- package/src/stores/dataCube/DataCubePropertiesPanelState.ts +65 -0
- package/src/stores/dataCube/DataCubeQueryEditorState.ts +66 -0
- package/src/stores/dataCube/DataCubeQueryTextEditorState.ts +41 -0
- package/src/stores/dataCube/DataCubeState.ts +333 -0
- package/src/stores/dataCube/HPivotAndSortPanelState.ts +170 -0
- package/tsconfig.json +11 -2
- package/lib/components/REPLQueryEditor.d.ts.map +0 -1
- package/lib/components/REPLQueryEditor.js.map +0 -1
- package/lib/stores/REPLGridState.d.ts.map +0 -1
- package/lib/stores/REPLGridState.js +0 -86
- package/lib/stores/REPLGridState.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { action, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { DataCubeState } from './DataCubeState.js';
|
|
19
|
+
import { DataCubeQueryEditorState } from './DataCubeQueryEditorState.js';
|
|
20
|
+
|
|
21
|
+
export class DataCubeQueryTextEditorState {
|
|
22
|
+
readonly dataCubeState!: DataCubeState;
|
|
23
|
+
|
|
24
|
+
queryEditorState!: DataCubeQueryEditorState;
|
|
25
|
+
currentSubQuery?: string | undefined;
|
|
26
|
+
|
|
27
|
+
constructor(dataCubeState: DataCubeState) {
|
|
28
|
+
makeObservable(this, {
|
|
29
|
+
currentSubQuery: observable,
|
|
30
|
+
queryEditorState: observable,
|
|
31
|
+
setCurrentSubQuery: action,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
this.dataCubeState = dataCubeState;
|
|
35
|
+
this.queryEditorState = new DataCubeQueryEditorState('');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setCurrentSubQuery(val: string | undefined): void {
|
|
39
|
+
this.currentSubQuery = val;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { flow, flowResult, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { REPLGridClientStore } from '../REPLGridClientStore.js';
|
|
19
|
+
import { DataCubeGridState } from './DataCubeGridState.js';
|
|
20
|
+
import { DataCubeQueryTextEditorState } from './DataCubeQueryTextEditorState.js';
|
|
21
|
+
import { DataCubeConfigState } from './DataCubeConfigState.js';
|
|
22
|
+
import { DataCubePropertiesPanelState } from './DataCubePropertiesPanelState.js';
|
|
23
|
+
import {
|
|
24
|
+
ActionState,
|
|
25
|
+
HttpStatus,
|
|
26
|
+
LogEvent,
|
|
27
|
+
NetworkClientError,
|
|
28
|
+
assertErrorThrown,
|
|
29
|
+
guaranteeNonNullable,
|
|
30
|
+
guaranteeType,
|
|
31
|
+
type GeneratorFn,
|
|
32
|
+
type PlainObject,
|
|
33
|
+
} from '@finos/legend-shared';
|
|
34
|
+
import { generatePath } from '@finos/legend-application/browser';
|
|
35
|
+
import {
|
|
36
|
+
V1_serializeValueSpecification,
|
|
37
|
+
type V1_TDSExecutionResult,
|
|
38
|
+
V1_buildExecutionResult,
|
|
39
|
+
V1_serializeExecutionResult,
|
|
40
|
+
TDSExecutionResult,
|
|
41
|
+
V1_ParserError,
|
|
42
|
+
ParserError,
|
|
43
|
+
SourceInformation,
|
|
44
|
+
V1_Lambda,
|
|
45
|
+
V1_deserializeValueSpecification,
|
|
46
|
+
} from '@finos/legend-graph';
|
|
47
|
+
import {
|
|
48
|
+
languages as monacoLanguagesAPI,
|
|
49
|
+
type IPosition,
|
|
50
|
+
type editor as monacoEditorAPI,
|
|
51
|
+
} from 'monaco-editor';
|
|
52
|
+
import { LEGEND_REPL_EVENT } from '../../Const.js';
|
|
53
|
+
import {
|
|
54
|
+
LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN,
|
|
55
|
+
LEGEND_REPL_GRID_CLIENT_PATTERN_TOKEN,
|
|
56
|
+
} from '../../components/LegendREPLGridClientApplication.js';
|
|
57
|
+
import { REPLGridServerResult } from '../../components/grid/REPLGridServerResult.js';
|
|
58
|
+
import { buildLambdaExpressions } from '../../components/grid/TDSLambdaBuilder.js';
|
|
59
|
+
import { TDSQuery } from '../../components/grid/TDSQuery.js';
|
|
60
|
+
import { TDSRequest, TDSGroupby } from '../../components/grid/TDSRequest.js';
|
|
61
|
+
import { CompletionItem } from '../CompletionResult.js';
|
|
62
|
+
|
|
63
|
+
export class DataCubeState {
|
|
64
|
+
readonly editorStore!: REPLGridClientStore;
|
|
65
|
+
|
|
66
|
+
gridState!: DataCubeGridState;
|
|
67
|
+
queryTextEditorState!: DataCubeQueryTextEditorState;
|
|
68
|
+
configState!: DataCubeConfigState;
|
|
69
|
+
propertiesPanelState!: DataCubePropertiesPanelState;
|
|
70
|
+
|
|
71
|
+
executeAction = ActionState.create();
|
|
72
|
+
|
|
73
|
+
constructor(editorStore: REPLGridClientStore) {
|
|
74
|
+
makeObservable(this, {
|
|
75
|
+
gridState: observable,
|
|
76
|
+
queryTextEditorState: observable,
|
|
77
|
+
configState: observable,
|
|
78
|
+
propertiesPanelState: observable,
|
|
79
|
+
executeAction: observable,
|
|
80
|
+
getREPLGridServerResult: flow,
|
|
81
|
+
getInitialQueryLambda: flow,
|
|
82
|
+
getInitialREPLGridServerResult: flow,
|
|
83
|
+
getLicenseKey: flow,
|
|
84
|
+
executeLambda: flow,
|
|
85
|
+
parseQuery: flow,
|
|
86
|
+
saveQuery: flow,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
this.editorStore = editorStore;
|
|
90
|
+
|
|
91
|
+
this.gridState = new DataCubeGridState(this);
|
|
92
|
+
this.queryTextEditorState = new DataCubeQueryTextEditorState(this);
|
|
93
|
+
this.configState = new DataCubeConfigState(this);
|
|
94
|
+
this.propertiesPanelState = new DataCubePropertiesPanelState(this);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
*getREPLGridServerResult(tdsRequest: TDSRequest): GeneratorFn<void> {
|
|
98
|
+
try {
|
|
99
|
+
const isSubQuery = tdsRequest.groupBy.groupKeys.length !== 0;
|
|
100
|
+
const lambda = buildLambdaExpressions(
|
|
101
|
+
guaranteeNonNullable(this.gridState.initialQueryLambda?.body[0]),
|
|
102
|
+
tdsRequest,
|
|
103
|
+
this.configState.isPaginationEnabled,
|
|
104
|
+
);
|
|
105
|
+
const resultObj = (yield flowResult(
|
|
106
|
+
this.editorStore.client.getREPLGridServerResult(
|
|
107
|
+
V1_serializeValueSpecification(lambda, []),
|
|
108
|
+
),
|
|
109
|
+
)) as PlainObject<REPLGridServerResult>;
|
|
110
|
+
const replGridResult =
|
|
111
|
+
REPLGridServerResult.serialization.fromJson(resultObj);
|
|
112
|
+
const tdsResult = JSON.parse(
|
|
113
|
+
replGridResult.result,
|
|
114
|
+
) as PlainObject<V1_TDSExecutionResult>;
|
|
115
|
+
this.gridState.setCurrentResult(
|
|
116
|
+
guaranteeType(
|
|
117
|
+
V1_buildExecutionResult(V1_serializeExecutionResult(tdsResult)),
|
|
118
|
+
TDSExecutionResult,
|
|
119
|
+
),
|
|
120
|
+
);
|
|
121
|
+
if (isSubQuery) {
|
|
122
|
+
this.queryTextEditorState.setCurrentSubQuery(
|
|
123
|
+
replGridResult.currentQuery,
|
|
124
|
+
);
|
|
125
|
+
} else {
|
|
126
|
+
this.queryTextEditorState.queryEditorState.setQuery(
|
|
127
|
+
replGridResult.currentQuery.substring(1),
|
|
128
|
+
);
|
|
129
|
+
this.queryTextEditorState.setCurrentSubQuery(undefined);
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
assertErrorThrown(error);
|
|
133
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
134
|
+
this.editorStore.applicationStore.logService.error(
|
|
135
|
+
LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
|
|
136
|
+
error,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async getTypeaheadResults(
|
|
142
|
+
position: IPosition,
|
|
143
|
+
model: monacoEditorAPI.ITextModel,
|
|
144
|
+
): Promise<monacoLanguagesAPI.CompletionItem[]> {
|
|
145
|
+
try {
|
|
146
|
+
const textUntilPosition = model.getValueInRange({
|
|
147
|
+
startLineNumber: 1,
|
|
148
|
+
startColumn: 1,
|
|
149
|
+
endLineNumber: position.lineNumber,
|
|
150
|
+
endColumn: position.column,
|
|
151
|
+
});
|
|
152
|
+
const resultObj =
|
|
153
|
+
await this.editorStore.client.getTypeaheadResults(textUntilPosition);
|
|
154
|
+
const result = resultObj.map((res) =>
|
|
155
|
+
CompletionItem.serialization.fromJson(res),
|
|
156
|
+
);
|
|
157
|
+
const currentWord = model.getWordUntilPosition(position);
|
|
158
|
+
return result.map((res) => ({
|
|
159
|
+
label: res.display,
|
|
160
|
+
kind: monacoLanguagesAPI.CompletionItemKind.Text,
|
|
161
|
+
range: {
|
|
162
|
+
startLineNumber: position.lineNumber,
|
|
163
|
+
startColumn: currentWord.startColumn + 1,
|
|
164
|
+
endLineNumber: position.lineNumber,
|
|
165
|
+
endColumn: currentWord.endColumn + 1,
|
|
166
|
+
},
|
|
167
|
+
insertText: res.completion,
|
|
168
|
+
})) as monacoLanguagesAPI.CompletionItem[];
|
|
169
|
+
} catch (e) {
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
*executeLambda(): GeneratorFn<void> {
|
|
175
|
+
try {
|
|
176
|
+
this.executeAction.inProgress();
|
|
177
|
+
const resultObj = (yield this.editorStore.client.executeLambda(
|
|
178
|
+
this.queryTextEditorState.queryEditorState.query,
|
|
179
|
+
this.configState.isPaginationEnabled,
|
|
180
|
+
)) as PlainObject<REPLGridServerResult>;
|
|
181
|
+
const replGridResult =
|
|
182
|
+
REPLGridServerResult.serialization.fromJson(resultObj);
|
|
183
|
+
const tdsResultObj = JSON.parse(
|
|
184
|
+
replGridResult.result,
|
|
185
|
+
) as PlainObject<V1_TDSExecutionResult>;
|
|
186
|
+
const tdsResult = guaranteeType(
|
|
187
|
+
V1_buildExecutionResult(V1_serializeExecutionResult(tdsResultObj)),
|
|
188
|
+
TDSExecutionResult,
|
|
189
|
+
);
|
|
190
|
+
this.gridState.setInitialResult(tdsResult);
|
|
191
|
+
this.queryTextEditorState.queryEditorState.setQuery(
|
|
192
|
+
replGridResult.currentQuery.substring(1),
|
|
193
|
+
);
|
|
194
|
+
this.queryTextEditorState.setCurrentSubQuery(undefined);
|
|
195
|
+
this.gridState.setColumns(tdsResult.result.columns);
|
|
196
|
+
|
|
197
|
+
yield flowResult(this.getInitialQueryLambda());
|
|
198
|
+
this.executeAction.complete();
|
|
199
|
+
} catch (error) {
|
|
200
|
+
this.executeAction.fail();
|
|
201
|
+
assertErrorThrown(error);
|
|
202
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
203
|
+
this.editorStore.applicationStore.logService.error(
|
|
204
|
+
LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
|
|
205
|
+
error,
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
*parseQuery(): GeneratorFn<void> {
|
|
211
|
+
try {
|
|
212
|
+
this.queryTextEditorState.queryEditorState.setParserError(undefined);
|
|
213
|
+
yield flowResult(
|
|
214
|
+
this.editorStore.client.parseQuery(
|
|
215
|
+
`|${this.queryTextEditorState.queryEditorState.query}`,
|
|
216
|
+
),
|
|
217
|
+
);
|
|
218
|
+
} catch (error) {
|
|
219
|
+
assertErrorThrown(error);
|
|
220
|
+
if (
|
|
221
|
+
error instanceof NetworkClientError &&
|
|
222
|
+
error.response.status === HttpStatus.BAD_REQUEST
|
|
223
|
+
) {
|
|
224
|
+
const protocol = V1_ParserError.serialization.fromJson(
|
|
225
|
+
error.payload as PlainObject<V1_ParserError>,
|
|
226
|
+
);
|
|
227
|
+
const parserError = new ParserError(protocol.message);
|
|
228
|
+
if (protocol.sourceInformation) {
|
|
229
|
+
parserError.sourceInformation = new SourceInformation(
|
|
230
|
+
protocol.sourceInformation.sourceId,
|
|
231
|
+
protocol.sourceInformation.startLine,
|
|
232
|
+
protocol.sourceInformation.startColumn,
|
|
233
|
+
protocol.sourceInformation.endLine,
|
|
234
|
+
protocol.sourceInformation.endColumn,
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
this.queryTextEditorState.queryEditorState.setParserError(parserError);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
*saveQuery(): GeneratorFn<void> {
|
|
243
|
+
try {
|
|
244
|
+
const query = TDSQuery.serialization.toJson(
|
|
245
|
+
new TDSQuery(
|
|
246
|
+
guaranteeNonNullable(this.gridState.initialQueryLambda),
|
|
247
|
+
this.gridState.lastQueryTDSRequest ??
|
|
248
|
+
new TDSRequest([], [], [], new TDSGroupby([], [], []), 0, 100),
|
|
249
|
+
),
|
|
250
|
+
);
|
|
251
|
+
const queryId = (yield flowResult(
|
|
252
|
+
this.editorStore.client.saveQuery(query),
|
|
253
|
+
)) as string;
|
|
254
|
+
this.editorStore.applicationStore.navigationService.navigator.goToLocation(
|
|
255
|
+
generatePath(LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN.SAVED_QUERY, {
|
|
256
|
+
[LEGEND_REPL_GRID_CLIENT_PATTERN_TOKEN.QUERY_ID]: queryId,
|
|
257
|
+
}),
|
|
258
|
+
);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
assertErrorThrown(error);
|
|
261
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
262
|
+
this.editorStore.applicationStore.logService.error(
|
|
263
|
+
LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
|
|
264
|
+
error,
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
*getInitialQueryLambda(queryId?: string): GeneratorFn<void> {
|
|
270
|
+
if (!queryId) {
|
|
271
|
+
const lambdaObj =
|
|
272
|
+
(yield this.editorStore.client.getIntialQueryLambda()) as PlainObject<V1_Lambda>;
|
|
273
|
+
const lambda = V1_deserializeValueSpecification(lambdaObj, []);
|
|
274
|
+
if (lambda instanceof V1_Lambda) {
|
|
275
|
+
this.gridState.setInitialQueryLambda(lambda);
|
|
276
|
+
}
|
|
277
|
+
// this.replGridState.setCurrentQueryTDSRequest(undefined);
|
|
278
|
+
} else {
|
|
279
|
+
const queryObj = (yield this.editorStore.client.getREPLQuery(
|
|
280
|
+
queryId,
|
|
281
|
+
)) as PlainObject<TDSQuery>;
|
|
282
|
+
const query = TDSQuery.serialization.fromJson(queryObj);
|
|
283
|
+
this.gridState.setCurrentQueryTDSRequest(query.currentQueryInfo);
|
|
284
|
+
this.gridState.setInitialQueryLambda(query.initialQuery);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
*getInitialREPLGridServerResult(queryId?: string): GeneratorFn<void> {
|
|
289
|
+
try {
|
|
290
|
+
this.executeAction.inProgress();
|
|
291
|
+
if (!this.configState.licenseKey) {
|
|
292
|
+
yield flowResult(this.getLicenseKey());
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
yield flowResult(this.getInitialQueryLambda(queryId));
|
|
296
|
+
|
|
297
|
+
const resultObj =
|
|
298
|
+
(yield this.editorStore.client.getInitialREPLGridServerResult(
|
|
299
|
+
this.configState.isPaginationEnabled,
|
|
300
|
+
)) as PlainObject<REPLGridServerResult>;
|
|
301
|
+
const replGridResult =
|
|
302
|
+
REPLGridServerResult.serialization.fromJson(resultObj);
|
|
303
|
+
const tdsResultObj = JSON.parse(
|
|
304
|
+
replGridResult.result,
|
|
305
|
+
) as PlainObject<V1_TDSExecutionResult>;
|
|
306
|
+
const tdsResult = guaranteeType(
|
|
307
|
+
V1_buildExecutionResult(V1_serializeExecutionResult(tdsResultObj)),
|
|
308
|
+
TDSExecutionResult,
|
|
309
|
+
);
|
|
310
|
+
this.gridState.setInitialResult(tdsResult);
|
|
311
|
+
this.queryTextEditorState.queryEditorState.setQuery(
|
|
312
|
+
replGridResult.currentQuery.substring(1),
|
|
313
|
+
);
|
|
314
|
+
this.queryTextEditorState.setCurrentSubQuery(undefined);
|
|
315
|
+
this.gridState.setColumns(tdsResult.result.columns);
|
|
316
|
+
this.executeAction.complete();
|
|
317
|
+
} catch (error) {
|
|
318
|
+
this.executeAction.fail();
|
|
319
|
+
assertErrorThrown(error);
|
|
320
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
|
321
|
+
this.editorStore.applicationStore.logService.error(
|
|
322
|
+
LogEvent.create(LEGEND_REPL_EVENT.FETCH_TDS_FAILURE),
|
|
323
|
+
error,
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
*getLicenseKey(): GeneratorFn<void> {
|
|
329
|
+
const licenseKey =
|
|
330
|
+
(yield this.editorStore.client.getLicenseKey()) as string;
|
|
331
|
+
this.configState.setLicenseKey(licenseKey);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
|
+
import type { DataCubeState } from './DataCubeState.js';
|
|
19
|
+
import { DataCubePanelState } from './DataCubePanelState.js';
|
|
20
|
+
import { TDSSort, TDS_SORT_ORDER } from '../../components/grid/TDSRequest.js';
|
|
21
|
+
|
|
22
|
+
export class HPivotAndSortPanelState extends DataCubePanelState {
|
|
23
|
+
isInitialized = false;
|
|
24
|
+
availableSortColumns: TDSSort[] = [];
|
|
25
|
+
selectedSortColumns: TDSSort[] = [];
|
|
26
|
+
availableSortColumnsSearchText = '';
|
|
27
|
+
selectedSortColumnsSearchText = '';
|
|
28
|
+
|
|
29
|
+
constructor(dataCubeState: DataCubeState) {
|
|
30
|
+
super(dataCubeState);
|
|
31
|
+
|
|
32
|
+
makeObservable(this, {
|
|
33
|
+
isInitialized: observable,
|
|
34
|
+
availableSortColumns: observable,
|
|
35
|
+
selectedSortColumns: observable,
|
|
36
|
+
availableSortColumnsSearchText: observable,
|
|
37
|
+
selectedSortColumnsSearchText: observable,
|
|
38
|
+
setAvailableSortColumns: action,
|
|
39
|
+
setSelectedSortColumns: action,
|
|
40
|
+
setIsInitialized: action,
|
|
41
|
+
addAvailableSortColumn: action,
|
|
42
|
+
addSelectedSortColumn: action,
|
|
43
|
+
addAllAvailableSortColumns: action,
|
|
44
|
+
addAllSelectedSortColumns: action,
|
|
45
|
+
applyChanges: action,
|
|
46
|
+
initialize: action,
|
|
47
|
+
setSelectedSortColumnsSearchText: action,
|
|
48
|
+
setAvailableSortColumnsSearchText: action,
|
|
49
|
+
availableSortColumnsSearchResults: computed,
|
|
50
|
+
selectedSortColumnsSearchResults: computed,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setAvailableSortColumns(val: TDSSort[]): void {
|
|
55
|
+
this.availableSortColumns = val;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
setSelectedSortColumns(val: TDSSort[]): void {
|
|
59
|
+
this.selectedSortColumns = val;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setIsInitialized(val: boolean): void {
|
|
63
|
+
this.isInitialized = val;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
initialize(): void {
|
|
67
|
+
if (!this.isInitialized) {
|
|
68
|
+
this.selectedSortColumns =
|
|
69
|
+
this.dataCubeState.gridState.lastQueryTDSRequest?.sort.map(
|
|
70
|
+
(col) => new TDSSort(col.column, col.order),
|
|
71
|
+
) ?? [];
|
|
72
|
+
this.availableSortColumns =
|
|
73
|
+
this.dataCubeState.gridState.columns
|
|
74
|
+
?.filter(
|
|
75
|
+
(col) => !this.selectedSortColumns.find((c) => c.column === col),
|
|
76
|
+
)
|
|
77
|
+
.map((col) => new TDSSort(col, TDS_SORT_ORDER.ASCENDING)) ?? [];
|
|
78
|
+
this.setIsInitialized(true);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
addAvailableSortColumn(columnName: string): void {
|
|
83
|
+
const column = this.availableSortColumns.find(
|
|
84
|
+
(col) => col.column === columnName,
|
|
85
|
+
);
|
|
86
|
+
if (column) {
|
|
87
|
+
this.setAvailableSortColumns(
|
|
88
|
+
this.availableSortColumns.filter((col) => col.column !== columnName),
|
|
89
|
+
);
|
|
90
|
+
this.setSelectedSortColumns(this.selectedSortColumns.concat(column));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
addSelectedSortColumn(columnName: string): void {
|
|
95
|
+
const column = this.selectedSortColumns.find(
|
|
96
|
+
(col) => col.column === columnName,
|
|
97
|
+
);
|
|
98
|
+
if (column) {
|
|
99
|
+
this.setSelectedSortColumns(
|
|
100
|
+
this.selectedSortColumns.filter((col) => col.column !== columnName),
|
|
101
|
+
);
|
|
102
|
+
this.setAvailableSortColumns(this.availableSortColumns.concat(column));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
addAllAvailableSortColumns(): void {
|
|
107
|
+
this.setSelectedSortColumns(
|
|
108
|
+
this.selectedSortColumns.concat(this.availableSortColumns),
|
|
109
|
+
);
|
|
110
|
+
this.setAvailableSortColumns([]);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
addAllSelectedSortColumns(): void {
|
|
114
|
+
this.setAvailableSortColumns(
|
|
115
|
+
this.availableSortColumns.concat(this.selectedSortColumns),
|
|
116
|
+
);
|
|
117
|
+
this.setSelectedSortColumns([]);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
applyChanges(): void {
|
|
121
|
+
if (this.dataCubeState.configState.gridApi) {
|
|
122
|
+
const columnDefs = this.dataCubeState.configState.gridApi.getColumnDefs();
|
|
123
|
+
this.selectedSortColumns.forEach((col) => {
|
|
124
|
+
const colDef = columnDefs?.find(
|
|
125
|
+
(cold) => 'colId' in cold && cold.colId === col.column,
|
|
126
|
+
);
|
|
127
|
+
if (colDef && 'sort' in colDef) {
|
|
128
|
+
colDef.sort = col.order === TDS_SORT_ORDER.ASCENDING ? 'asc' : 'desc';
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
this.dataCubeState.configState.gridApi.setGridOption(
|
|
132
|
+
'columnDefs',
|
|
133
|
+
columnDefs,
|
|
134
|
+
);
|
|
135
|
+
this.dataCubeState.configState.gridApi.onSortChanged();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
setAvailableSortColumnsSearchText(val: string): void {
|
|
140
|
+
this.availableSortColumnsSearchText = val;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
setSelectedSortColumnsSearchText(val: string): void {
|
|
144
|
+
this.selectedSortColumnsSearchText = val;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
get availableSortColumnsSearchResults(): TDSSort[] {
|
|
148
|
+
if (this.availableSortColumnsSearchText) {
|
|
149
|
+
return this.availableSortColumns.filter((col) =>
|
|
150
|
+
col.column
|
|
151
|
+
.toLowerCase()
|
|
152
|
+
.startsWith(this.availableSortColumnsSearchText.toLowerCase()),
|
|
153
|
+
);
|
|
154
|
+
} else {
|
|
155
|
+
return this.availableSortColumns;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
get selectedSortColumnsSearchResults(): TDSSort[] {
|
|
160
|
+
if (this.selectedSortColumnsSearchText) {
|
|
161
|
+
return this.selectedSortColumns.filter((col) =>
|
|
162
|
+
col.column
|
|
163
|
+
.toLowerCase()
|
|
164
|
+
.startsWith(this.selectedSortColumnsSearchText.toLowerCase()),
|
|
165
|
+
);
|
|
166
|
+
} else {
|
|
167
|
+
return this.selectedSortColumns;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -55,13 +55,21 @@
|
|
|
55
55
|
"./src/components/grid/REPLGridServerResult.ts",
|
|
56
56
|
"./src/components/grid/ServerSideDataSource.ts",
|
|
57
57
|
"./src/components/grid/TDSLambdaBuilder.ts",
|
|
58
|
+
"./src/components/grid/TDSQuery.ts",
|
|
58
59
|
"./src/components/grid/TDSRequest.ts",
|
|
59
60
|
"./src/server/REPLServerClient.ts",
|
|
60
61
|
"./src/stores/CompletionResult.ts",
|
|
61
62
|
"./src/stores/LegendREPLGridClientApplicationPlugin.ts",
|
|
62
63
|
"./src/stores/LegendREPLGridClientBaseStore.ts",
|
|
63
64
|
"./src/stores/REPLGridClientStore.ts",
|
|
64
|
-
"./src/stores/
|
|
65
|
+
"./src/stores/dataCube/DataCubeConfigState.ts",
|
|
66
|
+
"./src/stores/dataCube/DataCubeGridState.ts",
|
|
67
|
+
"./src/stores/dataCube/DataCubePanelState.ts",
|
|
68
|
+
"./src/stores/dataCube/DataCubePropertiesPanelState.ts",
|
|
69
|
+
"./src/stores/dataCube/DataCubeQueryEditorState.ts",
|
|
70
|
+
"./src/stores/dataCube/DataCubeQueryTextEditorState.ts",
|
|
71
|
+
"./src/stores/dataCube/DataCubeState.ts",
|
|
72
|
+
"./src/stores/dataCube/HPivotAndSortPanelState.ts",
|
|
65
73
|
"./src/index.tsx",
|
|
66
74
|
"./src/application/LegendREPLGridClient.tsx",
|
|
67
75
|
"./src/components/AgGrid.tsx",
|
|
@@ -70,7 +78,8 @@
|
|
|
70
78
|
"./src/components/LegendREPLGridClientFrameworkProvider.tsx",
|
|
71
79
|
"./src/components/REPLGridClient.tsx",
|
|
72
80
|
"./src/components/REPLGridClientStoreProvider.tsx",
|
|
73
|
-
"./src/components/
|
|
81
|
+
"./src/components/dataCube/DataCubeGridEditor.tsx",
|
|
82
|
+
"./src/components/dataCube/DataCubeQueryTextEditor.tsx"
|
|
74
83
|
],
|
|
75
84
|
"include": [
|
|
76
85
|
"src/**/*.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"REPLQueryEditor.d.ts","sourceRoot":"","sources":["../../src/components/REPLQueryEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH,OAAO,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAW1E,qBAAa,gBAAgB;IAC3B,IAAI,SAAU;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;gBAE1B,KAAK,EAAE,MAAM;IAWzB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI3B,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI;IAU1D,wBAAwB,CACtB,iBAAiB,EAAE,iBAAiB,GACnC,iBAAiB;CAarB;AAED,eAAO,MAAM,WAAW;;CAqHtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"REPLQueryEditor.js","sourceRoot":"","sources":["../../src/components/REPLQueryEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAoB,MAAM,qBAAqB,CAAC;AAC1E,OAA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,IAAI;IAI5C,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAI1C,IAAI,OAAO,IAAI,cAAc,EAAE,CAE9B;IAED,IAAI,UAAU,IAAI,MAAM,EAAE,CAYzB;CACF"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
17
|
-
import { getAggregationTDSColumnCustomizations, getTDSRowData, } from '../components/grid/GridUtils.js';
|
|
18
|
-
import { action, computed, makeObservable, observable } from 'mobx';
|
|
19
|
-
import { QueryEditorState } from '../components/REPLQueryEditor.js';
|
|
20
|
-
export class REPLGridState {
|
|
21
|
-
initialResult;
|
|
22
|
-
currentResult;
|
|
23
|
-
columns;
|
|
24
|
-
queryEditorState;
|
|
25
|
-
currentSubQuery;
|
|
26
|
-
licenseKey;
|
|
27
|
-
initialQueryLambda;
|
|
28
|
-
isPaginationEnabled;
|
|
29
|
-
constructor(isPaginationEnabled) {
|
|
30
|
-
makeObservable(this, {
|
|
31
|
-
initialResult: observable,
|
|
32
|
-
initialQueryLambda: observable,
|
|
33
|
-
currentResult: observable,
|
|
34
|
-
currentSubQuery: observable,
|
|
35
|
-
licenseKey: observable,
|
|
36
|
-
columns: observable,
|
|
37
|
-
isPaginationEnabled: observable,
|
|
38
|
-
queryEditorState: observable,
|
|
39
|
-
setInitialResult: action,
|
|
40
|
-
setCurrentSubQuery: action,
|
|
41
|
-
setColumns: action,
|
|
42
|
-
setInitialQueryLambda: action,
|
|
43
|
-
setCurrentResult: action,
|
|
44
|
-
setLicenseKey: action,
|
|
45
|
-
setIsPaginationEnabled: action,
|
|
46
|
-
rowData: computed,
|
|
47
|
-
columnDefs: computed,
|
|
48
|
-
});
|
|
49
|
-
this.queryEditorState = new QueryEditorState('');
|
|
50
|
-
this.isPaginationEnabled = isPaginationEnabled;
|
|
51
|
-
}
|
|
52
|
-
setInitialQueryLambda(val) {
|
|
53
|
-
this.initialQueryLambda = val;
|
|
54
|
-
}
|
|
55
|
-
setCurrentSubQuery(val) {
|
|
56
|
-
this.currentSubQuery = val;
|
|
57
|
-
}
|
|
58
|
-
setInitialResult(val) {
|
|
59
|
-
this.initialResult = val;
|
|
60
|
-
}
|
|
61
|
-
setCurrentResult(val) {
|
|
62
|
-
this.currentResult = val;
|
|
63
|
-
}
|
|
64
|
-
setColumns(val) {
|
|
65
|
-
this.columns = val;
|
|
66
|
-
}
|
|
67
|
-
setLicenseKey(val) {
|
|
68
|
-
this.licenseKey = val;
|
|
69
|
-
}
|
|
70
|
-
setIsPaginationEnabled(val) {
|
|
71
|
-
this.isPaginationEnabled = val;
|
|
72
|
-
}
|
|
73
|
-
get rowData() {
|
|
74
|
-
return this.initialResult ? getTDSRowData(this.initialResult.result) : [];
|
|
75
|
-
}
|
|
76
|
-
get columnDefs() {
|
|
77
|
-
return this.columns
|
|
78
|
-
? this.columns.map((c) => ({
|
|
79
|
-
field: c,
|
|
80
|
-
headerName: c,
|
|
81
|
-
...getAggregationTDSColumnCustomizations(this.licenseKey ? true : false, guaranteeNonNullable(this.initialResult), c),
|
|
82
|
-
}))
|
|
83
|
-
: [];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=REPLGridState.js.map
|
|
@@ -1 +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