@finos/legend-application-studio 28.21.42 → 28.21.44

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 (164) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +18 -4
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +20 -5
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +177 -31
  6. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioTelemetryHelper.js +229 -72
  8. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  9. package/lib/__lib__/LegendStudioUserDataHelper.d.ts +18 -1
  10. package/lib/__lib__/LegendStudioUserDataHelper.d.ts.map +1 -1
  11. package/lib/__lib__/LegendStudioUserDataHelper.js +71 -0
  12. package/lib/__lib__/LegendStudioUserDataHelper.js.map +1 -1
  13. package/lib/application/LegendStudioApplicationConfig.d.ts +12 -0
  14. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  15. package/lib/application/LegendStudioApplicationConfig.js +6 -0
  16. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  17. package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
  18. package/lib/components/LegendStudioWebApplication.js +5 -2
  19. package/lib/components/LegendStudioWebApplication.js.map +1 -1
  20. package/lib/components/ShowcaseManager.d.ts.map +1 -1
  21. package/lib/components/ShowcaseManager.js +6 -4
  22. package/lib/components/ShowcaseManager.js.map +1 -1
  23. package/lib/components/editor/ActivityBar.d.ts.map +1 -1
  24. package/lib/components/editor/ActivityBar.js +2 -1
  25. package/lib/components/editor/ActivityBar.js.map +1 -1
  26. package/lib/components/editor/editor-group/GrammarTextEditor.d.ts.map +1 -1
  27. package/lib/components/editor/editor-group/GrammarTextEditor.js +7 -1
  28. package/lib/components/editor/editor-group/GrammarTextEditor.js.map +1 -1
  29. package/lib/components/editor/editor-group/data-editor/RelationElementSampleValuesEditor.d.ts +37 -0
  30. package/lib/components/editor/editor-group/data-editor/RelationElementSampleValuesEditor.d.ts.map +1 -0
  31. package/lib/components/editor/editor-group/data-editor/RelationElementSampleValuesEditor.js +126 -0
  32. package/lib/components/editor/editor-group/data-editor/RelationElementSampleValuesEditor.js.map +1 -0
  33. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
  34. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +22 -127
  35. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
  36. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  37. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +4 -4
  38. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  39. package/lib/components/showcase/ShowcaseFeedback.d.ts +36 -0
  40. package/lib/components/showcase/ShowcaseFeedback.d.ts.map +1 -0
  41. package/lib/components/showcase/ShowcaseFeedback.js +70 -0
  42. package/lib/components/showcase/ShowcaseFeedback.js.map +1 -0
  43. package/lib/components/showcase/ShowcaseViewer.d.ts.map +1 -1
  44. package/lib/components/showcase/ShowcaseViewer.js +3 -1
  45. package/lib/components/showcase/ShowcaseViewer.js.map +1 -1
  46. package/lib/components/workspace-setup/WorkspaceSetup.d.ts.map +1 -1
  47. package/lib/components/workspace-setup/WorkspaceSetup.js +2 -1
  48. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  49. package/lib/index.css +2 -2
  50. package/lib/index.css.map +1 -1
  51. package/lib/index.d.ts +2 -1
  52. package/lib/index.d.ts.map +1 -1
  53. package/lib/index.js +2 -1
  54. package/lib/index.js.map +1 -1
  55. package/lib/package.json +1 -1
  56. package/lib/stores/LegendStudioBaseStore.d.ts.map +1 -1
  57. package/lib/stores/LegendStudioBaseStore.js +1 -0
  58. package/lib/stores/LegendStudioBaseStore.js.map +1 -1
  59. package/lib/stores/ShowcaseManagerState.d.ts +5 -3
  60. package/lib/stores/ShowcaseManagerState.d.ts.map +1 -1
  61. package/lib/stores/ShowcaseManagerState.js +44 -11
  62. package/lib/stores/ShowcaseManagerState.js.map +1 -1
  63. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  64. package/lib/stores/editor/EditorGraphState.js +1 -1
  65. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  66. package/lib/stores/editor/EditorStore.d.ts +2 -1
  67. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  68. package/lib/stores/editor/EditorStore.js +8 -2
  69. package/lib/stores/editor/EditorStore.js.map +1 -1
  70. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  71. package/lib/stores/editor/GraphEditFormModeState.js +2 -2
  72. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  73. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +19 -0
  74. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  75. package/lib/stores/editor/GraphEditGrammarModeState.js +92 -4
  76. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  77. package/lib/stores/editor/GraphEditorMode.d.ts +1 -0
  78. package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
  79. package/lib/stores/editor/GraphEditorMode.js.map +1 -1
  80. package/lib/stores/editor/StandardEditorMode.d.ts +16 -5
  81. package/lib/stores/editor/StandardEditorMode.d.ts.map +1 -1
  82. package/lib/stores/editor/StandardEditorMode.js +4 -2
  83. package/lib/stores/editor/StandardEditorMode.js.map +1 -1
  84. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +2 -14
  85. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  86. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +5 -75
  87. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  88. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts +0 -11
  89. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts.map +1 -1
  90. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js +2 -77
  91. package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js.map +1 -1
  92. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  93. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +4 -4
  94. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  95. package/lib/stores/editor/sidebar-state/LocalChangesState.d.ts +1 -0
  96. package/lib/stores/editor/sidebar-state/LocalChangesState.d.ts.map +1 -1
  97. package/lib/stores/editor/sidebar-state/LocalChangesState.js +27 -0
  98. package/lib/stores/editor/sidebar-state/LocalChangesState.js.map +1 -1
  99. package/lib/stores/editor/sidebar-state/WorkspaceUpdaterState.d.ts.map +1 -1
  100. package/lib/stores/editor/sidebar-state/WorkspaceUpdaterState.js +7 -0
  101. package/lib/stores/editor/sidebar-state/WorkspaceUpdaterState.js.map +1 -1
  102. package/lib/stores/editor/sidebar-state/dev-metadata/DevMetadataState.d.ts.map +1 -1
  103. package/lib/stores/editor/sidebar-state/dev-metadata/DevMetadataState.js +7 -2
  104. package/lib/stores/editor/sidebar-state/dev-metadata/DevMetadataState.js.map +1 -1
  105. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts +1 -0
  106. package/lib/stores/lazy-text-editor/LazyTextEditorStore.d.ts.map +1 -1
  107. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js +3 -0
  108. package/lib/stores/lazy-text-editor/LazyTextEditorStore.js.map +1 -1
  109. package/lib/stores/project-reviewer/ProjectReviewerStore.d.ts.map +1 -1
  110. package/lib/stores/project-reviewer/ProjectReviewerStore.js +2 -0
  111. package/lib/stores/project-reviewer/ProjectReviewerStore.js.map +1 -1
  112. package/lib/stores/project-view/ProjectViewerEditorMode.d.ts +2 -2
  113. package/lib/stores/project-view/ProjectViewerEditorMode.d.ts.map +1 -1
  114. package/lib/stores/project-view/ProjectViewerEditorMode.js +12 -0
  115. package/lib/stores/project-view/ProjectViewerEditorMode.js.map +1 -1
  116. package/lib/stores/project-view/ProjectViewerStore.d.ts.map +1 -1
  117. package/lib/stores/project-view/ProjectViewerStore.js +3 -1
  118. package/lib/stores/project-view/ProjectViewerStore.js.map +1 -1
  119. package/lib/stores/showcase/ShowcaseViewerEditorMode.d.ts.map +1 -1
  120. package/lib/stores/showcase/ShowcaseViewerEditorMode.js.map +1 -1
  121. package/lib/stores/showcase/ShowcaseViewerStore.d.ts.map +1 -1
  122. package/lib/stores/showcase/ShowcaseViewerStore.js +7 -3
  123. package/lib/stores/showcase/ShowcaseViewerStore.js.map +1 -1
  124. package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts.map +1 -1
  125. package/lib/stores/workspace-setup/WorkspaceSetupStore.js +1 -0
  126. package/lib/stores/workspace-setup/WorkspaceSetupStore.js.map +1 -1
  127. package/package.json +16 -16
  128. package/src/__lib__/LegendStudioEvent.ts +22 -6
  129. package/src/__lib__/LegendStudioTelemetryHelper.ts +425 -104
  130. package/src/__lib__/LegendStudioUserDataHelper.ts +115 -0
  131. package/src/application/LegendStudioApplicationConfig.ts +19 -0
  132. package/src/components/LegendStudioWebApplication.tsx +18 -2
  133. package/src/components/ShowcaseManager.tsx +24 -4
  134. package/src/components/editor/ActivityBar.tsx +5 -1
  135. package/src/components/editor/editor-group/GrammarTextEditor.tsx +18 -1
  136. package/src/components/editor/editor-group/data-editor/RelationElementSampleValuesEditor.tsx +285 -0
  137. package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +38 -323
  138. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +4 -0
  139. package/src/components/showcase/ShowcaseFeedback.tsx +136 -0
  140. package/src/components/showcase/ShowcaseViewer.tsx +10 -0
  141. package/src/components/workspace-setup/WorkspaceSetup.tsx +6 -1
  142. package/src/index.ts +2 -0
  143. package/src/stores/LegendStudioBaseStore.ts +1 -0
  144. package/src/stores/ShowcaseManagerState.ts +67 -8
  145. package/src/stores/editor/EditorGraphState.ts +1 -0
  146. package/src/stores/editor/EditorStore.ts +26 -4
  147. package/src/stores/editor/GraphEditFormModeState.ts +2 -0
  148. package/src/stores/editor/GraphEditGrammarModeState.ts +139 -1
  149. package/src/stores/editor/GraphEditorMode.ts +1 -0
  150. package/src/stores/editor/StandardEditorMode.ts +21 -7
  151. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +3 -119
  152. package/src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts +1 -136
  153. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +4 -0
  154. package/src/stores/editor/sidebar-state/LocalChangesState.ts +47 -0
  155. package/src/stores/editor/sidebar-state/WorkspaceUpdaterState.ts +18 -0
  156. package/src/stores/editor/sidebar-state/dev-metadata/DevMetadataState.ts +7 -0
  157. package/src/stores/lazy-text-editor/LazyTextEditorStore.ts +4 -0
  158. package/src/stores/project-reviewer/ProjectReviewerStore.ts +4 -0
  159. package/src/stores/project-view/ProjectViewerEditorMode.ts +17 -4
  160. package/src/stores/project-view/ProjectViewerStore.ts +5 -0
  161. package/src/stores/showcase/ShowcaseViewerEditorMode.ts +4 -5
  162. package/src/stores/showcase/ShowcaseViewerStore.ts +12 -2
  163. package/src/stores/workspace-setup/WorkspaceSetupStore.ts +2 -0
  164. package/tsconfig.json +2 -0
@@ -15,10 +15,8 @@
15
15
  */
16
16
 
17
17
  import {
18
- type AppDirNode,
19
18
  type ArtifactGenerationExtensionResult,
20
19
  type BatchLambdasRelationTypeResult,
21
- type IngestDefinition,
22
20
  type Mapping,
23
21
  type PackageableElement,
24
22
  type RawLambda,
@@ -31,7 +29,6 @@ import {
31
29
  type V1_RawLineageModel,
32
30
  AccessPoint,
33
31
  AccessPointGroup,
34
- AppDirOwner,
35
32
  CodeCompletionResult,
36
33
  DataElement,
37
34
  DataElementReference,
@@ -70,10 +67,8 @@ import {
70
67
  ActionState,
71
68
  addUniqueEntry,
72
69
  assertErrorThrown,
73
- assertTrue,
74
70
  deleteEntry,
75
71
  filterByType,
76
- guaranteeNonNullable,
77
72
  guaranteeType,
78
73
  LogEvent,
79
74
  returnUndefOnError,
@@ -98,11 +93,6 @@ import {
98
93
  EditorInitialConfiguration,
99
94
  } from '../ElementEditorInitialConfiguration.js';
100
95
  import { EXTERNAL_APPLICATION_NAVIGATION__generateUrlWithEditorConfig } from '../../../../../__lib__/LegendStudioNavigation.js';
101
- import type {
102
- AdhocDataProductDeployResponse,
103
- LakehouseIngestionManager,
104
- } from '@finos/legend-server-lakehouse';
105
- import { LegendStudioTelemetryHelper } from '../../../../../__lib__/LegendStudioTelemetryHelper.js';
106
96
 
107
97
  export enum DATA_PRODUCT_TAB {
108
98
  HOME = 'Home',
@@ -307,7 +297,6 @@ export class LakehouseAccessPointState extends AccessPointState {
307
297
  generatingArtifactState = ActionState.create();
308
298
  relationElementState: RelationElementState | undefined;
309
299
  showSampleValuesEditor = true;
310
- showSampleValuesModal = false;
311
300
 
312
301
  // Add lineage state and isGeneratingLineage
313
302
  lineageState: LineageState;
@@ -324,8 +313,6 @@ export class LakehouseAccessPointState extends AccessPointState {
324
313
  relationElementState: observable,
325
314
  showSampleValuesEditor: observable,
326
315
  setShowSampleValuesEditor: action,
327
- showSampleValuesModal: observable,
328
- setShowSampleValuesModal: action,
329
316
  addRelationElement: action,
330
317
  deleteRelationElement: action,
331
318
  createAndaddRelationElement: flow,
@@ -386,10 +373,6 @@ export class LakehouseAccessPointState extends AccessPointState {
386
373
  this.showSampleValuesEditor = value;
387
374
  }
388
375
 
389
- setShowSampleValuesModal(value: boolean): void {
390
- this.showSampleValuesModal = value;
391
- }
392
-
393
376
  getRelationElementState(): RelationElementState | undefined {
394
377
  const relationElement = this.getRelationElement();
395
378
  return relationElement
@@ -457,10 +440,11 @@ export class LakehouseAccessPointState extends AccessPointState {
457
440
  }
458
441
 
459
442
  newElement.rows = [];
460
- this.addRelationElement(observe_RelationElement(newElement), true);
443
+ this.addRelationElement(observe_RelationElement(newElement));
444
+ this.relationElementState?.addRow();
461
445
  }
462
446
 
463
- addRelationElement(newElement: RelationElement, openModal: boolean): void {
447
+ addRelationElement(newElement: RelationElement): void {
464
448
  const product = this.state.state.product;
465
449
 
466
450
  let relationElementsData = product.sampleValues?.find(
@@ -480,10 +464,6 @@ export class LakehouseAccessPointState extends AccessPointState {
480
464
  addUniqueEntry(relationElementsData.relationElements, newElement);
481
465
 
482
466
  this.relationElementState = new RelationElementState(newElement);
483
-
484
- if (openModal) {
485
- this.setShowSampleValuesModal(true);
486
- }
487
467
  }
488
468
 
489
469
  deleteRelationElement(): void {
@@ -795,11 +775,9 @@ export const generateUrlToDeployOnOpen = (
795
775
  };
796
776
 
797
777
  export class DataProductEditorState extends ElementEditorState {
798
- deploymentState = ActionState.create();
799
778
  accessPointGroupStates: AccessPointGroupState[] = [];
800
779
  isConvertingTransformLambdaObjects = false;
801
780
  deployOnOpen = false;
802
- deployResponse: AdhocDataProductDeployResponse | undefined;
803
781
  selectedGroupState: AccessPointGroupState | undefined;
804
782
  selectedTab: DATA_PRODUCT_TAB;
805
783
  modelledDataProduct = false;
@@ -821,11 +799,8 @@ export class DataProductEditorState extends ElementEditorState {
821
799
  setSelectedTab: action,
822
800
  addGroupState: action,
823
801
  deleteGroupState: action,
824
- deploy: flow,
825
802
  deployOnOpen: observable,
826
- deployResponse: observable,
827
803
  setDeployOnOpen: action,
828
- setDeployResponse: action,
829
804
  addAccessPoint: action,
830
805
  convertAccessPointsFuncObjects: flow,
831
806
  batchUpdateLambdaRelationColumns: flow,
@@ -862,12 +837,6 @@ export class DataProductEditorState extends ElementEditorState {
862
837
  this.deployOnOpen = value;
863
838
  }
864
839
 
865
- setDeployResponse(
866
- response: AdhocDataProductDeployResponse | undefined,
867
- ): void {
868
- this.deployResponse = response;
869
- }
870
-
871
840
  setSelectedTab(value: DATA_PRODUCT_TAB): void {
872
841
  this.selectedTab = value;
873
842
  }
@@ -1075,57 +1044,6 @@ export class DataProductEditorState extends ElementEditorState {
1075
1044
  }
1076
1045
  }
1077
1046
 
1078
- *deploy(token: string | undefined): GeneratorFn<void> {
1079
- try {
1080
- assertTrue(
1081
- this.validForDeployment,
1082
- 'Data product definition is not valid for deployment',
1083
- );
1084
- this.deploymentState.inProgress();
1085
- // The grammar we provide will be for the current data product + all ingests (used for compilation)
1086
- const grammar =
1087
- (yield this.editorStore.graphManagerState.graphManager.elementsToPureCode(
1088
- [...this.editorStore.graphManagerState.graph.ingests, this.product],
1089
- )) as unknown as string;
1090
-
1091
- const response = (yield guaranteeNonNullable(
1092
- this.ingestionManager,
1093
- ).deployDataProduct(
1094
- grammar,
1095
- guaranteeNonNullable(this.appDirDeployment),
1096
- (val: string) =>
1097
- this.editorStore.applicationStore.alertService.setBlockingAlert({
1098
- message: val,
1099
- showLoading: true,
1100
- }),
1101
- token,
1102
- )) as unknown as AdhocDataProductDeployResponse;
1103
- LegendStudioTelemetryHelper.logEvent_LakehouseDeployDataProduct(
1104
- this.editorStore.applicationStore.telemetryService,
1105
- this.editorStore.editorMode.getSourceInfo(),
1106
- this.product.path,
1107
- );
1108
-
1109
- this.setDeployResponse(response);
1110
- } catch (error) {
1111
- assertErrorThrown(error);
1112
- this.editorStore.applicationStore.notificationService.notifyError(
1113
- `Ingest definition failed to deploy: ${error.message}`,
1114
- );
1115
- LegendStudioTelemetryHelper.logEvent_LakehouseDeployDataProductFailure(
1116
- this.editorStore.applicationStore.telemetryService,
1117
- this.editorStore.editorMode.getSourceInfo(),
1118
- this.product.path,
1119
- error.message,
1120
- );
1121
- } finally {
1122
- this.deploymentState.complete();
1123
- this.editorStore.applicationStore.alertService.setBlockingAlert(
1124
- undefined,
1125
- );
1126
- }
1127
- }
1128
-
1129
1047
  clearSupportInfo(): void {
1130
1048
  const supportInfo = this.product.supportInfo;
1131
1049
  runInAction(() => {
@@ -1160,44 +1078,10 @@ export class DataProductEditorState extends ElementEditorState {
1160
1078
  );
1161
1079
  }
1162
1080
 
1163
- get validForDeployment(): boolean {
1164
- return Boolean(this.appDirDeployment && this.ingestionManager);
1165
- }
1166
-
1167
1081
  get accessPoints(): AccessPoint[] {
1168
1082
  return this.product.accessPointGroups.map((e) => e.accessPoints).flat();
1169
1083
  }
1170
1084
 
1171
- get ingestionManager(): LakehouseIngestionManager | undefined {
1172
- return this.editorStore.ingestionManager;
1173
- }
1174
-
1175
- get deployValidationMessage(): string {
1176
- if (!this.appDirDeployment) {
1177
- return 'No app dir deployment found';
1178
- } else if (!this.ingestionManager) {
1179
- return 'No ingestion manager found';
1180
- }
1181
- return 'Deploy';
1182
- }
1183
-
1184
- // Use explicit owner from the data product if available, otherwise fall back to the associated ingest's app dir deployment
1185
- get appDirDeployment(): AppDirNode | undefined {
1186
- const owner = this.product.owner;
1187
- if (owner instanceof AppDirOwner) {
1188
- return owner.production;
1189
- }
1190
- return this.associatedIngest?.appDirDeployment;
1191
- }
1192
-
1193
- // We need to get the associated Ingest to get the app dir deployment
1194
- // We could do a more in depth check on the access point lambdas to check which ingest it uses but for now
1195
- // we will assume all ingests have the same DID
1196
- // we get the last one, to prioritize the ones in the current project followed by dependency ones
1197
- get associatedIngest(): IngestDefinition | undefined {
1198
- return this.editorStore.graphManagerState.graph.ingests.slice(-1)[0];
1199
- }
1200
-
1201
1085
  override reprocess(
1202
1086
  newElement: PackageableElement,
1203
1087
  editorStore: EditorStore,
@@ -28,35 +28,17 @@ import type { EditorStore } from '../../../EditorStore.js';
28
28
  import {
29
29
  ActionState,
30
30
  assertErrorThrown,
31
- assertTrue,
32
- guaranteeNonNullable,
33
31
  guaranteeType,
34
32
  LogEvent,
35
- removePrefix,
36
33
  type GeneratorFn,
37
34
  } from '@finos/legend-shared';
38
- import {
39
- action,
40
- computed,
41
- flow,
42
- flowResult,
43
- makeObservable,
44
- observable,
45
- } from 'mobx';
46
- import type {
47
- IngestDefinitionDeploymentResponse,
48
- IngestDefinitionValidationResponse,
49
- LakehouseIngestionManager,
50
- ValidateAndDeploymentResponse,
51
- } from '@finos/legend-server-lakehouse';
35
+ import { action, flow, makeObservable, observable } from 'mobx';
52
36
  import {
53
37
  EditorInitialConfiguration,
54
38
  IngestElementEditorInitialConfiguration,
55
39
  } from '../ElementEditorInitialConfiguration.js';
56
- import type { AuthContextProps } from 'react-oidc-context';
57
40
  import { EXTERNAL_APPLICATION_NAVIGATION__generateUrlWithEditorConfig } from '../../../../../__lib__/LegendStudioNavigation.js';
58
41
  import { LineageState } from '@finos/legend-query-builder';
59
- import { LegendStudioTelemetryHelper } from '../../../../../__lib__/LegendStudioTelemetryHelper.js';
60
42
  import { IngestTestableState } from './IngestTestableState.js';
61
43
 
62
44
  export enum INGEST_DEFINITION_TAB {
@@ -88,8 +70,6 @@ export const generateUrlToDeployOnOpen = (
88
70
  );
89
71
  };
90
72
 
91
- const PARSER_SECTION = `###Lakehouse`;
92
-
93
73
  type CachedIngestArtifact = {
94
74
  hashCode: string;
95
75
  artifact: IngestionDefinitionArtifact;
@@ -97,8 +77,6 @@ type CachedIngestArtifact = {
97
77
 
98
78
  export class IngestDefinitionEditorState extends ElementEditorState {
99
79
  selectedTab = INGEST_DEFINITION_TAB.DEFINITION;
100
- validateAndDeployResponse: ValidateAndDeploymentResponse | undefined;
101
- deploymentState = ActionState.create();
102
80
  lineageGenerationState = ActionState.create();
103
81
  artifactGenerationState = ActionState.create();
104
82
  ingestionArtifact: IngestionDefinitionArtifact | undefined;
@@ -116,19 +94,13 @@ export class IngestDefinitionEditorState extends ElementEditorState {
116
94
 
117
95
  makeObservable(this, {
118
96
  selectedTab: observable,
119
- deploymentState: observable,
120
97
  deployOnOpen: observable,
121
98
  setDeployOnOpen: observable,
122
99
  cachedArtfact: observable,
123
- validateAndDeployResponse: observable,
124
100
  ingestionArtifact: observable,
125
- deploymentResponse: computed,
126
101
  setSelectedTab: action,
127
- setValidateAndDeployResponse: action,
128
102
  setIngestCachedArtifact: action,
129
103
  setIngestionArtifact: action,
130
- init_with_deploy: flow,
131
- deploy: flow,
132
104
  generateLineage: flow,
133
105
  generateArtifact: flow,
134
106
  });
@@ -148,26 +120,6 @@ export class IngestDefinitionEditorState extends ElementEditorState {
148
120
  this.selectedTab = val;
149
121
  }
150
122
 
151
- get deploymentResponse():
152
- | IngestDefinitionDeploymentResponse
153
- | IngestDefinitionValidationResponse
154
- | undefined {
155
- return (
156
- this.validateAndDeployResponse?.deploymentResponse ??
157
- this.validateAndDeployResponse?.validationResponse
158
- );
159
- }
160
-
161
- get ingestionManager(): LakehouseIngestionManager | undefined {
162
- return this.editorStore.ingestionManager;
163
- }
164
-
165
- setValidateAndDeployResponse(
166
- val: ValidateAndDeploymentResponse | undefined,
167
- ): void {
168
- this.validateAndDeployResponse = val;
169
- }
170
-
171
123
  setDeployOnOpen(value: boolean): void {
172
124
  this.deployOnOpen = value;
173
125
  }
@@ -180,76 +132,6 @@ export class IngestDefinitionEditorState extends ElementEditorState {
180
132
  this.cachedArtfact = val;
181
133
  }
182
134
 
183
- *init_with_deploy(auth: AuthContextProps): GeneratorFn<void> {
184
- this.setDeployOnOpen(false);
185
- if (!auth.isAuthenticated) {
186
- auth
187
- .signinRedirect({
188
- state: generateUrlToDeployOnOpen(this),
189
- })
190
- .catch(this.editorStore.applicationStore.alertUnhandledError);
191
- return;
192
- }
193
- const token = auth.user?.access_token;
194
- yield flowResult(this.generateElementGrammar()).catch(
195
- this.editorStore.applicationStore.alertUnhandledError,
196
- );
197
- flowResult(this.deploy(token)).catch(
198
- this.editorStore.applicationStore.alertUnhandledError,
199
- );
200
- }
201
-
202
- *deploy(token: string | undefined): GeneratorFn<void> {
203
- try {
204
- assertTrue(
205
- this.validForDeployment,
206
- 'Ingest definition is not valid for deployment',
207
- );
208
- this.deploymentState.inProgress();
209
- const response = (yield guaranteeNonNullable(
210
- this.ingestionManager,
211
- ).deploy(
212
- // remove parser prefix for now since api already expects it to be under lakehouse parser
213
- guaranteeNonNullable(removePrefix(this.textContent, PARSER_SECTION)),
214
- guaranteeNonNullable(this.ingest.appDirDeployment),
215
- (val: string) =>
216
- this.editorStore.applicationStore.alertService.setBlockingAlert({
217
- message: val,
218
- showLoading: true,
219
- }),
220
- token,
221
- )) as unknown as ValidateAndDeploymentResponse;
222
- this.editorStore.applicationStore.alertService.setBlockingAlert(
223
- undefined,
224
- );
225
- if (response.deploymentResponse) {
226
- LegendStudioTelemetryHelper.logEvent_LakehouseDeployIngest(
227
- this.editorStore.applicationStore.telemetryService,
228
- this.editorStore.editorMode.getSourceInfo(),
229
- response.deploymentResponse.ingestDefinitionUrn,
230
- this.ingest.path,
231
- );
232
- }
233
- this.setValidateAndDeployResponse(response);
234
- } catch (error) {
235
- this.editorStore.applicationStore.alertService.setBlockingAlert(
236
- undefined,
237
- );
238
- assertErrorThrown(error);
239
- LegendStudioTelemetryHelper.logEvent_LakehouseDeployIngestFailure(
240
- this.editorStore.applicationStore.telemetryService,
241
- this.editorStore.editorMode.getSourceInfo(),
242
- this.ingest.path,
243
- error.message,
244
- );
245
- this.editorStore.applicationStore.notificationService.notifyError(
246
- `Ingest definition failed to deploy: ${error.message}`,
247
- );
248
- } finally {
249
- this.deploymentState.complete();
250
- }
251
- }
252
-
253
135
  getMatviewFuncNames(): string[] {
254
136
  return (
255
137
  this.ingest.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS?.map(
@@ -358,27 +240,10 @@ export class IngestDefinitionEditorState extends ElementEditorState {
358
240
  return new IngestDefinitionEditorState(editorStore, newElement);
359
241
  }
360
242
 
361
- get validForDeployment(): boolean {
362
- return Boolean(
363
- this.ingest.appDirDeployment && this.textContent && this.ingestionManager,
364
- );
365
- }
366
-
367
243
  get validForLineageViewer(): boolean {
368
244
  return Boolean(this.ingest.TEMPORARY_MATVIEW_FUNCTION_DATA_SETS?.length);
369
245
  }
370
246
 
371
- get validationMessage(): string {
372
- if (!this.ingest.appDirDeployment) {
373
- return 'No app dir deployment found';
374
- } else if (!this.textContent) {
375
- return 'No ingest definition found';
376
- } else if (!this.ingestionManager) {
377
- return 'No ingestion manager found';
378
- }
379
- return 'Deploy';
380
- }
381
-
382
247
  get ingest(): IngestDefinition {
383
248
  return guaranteeType(
384
249
  this.element,
@@ -426,6 +426,7 @@ export class ConnectionTestDataState {
426
426
  // move this out
427
427
  LegendStudioTelemetryHelper.logEvent_TestDataGenerationLaunched(
428
428
  this.testDataState.editorStore.applicationStore.telemetryService,
429
+ this.editorStore.editorMode.getSourceInfo(),
429
430
  );
430
431
  const report = reportGraphAnalytics(
431
432
  this.editorStore.graphManagerState.graph,
@@ -457,6 +458,7 @@ export class ConnectionTestDataState {
457
458
  LegendStudioTelemetryHelper.logEvent_TestDataGenerationSucceeded(
458
459
  this.editorStore.applicationStore.telemetryService,
459
460
  report,
461
+ this.editorStore.editorMode.getSourceInfo(),
460
462
  );
461
463
  service_setConnectionTestDataEmbeddedData(
462
464
  this.connectionData,
@@ -541,6 +543,7 @@ export class ConnectionTestDataState {
541
543
  // move this out
542
544
  LegendStudioTelemetryHelper.logEvent_TestDataGenerationLaunched(
543
545
  this.testDataState.editorStore.applicationStore.telemetryService,
546
+ this.editorStore.editorMode.getSourceInfo(),
544
547
  );
545
548
  const report = reportGraphAnalytics(
546
549
  this.editorStore.graphManagerState.graph,
@@ -593,6 +596,7 @@ export class ConnectionTestDataState {
593
596
  LegendStudioTelemetryHelper.logEvent_TestDataGenerationSucceeded(
594
597
  this.editorStore.applicationStore.telemetryService,
595
598
  report,
599
+ this.editorStore.editorMode.getSourceInfo(),
596
600
  );
597
601
  service_setConnectionTestDataEmbeddedData(
598
602
  this.connectionData,
@@ -57,6 +57,12 @@ import {
57
57
  EntityChangeType,
58
58
  } from '@finos/legend-server-sdlc';
59
59
  import { LEGEND_STUDIO_APP_EVENT } from '../../../__lib__/LegendStudioEvent.js';
60
+ import {
61
+ GRAPH_EDITOR_MODE_LABEL,
62
+ LegendStudioTelemetryHelper,
63
+ } from '../../../__lib__/LegendStudioTelemetryHelper.js';
64
+ import { GraphEditGrammarModeState } from '../GraphEditGrammarModeState.js';
65
+ import { GraphEditLazyGrammarModeState } from '../../lazy-text-editor/LazyTextEditorStore.js';
60
66
  import { WorkspaceSyncState } from './WorkspaceSyncState.js';
61
67
  import { ACTIVITY_MODE } from '../EditorConfig.js';
62
68
  import { EntityChangeConflictEditorState } from '../editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js';
@@ -318,6 +324,17 @@ export abstract class LocalChangesState {
318
324
 
319
325
  abstract computeLocalEntityChanges(): EntityChange[];
320
326
 
327
+ private getGraphEditorModeLabel(): GRAPH_EDITOR_MODE_LABEL {
328
+ const graphEditorMode = this.editorStore.graphEditorMode;
329
+ if (graphEditorMode instanceof GraphEditLazyGrammarModeState) {
330
+ return GRAPH_EDITOR_MODE_LABEL.STRICT_TEXT;
331
+ }
332
+ if (graphEditorMode instanceof GraphEditGrammarModeState) {
333
+ return GRAPH_EDITOR_MODE_LABEL.TEXT;
334
+ }
335
+ return GRAPH_EDITOR_MODE_LABEL.FORM;
336
+ }
337
+
321
338
  *pushLocalChanges(pushMessage?: string): GeneratorFn<void> {
322
339
  if (
323
340
  this.pushChangesState.isInProgress ||
@@ -331,10 +348,21 @@ export abstract class LocalChangesState {
331
348
  this.pushChangesState.inProgress();
332
349
  const startTime = Date.now();
333
350
  const localChanges = this.computeLocalEntityChanges();
351
+ const mode = this.getGraphEditorModeLabel();
334
352
  if (!localChanges.length) {
353
+ LegendStudioTelemetryHelper.logEvent_PushLocalChangesEmpty(
354
+ this.editorStore.applicationStore.telemetryService,
355
+ this.editorStore.editorMode.getSourceInfo(),
356
+ { mode },
357
+ );
335
358
  this.pushChangesState.complete();
336
359
  return;
337
360
  }
361
+ LegendStudioTelemetryHelper.logEvent_PushLocalChangesLaunched(
362
+ this.editorStore.applicationStore.telemetryService,
363
+ this.editorStore.editorMode.getSourceInfo(),
364
+ { mode, changeCount: localChanges.length },
365
+ );
338
366
  yield flowResult(
339
367
  this.sdlcState.fetchRemoteWorkspaceRevision(
340
368
  this.sdlcState.activeProject.projectId,
@@ -423,6 +451,16 @@ export abstract class LocalChangesState {
423
451
  syncFinishedTime - startTime,
424
452
  'ms',
425
453
  );
454
+ LegendStudioTelemetryHelper.logEvent_PushLocalChangesSucceeded(
455
+ this.editorStore.applicationStore.telemetryService,
456
+ this.editorStore.editorMode.getSourceInfo(),
457
+ {
458
+ mode,
459
+ changeCount: localChanges.length,
460
+ durationMs: syncFinishedTime - startTime,
461
+ revisionId: latestRevision.id,
462
+ },
463
+ );
426
464
 
427
465
  // ======= (RE)START CHANGE DETECTION =======
428
466
 
@@ -515,6 +553,15 @@ export abstract class LocalChangesState {
515
553
  LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
516
554
  error,
517
555
  );
556
+ LegendStudioTelemetryHelper.logEvent_PushLocalChangesFailure(
557
+ this.editorStore.applicationStore.telemetryService,
558
+ this.editorStore.editorMode.getSourceInfo(),
559
+ {
560
+ mode,
561
+ changeCount: localChanges.length,
562
+ errorMessage: error.message,
563
+ },
564
+ );
518
565
  if (
519
566
  error instanceof NetworkClientError &&
520
567
  error.response.status === HttpStatus.CONFLICT
@@ -41,6 +41,7 @@ import {
41
41
  RevisionAlias,
42
42
  } from '@finos/legend-server-sdlc';
43
43
  import { LEGEND_STUDIO_APP_EVENT } from '../../../__lib__/LegendStudioEvent.js';
44
+ import { LegendStudioTelemetryHelper } from '../../../__lib__/LegendStudioTelemetryHelper.js';
44
45
 
45
46
  export class WorkspaceUpdaterState {
46
47
  readonly editorStore: EditorStore;
@@ -273,6 +274,10 @@ export class WorkspaceUpdaterState {
273
274
  prompt: 'Please do not close the application',
274
275
  showLoading: true,
275
276
  });
277
+ LegendStudioTelemetryHelper.logEvent_WorkspaceUpdateLaunched(
278
+ this.editorStore.applicationStore.telemetryService,
279
+ this.editorStore.editorMode.getSourceInfo(),
280
+ );
276
281
  const workspaceUpdateReport =
277
282
  (yield this.editorStore.sdlcServerClient.updateWorkspace(
278
283
  this.sdlcState.activeProject.projectId,
@@ -283,6 +288,14 @@ export class WorkspaceUpdaterState {
283
288
  Date.now() - startTime,
284
289
  'ms',
285
290
  );
291
+ LegendStudioTelemetryHelper.logEvent_WorkspaceUpdateSucceeded(
292
+ this.editorStore.applicationStore.telemetryService,
293
+ this.editorStore.editorMode.getSourceInfo(),
294
+ {
295
+ status: workspaceUpdateReport.status,
296
+ durationMs: Date.now() - startTime,
297
+ },
298
+ );
286
299
  this.sdlcState.isWorkspaceOutdated = false;
287
300
  switch (workspaceUpdateReport.status) {
288
301
  // TODO: we might want to handle the situation more gracefully rather than just reloading the page
@@ -302,6 +315,11 @@ export class WorkspaceUpdaterState {
302
315
  LogEvent.create(LEGEND_STUDIO_APP_EVENT.SDLC_MANAGER_FAILURE),
303
316
  error,
304
317
  );
318
+ LegendStudioTelemetryHelper.logEvent_WorkspaceUpdateFailure(
319
+ this.editorStore.applicationStore.telemetryService,
320
+ this.editorStore.editorMode.getSourceInfo(),
321
+ error.message,
322
+ );
305
323
  this.editorStore.applicationStore.notificationService.notifyError(error);
306
324
  } finally {
307
325
  this.editorStore.applicationStore.alertService.setBlockingAlert(
@@ -156,12 +156,18 @@ export class DevMetadataState {
156
156
  'Project Name required to push to dev mode',
157
157
  );
158
158
  this.pushState.inProgress();
159
+ const graph = this.editorStore.graphManagerState.graph;
160
+ const lakehouseElementCounts = {
161
+ ingestCount: graph.ownIngests.length,
162
+ dataProductCount: graph.ownDataProducts.length,
163
+ };
159
164
  LegendStudioTelemetryHelper.logEvent_DevMetadataPushLaunched(
160
165
  this.editorStore.applicationStore.telemetryService,
161
166
  this.editorStore.editorMode.getSourceInfo(),
162
167
  currentProjectConfiguration.groupId,
163
168
  currentProjectConfiguration.artifactId,
164
169
  undefined,
170
+ lakehouseElementCounts,
165
171
  );
166
172
  const result =
167
173
  (yield this.editorStore.graphManagerState.graphManager.pushToDevMetadata(
@@ -179,6 +185,7 @@ export class DevMetadataState {
179
185
  currentProjectConfiguration.artifactId,
180
186
  undefined,
181
187
  result.finalStatus,
188
+ lakehouseElementCounts,
182
189
  );
183
190
  this.pushState.complete();
184
191
  } catch (error) {
@@ -64,6 +64,10 @@ export class GraphEditLazyGrammarModeState extends GraphEditGrammarModeState {
64
64
  return 'Strict Text Mode (BETA)';
65
65
  }
66
66
 
67
+ protected override get isStrictTextMode(): boolean {
68
+ return true;
69
+ }
70
+
67
71
  override *onLeave(): GeneratorFn<void> {
68
72
  this.editorStore.applicationStore.alertService.setBlockingAlert(undefined);
69
73
  this.editorStore.applicationStore.alertService.setActionAlertInfo({
@@ -222,7 +222,11 @@ export class ProjectReviewerStore {
222
222
  baseUrl: this.editorStore.applicationStore.config.engineServerUrl,
223
223
  queryBaseUrl:
224
224
  this.editorStore.applicationStore.config.engineQueryServerUrl,
225
+ queryClientName:
226
+ this.editorStore.applicationStore.config.engineQueryClientName,
225
227
  enableCompression: true,
228
+ useCookieAuthOnly:
229
+ this.editorStore.applicationStore.config.engineUseCookieAuthOnly,
226
230
  },
227
231
  },
228
232
  {
@@ -32,7 +32,6 @@ import {
32
32
  LegendSourceType,
33
33
  type LegendGAVSourceInfo,
34
34
  type LegendProjectIdSourceInfo,
35
- type LegendSourceInfo,
36
35
  } from '@finos/legend-storage';
37
36
 
38
37
  export class ProjectViewerEditorMode extends EditorMode {
@@ -100,20 +99,34 @@ export class ProjectViewerEditorMode extends EditorMode {
100
99
  return !this.viewerStore.projectGAVCoordinates;
101
100
  }
102
101
 
103
- getSourceInfo(): LegendSourceInfo | undefined {
102
+ getSourceInfo(): LegendGAVSourceInfo | LegendProjectIdSourceInfo | undefined {
104
103
  if (this.viewerStore.editorStore.sdlcState.currentProject) {
104
+ // GAV coordinates are populated from the project configuration once the
105
+ // graph is initialized; forward them when available so project-id
106
+ // viewers can still be joined with GAV-viewer traffic.
107
+ const projectConfiguration =
108
+ this.viewerStore.editorStore.projectConfigurationEditorState
109
+ .projectConfiguration;
110
+ // Prefer the pinned version id when the viewer is on a specific
111
+ // version; fall back to the revision id when viewing a revision;
112
+ // otherwise the viewer is on HEAD and versionId is left undefined.
113
+ const versionId =
114
+ this.viewerStore.version?.id.id ?? this.viewerStore.revision?.id;
105
115
  return {
106
116
  sourceType: LegendSourceType.PROJECT_PROJECTID,
107
117
  projectId:
108
118
  this.viewerStore.editorStore.sdlcState.currentProject.projectId,
109
- } as LegendProjectIdSourceInfo;
119
+ groupId: projectConfiguration?.groupId,
120
+ artifactId: projectConfiguration?.artifactId,
121
+ versionId,
122
+ };
110
123
  } else if (this.viewerStore.projectGAVCoordinates) {
111
124
  return {
112
125
  sourceType: LegendSourceType.PROJECT_GAV,
113
126
  groupId: this.viewerStore.projectGAVCoordinates.groupId,
114
127
  artifactId: this.viewerStore.projectGAVCoordinates.artifactId,
115
128
  versionId: this.viewerStore.projectGAVCoordinates.versionId,
116
- } as LegendGAVSourceInfo;
129
+ };
117
130
  } else {
118
131
  return undefined;
119
132
  }