@finos/legend-application-studio 28.16.25 → 28.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/lib/components/ShowcaseManager.d.ts.map +1 -1
  2. package/lib/components/ShowcaseManager.js +2 -2
  3. package/lib/components/ShowcaseManager.js.map +1 -1
  4. package/lib/components/editor/editor-group/UnsupportedElementEditor.d.ts.map +1 -1
  5. package/lib/components/editor/editor-group/UnsupportedElementEditor.js +3 -3
  6. package/lib/components/editor/editor-group/UnsupportedElementEditor.js.map +1 -1
  7. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.d.ts.map +1 -1
  8. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js +3 -4
  9. package/lib/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.js.map +1 -1
  10. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.d.ts.map +1 -1
  11. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.js +2 -2
  12. package/lib/components/editor/editor-group/database/IsolatedQueryDatabase.js.map +1 -1
  13. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  14. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js +2 -2
  15. package/lib/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  16. package/lib/components/editor/panel-group/DevToolPanel.d.ts.map +1 -1
  17. package/lib/components/editor/panel-group/DevToolPanel.js +6 -4
  18. package/lib/components/editor/panel-group/DevToolPanel.js.map +1 -1
  19. package/lib/index.css +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/stores/editor/EditorGraphState.js +1 -1
  22. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  23. package/lib/stores/editor/GraphEditGrammarModeState.d.ts +1 -0
  24. package/lib/stores/editor/GraphEditGrammarModeState.d.ts.map +1 -1
  25. package/lib/stores/editor/GraphEditGrammarModeState.js +21 -5
  26. package/lib/stores/editor/GraphEditGrammarModeState.js.map +1 -1
  27. package/lib/stores/editor/editor-state/ModelImporterState.d.ts.map +1 -1
  28. package/lib/stores/editor/editor-state/ModelImporterState.js +3 -3
  29. package/lib/stores/editor/editor-state/ModelImporterState.js.map +1 -1
  30. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js +3 -3
  32. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
  33. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  34. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js +1 -2
  35. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  36. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +1 -1
  37. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
  38. package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -1
  39. package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
  40. package/package.json +11 -11
  41. package/src/components/ShowcaseManager.tsx +2 -1
  42. package/src/components/editor/editor-group/UnsupportedElementEditor.tsx +3 -5
  43. package/src/components/editor/editor-group/connection-editor/DatabaseSchemaExplorer.tsx +3 -3
  44. package/src/components/editor/editor-group/database/IsolatedQueryDatabase.tsx +6 -2
  45. package/src/components/editor/editor-group/project-configuration-editor/ProjectDependencyEditor.tsx +2 -4
  46. package/src/components/editor/panel-group/DevToolPanel.tsx +14 -7
  47. package/src/stores/editor/EditorGraphState.ts +1 -1
  48. package/src/stores/editor/GraphEditGrammarModeState.ts +30 -3
  49. package/src/stores/editor/editor-state/ModelImporterState.ts +3 -2
  50. package/src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts +3 -6
  51. package/src/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.ts +1 -1
  52. package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -1
@@ -32,7 +32,11 @@ import {
32
32
  import { useEditorStore } from '../EditorStoreProvider.js';
33
33
  import { LEGEND_STUDIO_SETTING_KEY } from '../../../__lib__/LegendStudioSetting.js';
34
34
  import { flowResult } from 'mobx';
35
- import type { PureModel } from '@finos/legend-graph';
35
+ import {
36
+ PARSER_SECTION_MARKER,
37
+ PURE_PARSER,
38
+ type PureModel,
39
+ } from '@finos/legend-graph';
36
40
 
37
41
  export const DevToolPanel = observer(() => {
38
42
  const editorStore = useEditorStore();
@@ -71,8 +75,8 @@ export const DevToolPanel = observer(() => {
71
75
  );
72
76
  };
73
77
 
74
- const downloadDependencyProjectGrammars = async (): Promise<string> => {
75
- const dependencyGrammars = await Promise.all(
78
+ const downloadDependencyProjectGrammars = async (): Promise<string[]> => {
79
+ const grammars = await Promise.all(
76
80
  Array.from(
77
81
  editorStore.graphManagerState.graph.dependencyManager
78
82
  .projectDependencyModelsIndex,
@@ -88,7 +92,7 @@ export const DevToolPanel = observer(() => {
88
92
  ) as string,
89
93
  ),
90
94
  );
91
- return dependencyGrammars.join('\n');
95
+ return grammars;
92
96
  };
93
97
 
94
98
  const downloadProjectGrammar = async (
@@ -105,14 +109,17 @@ export const DevToolPanel = observer(() => {
105
109
  const dependencyGrammars = withDependency
106
110
  ? ((await Promise.all([
107
111
  flowResult(downloadDependencyProjectGrammars()),
108
- ])) as unknown as string)
109
- : '';
112
+ ])) as unknown as string[])
113
+ : [];
114
+ const fullGrammar = [graphGrammar, ...dependencyGrammars].join(
115
+ `\n${PARSER_SECTION_MARKER}${PURE_PARSER.PURE}\n`,
116
+ );
110
117
  const fileName = `grammar.${getContentTypeFileExtension(
111
118
  ContentType.TEXT_PLAIN,
112
119
  )}`;
113
120
  downloadFileUsingDataURI(
114
121
  fileName,
115
- `${graphGrammar}\n${dependencyGrammars}`,
122
+ `${fullGrammar}`,
116
123
  ContentType.TEXT_PLAIN,
117
124
  );
118
125
  };
@@ -890,6 +890,6 @@ export class EditorGraphState {
890
890
  return label;
891
891
  }
892
892
  }
893
- return PACKAGEABLE_ELEMENT_TYPE.INTERNAL__UNKNOWN;
893
+ return PACKAGEABLE_ELEMENT_TYPE.INTERNAL__UnknownElement;
894
894
  }
895
895
  }
@@ -27,6 +27,7 @@ import {
27
27
  EngineError,
28
28
  GraphBuilderError,
29
29
  reportGraphAnalytics,
30
+ INTERNAL__UnknownElement,
30
31
  } from '@finos/legend-graph';
31
32
  import {
32
33
  type GeneratorFn,
@@ -35,6 +36,7 @@ import {
35
36
  ActionState,
36
37
  StopWatch,
37
38
  assertNonNullable,
39
+ filterByType,
38
40
  } from '@finos/legend-shared';
39
41
  import type { Entity } from '@finos/legend-storage';
40
42
  import { makeObservable, flow, flowResult, observable } from 'mobx';
@@ -96,6 +98,11 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
96
98
  sourceInformationIndex,
97
99
  );
98
100
 
101
+ //Include the UnknownPackageableElements when sending to compute local changes
102
+ //Otherwise, they get deleted because they dont exist in the graphGrammarText
103
+ const unknownEntities = this.getUnknownPackageableElementsAsEntities();
104
+ entities.push(...unknownEntities);
105
+
99
106
  yield flowResult(
100
107
  this.editorStore.changeDetectionState.computeLocalChangesInTextMode(
101
108
  entities,
@@ -195,6 +202,12 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
195
202
  return this.grammarTextEditorState.currentTextGraphHash;
196
203
  }
197
204
 
205
+ getUnknownPackageableElementsAsEntities(): Entity[] {
206
+ return this.editorStore.graphManagerState.graph.allOwnElements.filter(
207
+ filterByType(INTERNAL__UnknownElement),
208
+ );
209
+ }
210
+
198
211
  *addElement(
199
212
  element: PackageableElement,
200
213
  packagePath: string | undefined,
@@ -354,6 +367,12 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
354
367
  )) as TextCompilationResult;
355
368
 
356
369
  const entities = compilationResult.entities;
370
+
371
+ //Include the UnknownPackageableElements when updating graph and sending to compute local changes
372
+ //Otherwise, they get deleted because they dont exist in the CompilationResult
373
+ const unknownEntities = this.getUnknownPackageableElementsAsEntities();
374
+ entities.push(...unknownEntities);
375
+
357
376
  this.editorStore.graphState.setMostRecentCompilationGraphHash(
358
377
  currentGraphHash,
359
378
  );
@@ -477,8 +496,15 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
477
496
  compilationResult.warnings,
478
497
  )
479
498
  : [];
480
- this.editorStore.graphState.compilationResultEntities =
481
- compilationResult.entities;
499
+
500
+ const entities = compilationResult.entities;
501
+
502
+ //Include the UnknownPackageableElements when updating graph
503
+ //Otherwise, they get deleted because they dont exist in the CompilationResult
504
+ const unknownEntities = this.getUnknownPackageableElementsAsEntities();
505
+ entities.push(...unknownEntities);
506
+
507
+ this.editorStore.graphState.compilationResultEntities = entities;
482
508
  this.editorStore.applicationStore.alertService.setBlockingAlert({
483
509
  message: 'Leaving text mode and rebuilding graph...',
484
510
  showLoading: true,
@@ -557,10 +583,11 @@ export class GraphEditGrammarModeState extends GraphEditorMode {
557
583
  this.grammarTextEditorState.setGraphGrammarText(editorGrammar),
558
584
  );
559
585
  } else {
586
+ //Exclude UnknownPackageableElements from GrammarText editor mode since they cant be tranformed to PureCode
560
587
  const graphGrammar =
561
588
  (yield this.editorStore.graphManagerState.graphManager.graphToPureCode(
562
589
  this.editorStore.graphManagerState.graph,
563
- { pretty: true },
590
+ { pretty: true, excludeUnknown: true },
564
591
  )) as string;
565
592
  yield flowResult(
566
593
  this.grammarTextEditorState.setGraphGrammarText(graphGrammar),
@@ -170,7 +170,7 @@ export class NativeModelImporterEditorState extends ModelImporterEditorState {
170
170
  case MODEL_IMPORT_NATIVE_INPUT_TYPE.PURE_PROTOCOL: {
171
171
  const graphEntities = this.editorStore.graphManagerState.graphBuildState
172
172
  .hasSucceeded
173
- ? this.editorStore.graphManagerState.graph.allOwnElements.map(
173
+ ? this.editorStore.graphManagerState.graph.knownAllOwnElements.map(
174
174
  (element) =>
175
175
  this.editorStore.graphManagerState.graphManager.elementToEntity(
176
176
  element,
@@ -187,7 +187,7 @@ export class NativeModelImporterEditorState extends ModelImporterEditorState {
187
187
  case MODEL_IMPORT_NATIVE_INPUT_TYPE.ENTITIES: {
188
188
  const graphEntities = this.editorStore.graphManagerState.graphBuildState
189
189
  .hasSucceeded
190
- ? this.editorStore.graphManagerState.graph.allOwnElements.map(
190
+ ? this.editorStore.graphManagerState.graph.knownAllOwnElements.map(
191
191
  (element) =>
192
192
  this.editorStore.graphManagerState.graphManager.elementToEntity(
193
193
  element,
@@ -206,6 +206,7 @@ export class NativeModelImporterEditorState extends ModelImporterEditorState {
206
206
  this.modelText =
207
207
  (yield this.editorStore.graphManagerState.graphManager.graphToPureCode(
208
208
  this.editorStore.graphManagerState.graph,
209
+ { excludeUnknown: true },
209
210
  )) as string;
210
211
  break;
211
212
  }
@@ -31,7 +31,7 @@ import {
31
31
  type PackageableElement,
32
32
  GRAPH_MANAGER_EVENT,
33
33
  isElementReadOnly,
34
- INTERNAL__UnknownPackageableElement,
34
+ INTERNAL__UnknownElement,
35
35
  } from '@finos/legend-graph';
36
36
  import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
37
37
  import type { ElementFileGenerationState } from './ElementFileGenerationState.js';
@@ -201,14 +201,11 @@ export abstract class ElementEditorState extends EditorState {
201
201
  );
202
202
  } catch (error) {
203
203
  assertErrorThrown(error);
204
- const isUnknownEntity = isType(
205
- this.element,
206
- INTERNAL__UnknownPackageableElement,
207
- );
204
+ const isUnknownEntity = isType(this.element, INTERNAL__UnknownElement);
208
205
  if (isUnknownEntity) {
209
206
  const unknownEntity = guaranteeType(
210
207
  this.element,
211
- INTERNAL__UnknownPackageableElement,
208
+ INTERNAL__UnknownElement,
212
209
  );
213
210
  this.setTextContent(
214
211
  JSON.stringify(unknownEntity.content, undefined, DEFAULT_TAB_SIZE),
@@ -30,6 +30,7 @@ import {
30
30
  assertTrue,
31
31
  URL_SEPARATOR,
32
32
  filterByType,
33
+ compareSemVerVersions,
33
34
  } from '@finos/legend-shared';
34
35
  import { LEGEND_STUDIO_APP_EVENT } from '../../../../../__lib__/LegendStudioEvent.js';
35
36
  import {
@@ -48,7 +49,6 @@ import {
48
49
  ActionAlertActionType,
49
50
  ActionAlertType,
50
51
  } from '@finos/legend-application';
51
- import { compareSemVerVersions } from '@finos/legend-storage';
52
52
  import { MASTER_SNAPSHOT_ALIAS } from '@finos/legend-server-depot';
53
53
 
54
54
  export const LATEST_PROJECT_REVISION = 'Latest Project Revision';
@@ -73,7 +73,7 @@ export enum PACKAGEABLE_ELEMENT_TYPE {
73
73
  HOSTED_SERVICE = 'HOSTED_SERVICE',
74
74
 
75
75
  TEMPORARY__LOCAL_CONNECTION = 'LOCAL_CONNECTION',
76
- INTERNAL__UNKNOWN = 'UNKNOWN',
76
+ INTERNAL__UnknownElement = 'UNKNOWN',
77
77
  }
78
78
 
79
79
  export enum PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY {