@finos/legend-application-studio 28.21.46 → 28.21.48

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 (122) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +8 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +13 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +170 -6
  6. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioTelemetryHelper.js +116 -1
  8. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  9. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.d.ts +30 -0
  10. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.d.ts.map +1 -0
  11. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.js +43 -0
  12. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.js.map +1 -0
  13. package/lib/components/editor/editor-group/RuntimeEditor.d.ts +4 -3
  14. package/lib/components/editor/editor-group/RuntimeEditor.d.ts.map +1 -1
  15. package/lib/components/editor/editor-group/RuntimeEditor.js +90 -36
  16. package/lib/components/editor/editor-group/RuntimeEditor.js.map +1 -1
  17. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
  18. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +154 -35
  19. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
  20. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.d.ts.map +1 -1
  21. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js +4 -6
  22. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js.map +1 -1
  23. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  24. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +31 -7
  25. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  26. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  27. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js +4 -8
  28. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  29. package/lib/index.css +1 -1
  30. package/lib/index.d.ts +3 -1
  31. package/lib/index.d.ts.map +1 -1
  32. package/lib/index.js +3 -1
  33. package/lib/index.js.map +1 -1
  34. package/lib/package.json +1 -1
  35. package/lib/stores/editor/EditorStore.d.ts +2 -0
  36. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  37. package/lib/stores/editor/EditorStore.js +2 -0
  38. package/lib/stores/editor/EditorStore.js.map +1 -1
  39. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  40. package/lib/stores/editor/GraphEditFormModeState.js +21 -10
  41. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  42. package/lib/stores/editor/LegendAISuggestTelemetry.d.ts +143 -0
  43. package/lib/stores/editor/LegendAISuggestTelemetry.d.ts.map +1 -0
  44. package/lib/stores/editor/LegendAISuggestTelemetry.js +376 -0
  45. package/lib/stores/editor/LegendAISuggestTelemetry.js.map +1 -0
  46. package/lib/stores/editor/LegendSQLStudioPlaygroundState.js +3 -3
  47. package/lib/stores/editor/LegendSQLStudioPlaygroundState.js.map +1 -1
  48. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts +14 -3
  49. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts.map +1 -1
  50. package/lib/stores/editor/editor-state/GraphGenerationState.js +33 -21
  51. package/lib/stores/editor/editor-state/GraphGenerationState.js.map +1 -1
  52. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts +35 -6
  53. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts.map +1 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js +74 -29
  55. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js.map +1 -1
  56. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +1 -0
  57. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  58. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +5 -5
  59. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  60. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +12 -0
  61. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  62. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +60 -14
  63. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  64. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js +2 -2
  65. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  67. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js +34 -15
  68. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  69. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +1 -1
  70. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  71. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +3 -11
  72. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  73. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.d.ts.map +1 -1
  74. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js +30 -2
  75. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
  76. package/lib/stores/editor/sidebar-state/LocalChangesState.d.ts.map +1 -1
  77. package/lib/stores/editor/sidebar-state/LocalChangesState.js +1 -0
  78. package/lib/stores/editor/sidebar-state/LocalChangesState.js.map +1 -1
  79. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts +1 -1
  80. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts.map +1 -1
  81. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js +2 -12
  82. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js.map +1 -1
  83. package/lib/stores/editor/utils/MockDataUtils.d.ts +12 -2
  84. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  85. package/lib/stores/editor/utils/MockDataUtils.js +28 -28
  86. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  87. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +2 -0
  88. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
  89. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +13 -0
  90. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
  91. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.d.ts +20 -2
  92. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.d.ts.map +1 -1
  93. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js +38 -4
  94. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js.map +1 -1
  95. package/package.json +17 -17
  96. package/src/__lib__/LegendStudioEvent.ts +14 -0
  97. package/src/__lib__/LegendStudioTelemetryHelper.ts +277 -4
  98. package/src/components/editor/editor-group/LegendAISuggestTelemetryHooks.ts +57 -0
  99. package/src/components/editor/editor-group/RuntimeEditor.tsx +282 -132
  100. package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +293 -106
  101. package/src/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.ts +3 -13
  102. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +41 -23
  103. package/src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx +5 -11
  104. package/src/index.ts +13 -0
  105. package/src/stores/editor/EditorStore.ts +3 -0
  106. package/src/stores/editor/GraphEditFormModeState.ts +31 -15
  107. package/src/stores/editor/LegendAISuggestTelemetry.ts +592 -0
  108. package/src/stores/editor/LegendSQLStudioPlaygroundState.ts +3 -3
  109. package/src/stores/editor/editor-state/GraphGenerationState.ts +48 -42
  110. package/src/stores/editor/editor-state/element-editor-state/RuntimeEditorState.ts +92 -31
  111. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +6 -6
  112. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +75 -17
  113. package/src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts +2 -2
  114. package/src/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.ts +41 -23
  115. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +12 -21
  116. package/src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts +49 -6
  117. package/src/stores/editor/sidebar-state/LocalChangesState.ts +4 -0
  118. package/src/stores/editor/sidebar-state/WorkflowManagerState.ts +3 -12
  119. package/src/stores/editor/utils/MockDataUtils.ts +33 -32
  120. package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +18 -0
  121. package/src/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.ts +62 -7
  122. package/tsconfig.json +2 -0
@@ -117,19 +117,12 @@ export const createMockPrimitiveValueSpecificationFromRelationalDataType = (
117
117
  relationalDataType: RelationalDataType,
118
118
  graph: PureModel,
119
119
  observerContext: ObserverContext,
120
- ): ValueSpecification | undefined => {
121
- const primitiveTypeFromRelational =
122
- getPrimitiveTypeFromRelationalType(relationalDataType);
123
-
124
- if (primitiveTypeFromRelational) {
125
- return createMockPrimitiveValueSpecification(
126
- primitiveTypeFromRelational,
127
- graph,
128
- observerContext,
129
- );
130
- }
131
- return undefined;
132
- };
120
+ ): ValueSpecification =>
121
+ createMockPrimitiveValueSpecification(
122
+ getPrimitiveTypeFromRelationalType(relationalDataType),
123
+ graph,
124
+ observerContext,
125
+ );
133
126
 
134
127
  export class ServiceTestDataParametersState extends LambdaParametersState {
135
128
  connectionTestDataState: ConnectionTestDataState;
@@ -280,14 +273,12 @@ export class TableRowIdentifierState {
280
273
  this.connectionTestDataState.editorStore.changeDetectionState
281
274
  .observerContext,
282
275
  );
283
- if (valueSpec) {
284
- const rowIdentifierState = new RowIdentifierState(
285
- this.connectionTestDataState,
286
- column,
287
- valueSpec,
288
- );
289
- this.rowIdentifierStates.push(rowIdentifierState);
290
- }
276
+ const rowIdentifierState = new RowIdentifierState(
277
+ this.connectionTestDataState,
278
+ column,
279
+ valueSpec,
280
+ );
281
+ this.rowIdentifierStates.push(rowIdentifierState);
291
282
  }
292
283
 
293
284
  removeRowIdentifierState(rowIdentifierState: RowIdentifierState): void {
@@ -233,24 +233,67 @@ export class GlobalBulkServiceRegistrationState {
233
233
  const successfulResults = registrationResults.filter(
234
234
  (result) => result instanceof ServiceRegistrationSuccess,
235
235
  );
236
+ const failedResults = registrationResults.filter(
237
+ (result) => result instanceof ServiceRegistrationFail,
238
+ );
236
239
 
240
+ let activationFailedCount: number | undefined;
237
241
  if (this.activatePostRegistration) {
238
- yield Promise.resolve(
242
+ // Wait for every activation to settle so a single rejected activation
243
+ // neither hides the registration results nor goes unhandled.
244
+ const activationResults = (yield Promise.allSettled(
239
245
  successfulResults.map((serviceResult) =>
240
246
  this.editorStore.graphManagerState.graphManager.activateService(
241
247
  config.executionUrl,
242
248
  serviceResult.serviceInstanceId,
243
249
  ),
244
250
  ),
251
+ )) as PromiseSettledResult<void>[];
252
+ const activationFailures = activationResults.filter(
253
+ (result): result is PromiseRejectedResult =>
254
+ result.status === 'rejected',
255
+ );
256
+ activationFailedCount = activationFailures.length;
257
+ activationFailures.forEach((result) =>
258
+ this.editorStore.applicationStore.logService.error(
259
+ LogEvent.create(
260
+ LEGEND_STUDIO_APP_EVENT.SERVICE_REGISTRATION_FAILURE,
261
+ ),
262
+ result.reason,
263
+ ),
245
264
  );
246
265
  }
247
266
  this.handleResults(registrationResults);
248
267
  this.isServiceRegistering.complete();
249
- LegendStudioTelemetryHelper.logEvent_ServiceRegistrationSucceeded(
250
- this.editorStore.applicationStore.telemetryService,
251
- this.editorStore.editorMode.getSourceInfo(),
252
- { ...telemetryBase, durationMs: Date.now() - startedAt },
253
- );
268
+ const outcomeCounts = {
269
+ registeredCount: successfulResults.length,
270
+ failedCount: failedResults.length,
271
+ activationFailedCount,
272
+ };
273
+ // A bulk run where nothing got registered is a failed run; partial
274
+ // success is reported on the success payload via the outcome counts.
275
+ const firstFailure = failedResults[0];
276
+ if (successfulResults.length === 0 && firstFailure) {
277
+ LegendStudioTelemetryHelper.logEvent_ServiceRegistrationFailure(
278
+ this.editorStore.applicationStore.telemetryService,
279
+ this.editorStore.editorMode.getSourceInfo(),
280
+ {
281
+ ...telemetryBase,
282
+ ...outcomeCounts,
283
+ errorMessage: firstFailure.errorMessage,
284
+ },
285
+ );
286
+ } else {
287
+ LegendStudioTelemetryHelper.logEvent_ServiceRegistrationSucceeded(
288
+ this.editorStore.applicationStore.telemetryService,
289
+ this.editorStore.editorMode.getSourceInfo(),
290
+ {
291
+ ...telemetryBase,
292
+ ...outcomeCounts,
293
+ durationMs: Date.now() - startedAt,
294
+ },
295
+ );
296
+ }
254
297
  } catch (error) {
255
298
  assertErrorThrown(error);
256
299
  this.editorStore.applicationStore.logService.error(
@@ -461,6 +461,10 @@ export abstract class LocalChangesState {
461
461
  revisionId: latestRevision.id,
462
462
  },
463
463
  );
464
+ this.editorStore.legendAIAppliedSuggestionRegistry.reportPushedChanges(
465
+ this.editorStore,
466
+ localChanges,
467
+ );
464
468
 
465
469
  // ======= (RE)START CHANGE DETECTION =======
466
470
 
@@ -414,13 +414,7 @@ export class WorkflowState {
414
414
  WORKFLOW_MANAGER_JOB_ACTION.CANCEL,
415
415
  workflowJob,
416
416
  treeData,
417
- // NOTE: unlike retry/runManual, the current implementation does not
418
- // `yield` the underlying cancel call — see `cancelJob` below. The
419
- // launch event will still fire, and success will fire after the
420
- // refresh completes.
421
- () => {
422
- this.workflowManagerState.cancelJob(workflowJob);
423
- },
417
+ () => flowResult(this.workflowManagerState.cancelJob(workflowJob)),
424
418
  ),
425
419
  );
426
420
  }
@@ -479,7 +473,7 @@ export class WorkflowState {
479
473
  jobAction: WORKFLOW_MANAGER_JOB_ACTION,
480
474
  workflowJob: WorkflowJob,
481
475
  treeData: TreeData<WorkflowExplorerTreeNodeData>,
482
- invoke: () => Promise<void> | void,
476
+ invoke: () => Promise<void>,
483
477
  ): GeneratorFn<void> {
484
478
  const telemetryService = this.editorStore.applicationStore.telemetryService;
485
479
  const sourceInfo = this.editorStore.editorMode.getSourceInfo();
@@ -497,10 +491,7 @@ export class WorkflowState {
497
491
  const started = Date.now();
498
492
  try {
499
493
  this.isExecutingWorkflowRequest = true;
500
- const result = invoke();
501
- if (result) {
502
- yield result;
503
- }
494
+ yield invoke();
504
495
  yield flowResult(this.refreshWorkflow(workflowJob.workflowId, treeData));
505
496
  LegendStudioTelemetryHelper.logEvent_WorkflowManagerJobActionSucceeded(
506
497
  telemetryService,
@@ -21,7 +21,6 @@ import {
21
21
  Randomizer,
22
22
  UnsupportedOperationError,
23
23
  type PlainObject,
24
- isNonNullable,
25
24
  filterByType,
26
25
  } from '@finos/legend-shared';
27
26
  import type { EditorStore } from '../EditorStore.js';
@@ -37,16 +36,12 @@ import {
37
36
  TableAlias,
38
37
  Table,
39
38
  Column,
40
- VarChar,
41
39
  type RelationalDataType,
42
- Char,
43
- VarBinary,
40
+ BigInt,
44
41
  TinyInt,
45
42
  Float,
46
43
  Timestamp,
47
- Binary,
48
44
  Bit,
49
- Other,
50
45
  Numeric,
51
46
  Decimal,
52
47
  Double,
@@ -220,49 +215,56 @@ export const createMockDataForClassWithFormat = (
220
215
  }
221
216
  };
222
217
 
218
+ /**
219
+ * Maps a relational column type to the standard primitive type used to read
220
+ * the column with a TDS getter (e.g. `$row.getFloat('COL')`) and to mock its
221
+ * values.
222
+ *
223
+ * NOTE: this matches how the engine types `tableToTDS()` columns, except that
224
+ * `DECIMAL` and `NUMERIC` map to `Decimal` (the engine uses `Float`), so mock
225
+ * values keep exact-numeric semantics. Binary, JSON, semi-structured and other
226
+ * types have no TDS getter or literal of their own and map to `String`.
227
+ */
223
228
  export const getPrimitiveTypeFromRelationalType = (
224
229
  type: RelationalDataType,
225
- ): PrimitiveType | undefined => {
226
- if (
227
- type instanceof VarChar ||
228
- type instanceof Char ||
229
- type instanceof VarBinary ||
230
- type instanceof Binary ||
231
- type instanceof Bit ||
232
- type instanceof Other
233
- ) {
234
- return PrimitiveType.STRING;
235
- } else if (type instanceof Numeric) {
236
- return PrimitiveType.NUMBER;
237
- } else if (type instanceof Decimal) {
238
- return PrimitiveType.DECIMAL;
230
+ ): PrimitiveType => {
231
+ if (type instanceof Bit) {
232
+ return PrimitiveType.BOOLEAN;
239
233
  } else if (
240
- type instanceof Double ||
241
234
  type instanceof Integer ||
242
- type instanceof Real ||
235
+ type instanceof BigInt ||
243
236
  type instanceof SmallInt ||
244
237
  type instanceof TinyInt
245
238
  ) {
246
239
  return PrimitiveType.INTEGER;
247
- } else if (type instanceof Float) {
240
+ } else if (
241
+ type instanceof Float ||
242
+ type instanceof Double ||
243
+ type instanceof Real
244
+ ) {
248
245
  return PrimitiveType.FLOAT;
246
+ } else if (type instanceof Decimal || type instanceof Numeric) {
247
+ return PrimitiveType.DECIMAL;
249
248
  } else if (type instanceof ColumnDate) {
250
- return PrimitiveType.DATE;
249
+ return PrimitiveType.STRICTDATE;
251
250
  } else if (type instanceof Timestamp) {
252
251
  return PrimitiveType.DATETIME;
253
252
  }
254
- return undefined;
253
+ // VARCHAR, CHAR, BINARY, VARBINARY, JSON, SEMISTRUCTURED, OTHER
254
+ return PrimitiveType.STRING;
255
255
  };
256
+
256
257
  export const createMockDataForColumn = (
257
258
  col: Column,
258
259
  isPrimaryKey: boolean,
259
260
  idx?: number | undefined,
260
- ): string | undefined => {
261
+ ): string => {
261
262
  const type = col.type;
262
263
 
263
264
  if (
264
265
  (type instanceof Double ||
265
266
  type instanceof Integer ||
267
+ type instanceof BigInt ||
266
268
  type instanceof Real ||
267
269
  type instanceof SmallInt ||
268
270
  type instanceof TinyInt) &&
@@ -271,13 +273,13 @@ export const createMockDataForColumn = (
271
273
  ) {
272
274
  return idx.toString();
273
275
  }
274
- const primitive = getPrimitiveTypeFromRelationalType(type);
275
- if (primitive) {
276
- return createMockPrimitiveProperty(primitive, col.name).toString();
277
- } else if (type instanceof Json || type instanceof SemiStructured) {
276
+ if (type instanceof Json || type instanceof SemiStructured) {
278
277
  return '{}';
279
278
  }
280
- return undefined;
279
+ return createMockPrimitiveProperty(
280
+ getPrimitiveTypeFromRelationalType(type),
281
+ col.name,
282
+ ).toString();
281
283
  };
282
284
 
283
285
  export const createMockDataForTable = (
@@ -292,7 +294,6 @@ export const createMockDataForTable = (
292
294
  .map((col) =>
293
295
  createMockDataForColumn(col, table.primaryKey.includes(col), idx),
294
296
  )
295
- .filter(isNonNullable)
296
297
  .join(','),
297
298
  )
298
299
  .join('\n');
@@ -104,6 +104,24 @@ export const accessPointGroup_setTitle = action(
104
104
  },
105
105
  );
106
106
 
107
+ export const accessPointGroup_addTarget = action(
108
+ (group: AccessPointGroup, target: string) => {
109
+ if (!group.targets) {
110
+ group.targets = [target];
111
+ } else {
112
+ addUniqueEntry(group.targets, target);
113
+ }
114
+ },
115
+ );
116
+
117
+ export const accessPointGroup_deleteTarget = action(
118
+ (group: AccessPointGroup, target: string) => {
119
+ if (group.targets) {
120
+ deleteEntry(group.targets, target);
121
+ }
122
+ },
123
+ );
124
+
107
125
  export const modelAccessPointGroup_setMapping = action(
108
126
  (
109
127
  group: ModelAccessPointGroup,
@@ -17,10 +17,14 @@
17
17
  import {
18
18
  ConnectionPointer,
19
19
  type PackageableConnection,
20
+ type PackageableRuntime,
21
+ type ObserverContext,
20
22
  PackageableElementExplicitReference,
21
- type LakehouseRuntime,
23
+ LakehouseRuntime,
24
+ LakehouseSingleStoreRuntime,
22
25
  } from '@finos/legend-graph';
23
26
  import { action } from 'mobx';
27
+ import { packageableRuntime_setRuntimeValue } from './DSL_Mapping_GraphModifierHelper.js';
24
28
 
25
29
  export const lakehouseRuntime_setWarehouse = action(
26
30
  (runtime: LakehouseRuntime, warehouse: string | undefined) => {
@@ -28,12 +32,6 @@ export const lakehouseRuntime_setWarehouse = action(
28
32
  },
29
33
  );
30
34
 
31
- export const lakehouseRuntime_setEnvironment = action(
32
- (runtime: LakehouseRuntime, environment: string | undefined) => {
33
- runtime.environment = environment;
34
- },
35
- );
36
-
37
35
  export const lakehouseRuntime_setConnection = action(
38
36
  (
39
37
  runtime: LakehouseRuntime,
@@ -47,3 +45,60 @@ export const lakehouseRuntime_setConnection = action(
47
45
  : undefined;
48
46
  },
49
47
  );
48
+
49
+ export enum LakehouseComputeEngine {
50
+ SNOWFLAKE = 'SNOWFLAKE',
51
+ SINGLE_STORE = 'SINGLE_STORE',
52
+ }
53
+
54
+ /**
55
+ * Vendor product names, so they are spelled the way the vendor spells them --
56
+ * `prettyCONSTName` cannot produce "SingleStore" from any all-caps constant.
57
+ */
58
+ export const LAKEHOUSE_COMPUTE_ENGINE_LABEL: Record<
59
+ LakehouseComputeEngine,
60
+ string
61
+ > = {
62
+ [LakehouseComputeEngine.SNOWFLAKE]: 'Snowflake',
63
+ [LakehouseComputeEngine.SINGLE_STORE]: 'SingleStore',
64
+ };
65
+
66
+ export const getLakehouseComputeEngine = (
67
+ runtimeValue: LakehouseRuntime | LakehouseSingleStoreRuntime,
68
+ ): LakehouseComputeEngine =>
69
+ runtimeValue instanceof LakehouseRuntime
70
+ ? LakehouseComputeEngine.SNOWFLAKE
71
+ : LakehouseComputeEngine.SINGLE_STORE;
72
+
73
+ /**
74
+ * Swaps the concrete Lakehouse runtime class backing `packageableRuntime`
75
+ * between `LakehouseRuntime` (Snowflake) and `LakehouseSingleStoreRuntime`.
76
+ * These are distinct classes with distinct wire `_type`s, not a flag on one
77
+ * class, so switching compute engine means constructing a new instance --
78
+ * `environment` carries over, `warehouse`/`connectionPointer` naturally fall
79
+ * away (or reset to undefined) since the target class may not have them.
80
+ */
81
+ export const lakehouseRuntime_setComputeEngine = action(
82
+ (
83
+ packageableRuntime: PackageableRuntime,
84
+ computeEngine: LakehouseComputeEngine,
85
+ observerContext: ObserverContext,
86
+ ): LakehouseRuntime | LakehouseSingleStoreRuntime => {
87
+ const current = packageableRuntime.runtimeValue;
88
+ const environment =
89
+ current instanceof LakehouseRuntime ||
90
+ current instanceof LakehouseSingleStoreRuntime
91
+ ? current.environment
92
+ : undefined;
93
+ const next =
94
+ computeEngine === LakehouseComputeEngine.SNOWFLAKE
95
+ ? new LakehouseRuntime(environment)
96
+ : new LakehouseSingleStoreRuntime(environment);
97
+ packageableRuntime_setRuntimeValue(
98
+ packageableRuntime,
99
+ next,
100
+ observerContext,
101
+ );
102
+ return next;
103
+ },
104
+ );
package/tsconfig.json CHANGED
@@ -72,6 +72,7 @@
72
72
  "./src/application/LegendStudioApplicationConfig.ts",
73
73
  "./src/application/LegendStudioPluginManager.ts",
74
74
  "./src/components/__test-utils__/EmbeddedQueryBuilderTestUtils.ts",
75
+ "./src/components/editor/editor-group/LegendAISuggestTelemetryHooks.ts",
75
76
  "./src/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.ts",
76
77
  "./src/components/editor/editor-group/database-editor/DatabaseDiagramHelper.ts",
77
78
  "./src/components/shared/StudioSDLCErrors.ts",
@@ -94,6 +95,7 @@
94
95
  "./src/stores/editor/GraphEditFormModeState.ts",
95
96
  "./src/stores/editor/GraphEditGrammarModeState.ts",
96
97
  "./src/stores/editor/GraphEditorMode.ts",
98
+ "./src/stores/editor/LegendAISuggestTelemetry.ts",
97
99
  "./src/stores/editor/LegendSQLStudioPlaygroundState.ts",
98
100
  "./src/stores/editor/NewElementState.ts",
99
101
  "./src/stores/editor/QuickInputState.ts",