@finos/legend-application-studio 28.9.0 → 28.10.0

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.
Files changed (106) hide show
  1. package/lib/__lib__/LegendStudioCommand.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioCommand.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioCommand.js +5 -0
  4. package/lib/__lib__/LegendStudioCommand.js.map +1 -1
  5. package/lib/components/ShowcaseManager.d.ts.map +1 -1
  6. package/lib/components/ShowcaseManager.js +5 -2
  7. package/lib/components/ShowcaseManager.js.map +1 -1
  8. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  9. package/lib/components/editor/ActivityBar.js +20 -17
  10. package/lib/components/editor/ActivityBar.js.map +1 -1
  11. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  12. package/lib/components/editor/editor-group/EditorGroup.js +7 -1
  13. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  14. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts +5 -0
  15. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.d.ts.map +1 -1
  16. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js +28 -10
  17. package/lib/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.js.map +1 -1
  18. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts +11 -0
  19. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.d.ts.map +1 -1
  20. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js +22 -10
  21. package/lib/components/editor/editor-group/connection-editor/DatabaseModelBuilder.js.map +1 -1
  22. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts +7 -0
  23. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
  24. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +3 -3
  25. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  26. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.d.ts +59 -0
  27. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.d.ts.map +1 -0
  28. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.js +145 -0
  29. package/lib/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.js.map +1 -0
  30. package/lib/components/editor/side-bar/SideBar.d.ts.map +1 -1
  31. package/lib/components/editor/side-bar/SideBar.js +4 -1
  32. package/lib/components/editor/side-bar/SideBar.js.map +1 -1
  33. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.d.ts +23 -0
  34. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.d.ts.map +1 -0
  35. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.js +41 -0
  36. package/lib/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.js.map +1 -0
  37. package/lib/index.css +2 -2
  38. package/lib/index.css.map +1 -1
  39. package/lib/package.json +1 -1
  40. package/lib/stores/ShowcaseManagerState.d.ts +1 -0
  41. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  42. package/lib/stores/ShowcaseManagerState.js +11 -1
  43. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  44. package/lib/stores/editor/EditorConfig.d.ts +3 -1
  45. package/lib/stores/editor/EditorConfig.d.ts.map +1 -1
  46. package/lib/stores/editor/EditorConfig.js +4 -1
  47. package/lib/stores/editor/EditorConfig.js.map +1 -1
  48. package/lib/stores/editor/EditorStore.d.ts +2 -0
  49. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  50. package/lib/stores/editor/EditorStore.js +13 -0
  51. package/lib/stores/editor/EditorStore.js.map +1 -1
  52. package/lib/stores/editor/ExplorerTreeState.d.ts.map +1 -1
  53. package/lib/stores/editor/ExplorerTreeState.js +1 -1
  54. package/lib/stores/editor/ExplorerTreeState.js.map +1 -1
  55. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  56. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  57. package/lib/stores/editor/NewElementState.d.ts +1 -0
  58. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  59. package/lib/stores/editor/NewElementState.js +1 -1
  60. package/lib/stores/editor/NewElementState.js.map +1 -1
  61. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +6 -2
  62. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  63. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +53 -34
  64. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  65. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.d.ts.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js +1 -1
  67. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js.map +1 -1
  68. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts +3 -2
  69. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.d.ts.map +1 -1
  70. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js +8 -5
  71. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.js.map +1 -1
  72. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.d.ts +22 -0
  73. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.d.ts.map +1 -0
  74. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js +25 -0
  75. package/lib/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js.map +1 -0
  76. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.d.ts +113 -0
  77. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.d.ts.map +1 -0
  78. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js +494 -0
  79. package/lib/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js.map +1 -0
  80. package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
  81. package/lib/stores/showcase/ShowcaseViewerStore.js +5 -1
  82. package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
  83. package/package.json +5 -5
  84. package/src/__lib__/LegendStudioCommand.ts +5 -0
  85. package/src/components/ShowcaseManager.tsx +18 -0
  86. package/src/components/editor/ActivityBar.tsx +56 -15
  87. package/src/components/editor/editor-group/EditorGroup.tsx +21 -1
  88. package/src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx +135 -103
  89. package/src/components/editor/editor-group/connection-editor/DatabaseModelBuilder.tsx +97 -53
  90. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +4 -3
  91. package/src/components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.tsx +478 -0
  92. package/src/components/editor/side-bar/SideBar.tsx +13 -1
  93. package/src/components/editor/side-bar/end-to-end-workflow/EndToEndWorkflows.tsx +101 -0
  94. package/src/stores/ShowcaseManagerState.ts +19 -1
  95. package/src/stores/editor/EditorConfig.ts +3 -0
  96. package/src/stores/editor/EditorStore.ts +16 -0
  97. package/src/stores/editor/ExplorerTreeState.ts +1 -0
  98. package/src/stores/editor/GraphEditGrammarModeState.ts +3 -3
  99. package/src/stores/editor/NewElementState.ts +1 -1
  100. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +77 -49
  101. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts +1 -2
  102. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseModelBuilderState.ts +12 -8
  103. package/src/stores/editor/editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.ts +25 -0
  104. package/src/stores/editor/sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.tsx +884 -0
  105. package/src/stores/showcase/ShowcaseViewerStore.ts +4 -0
  106. package/tsconfig.json +5 -1
@@ -0,0 +1,884 @@
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, flow, flowResult, makeObservable, observable } from 'mobx';
18
+ import type { EditorStore } from '../../EditorStore.js';
19
+ import { QueryConnectionEndToEndWorkflowEditorState } from '../../editor-state/end-to-end-workflow-state/EndToEndWorkflowEditorState.js';
20
+ import { RelationalDatabaseConnectionValueState } from '../../editor-state/element-editor-state/connection/ConnectionEditorState.js';
21
+ import {
22
+ RelationalDatabaseConnection,
23
+ LocalH2DatasourceSpecification,
24
+ PackageableElementExplicitReference,
25
+ stub_Database,
26
+ DatabaseType,
27
+ DefaultH2AuthenticationStrategy,
28
+ type TextCompilationResult,
29
+ type PureModel,
30
+ PackageableConnection,
31
+ EngineRuntime,
32
+ IdentifiedConnection,
33
+ generateIdentifiedConnectionId,
34
+ PackageableRuntime,
35
+ extractElementNameFromPath,
36
+ getOrCreatePackage,
37
+ extractPackagePathFromPath,
38
+ getMappingCompatibleClasses,
39
+ RuntimePointer,
40
+ ParserError,
41
+ CompilationError,
42
+ observe_RelationalDatabaseConnection,
43
+ } from '@finos/legend-graph';
44
+ import { DEFAULT_H2_SQL } from '../../NewElementState.js';
45
+ import {
46
+ guaranteeNonNullable,
47
+ type GeneratorFn,
48
+ LogEvent,
49
+ assertErrorThrown,
50
+ ActionState,
51
+ getNonNullableEntry,
52
+ } from '@finos/legend-shared';
53
+ import { DatabaseBuilderWizardState } from '../../editor-state/element-editor-state/connection/DatabaseBuilderWizardState.js';
54
+ import { LEGEND_STUDIO_APP_EVENT } from '../../../../__lib__/LegendStudioEvent.js';
55
+ import { DatabaseModelBuilderState } from '../../editor-state/element-editor-state/connection/DatabaseModelBuilderState.js';
56
+ import { EntityChangeType, type EntityChange } from '@finos/legend-server-sdlc';
57
+ import type { Entity } from '@finos/legend-storage';
58
+ import {
59
+ packageableConnection_setConnectionValue,
60
+ runtime_addIdentifiedConnection,
61
+ runtime_addMapping,
62
+ runtime_setMappings,
63
+ } from '../../../graph-modifier/DSL_Mapping_GraphModifierHelper.js';
64
+ import {
65
+ ClassQueryBuilderState,
66
+ QueryBuilderConfig,
67
+ } from '@finos/legend-query-builder';
68
+ import { BaseStepperState } from '@finos/legend-art';
69
+ import {
70
+ QUERY_CONNECTION_WORKFLOW_STEPS,
71
+ QueryConnectionConfirmationAndGrammarEditor,
72
+ QueryConnectionDatabaseBuilderEditor,
73
+ QueryConnectionDatabaseGrammarEditor,
74
+ QueryConnectionModelsEditor,
75
+ QueryConnectionRelationalConnectionEditor,
76
+ } from '../../../../components/editor/editor-group/end-to-end-flow-editor/QueryConnectionWorkflowEditor.js';
77
+
78
+ export enum SupportedEndToEndWorkflow {
79
+ CREATE_QUERY_FROM_CONNECTION = 'Create Query From Connection',
80
+ }
81
+
82
+ const DEFAULT_CONNECTION_PATH = 'store::MyConnection';
83
+ const DEFAULT_RUNTIME_PATH = 'store::MyRuntime';
84
+ const JOIN_CODE_SYNTAX =
85
+ '// Please refer to pure code syntax below for how to create join' +
86
+ '\n' +
87
+ '// Join join_name(Table1.column1 = Table2.column2);' +
88
+ '\n';
89
+
90
+ // step5 - confirm/update final grammar and query
91
+ export class QueryConnectionConfirmationAndGrammarEditorStepperState extends BaseStepperState {
92
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState;
93
+ isCompilingCode = ActionState.create();
94
+ editorStore: EditorStore;
95
+
96
+ constructor(
97
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState,
98
+ stepLabel: string,
99
+ ) {
100
+ super(stepLabel);
101
+ makeObservable(this, {
102
+ queryConnectionEndToEndWorkflowState: false,
103
+ stepLabel: observable,
104
+ isCompilingCode: observable,
105
+ handleNext: flow,
106
+ query: flow,
107
+ compile: flow,
108
+ });
109
+ this.queryConnectionEndToEndWorkflowState =
110
+ queryConnectionEndToEndWorkflowState;
111
+ this.editorStore =
112
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState.editorStore;
113
+ }
114
+
115
+ *compile(): GeneratorFn<void> {
116
+ try {
117
+ this.isCompilingCode.inProgress();
118
+ const compilationResult = (yield flowResult(
119
+ yield this.editorStore.graphManagerState.graphManager.compileText(
120
+ this.queryConnectionEndToEndWorkflowState.finalGrammarCode,
121
+ this.queryConnectionEndToEndWorkflowState.graph,
122
+ ),
123
+ )) as TextCompilationResult;
124
+ this.editorStore.applicationStore.notificationService.notifySuccess(
125
+ 'Compiled successfully',
126
+ );
127
+ const entities = compilationResult.entities;
128
+ const newGraph = this.editorStore.graphManagerState.createNewGraph();
129
+ yield flowResult(
130
+ this.editorStore.graphManagerState.graphManager.buildGraph(
131
+ newGraph,
132
+ entities,
133
+ ActionState.create(),
134
+ ),
135
+ );
136
+ this.queryConnectionEndToEndWorkflowState.graph = newGraph;
137
+ this.queryConnectionEndToEndWorkflowState.setCompileError(undefined);
138
+ } catch (error) {
139
+ if (error instanceof ParserError || error instanceof CompilationError) {
140
+ this.queryConnectionEndToEndWorkflowState.setCompileError(error);
141
+ }
142
+ assertErrorThrown(error);
143
+ this.editorStore.applicationStore.logService.error(
144
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_MODEL_BUILDER_FAILURE),
145
+ error,
146
+ );
147
+ this.editorStore.applicationStore.notificationService.notifyError(error);
148
+ this.isCompilingCode.fail();
149
+ } finally {
150
+ this.isCompilingCode.complete();
151
+ }
152
+ }
153
+
154
+ *query(): GeneratorFn<void> {
155
+ const entities =
156
+ (yield this.editorStore.graphManagerState.graphManager.pureCodeToEntities(
157
+ this.queryConnectionEndToEndWorkflowState.finalGrammarCode,
158
+ )) as Entity[];
159
+ const newEntities: EntityChange[] = [];
160
+ for (const entity of entities) {
161
+ newEntities.push({
162
+ type: EntityChangeType.CREATE,
163
+ entityPath: entity.path,
164
+ content: entity.content,
165
+ });
166
+ }
167
+ yield flowResult(
168
+ this.editorStore.graphState.loadEntityChangesToGraph(
169
+ newEntities,
170
+ undefined,
171
+ ),
172
+ );
173
+ this.editorStore.tabManagerState.openTab(
174
+ this.queryConnectionEndToEndWorkflowState
175
+ .queryConnectionEndToEndWorkflowEditorState,
176
+ );
177
+ this.editorStore.tabManagerState.closeTab(
178
+ this.queryConnectionEndToEndWorkflowState
179
+ .queryConnectionEndToEndWorkflowEditorState,
180
+ );
181
+ const theClass = getMappingCompatibleClasses(
182
+ getNonNullableEntry(
183
+ this.queryConnectionEndToEndWorkflowState.graph.mappings,
184
+ 0,
185
+ ),
186
+ this.queryConnectionEndToEndWorkflowState.graph.classes,
187
+ )[0];
188
+ if (theClass) {
189
+ const config = new QueryBuilderConfig();
190
+ const queryBuilderState = new ClassQueryBuilderState(
191
+ this.editorStore.applicationStore,
192
+ this.editorStore.graphManagerState,
193
+ config,
194
+ );
195
+ queryBuilderState.class = theClass;
196
+ queryBuilderState.executionContextState.mapping = getNonNullableEntry(
197
+ this.queryConnectionEndToEndWorkflowState.graph.mappings,
198
+ 0,
199
+ );
200
+ queryBuilderState.executionContextState.runtimeValue = new RuntimePointer(
201
+ PackageableElementExplicitReference.create(
202
+ getNonNullableEntry(
203
+ this.queryConnectionEndToEndWorkflowState.graph.runtimes,
204
+ 0,
205
+ ),
206
+ ),
207
+ );
208
+ yield flowResult(
209
+ this.editorStore.embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration(
210
+ {
211
+ setupQueryBuilderState: () => queryBuilderState,
212
+ actionConfigs: [],
213
+ },
214
+ ),
215
+ );
216
+ }
217
+ }
218
+
219
+ override *handleNext(): GeneratorFn<void> {
220
+ yield flowResult(this.query()).then(() => {
221
+ this.queryConnectionEndToEndWorkflowState.reset();
222
+ });
223
+ }
224
+
225
+ override renderStepContent(): React.ReactNode {
226
+ return (
227
+ <QueryConnectionConfirmationAndGrammarEditor
228
+ queryConnectionEndToEndWorkflowState={
229
+ this.queryConnectionEndToEndWorkflowState
230
+ }
231
+ queryConnectionConfirmationAndGrammarEditorStepperState={this}
232
+ />
233
+ );
234
+ }
235
+ }
236
+
237
+ // step 4 - build class/mapping/runtime from database
238
+ export class DatabaseModelBuilderStepperState extends BaseStepperState {
239
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState;
240
+ databaseModelBuilderState: DatabaseModelBuilderState;
241
+ editorStore: EditorStore;
242
+
243
+ constructor(
244
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState,
245
+ stepLabel: string,
246
+ databaseModelBuilderState: DatabaseModelBuilderState,
247
+ ) {
248
+ super(stepLabel);
249
+ makeObservable(this, {
250
+ queryConnectionEndToEndWorkflowState: false,
251
+ stepLabel: observable,
252
+ updateGraphWithModels: flow,
253
+ handleNext: flow,
254
+ });
255
+ this.queryConnectionEndToEndWorkflowState =
256
+ queryConnectionEndToEndWorkflowState;
257
+ this.databaseModelBuilderState = databaseModelBuilderState;
258
+ this.editorStore =
259
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState.editorStore;
260
+ }
261
+
262
+ *updateGraphWithModels(entities: Entity[]): GeneratorFn<void> {
263
+ try {
264
+ const newGraph = this.editorStore.graphManagerState.createNewGraph();
265
+ newGraph.addElement(
266
+ guaranteeNonNullable(
267
+ this.queryConnectionEndToEndWorkflowState.packageableConnection,
268
+ ),
269
+ this.queryConnectionEndToEndWorkflowState.packageableConnection?.package
270
+ ?.path,
271
+ );
272
+ const databaseBuilderStepperState =
273
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.get(
274
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_DATABASE,
275
+ ) as DatabaseBuilderStepperState;
276
+
277
+ newGraph.addElement(
278
+ databaseBuilderStepperState.databaseBuilderWizardState
279
+ .schemaExplorerState.database,
280
+ databaseBuilderStepperState.databaseBuilderWizardState
281
+ .schemaExplorerState.database.package?.path,
282
+ );
283
+ yield flowResult(
284
+ this.editorStore.graphManagerState.graphManager.buildGraph(
285
+ newGraph,
286
+ entities,
287
+ ActionState.create(),
288
+ ),
289
+ );
290
+ // create a runtime
291
+ if (this.queryConnectionEndToEndWorkflowState.packageableRuntime) {
292
+ runtime_setMappings(
293
+ this.queryConnectionEndToEndWorkflowState.packageableRuntime
294
+ .runtimeValue,
295
+ [
296
+ PackageableElementExplicitReference.create(
297
+ getNonNullableEntry(newGraph.mappings, 0),
298
+ ),
299
+ ],
300
+ );
301
+ } else {
302
+ const runtime = new PackageableRuntime(
303
+ extractElementNameFromPath(
304
+ this.queryConnectionEndToEndWorkflowState.targetRuntimePath,
305
+ ),
306
+ );
307
+ runtime.runtimeValue = new EngineRuntime();
308
+ runtime_addMapping(
309
+ runtime.runtimeValue,
310
+ PackageableElementExplicitReference.create(
311
+ getNonNullableEntry(newGraph.mappings, 0),
312
+ ),
313
+ );
314
+ runtime_addIdentifiedConnection(
315
+ runtime.runtimeValue,
316
+ new IdentifiedConnection(
317
+ generateIdentifiedConnectionId(runtime.runtimeValue),
318
+ guaranteeNonNullable(
319
+ this.queryConnectionEndToEndWorkflowState.packageableConnection,
320
+ ).connectionValue,
321
+ ),
322
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState
323
+ .editorStore.changeDetectionState.observerContext,
324
+ );
325
+ this.queryConnectionEndToEndWorkflowState.packageableRuntime = runtime;
326
+ }
327
+ newGraph.addElement(
328
+ this.queryConnectionEndToEndWorkflowState.packageableRuntime,
329
+ extractPackagePathFromPath(
330
+ this.queryConnectionEndToEndWorkflowState.targetRuntimePath,
331
+ ),
332
+ );
333
+ this.queryConnectionEndToEndWorkflowState.graph = newGraph;
334
+ this.queryConnectionEndToEndWorkflowState.setRuntimeGrammarCode(
335
+ (yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
336
+ [
337
+ this.editorStore.graphManagerState.graphManager.elementToEntity(
338
+ this.queryConnectionEndToEndWorkflowState.packageableRuntime,
339
+ ),
340
+ ],
341
+ { pretty: true },
342
+ )) as string,
343
+ );
344
+ const connectionGrammarCode =
345
+ (yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
346
+ [
347
+ this.editorStore.graphManagerState.graphManager.elementToEntity(
348
+ guaranteeNonNullable(
349
+ this.queryConnectionEndToEndWorkflowState.packageableConnection,
350
+ ),
351
+ ),
352
+ ],
353
+ { pretty: true },
354
+ )) as string;
355
+ this.queryConnectionEndToEndWorkflowState.connectionGrammarCode =
356
+ connectionGrammarCode;
357
+ } catch (error) {
358
+ assertErrorThrown(error);
359
+ this.editorStore.applicationStore.logService.error(
360
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_MODEL_BUILDER_FAILURE),
361
+ error,
362
+ );
363
+ this.editorStore.applicationStore.notificationService.notifyError(error);
364
+ }
365
+ }
366
+
367
+ override *handleNext(): GeneratorFn<void> {
368
+ this.queryConnectionEndToEndWorkflowState.setFinalGrammarCode(
369
+ this.databaseModelBuilderState.generatedGrammarCode
370
+ .concat(this.queryConnectionEndToEndWorkflowState.runtimeGrammarCode)
371
+ .concat(this.queryConnectionEndToEndWorkflowState.databaseGrammarCode)
372
+ .concat(
373
+ this.queryConnectionEndToEndWorkflowState.connectionGrammarCode,
374
+ ),
375
+ );
376
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.set(
377
+ QUERY_CONNECTION_WORKFLOW_STEPS.CONFIRMATION,
378
+ new QueryConnectionConfirmationAndGrammarEditorStepperState(
379
+ this.queryConnectionEndToEndWorkflowState,
380
+ QUERY_CONNECTION_WORKFLOW_STEPS.CONFIRMATION,
381
+ ),
382
+ );
383
+ }
384
+
385
+ override renderStepContent(): React.ReactNode {
386
+ return (
387
+ <QueryConnectionModelsEditor
388
+ databaseModelBuilderStepperState={this}
389
+ queryConnectionEndToEndWorkflowState={
390
+ this.queryConnectionEndToEndWorkflowState
391
+ }
392
+ />
393
+ );
394
+ }
395
+ }
396
+
397
+ // step 3 - database grammar editor
398
+ export class DatabaseGrammarEditorStepperState extends BaseStepperState {
399
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState;
400
+ isCompilingGrammarCode = ActionState.create();
401
+ editorStore: EditorStore;
402
+
403
+ constructor(
404
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState,
405
+ stepLabel: string,
406
+ ) {
407
+ super(stepLabel);
408
+ makeObservable(this, {
409
+ queryConnectionEndToEndWorkflowState: false,
410
+ stepLabel: observable,
411
+ isCompilingGrammarCode: observable,
412
+ buildDatabaseModelBuilderState: action,
413
+ compileDatabaseGrammarCode: flow,
414
+ handleNext: flow,
415
+ });
416
+ this.queryConnectionEndToEndWorkflowState =
417
+ queryConnectionEndToEndWorkflowState;
418
+ this.editorStore =
419
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState.editorStore;
420
+ }
421
+
422
+ *compileDatabaseGrammarCode(): GeneratorFn<void> {
423
+ try {
424
+ this.isCompilingGrammarCode.inProgress();
425
+ const databaseBuilderStepperState =
426
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.get(
427
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_DATABASE,
428
+ ) as DatabaseBuilderStepperState;
429
+ const connectionValueStepperState =
430
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.get(
431
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CONNECTION,
432
+ ) as ConnectionValueStepperState;
433
+ const compilationResult = (yield flowResult(
434
+ yield this.editorStore.graphManagerState.graphManager.compileText(
435
+ this.queryConnectionEndToEndWorkflowState.databaseGrammarCode,
436
+ this.queryConnectionEndToEndWorkflowState.graph,
437
+ ),
438
+ )) as TextCompilationResult;
439
+ this.editorStore.applicationStore.notificationService.notifySuccess(
440
+ 'Compiled successfully',
441
+ );
442
+ const entities = compilationResult.entities;
443
+ const newGraph = this.editorStore.graphManagerState.createNewGraph();
444
+ yield flowResult(
445
+ this.editorStore.graphManagerState.graphManager.buildGraph(
446
+ newGraph,
447
+ entities,
448
+ ActionState.create(),
449
+ ),
450
+ );
451
+ if (newGraph.databases.length > 1) {
452
+ this.queryConnectionEndToEndWorkflowState.isValid = false;
453
+ this.editorStore.applicationStore.notificationService.notifyError(
454
+ 'Please make sure there is only one databse',
455
+ );
456
+ } else {
457
+ this.queryConnectionEndToEndWorkflowState.isValid = true;
458
+ }
459
+ // databaseBuilderWizardState.schemaExplorerState.database needs to be updated
460
+ databaseBuilderStepperState.databaseBuilderWizardState.schemaExplorerState.database =
461
+ getNonNullableEntry(newGraph.databases, 0);
462
+ this.queryConnectionEndToEndWorkflowState.graph = newGraph;
463
+ // start building packageableConnection based on database and adding it to current graph
464
+ const packageableConnection = new PackageableConnection(
465
+ extractElementNameFromPath(
466
+ connectionValueStepperState.targetConnectionPath,
467
+ ),
468
+ );
469
+ connectionValueStepperState.connectionValueState.connection.store =
470
+ PackageableElementExplicitReference.create(
471
+ databaseBuilderStepperState.databaseBuilderWizardState
472
+ .schemaExplorerState.database,
473
+ );
474
+ packageableConnection.package = getOrCreatePackage(
475
+ this.queryConnectionEndToEndWorkflowState.graph.root,
476
+ connectionValueStepperState.targetConnectionPath,
477
+ true,
478
+ new Map(),
479
+ );
480
+ packageableConnection_setConnectionValue(
481
+ packageableConnection,
482
+ connectionValueStepperState.connectionValueState.connection,
483
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState
484
+ .editorStore.changeDetectionState.observerContext,
485
+ );
486
+ this.queryConnectionEndToEndWorkflowState.packageableConnection =
487
+ packageableConnection;
488
+ this.queryConnectionEndToEndWorkflowState.graph.addElement(
489
+ packageableConnection,
490
+ extractPackagePathFromPath(
491
+ connectionValueStepperState.targetConnectionPath,
492
+ ),
493
+ );
494
+ this.queryConnectionEndToEndWorkflowState.setCompileError(undefined);
495
+ this.isCompilingGrammarCode.pass();
496
+ } catch (error) {
497
+ if (error instanceof ParserError || error instanceof CompilationError) {
498
+ this.queryConnectionEndToEndWorkflowState.setCompileError(error);
499
+ }
500
+ this.queryConnectionEndToEndWorkflowState.isValid = false;
501
+ assertErrorThrown(error);
502
+ this.editorStore.applicationStore.logService.error(
503
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_MODEL_BUILDER_FAILURE),
504
+ error,
505
+ );
506
+ this.editorStore.applicationStore.notificationService.notifyError(error);
507
+ this.isCompilingGrammarCode.fail();
508
+ } finally {
509
+ this.isCompilingGrammarCode.complete();
510
+ }
511
+ }
512
+
513
+ buildDatabaseModelBuilderState(): void {
514
+ const databaseBuilderStepperState =
515
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.get(
516
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_DATABASE,
517
+ ) as DatabaseBuilderStepperState;
518
+ const databaseModelBuilderState = new DatabaseModelBuilderState(
519
+ this.editorStore,
520
+ databaseBuilderStepperState.databaseBuilderWizardState.schemaExplorerState.database,
521
+ false,
522
+ this.queryConnectionEndToEndWorkflowState.graph,
523
+ );
524
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.set(
525
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CLASS_MAPPING_RUNTIME,
526
+ new DatabaseModelBuilderStepperState(
527
+ this.queryConnectionEndToEndWorkflowState,
528
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CLASS_MAPPING_RUNTIME,
529
+ databaseModelBuilderState,
530
+ ),
531
+ );
532
+ }
533
+
534
+ override *handleNext(): GeneratorFn<void> {
535
+ yield flowResult(this.compileDatabaseGrammarCode()).then(() => {
536
+ this.buildDatabaseModelBuilderState();
537
+ });
538
+ }
539
+
540
+ override renderStepContent(): React.ReactNode {
541
+ return (
542
+ <QueryConnectionDatabaseGrammarEditor
543
+ queryConnectionEndToEndWorkflowState={
544
+ this.queryConnectionEndToEndWorkflowState
545
+ }
546
+ databaseGrammarEditorStepperState={this}
547
+ />
548
+ );
549
+ }
550
+ }
551
+
552
+ // step 2 - build database
553
+ export class DatabaseBuilderStepperState extends BaseStepperState {
554
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState;
555
+ databaseBuilderWizardState: DatabaseBuilderWizardState;
556
+ isGeneratingDatabaseGrammarCode = ActionState.create();
557
+ editorStore: EditorStore;
558
+
559
+ constructor(
560
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState,
561
+ stepLabel: string,
562
+ databaseBuilderWizardState: DatabaseBuilderWizardState,
563
+ ) {
564
+ super(stepLabel);
565
+ makeObservable(this, {
566
+ queryConnectionEndToEndWorkflowState: false,
567
+ stepLabel: observable,
568
+ databaseBuilderWizardState: observable,
569
+ isGeneratingDatabaseGrammarCode: observable,
570
+ handleNext: flow,
571
+ generateDatabaseGrammarCode: flow,
572
+ buildDatabase: flow,
573
+ });
574
+ this.queryConnectionEndToEndWorkflowState =
575
+ queryConnectionEndToEndWorkflowState;
576
+ this.databaseBuilderWizardState = databaseBuilderWizardState;
577
+ this.editorStore =
578
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState.editorStore;
579
+ }
580
+
581
+ *buildDatabase(): GeneratorFn<void> {
582
+ try {
583
+ if (!this.databaseBuilderWizardState.schemaExplorerState.treeData) {
584
+ return;
585
+ }
586
+ yield flowResult(
587
+ this.databaseBuilderWizardState.schemaExplorerState.updateDatabase(),
588
+ );
589
+ } catch (error) {
590
+ assertErrorThrown(error);
591
+ this.editorStore.applicationStore.logService.error(
592
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_BUILDER_FAILURE),
593
+ error,
594
+ );
595
+ this.editorStore.applicationStore.notificationService.notifyError(error);
596
+ this.isGeneratingDatabaseGrammarCode.fail();
597
+ }
598
+ }
599
+
600
+ *generateDatabaseGrammarCode(): GeneratorFn<void> {
601
+ try {
602
+ this.isGeneratingDatabaseGrammarCode.inProgress();
603
+ // can't use this.databaseBuilderState.databaseGrammarCode as databaseGrammarCode might not be up to date
604
+ this.queryConnectionEndToEndWorkflowState.setDatabaseGrammarCode(
605
+ JOIN_CODE_SYNTAX +
606
+ ((yield this.editorStore.graphManagerState.graphManager.entitiesToPureCode(
607
+ [
608
+ this.editorStore.graphManagerState.graphManager.elementToEntity(
609
+ this.databaseBuilderWizardState.schemaExplorerState.database,
610
+ ),
611
+ ],
612
+ { pretty: true },
613
+ )) as string),
614
+ );
615
+ this.isGeneratingDatabaseGrammarCode.pass();
616
+ } catch (error) {
617
+ assertErrorThrown(error);
618
+ this.editorStore.applicationStore.logService.error(
619
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DATABASE_MODEL_BUILDER_FAILURE),
620
+ error,
621
+ );
622
+ this.editorStore.applicationStore.notificationService.notifyError(error);
623
+ this.isGeneratingDatabaseGrammarCode.fail();
624
+ }
625
+ }
626
+
627
+ override *handleNext(): GeneratorFn<void> {
628
+ yield flowResult(this.buildDatabase());
629
+ yield flowResult(this.generateDatabaseGrammarCode());
630
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.set(
631
+ QUERY_CONNECTION_WORKFLOW_STEPS.EDIT_DATABASE,
632
+ new DatabaseGrammarEditorStepperState(
633
+ this.queryConnectionEndToEndWorkflowState,
634
+ QUERY_CONNECTION_WORKFLOW_STEPS.EDIT_DATABASE,
635
+ ),
636
+ );
637
+ }
638
+
639
+ override renderStepContent(): React.ReactNode {
640
+ return (
641
+ <QueryConnectionDatabaseBuilderEditor
642
+ databaseBuilderState={this.databaseBuilderWizardState}
643
+ />
644
+ );
645
+ }
646
+ }
647
+
648
+ // step 1 - build connection
649
+ export class ConnectionValueStepperState extends BaseStepperState {
650
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState;
651
+ targetConnectionPath = DEFAULT_CONNECTION_PATH;
652
+ connectionValueState: RelationalDatabaseConnectionValueState;
653
+
654
+ constructor(
655
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState,
656
+ stepLabel: string,
657
+ ) {
658
+ super(stepLabel);
659
+ makeObservable(this, {
660
+ queryConnectionEndToEndWorkflowState: false,
661
+ stepLabel: observable,
662
+ targetConnectionPath: observable,
663
+ connectionValueState: observable,
664
+ setTargetConnectionPath: action,
665
+ handleNext: flow,
666
+ });
667
+ this.queryConnectionEndToEndWorkflowState =
668
+ queryConnectionEndToEndWorkflowState;
669
+ this.connectionValueState = new RelationalDatabaseConnectionValueState(
670
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState.editorStore,
671
+ observe_RelationalDatabaseConnection(
672
+ this.createConnection,
673
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState
674
+ .editorStore.changeDetectionState.observerContext,
675
+ ),
676
+ );
677
+ }
678
+
679
+ get createConnection(): RelationalDatabaseConnection {
680
+ const spec = new LocalH2DatasourceSpecification();
681
+ spec.testDataSetupSqls = [DEFAULT_H2_SQL];
682
+ const connection = new RelationalDatabaseConnection(
683
+ PackageableElementExplicitReference.create(stub_Database()),
684
+ DatabaseType.H2,
685
+ spec,
686
+ new DefaultH2AuthenticationStrategy(),
687
+ );
688
+
689
+ return connection;
690
+ }
691
+
692
+ setTargetConnectionPath(val: string): void {
693
+ this.targetConnectionPath = val;
694
+ }
695
+
696
+ override *handleNext(): GeneratorFn<void> {
697
+ const databaseBuilderWizardState = new DatabaseBuilderWizardState(
698
+ this.queryConnectionEndToEndWorkflowState.globalEndToEndWorkflowState.editorStore,
699
+ this.connectionValueState.connection,
700
+ false,
701
+ );
702
+ databaseBuilderWizardState.schemaExplorerState.setMakeTargetDatabasePathEditable(
703
+ true,
704
+ );
705
+ this.queryConnectionEndToEndWorkflowState.activeStepToBaseStepperState.set(
706
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_DATABASE,
707
+ new DatabaseBuilderStepperState(
708
+ this.queryConnectionEndToEndWorkflowState,
709
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_DATABASE,
710
+ databaseBuilderWizardState,
711
+ ),
712
+ );
713
+ }
714
+
715
+ override renderStepContent(): React.ReactNode {
716
+ return (
717
+ <QueryConnectionRelationalConnectionEditor
718
+ queryConnectionEndToEndWorkflowState={
719
+ this.queryConnectionEndToEndWorkflowState
720
+ }
721
+ connectionValueStepperState={this}
722
+ />
723
+ );
724
+ }
725
+ }
726
+
727
+ export class QueryConnectionEndToEndWorkflowState {
728
+ activeStep: number;
729
+ activeStepToBaseStepperState = new Map<string, BaseStepperState>();
730
+ activeStepToStepLabel = new Map<number, string>();
731
+ globalEndToEndWorkflowState: GlobalEndToEndWorkflowState;
732
+ queryConnectionEndToEndWorkflowEditorState: QueryConnectionEndToEndWorkflowEditorState;
733
+ targetRuntimePath = DEFAULT_RUNTIME_PATH;
734
+ packageableConnection: PackageableConnection | undefined;
735
+ packageableRuntime: PackageableRuntime | undefined;
736
+ databaseGrammarCode = '';
737
+ runtimeGrammarCode = '';
738
+ connectionGrammarCode = '';
739
+ finalGrammarCode = '';
740
+ graph: PureModel;
741
+ isValid: boolean;
742
+ compileError: ParserError | CompilationError | undefined;
743
+
744
+ constructor(globalEndToEndWorkflowState: GlobalEndToEndWorkflowState) {
745
+ makeObservable(this, {
746
+ globalEndToEndWorkflowState: false,
747
+ activeStep: observable,
748
+ activeStepToBaseStepperState: observable,
749
+ compileError: observable,
750
+ packageableRuntime: observable,
751
+ runtimeGrammarCode: observable,
752
+ connectionGrammarCode: observable,
753
+ finalGrammarCode: observable,
754
+ targetRuntimePath: observable,
755
+ isValid: observable,
756
+ queryConnectionEndToEndWorkflowEditorState: observable,
757
+ packageableConnection: observable,
758
+ setActiveStep: action,
759
+ setDatabaseGrammarCode: action,
760
+ setRuntimeGrammarCode: action,
761
+ setTargetRuntimePath: action,
762
+ setFinalGrammarCode: action,
763
+ setCompileError: action,
764
+ reset: action,
765
+ updateRuntime: flow,
766
+ });
767
+ this.activeStep = 0;
768
+ this.isValid = true;
769
+ this.globalEndToEndWorkflowState = globalEndToEndWorkflowState;
770
+ this.activeStepToBaseStepperState.set(
771
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CONNECTION,
772
+ new ConnectionValueStepperState(
773
+ this,
774
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CONNECTION,
775
+ ),
776
+ );
777
+ this.queryConnectionEndToEndWorkflowEditorState =
778
+ new QueryConnectionEndToEndWorkflowEditorState(
779
+ this.globalEndToEndWorkflowState.editorStore,
780
+ );
781
+ this.graph =
782
+ this.globalEndToEndWorkflowState.editorStore.graphManagerState.createNewGraph();
783
+ this.initactiveStepToStepLabel();
784
+ }
785
+
786
+ initactiveStepToStepLabel(): void {
787
+ Object.values(QUERY_CONNECTION_WORKFLOW_STEPS).forEach((val, index) =>
788
+ this.activeStepToStepLabel.set(index, val),
789
+ );
790
+ }
791
+
792
+ setActiveStep(step: number): void {
793
+ this.activeStep = step;
794
+ }
795
+
796
+ setTargetRuntimePath(val: string): void {
797
+ this.targetRuntimePath = val;
798
+ }
799
+
800
+ setRuntimeGrammarCode(val: string): void {
801
+ this.runtimeGrammarCode = val;
802
+ }
803
+
804
+ setDatabaseGrammarCode(code: string): void {
805
+ this.databaseGrammarCode = code;
806
+ }
807
+
808
+ setFinalGrammarCode(val: string): void {
809
+ this.finalGrammarCode = val;
810
+ }
811
+
812
+ setCompileError(err: ParserError | CompilationError | undefined): void {
813
+ this.compileError = err;
814
+ }
815
+
816
+ *updateRuntime(newPath: string): GeneratorFn<void> {
817
+ if (this.packageableRuntime) {
818
+ this.packageableRuntime.package = getOrCreatePackage(
819
+ this.graph.root,
820
+ extractPackagePathFromPath(newPath) ?? newPath,
821
+ true,
822
+ new Map(),
823
+ );
824
+ if (newPath.includes('::')) {
825
+ this.packageableRuntime.name = extractElementNameFromPath(newPath);
826
+ } else {
827
+ this.packageableRuntime.name = newPath;
828
+ }
829
+ this.packageableRuntime.name = extractElementNameFromPath(newPath);
830
+ this.setRuntimeGrammarCode(
831
+ (yield this.globalEndToEndWorkflowState.editorStore.graphManagerState.graphManager.entitiesToPureCode(
832
+ [
833
+ this.globalEndToEndWorkflowState.editorStore.graphManagerState.graphManager.elementToEntity(
834
+ this.packageableRuntime,
835
+ ),
836
+ ],
837
+ { pretty: true },
838
+ )) as string,
839
+ );
840
+ }
841
+ }
842
+
843
+ reset(): void {
844
+ this.activeStep = -1;
845
+ this.graph =
846
+ this.globalEndToEndWorkflowState.editorStore.graphManagerState.createNewGraph();
847
+ this.packageableConnection = undefined;
848
+ this.packageableRuntime = undefined;
849
+ this.activeStepToBaseStepperState.set(
850
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CONNECTION,
851
+ new ConnectionValueStepperState(
852
+ this,
853
+ QUERY_CONNECTION_WORKFLOW_STEPS.CREATE_CONNECTION,
854
+ ),
855
+ );
856
+ }
857
+ }
858
+
859
+ export class GlobalEndToEndWorkflowState {
860
+ editorStore: EditorStore;
861
+ queryConnectionEndToEndWorkflowState: QueryConnectionEndToEndWorkflowState;
862
+ queryConnectionEndToEndWorkflowEditorState: QueryConnectionEndToEndWorkflowEditorState;
863
+
864
+ constructor(editorStore: EditorStore) {
865
+ makeObservable(this, {
866
+ editorStore: false,
867
+ queryConnectionEndToEndWorkflowState: observable,
868
+ queryConnectionEndToEndWorkflowEditorState: observable,
869
+ });
870
+ this.editorStore = editorStore;
871
+ this.queryConnectionEndToEndWorkflowState =
872
+ new QueryConnectionEndToEndWorkflowState(this);
873
+ this.queryConnectionEndToEndWorkflowEditorState =
874
+ new QueryConnectionEndToEndWorkflowEditorState(this.editorStore);
875
+ }
876
+
877
+ visitWorkflow(workflow: string): void {
878
+ if (workflow === SupportedEndToEndWorkflow.CREATE_QUERY_FROM_CONNECTION) {
879
+ this.editorStore.tabManagerState.openTab(
880
+ this.queryConnectionEndToEndWorkflowEditorState,
881
+ );
882
+ }
883
+ }
884
+ }