@finos/legend-application-studio 13.1.1 → 13.1.2

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 (54) hide show
  1. package/lib/components/LegendStudioApplication.js +1 -1
  2. package/lib/components/LegendStudioApplication.js.map +1 -1
  3. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
  4. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js +10 -2
  5. package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  6. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  7. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js +6 -4
  8. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  9. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
  10. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +2 -4
  11. package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
  12. package/lib/index.css +2 -2
  13. package/lib/index.css.map +1 -1
  14. package/lib/package.json +1 -1
  15. package/lib/stores/LegendStudioBaseStore.d.ts +8 -3
  16. package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
  17. package/lib/stores/LegendStudioBaseStore.js +105 -9
  18. package/lib/stores/LegendStudioBaseStore.js.map +1 -1
  19. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  20. package/lib/stores/editor/NewElementState.js +4 -3
  21. package/lib/stores/editor/NewElementState.js.map +1 -1
  22. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts +2 -1
  23. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts.map +1 -1
  24. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js +9 -1
  25. package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js.map +1 -1
  26. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
  27. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
  28. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  29. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  30. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +2 -2
  31. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  32. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  33. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -3
  34. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  35. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts +2 -1
  36. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts.map +1 -1
  37. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js +3 -0
  38. package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js.map +1 -1
  39. package/lib/stores/shared/testable/TestableUtils.d.ts.map +1 -1
  40. package/lib/stores/shared/testable/TestableUtils.js +2 -3
  41. package/lib/stores/shared/testable/TestableUtils.js.map +1 -1
  42. package/package.json +4 -4
  43. package/src/components/LegendStudioApplication.tsx +2 -2
  44. package/src/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.tsx +36 -0
  45. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.tsx +63 -36
  46. package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +1 -7
  47. package/src/stores/LegendStudioBaseStore.ts +147 -20
  48. package/src/stores/editor/NewElementState.ts +4 -3
  49. package/src/stores/editor-state/element-editor-state/connection/ConnectionEditorState.ts +10 -0
  50. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -0
  51. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +2 -1
  52. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +12 -3
  53. package/src/stores/graphModifier/StoreRelational_GraphModifierHelper.ts +10 -0
  54. package/src/stores/shared/testable/TestableUtils.ts +4 -3
@@ -45,6 +45,7 @@ import {
45
45
  ApiTokenAuthenticationStrategy,
46
46
  UsernamePasswordAuthenticationStrategy,
47
47
  GCPWorkloadIdentityFederationAuthenticationStrategy,
48
+ MiddleTierUsernamePasswordAuthenticationStrategy,
48
49
  EmbeddedH2DatasourceSpecification,
49
50
  LocalH2DatasourceSpecification,
50
51
  SnowflakeDatasourceSpecification,
@@ -114,6 +115,7 @@ import {
114
115
  usernamePasswordAuthenticationStrategy_setUserNameVaultReference,
115
116
  gcpWorkloadIdentityFederationAuthenticationStrategy_setServiceAccountEmail,
116
117
  gcpWorkloadIdentityFederationAuthenticationStrategy_setAdditionalGcpScopes,
118
+ middleTierUsernamePasswordAuthenticationStrategy_setVaultReference,
117
119
  } from '../../../../stores/graphModifier/StoreRelational_GraphModifierHelper.js';
118
120
 
119
121
  /**
@@ -1014,6 +1016,31 @@ const UsernamePasswordAuthenticationStrategyEditor = observer(
1014
1016
  );
1015
1017
  },
1016
1018
  );
1019
+ // Middle Tier Username Password Authentication Strategy obtains credentials(username and password) from the provided vault reference
1020
+ const MiddleTierUsernamePasswordAuthenticationStrategyEditor = observer(
1021
+ (props: {
1022
+ authSpec: MiddleTierUsernamePasswordAuthenticationStrategy;
1023
+ isReadOnly: boolean;
1024
+ }) => {
1025
+ const { authSpec, isReadOnly } = props;
1026
+ return (
1027
+ <>
1028
+ <ConnectionEditor_StringEditor
1029
+ isReadOnly={isReadOnly}
1030
+ value={authSpec.vaultReference}
1031
+ propertyName={'vault reference'}
1032
+ description="Specifies the cred vault reference containing connection credentials"
1033
+ update={(value: string | undefined): void =>
1034
+ middleTierUsernamePasswordAuthenticationStrategy_setVaultReference(
1035
+ authSpec,
1036
+ value ?? '',
1037
+ )
1038
+ }
1039
+ />
1040
+ </>
1041
+ );
1042
+ },
1043
+ );
1017
1044
 
1018
1045
  const GCPWorkloadIdentityFederationAuthenticationStrategyEditor = observer(
1019
1046
  (props: {
@@ -1238,6 +1265,15 @@ const renderAuthenticationStrategyEditor = (
1238
1265
  isReadOnly={isReadOnly}
1239
1266
  />
1240
1267
  );
1268
+ } else if (
1269
+ authSpec instanceof MiddleTierUsernamePasswordAuthenticationStrategy
1270
+ ) {
1271
+ return (
1272
+ <MiddleTierUsernamePasswordAuthenticationStrategyEditor
1273
+ authSpec={authSpec}
1274
+ isReadOnly={isReadOnly}
1275
+ />
1276
+ );
1241
1277
  } else if (
1242
1278
  authSpec instanceof GCPWorkloadIdentityFederationAuthenticationStrategy
1243
1279
  ) {
@@ -212,12 +212,14 @@ export const NewConnectionDataModal = observer(
212
212
  const dataElementOptions = testDataState.editorStore.dataOptions;
213
213
  const newConnectionState = testDataState.newConnectionDataState;
214
214
  const dataElement = newConnectionState.dataElement;
215
- const selectedOption = dataElement ? buildElementOption(dataElement) : null;
215
+ const selectedDataElement = dataElement
216
+ ? buildElementOption(dataElement)
217
+ : null;
216
218
  const onDataElementChange = (val: {
217
219
  label: string;
218
220
  value?: DataElement;
219
221
  }): void => {
220
- if (val.value !== selectedOption?.value && val.value) {
222
+ if (val.value !== selectedDataElement?.value && val.value) {
221
223
  newConnectionState.setDataElement(val.value);
222
224
  }
223
225
  };
@@ -265,7 +267,7 @@ export const NewConnectionDataModal = observer(
265
267
  // external format
266
268
  const selectedEmbeddedType = newConnectionState.embeddedDataType
267
269
  ? {
268
- label: prettyCONSTName(newConnectionState.embeddedDataType.label),
270
+ label: prettyCONSTName(newConnectionState.embeddedDataType.value),
269
271
  value: newConnectionState.embeddedDataType.value,
270
272
  }
271
273
  : undefined;
@@ -301,42 +303,67 @@ export const NewConnectionDataModal = observer(
301
303
  >
302
304
  <form
303
305
  onSubmit={handleSubmit}
304
- className="modal modal--dark search-modal"
306
+ className="modal service-test-data-modal modal--dark"
305
307
  >
306
- <div className="modal__title">Create a connection test data</div>
307
- <div className="explorer__new-element-modal__driver">
308
- <CustomSelectorInput
309
- className="explorer__new-element-modal__driver__dropdown"
310
- options={connectionOptions}
311
- onChange={onConnectionSelectionChange}
312
- value={selectedConnection}
313
- isClearable={false}
314
- darkMode={true}
315
- />
308
+ <div className="modal__header">
309
+ <div className="modal__title">Create a connection test data</div>
316
310
  </div>
317
- <div className="explorer__new-element-modal__driver">
318
- <CustomSelectorInput
319
- className="explorer__new-element-modal__driver__dropdown"
320
- options={embeddedOptions}
321
- onChange={onEmbeddedTypeChange}
322
- value={selectedEmbeddedType}
323
- isClearable={false}
324
- darkMode={true}
325
- />
326
- </div>
327
- {selectedEmbeddedType?.value === EmbeddedDataType.DATA_ELEMENT && (
328
- <div className="explorer__new-element-modal__driver">
329
- <CustomSelectorInput
330
- className="panel__content__form__section__dropdown data-element-reference-editor__value__dropdown"
331
- disabled={isReadOnly}
332
- options={dataElementOptions}
333
- onChange={onDataElementChange}
334
- value={selectedOption}
335
- darkMode={true}
336
- />
311
+ <div className="modal__body">
312
+ <div className="panel__content__form__section">
313
+ <div className="panel__content__form__section__header__label">
314
+ Connection ID
315
+ </div>
316
+ <div className="panel__content__form__section__header__prompt">
317
+ Connection in runtime to povide test data for
318
+ </div>
319
+ <div className="explorer__new-element-modal__driver">
320
+ <CustomSelectorInput
321
+ className="explorer__new-element-modal__driver__dropdown"
322
+ options={connectionOptions}
323
+ onChange={onConnectionSelectionChange}
324
+ value={selectedConnection}
325
+ isClearable={false}
326
+ darkMode={true}
327
+ />
328
+ </div>
337
329
  </div>
338
- )}
339
- <div className="search-modal__actions">
330
+ <div className="panel__content__form__section">
331
+ <div className="panel__content__form__section__header__label">
332
+ Data Type
333
+ </div>
334
+ <div className="panel__content__form__section__header__prompt">
335
+ Test data type that will be loaded to your test connection
336
+ </div>
337
+ <div className="explorer__new-element-modal__driver">
338
+ <CustomSelectorInput
339
+ className="explorer__new-element-modal__driver__dropdown"
340
+ options={embeddedOptions}
341
+ onChange={onEmbeddedTypeChange}
342
+ value={selectedEmbeddedType}
343
+ isClearable={false}
344
+ darkMode={true}
345
+ />
346
+ </div>
347
+ </div>
348
+ {selectedEmbeddedType?.value === EmbeddedDataType.DATA_ELEMENT && (
349
+ <div className="panel__content__form__section">
350
+ <div className="panel__content__form__section__header__label">
351
+ Data Element
352
+ </div>
353
+ <div className="explorer__new-element-modal__driver">
354
+ <CustomSelectorInput
355
+ className="panel__content__form__section__dropdown data-element-reference-editor__value__dropdown"
356
+ disabled={isReadOnly}
357
+ options={dataElementOptions}
358
+ onChange={onDataElementChange}
359
+ value={selectedDataElement}
360
+ darkMode={true}
361
+ />
362
+ </div>
363
+ </div>
364
+ )}
365
+ </div>
366
+ <div className="modal__footer">
340
367
  <button
341
368
  type="button"
342
369
  className="btn btn--dark"
@@ -74,7 +74,6 @@ import {
74
74
  stub_Stereotype,
75
75
  getFirstAssociatedProperty,
76
76
  getSecondAssociatedProperty,
77
- getOtherAssociatedProperty,
78
77
  } from '@finos/legend-graph';
79
78
  import {
80
79
  property_setName,
@@ -120,12 +119,7 @@ const AssociationPropertyBasicEditor = observer(
120
119
  // Generic Type
121
120
  const [isEditingType, setIsEditingType] = useState(false);
122
121
  // TODO: make this so that association can only refer to classes from the same graph space
123
- const propertyTypeOptions = editorStore.classOptions.filter(
124
- (classOption) =>
125
- classOption.value !==
126
- getOtherAssociatedProperty(association, property).genericType.value
127
- .rawType,
128
- );
122
+ const propertyTypeOptions = editorStore.classOptions;
129
123
  const propertyType = property.genericType.value.rawType;
130
124
  const propertyTypeName = getClassPropertyType(propertyType);
131
125
  const filterOption = createFilter({
@@ -14,14 +14,31 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { type GeneratorFn, ActionState } from '@finos/legend-shared';
17
+ import {
18
+ type GeneratorFn,
19
+ type PlainObject,
20
+ HttpStatus,
21
+ NetworkClientError,
22
+ ActionState,
23
+ LogEvent,
24
+ assertErrorThrown,
25
+ } from '@finos/legend-shared';
18
26
  import {
19
27
  type ApplicationStore,
28
+ ActionAlertActionType,
29
+ ActionAlertType,
20
30
  ApplicationTelemetry,
21
- LegendApplicationSDLCSetupState,
22
31
  } from '@finos/legend-application';
23
- import { flow, flowResult, makeObservable } from 'mobx';
24
- import type { SDLCServerClient } from '@finos/legend-server-sdlc';
32
+ import {
33
+ action,
34
+ computed,
35
+ flow,
36
+ flowResult,
37
+ makeObservable,
38
+ observable,
39
+ } from 'mobx';
40
+ import { User, SDLCServerClient } from '@finos/legend-server-sdlc';
41
+ import { LEGEND_STUDIO_APP_EVENT } from './LegendStudioAppEvent.js';
25
42
  import type { DepotServerClient } from '@finos/legend-server-depot';
26
43
  import type { LegendStudioPluginManager } from '../application/LegendStudioPluginManager.js';
27
44
  import type { LegendStudioApplicationConfig } from '../application/LegendStudioApplicationConfig.js';
@@ -37,11 +54,14 @@ export type LegendStudioApplicationStore = ApplicationStore<
37
54
 
38
55
  export class LegendStudioBaseStore {
39
56
  applicationStore: LegendStudioApplicationStore;
57
+ sdlcServerClient: SDLCServerClient;
40
58
  depotServerClient: DepotServerClient;
41
59
  pluginManager: LegendStudioPluginManager;
42
60
 
43
61
  initState = ActionState.create();
44
- applicationSDLCSetupState: LegendApplicationSDLCSetupState;
62
+
63
+ isSDLCAuthorized = false;
64
+ SDLCServerTermsOfServicesUrlsToView: string[] = [];
45
65
 
46
66
  constructor(
47
67
  applicationStore: LegendStudioApplicationStore,
@@ -49,23 +69,23 @@ export class LegendStudioBaseStore {
49
69
  depotServerClient: DepotServerClient,
50
70
  pluginManager: LegendStudioPluginManager,
51
71
  ) {
52
- makeObservable(this, {
72
+ makeObservable<LegendStudioBaseStore, 'initializeSDLCServerClient'>(this, {
73
+ isSDLCAuthorized: observable,
74
+ SDLCServerTermsOfServicesUrlsToView: observable,
75
+ needsToAcceptSDLCServerTermsOfServices: computed,
53
76
  initialize: flow,
77
+ initializeSDLCServerClient: flow,
78
+ dismissSDLCServerTermsOfServicesAlert: action,
54
79
  });
55
80
 
56
81
  this.applicationStore = applicationStore;
57
- this.applicationSDLCSetupState = new LegendApplicationSDLCSetupState(
58
- applicationStore,
59
- sdlcServerClient,
60
- );
82
+ this.sdlcServerClient = sdlcServerClient;
61
83
  this.depotServerClient = depotServerClient;
62
84
 
63
85
  this.pluginManager = pluginManager;
64
86
 
65
87
  // Register plugins
66
- this.applicationSDLCSetupState.sdlcServerClient.setTracerService(
67
- this.applicationStore.tracerService,
68
- );
88
+ this.sdlcServerClient.setTracerService(this.applicationStore.tracerService);
69
89
  this.depotServerClient.setTracerService(
70
90
  this.applicationStore.tracerService,
71
91
  );
@@ -81,15 +101,26 @@ export class LegendStudioBaseStore {
81
101
  this.initState.inProgress();
82
102
 
83
103
  // setup SDLC server client
84
- yield flowResult(
85
- this.applicationSDLCSetupState.initializeSDLCServerClient(),
86
- );
104
+ yield flowResult(this.initializeSDLCServerClient());
105
+
106
+ let currentUserID = UNKNOWN_USER_ID;
107
+ try {
108
+ const currentUser = User.serialization.fromJson(
109
+ (yield this.sdlcServerClient.getCurrentUser()) as PlainObject<User>,
110
+ );
111
+ this.sdlcServerClient.setCurrentUser(currentUser);
112
+ currentUserID = currentUser.userId;
113
+ } catch (error) {
114
+ assertErrorThrown(error);
115
+ this.applicationStore.log.error(
116
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
117
+ error,
118
+ );
119
+ this.applicationStore.notifyWarning(error.message);
120
+ }
87
121
 
88
122
  // setup telemetry service
89
- this.applicationStore.telemetryService.setUserId(
90
- this.applicationSDLCSetupState.sdlcServerClient.currentUser?.userId ??
91
- UNKNOWN_USER_ID,
92
- );
123
+ this.applicationStore.telemetryService.setUserId(currentUserID);
93
124
 
94
125
  ApplicationTelemetry.logEvent_ApplicationInitialized(
95
126
  this.applicationStore.telemetryService,
@@ -109,4 +140,100 @@ export class LegendStudioBaseStore {
109
140
 
110
141
  this.initState.complete();
111
142
  }
143
+
144
+ private *initializeSDLCServerClient(): GeneratorFn<void> {
145
+ try {
146
+ this.isSDLCAuthorized =
147
+ (yield this.sdlcServerClient.isAuthorized()) as boolean;
148
+ if (!this.isSDLCAuthorized) {
149
+ this.applicationStore.navigator.jumpTo(
150
+ SDLCServerClient.authorizeCallbackUrl(
151
+ this.applicationStore.config.sdlcServerUrl,
152
+ this.applicationStore.navigator.getCurrentLocation(),
153
+ ),
154
+ );
155
+ } else {
156
+ // Only proceed intialization after passing authorization check
157
+
158
+ // check terms of service agreement status
159
+ this.SDLCServerTermsOfServicesUrlsToView =
160
+ (yield this.sdlcServerClient.hasAcceptedTermsOfService()) as string[];
161
+ if (this.SDLCServerTermsOfServicesUrlsToView.length) {
162
+ this.applicationStore.setActionAlertInfo({
163
+ message: `Please read and accept the SDLC servers' terms of service`,
164
+ prompt: `Click 'Done' when you have accepted all the terms`,
165
+ type: ActionAlertType.CAUTION,
166
+ actions: [
167
+ {
168
+ label: 'See terms of services',
169
+ default: true,
170
+ handler: (): void =>
171
+ this.SDLCServerTermsOfServicesUrlsToView.forEach((url) =>
172
+ this.applicationStore.navigator.openNewWindow(url),
173
+ ),
174
+ type: ActionAlertActionType.PROCEED,
175
+ },
176
+ {
177
+ label: 'Done',
178
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
179
+ handler: (): void => {
180
+ this.dismissSDLCServerTermsOfServicesAlert();
181
+ this.applicationStore.navigator.reload();
182
+ },
183
+ },
184
+ ],
185
+ });
186
+ }
187
+
188
+ // fetch server features config
189
+ yield this.sdlcServerClient.fetchServerFeaturesConfiguration();
190
+ }
191
+ } catch (error) {
192
+ assertErrorThrown(error);
193
+ if (
194
+ // eslint-disable-next-line no-process-env
195
+ process.env.NODE_ENV === 'development' &&
196
+ error instanceof NetworkClientError &&
197
+ error.response.status === HttpStatus.UNAUTHORIZED
198
+ ) {
199
+ this.applicationStore.setActionAlertInfo({
200
+ message:
201
+ 'The first time the application starts in development mode, the developer would need to authenticate using SDLC server. Please do so then manually reload the app',
202
+ type: ActionAlertType.STANDARD,
203
+ actions: [
204
+ {
205
+ label: 'Authenticate using SDLC',
206
+ type: ActionAlertActionType.PROCEED,
207
+ default: true,
208
+ handler: (): void => {
209
+ this.applicationStore.navigator.openNewWindow(
210
+ this.sdlcServerClient.currentUserUrl,
211
+ );
212
+ this.applicationStore.setBlockingAlert({
213
+ message:
214
+ 'Waiting for the developer to authenticate using SDLC server',
215
+ prompt:
216
+ 'Please manually reload the application after authentication',
217
+ });
218
+ },
219
+ },
220
+ ],
221
+ });
222
+ } else {
223
+ this.applicationStore.log.error(
224
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
225
+ error,
226
+ );
227
+ this.applicationStore.notifyError(error);
228
+ }
229
+ }
230
+ }
231
+
232
+ get needsToAcceptSDLCServerTermsOfServices(): boolean {
233
+ return Boolean(this.SDLCServerTermsOfServicesUrlsToView.length);
234
+ }
235
+
236
+ dismissSDLCServerTermsOfServicesAlert(): void {
237
+ this.SDLCServerTermsOfServicesUrlsToView = [];
238
+ }
112
239
  }
@@ -190,7 +190,7 @@ export class NewPackageableRuntimeDriver extends NewElementDriver<PackageableRun
190
190
  isValid: computed,
191
191
  });
192
192
 
193
- const mappings = this.editorStore.graphManagerState.graph.ownMappings;
193
+ const mappings = this.editorStore.graphManagerState.graph.mappings;
194
194
  if (mappings.length) {
195
195
  this.mapping = mappings[0];
196
196
  }
@@ -240,7 +240,7 @@ export class NewPureModelConnectionDriver extends NewConnectionValueDriver<PureM
240
240
  isValid: computed,
241
241
  });
242
242
 
243
- const classes = this.editorStore.graphManagerState.graph.ownClasses;
243
+ const classes = this.editorStore.graphManagerState.graph.classes;
244
244
  if (classes.length) {
245
245
  this.class = classes[0];
246
246
  }
@@ -302,7 +302,7 @@ export class NewRelationalDatabaseConnectionDriver extends NewConnectionValueDri
302
302
  if (store instanceof Database) {
303
303
  selectedStore = store;
304
304
  } else {
305
- const dbs = this.editorStore.graphManagerState.graph.ownDatabases;
305
+ const dbs = this.editorStore.graphManagerState.graph.databases;
306
306
  selectedStore = dbs.length ? (dbs[0] as Database) : stub_Database();
307
307
  }
308
308
  return new RelationalDatabaseConnection(
@@ -533,6 +533,7 @@ export class NewGenerationSpecificationDriver extends NewElementDriver<Generatio
533
533
  }
534
534
 
535
535
  get isValid(): boolean {
536
+ // only one generation specification should exist
536
537
  return !this.editorStore.graphManagerState.graph.ownGenerationSpecifications
537
538
  .length;
538
539
  }
@@ -42,6 +42,7 @@ import {
42
42
  SnowflakePublicAuthenticationStrategy,
43
43
  GCPApplicationDefaultCredentialsAuthenticationStrategy,
44
44
  GCPWorkloadIdentityFederationAuthenticationStrategy,
45
+ MiddleTierUsernamePasswordAuthenticationStrategy,
45
46
  EmbeddedH2DatasourceSpecification,
46
47
  LocalH2DatasourceSpecification,
47
48
  DatabricksDatasourceSpecification,
@@ -94,6 +95,7 @@ export enum CORE_AUTHENTICATION_STRATEGY_TYPE {
94
95
  OAUTH = 'OAUTH',
95
96
  USERNAME_PASSWORD = 'USERNAME_PASSWORD',
96
97
  GCP_WORKLOAD_IDENTITY_FEDERATION = 'GCP_WORKLOAD_IDENTITY_FEDERATION',
98
+ MIDDLE_TIER_USERNAME_PASSWORD = 'MIDDLE_TIER_USERNAME_PASSWORD',
97
99
  }
98
100
 
99
101
  export class RelationalDatabaseConnectionValueState extends ConnectionValueState {
@@ -262,6 +264,10 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
262
264
  auth instanceof GCPWorkloadIdentityFederationAuthenticationStrategy
263
265
  ) {
264
266
  return CORE_AUTHENTICATION_STRATEGY_TYPE.GCP_WORKLOAD_IDENTITY_FEDERATION;
267
+ } else if (
268
+ auth instanceof MiddleTierUsernamePasswordAuthenticationStrategy
269
+ ) {
270
+ return CORE_AUTHENTICATION_STRATEGY_TYPE.MIDDLE_TIER_USERNAME_PASSWORD;
265
271
  }
266
272
 
267
273
  const extraAuthenticationStrategyTypeGetters =
@@ -326,6 +332,10 @@ export class RelationalDatabaseConnectionValueState extends ConnectionValueState
326
332
  authStrategy = new OAuthAuthenticationStrategy('', '');
327
333
  break;
328
334
  }
335
+ case CORE_AUTHENTICATION_STRATEGY_TYPE.MIDDLE_TIER_USERNAME_PASSWORD: {
336
+ authStrategy = new MiddleTierUsernamePasswordAuthenticationStrategy('');
337
+ break;
338
+ }
329
339
  default: {
330
340
  const extraAuthenticationStrategyCreators =
331
341
  this.editorStore.pluginManager
@@ -125,6 +125,7 @@ export class ServiceExecutionParameterState extends LambdaParametersState {
125
125
  const parmeterState = new LambdaParameterState(
126
126
  p,
127
127
  this.executionState.editorStore.changeDetectionState.observerContext,
128
+ this.executionState.editorStore.graphManagerState.graph,
128
129
  );
129
130
  parmeterState.mockParameterValue();
130
131
  return parmeterState;
@@ -44,6 +44,7 @@ import {
44
44
  isNonNullable,
45
45
  returnUndefOnError,
46
46
  getNullableFirstElement,
47
+ uniq,
47
48
  } from '@finos/legend-shared';
48
49
  import { action, flow, makeObservable, observable } from 'mobx';
49
50
  import type { EditorStore } from '../../../../EditorStore.js';
@@ -360,6 +361,6 @@ export class ServiceTestDataState {
360
361
  } else if (execution instanceof PureMultiExecution) {
361
362
  runtimes = execution.executionParameters.map((t) => t.runtime);
362
363
  }
363
- return runtimes.flatMap(getAllIdentifiedConnectionsFromRuntime);
364
+ return uniq(runtimes.flatMap(getAllIdentifiedConnectionsFromRuntime));
364
365
  }
365
366
  }
@@ -136,7 +136,10 @@ export class ServiceValueSpecificationTestParameterState extends ServiceTestPara
136
136
  }
137
137
 
138
138
  resetValueSpec(): void {
139
- const mockValue = generateVariableExpressionMockValue(this.varExpression);
139
+ const mockValue = generateVariableExpressionMockValue(
140
+ this.varExpression,
141
+ this.editorStore.graphManagerState.graph,
142
+ );
140
143
  if (mockValue) {
141
144
  this.updateValueSpecification(mockValue);
142
145
  }
@@ -258,7 +261,10 @@ export class ServiceTestSetupState {
258
261
  addExpressionParameterValue(expression: VariableExpression): void {
259
262
  try {
260
263
  const mockValue = guaranteeNonNullable(
261
- generateVariableExpressionMockValue(expression),
264
+ generateVariableExpressionMockValue(
265
+ expression,
266
+ this.editorStore.graphManagerState.graph,
267
+ ),
262
268
  );
263
269
  const paramValue = new ParameterValue();
264
270
  paramValue.name = expression.name;
@@ -338,7 +344,10 @@ export class ServiceTestSetupState {
338
344
  const varExpressions = this.queryVariableExpressions;
339
345
  const parameterValueStates = varExpressions
340
346
  .map((varExpression) => {
341
- const mockValue = generateVariableExpressionMockValue(varExpression);
347
+ const mockValue = generateVariableExpressionMockValue(
348
+ varExpression,
349
+ this.editorStore.graphManagerState.graph,
350
+ );
342
351
  if (mockValue) {
343
352
  const paramValue = new ParameterValue();
344
353
  paramValue.name = varExpression.name;
@@ -38,6 +38,7 @@ import {
38
38
  type StaticDatasourceSpecification,
39
39
  type UsernamePasswordAuthenticationStrategy,
40
40
  type GCPWorkloadIdentityFederationAuthenticationStrategy,
41
+ type MiddleTierUsernamePasswordAuthenticationStrategy,
41
42
  type ObserverContext,
42
43
  type EnumerationMappingReference,
43
44
  type TableAlias,
@@ -163,6 +164,15 @@ export const gcpWorkloadIdentityFederationAuthenticationStrategy_setAdditionalGc
163
164
  },
164
165
  );
165
166
 
167
+ export const middleTierUsernamePasswordAuthenticationStrategy_setVaultReference =
168
+ action(
169
+ (
170
+ v: MiddleTierUsernamePasswordAuthenticationStrategy,
171
+ val: string,
172
+ ): void => {
173
+ v.vaultReference = val;
174
+ },
175
+ );
166
176
  // --------------------------------------------- DatasourceSpecification -------------------------------------
167
177
  export const staticDatasourceSpecification_setHost = action(
168
178
  (v: StaticDatasourceSpecification, val: string): void => {
@@ -63,13 +63,14 @@ export const getAllIdentifiedConnectionsFromRuntime = (
63
63
  ): IdentifiedConnection[] => {
64
64
  const resolvedRuntimes: EngineRuntime[] = [];
65
65
  if (runtime instanceof RuntimePointer) {
66
- const engineRuntime = runtime.packageableRuntime.value.runtimeValue;
67
- resolvedRuntimes.push(engineRuntime);
66
+ resolvedRuntimes.push(runtime.packageableRuntime.value.runtimeValue);
68
67
  } else if (runtime instanceof EngineRuntime) {
69
68
  resolvedRuntimes.push(runtime);
70
69
  }
71
70
  return resolvedRuntimes
72
- .flatMap((e) => e.connections.map((l) => l.storeConnections))
71
+ .flatMap((e) =>
72
+ e.connections.map((connection) => connection.storeConnections),
73
+ )
73
74
  .flat();
74
75
  };
75
76