@finos/legend-application-studio 27.0.0 → 27.1.1
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/__lib__/LegendStudioApplicationNavigationContext.d.ts +9 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js +11 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js.map +1 -1
- package/lib/__lib__/LegendStudioEvent.d.ts +1 -0
- package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioEvent.js +1 -0
- package/lib/__lib__/LegendStudioEvent.js.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.d.ts +6 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +7 -0
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/ElementIconUtils.d.ts.map +1 -1
- package/lib/components/ElementIconUtils.js +3 -1
- package/lib/components/ElementIconUtils.js.map +1 -1
- package/lib/components/editor/editor-group/ModelImporter.d.ts.map +1 -1
- package/lib/components/editor/editor-group/ModelImporter.js +1 -0
- package/lib/components/editor/editor-group/ModelImporter.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.d.ts.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js +8 -10
- package/lib/components/editor/editor-group/connection-editor/DatabaseBuilder.js.map +1 -1
- package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js +10 -4
- package/lib/components/editor/editor-group/data-editor/EmbeddedDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js +65 -12
- package/lib/components/editor/editor-group/data-editor/RelationalCSVDataEditor.js.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js +3 -0
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.js.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js +3 -0
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.js.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js +3 -0
- package/lib/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js +101 -137
- package/lib/components/editor/editor-group/mapping-editor/MappingTestableEditor.js.map +1 -1
- package/lib/components/editor/editor-group/mapping-editor/NewMappingElementModal.js +1 -2
- package/lib/components/editor/editor-group/mapping-editor/NewMappingElementModal.js.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js +9 -4
- package/lib/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.js.map +1 -1
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts +11 -0
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.d.ts.map +1 -1
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.js +27 -2
- package/lib/components/editor/editor-group/testable/TestableSharedComponents.js.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.d.ts.map +1 -1
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js +38 -6
- package/lib/components/editor/panel-group/SQLPlaygroundPanel.js.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts +3 -0
- package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js +43 -1
- package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
- package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +10 -0
- package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.js +1 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +10 -2
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts +0 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +43 -10
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +26 -30
- package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/data/DataEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts +14 -19
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js +30 -65
- package/lib/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts +4 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +5 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts +56 -78
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +285 -384
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts +23 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js +129 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +12 -2
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js +15 -8
- package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts +7 -4
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js +53 -10
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +2 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +20 -16
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts +9 -0
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.d.ts.map +1 -1
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js +149 -3
- package/lib/stores/editor/panel-group/SQLPlaygroundPanelState.js.map +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.d.ts.map +1 -1
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js +3 -0
- package/lib/stores/editor/sidebar-state/testable/GlobalTestRunnerState.js.map +1 -1
- package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/MockDataUtils.js +3 -0
- package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +2 -5
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +2 -6
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/lib/stores/editor/utils/TestableUtils.d.ts +11 -1
- package/lib/stores/editor/utils/TestableUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/TestableUtils.js +50 -1
- package/lib/stores/editor/utils/TestableUtils.js.map +1 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts +5 -4
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js +4 -1
- package/lib/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js.map +1 -1
- package/package.json +6 -6
- package/src/__lib__/LegendStudioApplicationNavigationContext.ts +12 -1
- package/src/__lib__/LegendStudioEvent.ts +1 -1
- package/src/application/LegendStudioApplicationConfig.ts +8 -0
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/editor/editor-group/ModelImporter.tsx +4 -0
- package/src/components/editor/editor-group/connection-editor/DatabaseBuilder.tsx +12 -13
- package/src/components/editor/editor-group/data-editor/EmbeddedDataEditor.tsx +45 -38
- package/src/components/editor/editor-group/data-editor/RelationalCSVDataEditor.tsx +140 -31
- package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_BindingElementEditor.tsx +7 -0
- package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetElementEditor.tsx +6 -0
- package/src/components/editor/editor-group/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.tsx +6 -0
- package/src/components/editor/editor-group/mapping-editor/MappingTestableEditor.tsx +296 -414
- package/src/components/editor/editor-group/mapping-editor/NewMappingElementModal.tsx +1 -1
- package/src/components/editor/editor-group/service-editor/testable/ServiceTestsEditor.tsx +12 -7
- package/src/components/editor/editor-group/testable/TestableSharedComponents.tsx +88 -3
- package/src/components/editor/panel-group/SQLPlaygroundPanel.tsx +104 -18
- package/src/components/editor/side-bar/CreateNewElementModal.tsx +111 -1
- package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +10 -0
- package/src/stores/editor/EditorGraphState.ts +1 -1
- package/src/stores/editor/EditorStore.ts +29 -17
- package/src/stores/editor/NewElementState.ts +109 -21
- package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +33 -40
- package/src/stores/editor/editor-state/element-editor-state/data/DataEditorState.ts +7 -1
- package/src/stores/editor/editor-state/element-editor-state/data/EmbeddedDataState.ts +48 -77
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +5 -1
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +407 -617
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestingHelper.ts +243 -0
- package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +6 -2
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +18 -1
- package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestableState.ts +20 -12
- package/src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts +76 -18
- package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +29 -24
- package/src/stores/editor/panel-group/SQLPlaygroundPanelState.ts +224 -1
- package/src/stores/editor/sidebar-state/testable/GlobalTestRunnerState.ts +4 -1
- package/src/stores/editor/utils/MockDataUtils.ts +2 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +2 -6
- package/src/stores/editor/utils/TestableUtils.ts +73 -0
- package/src/stores/graph-modifier/DSL_Mapping_GraphModifierHelper.ts +15 -12
- package/tsconfig.json +1 -0
@@ -14,13 +14,14 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
import { AssertFail, TestExecuted, TestError, EqualToJson, ExternalFormatData, EqualToJsonAssertFail, MultiExecutionServiceTestResult, AssertPass, TestExecutionStatus, } from '@finos/legend-graph';
|
17
|
-
import { ActionState, assertErrorThrown, ContentType, UnsupportedOperationError, } from '@finos/legend-shared';
|
18
|
-
import { action, flow, makeObservable, observable } from 'mobx';
|
17
|
+
import { ActionState, assertErrorThrown, ContentType, UnsupportedOperationError, assertTrue, isNonNullable, IllegalStateError, guaranteeNonNullable, guaranteeType, } from '@finos/legend-shared';
|
18
|
+
import { action, flow, flowResult, makeObservable, observable } from 'mobx';
|
19
19
|
import { externalFormatData_setData } from '../../../../graph-modifier/DSL_Data_GraphModifierHelper.js';
|
20
20
|
import { getTestableResultFromAssertionStatus, TESTABLE_RESULT, } from '../../../sidebar-state/testable/GlobalTestRunnerState.js';
|
21
|
+
import { isTestPassing } from '../../../utils/TestableUtils.js';
|
21
22
|
export var TEST_ASSERTION_TAB;
|
22
23
|
(function (TEST_ASSERTION_TAB) {
|
23
|
-
TEST_ASSERTION_TAB["
|
24
|
+
TEST_ASSERTION_TAB["EXPECTED"] = "EXPECTED";
|
24
25
|
TEST_ASSERTION_TAB["RESULT"] = "RESULT";
|
25
26
|
})(TEST_ASSERTION_TAB || (TEST_ASSERTION_TAB = {}));
|
26
27
|
export class TestAssertionStatusState {
|
@@ -157,11 +158,16 @@ export class EqualToJsonAssertionState extends TestAssertionState {
|
|
157
158
|
setExpectedValue(val) {
|
158
159
|
externalFormatData_setData(this.assertion.expected, val);
|
159
160
|
}
|
161
|
+
get supportsGeneratingAssertion() {
|
162
|
+
return true;
|
163
|
+
}
|
160
164
|
generateExpected(status) {
|
161
165
|
if (status instanceof EqualToJsonAssertFail) {
|
162
166
|
const expected = status.actual;
|
163
167
|
this.setExpectedValue(expected);
|
168
|
+
return true;
|
164
169
|
}
|
170
|
+
return false;
|
165
171
|
}
|
166
172
|
generateBare() {
|
167
173
|
const bareAssertion = new EqualToJson();
|
@@ -175,11 +181,14 @@ export class EqualToJsonAssertionState extends TestAssertionState {
|
|
175
181
|
}
|
176
182
|
}
|
177
183
|
export class UnsupportedAssertionState extends TestAssertionState {
|
184
|
+
get supportsGeneratingAssertion() {
|
185
|
+
return false;
|
186
|
+
}
|
178
187
|
generateBare() {
|
179
188
|
throw new UnsupportedOperationError();
|
180
189
|
}
|
181
190
|
generateExpected(status) {
|
182
|
-
return;
|
191
|
+
return false;
|
183
192
|
}
|
184
193
|
label() {
|
185
194
|
return 'Unsupported';
|
@@ -191,7 +200,7 @@ export class TestAssertionEditorState {
|
|
191
200
|
assertionState;
|
192
201
|
assertionResultState;
|
193
202
|
assertion;
|
194
|
-
selectedTab = TEST_ASSERTION_TAB.
|
203
|
+
selectedTab = TEST_ASSERTION_TAB.EXPECTED;
|
195
204
|
generatingExpectedAction = ActionState.create();
|
196
205
|
constructor(editorStore, assertion, testState) {
|
197
206
|
makeObservable(this, {
|
@@ -211,18 +220,52 @@ export class TestAssertionEditorState {
|
|
211
220
|
}
|
212
221
|
*generateExpected() {
|
213
222
|
try {
|
223
|
+
assertTrue(this.assertionState.supportsGeneratingAssertion, 'Assertion does not support generation');
|
214
224
|
this.generatingExpectedAction.inProgress();
|
215
|
-
const
|
216
|
-
|
217
|
-
|
218
|
-
|
225
|
+
const result = (yield flowResult(this.testState.fetchTestResult()));
|
226
|
+
let testExecuted;
|
227
|
+
if (result instanceof TestExecuted) {
|
228
|
+
testExecuted = result;
|
229
|
+
}
|
230
|
+
else if (result instanceof MultiExecutionServiceTestResult) {
|
231
|
+
testExecuted = guaranteeNonNullable(Array.from(result.keyIndexedTestResults.values())
|
232
|
+
.map((testResult) => {
|
233
|
+
if (testResult instanceof TestExecuted) {
|
234
|
+
return testResult;
|
235
|
+
}
|
236
|
+
else if (testResult instanceof TestError) {
|
237
|
+
throw new IllegalStateError(testResult.error);
|
238
|
+
}
|
239
|
+
return undefined;
|
240
|
+
})
|
241
|
+
.filter(isNonNullable)[0], 'Unable to derive expected result from test result');
|
242
|
+
}
|
243
|
+
else {
|
244
|
+
throw new UnsupportedOperationError('Unable to derive expected result from test result');
|
245
|
+
}
|
246
|
+
// if test is passing, update UI and return
|
247
|
+
// if test errors report error
|
248
|
+
if (isTestPassing(testExecuted)) {
|
249
|
+
this.testState.handleTestResult(testExecuted);
|
250
|
+
return;
|
251
|
+
}
|
252
|
+
else if (testExecuted instanceof TestError) {
|
253
|
+
throw new IllegalStateError(testExecuted.error);
|
254
|
+
}
|
255
|
+
const assertionStatus = testExecuted.assertStatuses.find((aStatus) => aStatus.assertion.id === this.assertion.id &&
|
256
|
+
aStatus instanceof AssertFail);
|
257
|
+
const assertFail = guaranteeType(assertionStatus, AssertFail, 'Unable to derive expected result from test result');
|
258
|
+
const generated = this.assertionState.generateExpected(assertFail);
|
259
|
+
if (generated) {
|
260
|
+
this.setSelectedTab(TEST_ASSERTION_TAB.EXPECTED);
|
261
|
+
}
|
219
262
|
this.generatingExpectedAction.complete();
|
220
263
|
this.editorStore.applicationStore.notificationService.notifySuccess(`Expected results generated!`);
|
221
264
|
}
|
222
265
|
catch (error) {
|
223
266
|
assertErrorThrown(error);
|
224
267
|
this.editorStore.applicationStore.notificationService.notifyError(`Error generating expected result, please check data input: ${error.message}.`);
|
225
|
-
this.setSelectedTab(TEST_ASSERTION_TAB.
|
268
|
+
this.setSelectedTab(TEST_ASSERTION_TAB.EXPECTED);
|
226
269
|
this.generatingExpectedAction.fail();
|
227
270
|
}
|
228
271
|
}
|
package/lib/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TestAssertionState.js","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,UAAU,EAEV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,+BAA+B,EAC/B,UAAU,EACV,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,yBAAyB,
|
1
|
+
{"version":3,"file":"TestAssertionState.js","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/testable/TestAssertionState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,UAAU,EAEV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,qBAAqB,EACrB,+BAA+B,EAC/B,UAAU,EACV,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,yBAAyB,EACzB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAE5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAC;AACxG,OAAO,EACL,oCAAoC,EACpC,eAAe,GAChB,MAAM,0DAA0D,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;AACnB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,OAAgB,wBAAwB;IAC5C,WAAW,CAA2B;IACtC,MAAM,CAAkB;IAExB,YAAY,WAAqC,EAAE,MAAuB;QACxE,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,wBAAwB;IAG3D,YAAY,WAAqC,EAAE,MAAkB;QACnE,KAA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EAAE,CACV,OAAO,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE;gBAC1C,OAAO,YAAY,UAAU,CAChC,CAAC;YACF,MAAM,UAAU,GAAG,aAAa,CAC9B,eAAe,EACf,UAAU,EACV,mDAAmD,CACpD,CAAC;YACF,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;YAEnE,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;aAClD;YACD,IAAI,CAAC,wBAAwB,CAAC,QAAQ,EAAE,CAAC;YACzC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,aAAa,CACjE,6BAA6B,CAC9B,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAC/D,8DAA8D,KAAK,CAAC,OAAO,GAAG,CAC/E,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YACjD,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,CAAC;SACtC;IACH,CAAC;IAED,mBAAmB,CAAC,SAAwB;QAC1C,IAAI,SAAS,YAAY,WAAW,EAAE;YACpC,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SAC9D;QACD,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAC/D,CAAC;CACF"}
|
package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts
CHANGED
@@ -46,6 +46,7 @@ export declare class TestableTestEditorState {
|
|
46
46
|
deleteAssertion(assertionState: TestAssertionEditorState): void;
|
47
47
|
openAssertion(val: TestAssertion): void;
|
48
48
|
runTest(): GeneratorFn<void>;
|
49
|
+
fetchTestResult(): Promise<TestResult>;
|
49
50
|
resetResult(): void;
|
50
51
|
handleTestResult(testResult: TestResult): void;
|
51
52
|
get assertionCount(): number;
|
@@ -58,7 +59,7 @@ export declare class TestableTestSuiteEditorState {
|
|
58
59
|
suite: TestSuite;
|
59
60
|
isReadOnly: boolean;
|
60
61
|
testStates: TestableTestEditorState[];
|
61
|
-
|
62
|
+
runningSuiteState: ActionState;
|
62
63
|
selectTestState: TestableTestEditorState | undefined;
|
63
64
|
constructor(testable: Testable, suite: TestSuite, isReadOnly: boolean, editorStore: EditorStore);
|
64
65
|
runSuite(): GeneratorFn<void>;
|
package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TestableEditorState.d.ts","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,WAAW,EAIhB,WAAW,EAIZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EACL,wBAAwB,EAEzB,MAAM,yBAAyB,CAAC;AAEjC,qBAAa,uBAAuB;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAC5C,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;gBAEnB,SAAS,EAAE,uBAAuB,EAAE,WAAW,EAAE,WAAW;IAUxE,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI;CAG7C;AAED,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,SAAS,cAAc;CACxB;AAED,qBAAa,uBAAuB;IAClC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,qBAAqB,EAAE,wBAAwB,GAAG,SAAS,CAAC;IAC5D,qBAAqB,EAAE,wBAAwB,EAAE,CAAM;IACvD,WAAW,oBAA+B;IAC1C,iBAAiB,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7C,iBAAiB,cAAwB;IACzC,eAAe,EAAE,uBAAuB,CAAC;IACzC,UAAU,EAAE,OAAO,CAAC;gBAGlB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,OAAO,EACnB,WAAW,EAAE,WAAW;IAc1B,cAAc,CAAC,GAAG,EAAE,iBAAiB,GAAG,IAAI;IAI5C,oBAAoB,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;IAIhE,YAAY,IAAI,IAAI;IAapB,eAAe,CAAC,cAAc,EAAE,wBAAwB,GAAG,IAAI;IAQ/D,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI;IAOtC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"TestableEditorState.d.ts","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,UAAU,EAIf,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,WAAW,EAIhB,WAAW,EAIZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EACL,wBAAwB,EA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G,IAAI;IAQ9C,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,eAAe,IAAI,MAAM,CAW5B;IAED,IAAI,eAAe,IAAI,MAAM,CAW5B;CACF;AAED,qBAAa,4BAA4B;IACvC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,uBAAuB,EAAE,CAAM;IAC3C,iBAAiB,cAAwB;IACzC,eAAe,EAAE,uBAAuB,GAAG,SAAS,CAAC;gBAGnD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,OAAO,EACnB,WAAW,EAAE,WAAW;IAQzB,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC;IA4B7B,eAAe,IAAI,WAAW,CAAC,IAAI,CAAC;CAoCtC"}
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
import { TestExecuted, UniqueTestId, RunTestsTestableInput, TestSuite, TestExecutionStatus, TestError, } from '@finos/legend-graph';
|
17
17
|
import { assertErrorThrown, assertTrue, guaranteeNonNullable, ActionState, addUniqueEntry, deleteEntry, isNonNullable, } from '@finos/legend-shared';
|
18
|
-
import { action, makeObservable, observable } from 'mobx';
|
18
|
+
import { action, flowResult, makeObservable, observable } from 'mobx';
|
19
19
|
import { atomicTest_addAssertion } from '../../../../graph-modifier/Testable_GraphModifierHelper.js';
|
20
20
|
import { createEmptyEqualToJsonAssertion } from '../../../utils/TestableUtils.js';
|
21
21
|
import { TESTABLE_RESULT } from '../../../sidebar-state/testable/GlobalTestRunnerState.js';
|
@@ -92,14 +92,7 @@ export class TestableTestEditorState {
|
|
92
92
|
try {
|
93
93
|
this.resetResult();
|
94
94
|
this.runningTestAction.inProgress();
|
95
|
-
const
|
96
|
-
const suite = this.test.__parent instanceof TestSuite
|
97
|
-
? this.test.__parent
|
98
|
-
: undefined;
|
99
|
-
input.unitTestIds.push(new UniqueTestId(suite, this.test));
|
100
|
-
const testResults = (yield this.editorStore.graphManagerState.graphManager.runTests([input], this.editorStore.graphManagerState.graph));
|
101
|
-
const result = guaranteeNonNullable(testResults[0]);
|
102
|
-
assertTrue(result.testable === this.testable && result.atomicTest === this.test, 'Unexpected test result');
|
95
|
+
const result = (yield flowResult(this.fetchTestResult()));
|
103
96
|
this.handleTestResult(result);
|
104
97
|
this.runningTestAction.complete();
|
105
98
|
}
|
@@ -109,6 +102,17 @@ export class TestableTestEditorState {
|
|
109
102
|
this.runningTestAction.fail();
|
110
103
|
}
|
111
104
|
}
|
105
|
+
// Fetches test results. Caller of test should catch the error
|
106
|
+
async fetchTestResult() {
|
107
|
+
const input = new RunTestsTestableInput(this.testable);
|
108
|
+
const suite = this.test.__parent instanceof TestSuite ? this.test.__parent : undefined;
|
109
|
+
input.unitTestIds.push(new UniqueTestId(suite, this.test));
|
110
|
+
const testResults = await this.editorStore.graphManagerState.graphManager.runTests([input], this.editorStore.graphManagerState.graph);
|
111
|
+
const result = guaranteeNonNullable(testResults[0]);
|
112
|
+
assertTrue(result.testable === this.testable &&
|
113
|
+
result.atomicTest.id === this.test.id, 'Unexpected test result');
|
114
|
+
return result;
|
115
|
+
}
|
112
116
|
resetResult() {
|
113
117
|
this.testResultState.setResult(undefined);
|
114
118
|
this.assertionEditorStates.forEach((assertionState) => assertionState.assertionResultState.setTestResult(undefined));
|
@@ -146,7 +150,7 @@ export class TestableTestSuiteEditorState {
|
|
146
150
|
suite;
|
147
151
|
isReadOnly;
|
148
152
|
testStates = [];
|
149
|
-
|
153
|
+
runningSuiteState = ActionState.create();
|
150
154
|
selectTestState;
|
151
155
|
constructor(testable, suite, isReadOnly, editorStore) {
|
152
156
|
this.testable = testable;
|
@@ -156,7 +160,7 @@ export class TestableTestSuiteEditorState {
|
|
156
160
|
}
|
157
161
|
*runSuite() {
|
158
162
|
try {
|
159
|
-
this.
|
163
|
+
this.runningSuiteState.inProgress();
|
160
164
|
this.testStates.forEach((t) => t.resetResult());
|
161
165
|
this.testStates.forEach((t) => t.runningTestAction.inProgress());
|
162
166
|
const input = new RunTestsTestableInput(this.testable);
|
@@ -166,12 +170,12 @@ export class TestableTestSuiteEditorState {
|
|
166
170
|
const state = this.testStates.find((t) => t.test === result.atomicTest);
|
167
171
|
state?.handleTestResult(result);
|
168
172
|
});
|
169
|
-
this.
|
173
|
+
this.runningSuiteState.complete();
|
170
174
|
}
|
171
175
|
catch (error) {
|
172
176
|
assertErrorThrown(error);
|
173
177
|
this.editorStore.applicationStore.notificationService.notifyError(error);
|
174
|
-
this.
|
178
|
+
this.runningSuiteState.fail();
|
175
179
|
}
|
176
180
|
finally {
|
177
181
|
this.testStates.forEach((t) => t.runningTestAction.complete());
|
@@ -179,7 +183,7 @@ export class TestableTestSuiteEditorState {
|
|
179
183
|
}
|
180
184
|
*runFailingTests() {
|
181
185
|
try {
|
182
|
-
this.
|
186
|
+
this.runningSuiteState.inProgress();
|
183
187
|
const input = new RunTestsTestableInput(this.testable);
|
184
188
|
input.unitTestIds = this.testStates
|
185
189
|
.map((testState) => {
|
@@ -198,12 +202,12 @@ export class TestableTestSuiteEditorState {
|
|
198
202
|
const state = this.testStates.find((t) => t.test === result.atomicTest);
|
199
203
|
state?.handleTestResult(result);
|
200
204
|
});
|
201
|
-
this.
|
205
|
+
this.runningSuiteState.complete();
|
202
206
|
}
|
203
207
|
catch (error) {
|
204
208
|
assertErrorThrown(error);
|
205
209
|
this.editorStore.applicationStore.notificationService.notifyError(error);
|
206
|
-
this.
|
210
|
+
this.runningSuiteState.fail();
|
207
211
|
}
|
208
212
|
finally {
|
209
213
|
this.testStates.forEach((t) => t.runningTestAction.complete());
|
package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TestableEditorState.js","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,mBAAmB,EACnB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"TestableEditorState.js","sourceRoot":"","sources":["../../../../../../src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,mBAAmB,EACnB,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,iBAAiB,EACjB,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AACrG,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,EACL,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,OAAO,uBAAuB;IACzB,WAAW,CAAc;IACzB,SAAS,CAA0B;IAC5C,MAAM,CAAyB;IAE/B,YAAY,SAAkC,EAAE,WAAwB;QACtE,cAAc,CAAC,IAAI,EAAE;YACnB,MAAM,EAAE,UAAU;YAClB,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AS,EAC3B;oBACA,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,CAAC;oBACzC,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;iBACrD;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC,CAAC;iBACD,MAAM,CAAC,aAAa,CAAC,CAAC;YACzB,MAAM,WAAW,GACf,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,YAAY,CAAC,QAAQ,CAC7D,CAAC,KAAK,CAAC,EACP,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CACzC,CAAiB,CAAC;YACrB,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,UAAU,CAAC,CAAC;gBACxE,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;SACnC;QAAC,OAAO,KAAK,EAAE;YACd,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACzE,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;SAC/B;gBAAS;YACR,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAC;SAChE;IACH,CAAC;CACF"}
|
@@ -19,13 +19,16 @@ import { editor as monacoEditorAPI } from 'monaco-editor';
|
|
19
19
|
import { type Schema, type Table, type Database, type PackageableConnection, Column } from '@finos/legend-graph';
|
20
20
|
import type { EditorStore } from '../EditorStore.js';
|
21
21
|
import type { CommandRegistrar } from '@finos/legend-application';
|
22
|
+
import type { Entity } from '@finos/legend-storage';
|
22
23
|
export declare abstract class DatabaseSchemaExplorerTreeNodeData implements TreeNodeData {
|
23
24
|
isOpen?: boolean | undefined;
|
24
25
|
id: string;
|
25
26
|
label: string;
|
26
27
|
parentId?: string | undefined;
|
27
28
|
childrenIds?: string[] | undefined;
|
29
|
+
isChecked: boolean;
|
28
30
|
constructor(id: string, label: string, parentId: string | undefined);
|
31
|
+
setChecked(val: boolean): void;
|
29
32
|
}
|
30
33
|
export declare class DatabaseSchemaExplorerTreeSchemaNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
31
34
|
schema: Schema;
|
@@ -51,12 +54,15 @@ export declare class SQLPlaygroundPanelState implements CommandRegistrar {
|
|
51
54
|
isFetchingSchema: boolean;
|
52
55
|
isExecutingRawSQL: boolean;
|
53
56
|
connection?: PackageableConnection | undefined;
|
57
|
+
database?: Database | undefined;
|
54
58
|
treeData?: DatabaseSchemaExplorerTreeData | undefined;
|
55
59
|
readonly sqlEditorTextModel: monacoEditorAPI.ITextModel;
|
56
60
|
sqlEditor?: monacoEditorAPI.IStandaloneCodeEditor | undefined;
|
57
61
|
sqlEditorViewState?: monacoEditorAPI.ICodeEditorViewState | undefined;
|
58
62
|
sqlText: string;
|
59
63
|
sqlExecutionResult?: string | undefined;
|
64
|
+
isBuildingDatabase: boolean;
|
65
|
+
isUpdatingDatabase: boolean;
|
60
66
|
constructor(editorStore: EditorStore);
|
61
67
|
setTreeData(val?: DatabaseSchemaExplorerTreeData): void;
|
62
68
|
setConnection(val: PackageableConnection | undefined): void;
|
@@ -68,6 +74,7 @@ export declare class SQLPlaygroundPanelState implements CommandRegistrar {
|
|
68
74
|
deregisterCommands(): void;
|
69
75
|
onNodeSelect(node: DatabaseSchemaExplorerTreeNodeData, treeData: DatabaseSchemaExplorerTreeData): GeneratorFn<void>;
|
70
76
|
getChildNodes(node: DatabaseSchemaExplorerTreeNodeData, treeData: DatabaseSchemaExplorerTreeData): DatabaseSchemaExplorerTreeNodeData[] | undefined;
|
77
|
+
toggleCheckedNode(node: DatabaseSchemaExplorerTreeNodeData, treeData: DatabaseSchemaExplorerTreeData): void;
|
71
78
|
fetchDatabaseMetadata(): GeneratorFn<void>;
|
72
79
|
fetchSchemaMetadata(schemaNode: DatabaseSchemaExplorerTreeSchemaNodeData, treeData: DatabaseSchemaExplorerTreeData): GeneratorFn<void>;
|
73
80
|
fetchTableMetadata(tableNode: DatabaseSchemaExplorerTreeTableNodeData, treeData: DatabaseSchemaExplorerTreeData): GeneratorFn<void>;
|
@@ -78,5 +85,7 @@ export declare class SQLPlaygroundPanelState implements CommandRegistrar {
|
|
78
85
|
*/
|
79
86
|
private buildIntermediateDatabase;
|
80
87
|
executeRawSQL(): GeneratorFn<void>;
|
88
|
+
generateDatabase(): GeneratorFn<Entity>;
|
89
|
+
updateDatabase(): GeneratorFn<void>;
|
81
90
|
}
|
82
91
|
//# sourceMappingURL=SQLPlaygroundPanelState.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SQLPlaygroundPanelState.d.ts","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/SQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACL,KAAK,WAAW,
|
1
|
+
{"version":3,"file":"SQLPlaygroundPanelState.d.ts","sourceRoot":"","sources":["../../../../src/stores/editor/panel-group/SQLPlaygroundPanelState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EACL,KAAK,WAAW,EAYjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,IAAI,e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kCAAkC,EACxC,QAAQ,EAAE,8BAA8B,GACvC,WAAW,CAAC,IAAI,CAAC;IAgBpB,aAAa,CACX,IAAI,EAAE,kCAAkC,EACxC,QAAQ,EAAE,8BAA8B,GACvC,kCAAkC,EAAE,GAAG,SAAS;IAMnD,iBAAiB,CACf,IAAI,EAAE,kCAAkC,EACxC,QAAQ,EAAE,8BAA8B,GACvC,IAAI;IAwBN,qBAAqB,IAAI,WAAW,CAAC,IAAI,CAAC;IA4D1C,mBAAmB,CAClB,UAAU,EAAE,wCAAwC,EACpD,QAAQ,EAAE,8BAA8B,GACvC,WAAW,CAAC,IAAI,CAAC;IAyEnB,kBAAkB,CACjB,SAAS,EAAE,uCAAuC,EAClD,QAAQ,EAAE,8BAA8B,GACvC,WAAW,CAAC,IAAI,CAAC;IAkEpB;;;;OAIG;YACW,yBAAyB;IAoBtC,aAAa,IAAI,WAAW,CAAC,IAAI,CAAC;IAmClC,gBAAgB,IAAI,WAAW,CAAC,MAAM,CAAC;IAmEvC,cAAc,IAAI,WAAW,CAAC,IAAI,CAAC;CA2ErC"}
|
@@ -13,25 +13,34 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { assertErrorThrown, LogEvent, addUniqueEntry, isNonNullable, filterByType, ActionState, getNonNullableEntry, getNullableLastEntry, } from '@finos/legend-shared';
|
16
|
+
import { assertErrorThrown, LogEvent, addUniqueEntry, isNonNullable, filterByType, ActionState, getNonNullableEntry, getNullableLastEntry, guaranteeNonNullable, IllegalStateError, } from '@finos/legend-shared';
|
17
17
|
import { observable, makeObservable, flow, flowResult, action } from 'mobx';
|
18
18
|
import { editor as monacoEditorAPI } from 'monaco-editor';
|
19
|
-
import { DatabaseBuilderInput, DatabasePattern, TargetDatabase, Column, getSchema, guaranteeRelationalDatabaseConnection, GRAPH_MANAGER_EVENT, } from '@finos/legend-graph';
|
19
|
+
import { DatabaseBuilderInput, DatabasePattern, TargetDatabase, Column, getSchema, guaranteeRelationalDatabaseConnection, GRAPH_MANAGER_EVENT, getNullableSchema, getNullableTable, } from '@finos/legend-graph';
|
20
20
|
import { LEGEND_STUDIO_APP_EVENT } from '../../../__lib__/LegendStudioEvent.js';
|
21
21
|
import { CODE_EDITOR_LANGUAGE, moveCursorToPosition, } from '@finos/legend-lego/code-editor';
|
22
22
|
import { STO_RELATIONAL_LEGEND_STUDIO_COMMAND_KEY } from '../../../__lib__/STO_Relational_LegendStudioCommand.js';
|
23
23
|
import { PANEL_MODE } from '../EditorConfig.js';
|
24
|
+
import { GraphEditFormModeState } from '../GraphEditFormModeState.js';
|
24
25
|
export class DatabaseSchemaExplorerTreeNodeData {
|
25
26
|
isOpen;
|
26
27
|
id;
|
27
28
|
label;
|
28
29
|
parentId;
|
29
30
|
childrenIds;
|
31
|
+
isChecked = false;
|
30
32
|
constructor(id, label, parentId) {
|
33
|
+
makeObservable(this, {
|
34
|
+
isChecked: observable,
|
35
|
+
setChecked: action,
|
36
|
+
});
|
31
37
|
this.id = id;
|
32
38
|
this.label = label;
|
33
39
|
this.parentId = parentId;
|
34
40
|
}
|
41
|
+
setChecked(val) {
|
42
|
+
this.isChecked = val;
|
43
|
+
}
|
35
44
|
}
|
36
45
|
export class DatabaseSchemaExplorerTreeSchemaNodeData extends DatabaseSchemaExplorerTreeNodeData {
|
37
46
|
schema;
|
@@ -70,23 +79,29 @@ export class SQLPlaygroundPanelState {
|
|
70
79
|
isFetchingSchema = false;
|
71
80
|
isExecutingRawSQL = false;
|
72
81
|
connection;
|
82
|
+
database;
|
73
83
|
treeData;
|
74
84
|
sqlEditorTextModel;
|
75
85
|
sqlEditor;
|
76
86
|
sqlEditorViewState;
|
77
87
|
sqlText = DEFAULT_SQL_TEXT;
|
78
88
|
sqlExecutionResult;
|
89
|
+
isBuildingDatabase = false;
|
90
|
+
isUpdatingDatabase = false;
|
79
91
|
constructor(editorStore) {
|
80
92
|
makeObservable(this, {
|
81
93
|
isFetchingSchema: observable,
|
82
94
|
isExecutingRawSQL: observable,
|
83
95
|
connection: observable,
|
96
|
+
database: observable,
|
84
97
|
treeData: observable,
|
85
98
|
sqlText: observable,
|
86
99
|
resetSQL: action,
|
87
100
|
sqlExecutionResult: observable,
|
88
101
|
sqlEditor: observable.ref,
|
89
102
|
sqlEditorViewState: observable.ref,
|
103
|
+
isBuildingDatabase: observable,
|
104
|
+
isUpdatingDatabase: observable,
|
90
105
|
setTreeData: action,
|
91
106
|
setConnection: action,
|
92
107
|
setSQLEditor: action,
|
@@ -97,6 +112,8 @@ export class SQLPlaygroundPanelState {
|
|
97
112
|
fetchSchemaMetadata: flow,
|
98
113
|
fetchTableMetadata: flow,
|
99
114
|
executeRawSQL: flow,
|
115
|
+
generateDatabase: flow,
|
116
|
+
updateDatabase: flow,
|
100
117
|
});
|
101
118
|
this.editorStore = editorStore;
|
102
119
|
this.sqlEditorTextModel = monacoEditorAPI.createModel(this.sqlText, CODE_EDITOR_LANGUAGE.SQL);
|
@@ -106,6 +123,9 @@ export class SQLPlaygroundPanelState {
|
|
106
123
|
}
|
107
124
|
setConnection(val) {
|
108
125
|
this.connection = val;
|
126
|
+
if (val) {
|
127
|
+
this.database = guaranteeRelationalDatabaseConnection(val).store.value;
|
128
|
+
}
|
109
129
|
this.sqlEditorTextModel.setValue(DEFAULT_SQL_TEXT);
|
110
130
|
}
|
111
131
|
setSQLText(val) {
|
@@ -158,9 +178,28 @@ export class SQLPlaygroundPanelState {
|
|
158
178
|
}
|
159
179
|
getChildNodes(node, treeData) {
|
160
180
|
return node.childrenIds
|
161
|
-
?.map((
|
181
|
+
?.map((childNode) => treeData.nodes.get(childNode))
|
162
182
|
.filter(isNonNullable);
|
163
183
|
}
|
184
|
+
toggleCheckedNode(node, treeData) {
|
185
|
+
node.setChecked(!node.isChecked);
|
186
|
+
if (node instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
187
|
+
this.getChildNodes(node, treeData)?.forEach((childNode) => {
|
188
|
+
childNode.setChecked(node.isChecked);
|
189
|
+
});
|
190
|
+
}
|
191
|
+
else if (node instanceof DatabaseSchemaExplorerTreeTableNodeData) {
|
192
|
+
if (node.parentId) {
|
193
|
+
const parent = treeData.nodes.get(node.parentId);
|
194
|
+
if (parent &&
|
195
|
+
this.getChildNodes(parent, treeData)?.every((e) => e.isChecked === node.isChecked)) {
|
196
|
+
parent.setChecked(node.isChecked);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
200
|
+
// TODO: support toggling check for columns
|
201
|
+
this.setTreeData({ ...treeData });
|
202
|
+
}
|
164
203
|
*fetchDatabaseMetadata() {
|
165
204
|
if (!this.connection) {
|
166
205
|
return;
|
@@ -185,6 +224,7 @@ export class SQLPlaygroundPanelState {
|
|
185
224
|
rootIds.push(schemaId);
|
186
225
|
const schemaNode = new DatabaseSchemaExplorerTreeSchemaNodeData(schemaId, dbSchema);
|
187
226
|
nodes.set(schemaId, schemaNode);
|
227
|
+
schemaNode.setChecked(Boolean(this.database?.schemas.find((schema) => schema.name === dbSchema.name)));
|
188
228
|
});
|
189
229
|
const treeData = { rootIds, nodes, database };
|
190
230
|
this.setTreeData(treeData);
|
@@ -225,6 +265,15 @@ export class SQLPlaygroundPanelState {
|
|
225
265
|
const tableNode = new DatabaseSchemaExplorerTreeTableNodeData(tableId, schemaNode.id, schema, table);
|
226
266
|
treeData.nodes.set(tableId, tableNode);
|
227
267
|
addUniqueEntry(childrenIds, tableId);
|
268
|
+
if (this.database) {
|
269
|
+
const matchingSchema = getNullableSchema(this.database, schema.name);
|
270
|
+
tableNode.setChecked(Boolean(matchingSchema
|
271
|
+
? getNullableTable(matchingSchema, table.name)
|
272
|
+
: undefined));
|
273
|
+
}
|
274
|
+
else {
|
275
|
+
tableNode.setChecked(false);
|
276
|
+
}
|
228
277
|
});
|
229
278
|
schemaNode.childrenIds = childrenIds;
|
230
279
|
this.setTreeData({ ...treeData });
|
@@ -324,5 +373,102 @@ export class SQLPlaygroundPanelState {
|
|
324
373
|
this.isExecutingRawSQL = false;
|
325
374
|
}
|
326
375
|
}
|
376
|
+
*generateDatabase() {
|
377
|
+
if (!this.database || !this.connection || !this.treeData) {
|
378
|
+
throw new IllegalStateError(`Can't build database: builder is not properly set up`);
|
379
|
+
}
|
380
|
+
try {
|
381
|
+
this.isBuildingDatabase = true;
|
382
|
+
const treeData = this.treeData;
|
383
|
+
const databaseBuilderInput = new DatabaseBuilderInput(guaranteeRelationalDatabaseConnection(this.connection));
|
384
|
+
const packagePath = guaranteeNonNullable(this.database.package).path;
|
385
|
+
const databaseName = this.database.name;
|
386
|
+
databaseBuilderInput.targetDatabase = new TargetDatabase(packagePath, databaseName);
|
387
|
+
const config = databaseBuilderInput.config;
|
388
|
+
config.maxTables = undefined;
|
389
|
+
config.enrichTables = true;
|
390
|
+
config.enrichColumns = true;
|
391
|
+
config.enrichPrimaryKeys = true;
|
392
|
+
treeData.rootIds
|
393
|
+
.map((e) => treeData.nodes.get(e))
|
394
|
+
.filter(isNonNullable)
|
395
|
+
.forEach((schemaNode) => {
|
396
|
+
if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
397
|
+
const tableNodes = this.getChildNodes(schemaNode, treeData);
|
398
|
+
const allChecked = tableNodes?.every((t) => t.isChecked === true);
|
399
|
+
if (allChecked ||
|
400
|
+
(schemaNode.isChecked && !schemaNode.childrenIds)) {
|
401
|
+
config.patterns.push(new DatabasePattern(schemaNode.schema.name, undefined));
|
402
|
+
}
|
403
|
+
else {
|
404
|
+
tableNodes?.forEach((t) => {
|
405
|
+
if (t instanceof DatabaseSchemaExplorerTreeTableNodeData &&
|
406
|
+
t.isChecked) {
|
407
|
+
config.patterns.push(new DatabasePattern(schemaNode.schema.name, t.table.name));
|
408
|
+
}
|
409
|
+
});
|
410
|
+
}
|
411
|
+
}
|
412
|
+
});
|
413
|
+
const entities = (yield this.editorStore.graphManagerState.graphManager.buildDatabase(databaseBuilderInput));
|
414
|
+
return getNonNullableEntry(entities, 0, 'Expected a database to be generated');
|
415
|
+
}
|
416
|
+
finally {
|
417
|
+
this.isBuildingDatabase = false;
|
418
|
+
}
|
419
|
+
}
|
420
|
+
*updateDatabase() {
|
421
|
+
if (!this.treeData || !this.database || !this.connection) {
|
422
|
+
return;
|
423
|
+
}
|
424
|
+
try {
|
425
|
+
this.isUpdatingDatabase = true;
|
426
|
+
const graph = this.editorStore.graphManagerState.createNewGraph();
|
427
|
+
(yield this.editorStore.graphManagerState.graphManager.buildGraph(graph, [(yield flowResult(this.generateDatabase()))], ActionState.create()));
|
428
|
+
const generatedDatabase = getNonNullableEntry(graph.ownDatabases, 0, 'Expected one database to be generated from input');
|
429
|
+
const currentDatabase = this.database;
|
430
|
+
// remove undefined schemas
|
431
|
+
const schemas = Array.from(this.treeData.nodes.values())
|
432
|
+
.map((schemaNode) => {
|
433
|
+
if (schemaNode instanceof DatabaseSchemaExplorerTreeSchemaNodeData) {
|
434
|
+
return schemaNode.schema;
|
435
|
+
}
|
436
|
+
return undefined;
|
437
|
+
})
|
438
|
+
.filter(isNonNullable);
|
439
|
+
currentDatabase.schemas = currentDatabase.schemas.filter((schema) => {
|
440
|
+
if (schemas.find((item) => item.name === schema.name) &&
|
441
|
+
!generatedDatabase.schemas.find((s) => s.name === schema.name)) {
|
442
|
+
return false;
|
443
|
+
}
|
444
|
+
return true;
|
445
|
+
});
|
446
|
+
// update existing schemas
|
447
|
+
generatedDatabase.schemas.forEach((schema) => {
|
448
|
+
schema._OWNER = currentDatabase;
|
449
|
+
const currentSchemaIndex = currentDatabase.schemas.findIndex((item) => item.name === schema.name);
|
450
|
+
if (currentSchemaIndex !== -1) {
|
451
|
+
currentDatabase.schemas[currentSchemaIndex] = schema;
|
452
|
+
}
|
453
|
+
else {
|
454
|
+
currentDatabase.schemas.push(schema);
|
455
|
+
}
|
456
|
+
});
|
457
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(`Database successfully updated`);
|
458
|
+
yield flowResult(this.editorStore
|
459
|
+
.getGraphEditorMode(GraphEditFormModeState)
|
460
|
+
.globalCompile({
|
461
|
+
message: `Can't compile graph after editing database. Redirecting you to text mode`,
|
462
|
+
}));
|
463
|
+
}
|
464
|
+
catch (error) {
|
465
|
+
assertErrorThrown(error);
|
466
|
+
this.editorStore.applicationStore.logService.error(LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_BUILDER_FAILURE), error);
|
467
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
468
|
+
}
|
469
|
+
finally {
|
470
|
+
this.isUpdatingDatabase = false;
|
471
|
+
}
|
472
|
+
}
|
327
473
|
}
|
328
474
|
//# sourceMappingURL=SQLPlaygroundPanelState.js.map
|