@finos/legend-application-studio 28.21.46 → 28.21.47

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 +9 -9
  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
@@ -13,18 +13,52 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ConnectionPointer, PackageableElementExplicitReference, } from '@finos/legend-graph';
16
+ import { ConnectionPointer, PackageableElementExplicitReference, LakehouseRuntime, LakehouseSingleStoreRuntime, } from '@finos/legend-graph';
17
17
  import { action } from 'mobx';
18
+ import { packageableRuntime_setRuntimeValue } from './DSL_Mapping_GraphModifierHelper.js';
18
19
  export const lakehouseRuntime_setWarehouse = action((runtime, warehouse) => {
19
20
  runtime.warehouse = warehouse;
20
21
  });
21
- export const lakehouseRuntime_setEnvironment = action((runtime, environment) => {
22
- runtime.environment = environment;
23
- });
24
22
  export const lakehouseRuntime_setConnection = action((runtime, connection) => {
25
23
  runtime.connectionPointer =
26
24
  connection !== undefined
27
25
  ? new ConnectionPointer(PackageableElementExplicitReference.create(connection))
28
26
  : undefined;
29
27
  });
28
+ export var LakehouseComputeEngine;
29
+ (function (LakehouseComputeEngine) {
30
+ LakehouseComputeEngine["SNOWFLAKE"] = "SNOWFLAKE";
31
+ LakehouseComputeEngine["SINGLE_STORE"] = "SINGLE_STORE";
32
+ })(LakehouseComputeEngine || (LakehouseComputeEngine = {}));
33
+ /**
34
+ * Vendor product names, so they are spelled the way the vendor spells them --
35
+ * `prettyCONSTName` cannot produce "SingleStore" from any all-caps constant.
36
+ */
37
+ export const LAKEHOUSE_COMPUTE_ENGINE_LABEL = {
38
+ [LakehouseComputeEngine.SNOWFLAKE]: 'Snowflake',
39
+ [LakehouseComputeEngine.SINGLE_STORE]: 'SingleStore',
40
+ };
41
+ export const getLakehouseComputeEngine = (runtimeValue) => runtimeValue instanceof LakehouseRuntime
42
+ ? LakehouseComputeEngine.SNOWFLAKE
43
+ : LakehouseComputeEngine.SINGLE_STORE;
44
+ /**
45
+ * Swaps the concrete Lakehouse runtime class backing `packageableRuntime`
46
+ * between `LakehouseRuntime` (Snowflake) and `LakehouseSingleStoreRuntime`.
47
+ * These are distinct classes with distinct wire `_type`s, not a flag on one
48
+ * class, so switching compute engine means constructing a new instance --
49
+ * `environment` carries over, `warehouse`/`connectionPointer` naturally fall
50
+ * away (or reset to undefined) since the target class may not have them.
51
+ */
52
+ export const lakehouseRuntime_setComputeEngine = action((packageableRuntime, computeEngine, observerContext) => {
53
+ const current = packageableRuntime.runtimeValue;
54
+ const environment = current instanceof LakehouseRuntime ||
55
+ current instanceof LakehouseSingleStoreRuntime
56
+ ? current.environment
57
+ : undefined;
58
+ const next = computeEngine === LakehouseComputeEngine.SNOWFLAKE
59
+ ? new LakehouseRuntime(environment)
60
+ : new LakehouseSingleStoreRuntime(environment);
61
+ packageableRuntime_setRuntimeValue(packageableRuntime, next, observerContext);
62
+ return next;
63
+ });
30
64
  //# sourceMappingURL=DSL_LakehouseRuntime_GraphModifierHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DSL_LakehouseRuntime_GraphModifierHelper.js","sourceRoot":"","sources":["../../../src/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EAEjB,mCAAmC,GAEpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CACjD,CAAC,OAAyB,EAAE,SAA6B,EAAE,EAAE;IAC3D,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;AAChC,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CACnD,CAAC,OAAyB,EAAE,WAA+B,EAAE,EAAE;IAC7D,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AACpC,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAClD,CACE,OAAyB,EACzB,UAA6C,EAC7C,EAAE;IACF,OAAO,CAAC,iBAAiB;QACvB,UAAU,KAAK,SAAS;YACtB,CAAC,CAAC,IAAI,iBAAiB,CACnB,mCAAmC,CAAC,MAAM,CAAC,UAAU,CAAC,CACvD;YACH,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"DSL_LakehouseRuntime_GraphModifierHelper.js","sourceRoot":"","sources":["../../../src/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EAIjB,mCAAmC,EACnC,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAE1F,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CACjD,CAAC,OAAyB,EAAE,SAA6B,EAAE,EAAE;IAC3D,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;AAChC,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAClD,CACE,OAAyB,EACzB,UAA6C,EAC7C,EAAE;IACF,OAAO,CAAC,iBAAiB;QACvB,UAAU,KAAK,SAAS;YACtB,CAAC,CAAC,IAAI,iBAAiB,CACnB,mCAAmC,CAAC,MAAM,CAAC,UAAU,CAAC,CACvD;YACH,CAAC,CAAC,SAAS,CAAC;AAClB,CAAC,CACF,CAAC;AAEF,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,iDAAuB,CAAA;IACvB,uDAA6B,CAAA;AAC/B,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAGvC;IACF,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,WAAW;IAC/C,CAAC,sBAAsB,CAAC,YAAY,CAAC,EAAE,aAAa;CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,YAA4D,EACpC,EAAE,CAC1B,YAAY,YAAY,gBAAgB;IACtC,CAAC,CAAC,sBAAsB,CAAC,SAAS;IAClC,CAAC,CAAC,sBAAsB,CAAC,YAAY,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CACrD,CACE,kBAAsC,EACtC,aAAqC,EACrC,eAAgC,EACgB,EAAE;IAClD,MAAM,OAAO,GAAG,kBAAkB,CAAC,YAAY,CAAC;IAChD,MAAM,WAAW,GACf,OAAO,YAAY,gBAAgB;QACnC,OAAO,YAAY,2BAA2B;QAC5C,CAAC,CAAC,OAAO,CAAC,WAAW;QACrB,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,IAAI,GACR,aAAa,KAAK,sBAAsB,CAAC,SAAS;QAChD,CAAC,CAAC,IAAI,gBAAgB,CAAC,WAAW,CAAC;QACnC,CAAC,CAAC,IAAI,2BAA2B,CAAC,WAAW,CAAC,CAAC;IACnD,kCAAkC,CAChC,kBAAkB,EAClB,IAAI,EACJ,eAAe,CAChB,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC,CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-studio",
3
- "version": "28.21.46",
3
+ "version": "28.21.47",
4
4
  "description": "Legend Studio application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -49,15 +49,15 @@
49
49
  "@dagrejs/dagre": "1.1.4",
50
50
  "@finos/legend-application": "16.0.125",
51
51
  "@finos/legend-art": "7.1.165",
52
- "@finos/legend-code-editor": "2.0.206",
53
- "@finos/legend-data-cube": "0.3.124",
54
- "@finos/legend-extension-dsl-data-product": "0.1.2",
55
- "@finos/legend-extension-dsl-diagram": "8.1.270",
56
- "@finos/legend-graph": "32.7.2",
57
- "@finos/legend-lego": "2.0.226",
58
- "@finos/legend-query-builder": "4.19.15",
52
+ "@finos/legend-code-editor": "2.0.207",
53
+ "@finos/legend-data-cube": "0.3.125",
54
+ "@finos/legend-extension-dsl-data-product": "0.1.3",
55
+ "@finos/legend-extension-dsl-diagram": "8.1.271",
56
+ "@finos/legend-graph": "32.7.3",
57
+ "@finos/legend-lego": "2.0.227",
58
+ "@finos/legend-query-builder": "4.19.16",
59
59
  "@finos/legend-server-depot": "6.1.22",
60
- "@finos/legend-server-lakehouse": "0.3.86",
60
+ "@finos/legend-server-lakehouse": "0.3.87",
61
61
  "@finos/legend-server-sdlc": "5.5.0",
62
62
  "@finos/legend-server-showcase": "0.2.71",
63
63
  "@finos/legend-shared": "11.0.30",
@@ -135,6 +135,20 @@ export enum LEGEND_STUDIO_APP_EVENT {
135
135
  SERVICE_LEGENDAI_SUGGEST__DISCARD = 'editor.service-editor.legendai-suggest.discard',
136
136
  SERVICE_LEGENDAI_SUGGEST__FAILURE = 'editor.service-editor.legendai-suggest.failure',
137
137
 
138
+ // unified LegendAI suggest lifecycle across surfaces (service / dataspace /
139
+ // data product). Every event carries a `surface` discriminator; events
140
+ // after `launch` also carry a `suggestionId` so a single suggestion can be
141
+ // followed end to end. The per-surface events above are still emitted
142
+ // alongside these for backward compatibility.
143
+ LEGENDAI_SUGGEST__EXPOSURE = 'editor.legendai-suggest.exposure',
144
+ LEGENDAI_SUGGEST__LAUNCH = 'editor.legendai-suggest.launch',
145
+ LEGENDAI_SUGGEST__SUCCESS = 'editor.legendai-suggest.success',
146
+ LEGENDAI_SUGGEST__FAILURE = 'editor.legendai-suggest.failure',
147
+ LEGENDAI_SUGGEST__APPLY = 'editor.legendai-suggest.apply',
148
+ LEGENDAI_SUGGEST__DISCARD = 'editor.legendai-suggest.discard',
149
+ LEGENDAI_SUGGEST__ABANDON = 'editor.legendai-suggest.abandon',
150
+ LEGENDAI_SUGGEST__PERSISTED = 'editor.legendai-suggest.persisted',
151
+
138
152
  // push to dev
139
153
  METADATA_PUSH_TO_METADATA = 'editor.metadata.push-to-metadata',
140
154
  METADATA_PUSH_TO_METADATA__LAUNCH = 'editor.metadata.push-to-metadata.launch',
@@ -174,6 +174,8 @@ export enum GRAPH_EDITOR_MODE_LABEL {
174
174
  export enum FORM_MODE_COMPILATION_ERROR_KIND {
175
175
  COMPILATION = 'compilation',
176
176
  ENGINE = 'engine',
177
+ /** Non-engine error (e.g. network) surfaced while compiling. */
178
+ OTHER = 'other',
177
179
  }
178
180
 
179
181
  export enum GRAPH_INITIALIZATION_ERROR_KIND {
@@ -196,6 +198,22 @@ export type ServiceRegistrationCommonData = {
196
198
  activatePostRegistration: boolean;
197
199
  };
198
200
 
201
+ /**
202
+ * Per-service outcome counts for a registration run. For `single` /
203
+ * `service-query-editor` runs these are always `1` / `0` on success (a
204
+ * failed registration throws and emits `.failure` instead); `bulk` runs
205
+ * report the per-service split returned by the engine.
206
+ */
207
+ export type ServiceRegistrationOutcomeCounts = {
208
+ registeredCount: number;
209
+ failedCount: number;
210
+ /**
211
+ * Only set for `bulk` runs with `activatePostRegistration` — number of
212
+ * successfully registered services whose activation call rejected.
213
+ */
214
+ activationFailedCount?: number | undefined;
215
+ };
216
+
199
217
  export type ServiceRegistrationCheckCommonData = {
200
218
  servicePath: string;
201
219
  envCount: number;
@@ -602,6 +620,160 @@ export type GlobalTestRunCommonData = {
602
620
  testableCount: number;
603
621
  };
604
622
 
623
+ /**
624
+ * Which editor surface a LegendAI suggestion was requested from.
625
+ */
626
+ export enum LEGENDAI_SUGGEST_SURFACE {
627
+ SERVICE = 'service',
628
+ DATASPACE = 'dataspace',
629
+ DATA_PRODUCT = 'data-product',
630
+ }
631
+
632
+ /**
633
+ * Which step of a suggestion request failed: serializing the model to grammar
634
+ * (done locally by the graph manager) or the LegendAI request itself.
635
+ */
636
+ export enum LEGENDAI_SUGGEST_STAGE {
637
+ SERIALIZE = 'serialize',
638
+ REQUEST = 'request',
639
+ }
640
+
641
+ export enum LEGENDAI_SUGGEST_ERROR_KIND {
642
+ /** Grammar serialization failed before LegendAI was called. */
643
+ SERIALIZATION = 'serialization',
644
+ /** HTTP 401 / 403 — the user lacks LegendAI entitlements. */
645
+ ENTITLEMENT = 'entitlement',
646
+ /** Any other HTTP 4xx. */
647
+ CLIENT = 'client',
648
+ /** HTTP 5xx. */
649
+ SERVER = 'server',
650
+ /** LegendAI answered but the suggestion was empty, so nothing was shown. */
651
+ EMPTY_RESPONSE = 'empty-response',
652
+ OTHER = 'other',
653
+ }
654
+
655
+ /**
656
+ * What the user was looking at when they left the editor without applying or
657
+ * dismissing: a request still in flight, or a suggestion already on screen.
658
+ */
659
+ export enum LEGENDAI_SUGGEST_ABANDON_PHASE {
660
+ PENDING = 'pending',
661
+ SHOWN = 'shown',
662
+ }
663
+
664
+ /**
665
+ * State of an applied suggestion's text at the time the element was pushed.
666
+ */
667
+ export enum LEGENDAI_SUGGEST_RETENTION {
668
+ UNCHANGED = 'unchanged',
669
+ EDITED = 'edited',
670
+ CLEARED = 'cleared',
671
+ ELEMENT_REMOVED = 'element-removed',
672
+ }
673
+
674
+ /**
675
+ * Data product only: how the suggested access point group metadata was matched
676
+ * to the group the user applied it on.
677
+ */
678
+ export enum LEGENDAI_SUGGEST_MATCH_STRATEGY {
679
+ NAME = 'name',
680
+ INDEX = 'index',
681
+ NONE = 'none',
682
+ }
683
+
684
+ /**
685
+ * Identifies the editor target a suggestion is about. `accessPointGroupId` is
686
+ * only set for data product suggestions, which are launched per access point
687
+ * group.
688
+ */
689
+ export type LegendAISuggestTarget = {
690
+ surface: LEGENDAI_SUGGEST_SURFACE;
691
+ elementPath: string;
692
+ accessPointGroupId?: string | undefined;
693
+ };
694
+
695
+ export type LegendAISuggestIdentity = LegendAISuggestTarget & {
696
+ suggestionId: string;
697
+ /** 1-based count of suggestions requested from this editor instance. */
698
+ attempt: number;
699
+ };
700
+
701
+ export type LegendAISuggestExposureData = LegendAISuggestTarget & {
702
+ /** Whether a suggester plugin is installed for this surface. */
703
+ available: boolean;
704
+ isReadOnly: boolean;
705
+ };
706
+
707
+ export type LegendAISuggestLaunchData = LegendAISuggestIdentity & {
708
+ hadExistingText: boolean;
709
+ existingLength: number;
710
+ /** Data product only. */
711
+ accessPointCount?: number | undefined;
712
+ };
713
+
714
+ export type LegendAISuggestSuccessData = LegendAISuggestIdentity & {
715
+ durationMs: number;
716
+ /** Length of the grammar sent to LegendAI. */
717
+ definitionsLength: number;
718
+ suggestionLength: number;
719
+ /** Model-reported confidence, when the surface's API returns one. */
720
+ confidence?: number | undefined;
721
+ /** The user edited the target text while the request was in flight. */
722
+ editedWhilePending: boolean;
723
+ /** Data product only: number of access point suggestions for this group. */
724
+ accessPointSuggestionCount?: number | undefined;
725
+ };
726
+
727
+ export type LegendAISuggestFailureData = LegendAISuggestIdentity & {
728
+ durationMs: number;
729
+ stage: LEGENDAI_SUGGEST_STAGE;
730
+ errorKind: LEGENDAI_SUGGEST_ERROR_KIND;
731
+ httpStatus?: number | undefined;
732
+ errorMessage: string;
733
+ };
734
+
735
+ export type LegendAISuggestDataProductApplyData = {
736
+ matchStrategy: LEGENDAI_SUGGEST_MATCH_STRATEGY;
737
+ accessPointsUpdated: number;
738
+ /** Access points whose id was changed by the suggestion. */
739
+ accessPointsRenamed: number;
740
+ /** Suggested names that had to be sanitized into valid identifiers. */
741
+ namesSanitized: number;
742
+ /** Suggested access point count differs from the group's access point count. */
743
+ accessPointCountMismatch: boolean;
744
+ };
745
+
746
+ export type LegendAISuggestApplyData = LegendAISuggestIdentity &
747
+ Partial<LegendAISuggestDataProductApplyData> & {
748
+ timeToDecisionMs: number;
749
+ hadExistingText: boolean;
750
+ existingLength: number;
751
+ suggestionLength: number;
752
+ };
753
+
754
+ export type LegendAISuggestDiscardData = LegendAISuggestIdentity & {
755
+ timeToDecisionMs: number;
756
+ };
757
+
758
+ export type LegendAISuggestAbandonData = LegendAISuggestIdentity & {
759
+ phase: LEGENDAI_SUGGEST_ABANDON_PHASE;
760
+ /** Time since launch (pending) or since the suggestion was shown (shown). */
761
+ elapsedMs: number;
762
+ };
763
+
764
+ export type LegendAISuggestPersistedData = LegendAISuggestIdentity & {
765
+ retention: LEGENDAI_SUGGEST_RETENTION;
766
+ /**
767
+ * Normalized edit distance between the applied and pushed text (0 = same,
768
+ * 1 = fully rewritten). Only set for `edited`, and omitted for very long
769
+ * texts to keep the computation cheap.
770
+ */
771
+ editRatio?: number | undefined;
772
+ msSinceApply: number;
773
+ /** Earlier applies on the same target that were replaced before this push. */
774
+ supersededApplyCount: number;
775
+ };
776
+
605
777
  export class LegendStudioTelemetryHelper {
606
778
  static logEvent_GraphCompilationLaunched(
607
779
  service: TelemetryService,
@@ -739,7 +911,8 @@ export class LegendStudioTelemetryHelper {
739
911
  static logEvent_ServiceRegistrationSucceeded(
740
912
  service: TelemetryService,
741
913
  sourceInfo: LegendSourceInfo | undefined,
742
- data: ServiceRegistrationCommonData & { durationMs: number },
914
+ data: ServiceRegistrationCommonData &
915
+ ServiceRegistrationOutcomeCounts & { durationMs: number },
743
916
  ): void {
744
917
  service.logEvent(LEGEND_STUDIO_APP_EVENT.SERVICE_REGISTRATION_SUCCESS, {
745
918
  sourceInfo,
@@ -750,7 +923,8 @@ export class LegendStudioTelemetryHelper {
750
923
  static logEvent_ServiceRegistrationFailure(
751
924
  service: TelemetryService,
752
925
  sourceInfo: LegendSourceInfo | undefined,
753
- data: ServiceRegistrationCommonData & { errorMessage: string },
926
+ data: ServiceRegistrationCommonData &
927
+ Partial<ServiceRegistrationOutcomeCounts> & { errorMessage: string },
754
928
  ): void {
755
929
  service.logEvent(LEGEND_STUDIO_APP_EVENT.SERVICE_REGISTRATION_FAILURE, {
756
930
  sourceInfo,
@@ -758,7 +932,10 @@ export class LegendStudioTelemetryHelper {
758
932
  });
759
933
  }
760
934
 
761
- // Service registration precheck (per-env "is this service already deployed?")
935
+ // Service registration precheck ("is this service already deployed?" probed
936
+ // against every configured env). One launch and exactly one terminal event
937
+ // (success / failure) per precheck run; per-env errors are aggregated into
938
+ // `errorCount` / `failedEnvs` rather than emitted individually.
762
939
  static logEvent_ServiceRegistrationCheckLaunched(
763
940
  service: TelemetryService,
764
941
  sourceInfo: LegendSourceInfo | undefined,
@@ -777,6 +954,7 @@ export class LegendStudioTelemetryHelper {
777
954
  durationMs: number;
778
955
  registeredEnvCount: number;
779
956
  errorCount: number;
957
+ failedEnvs: string[];
780
958
  },
781
959
  ): void {
782
960
  service.logEvent(
@@ -788,7 +966,13 @@ export class LegendStudioTelemetryHelper {
788
966
  static logEvent_ServiceRegistrationCheckFailure(
789
967
  service: TelemetryService,
790
968
  sourceInfo: LegendSourceInfo | undefined,
791
- data: { servicePath: string; env: string; errorMessage: string },
969
+ data: ServiceRegistrationCheckCommonData & {
970
+ durationMs: number;
971
+ errorCount: number;
972
+ failedEnvs: string[];
973
+ /** Message of the last per-env error encountered. */
974
+ errorMessage: string;
975
+ },
792
976
  ): void {
793
977
  service.logEvent(
794
978
  LEGEND_STUDIO_APP_EVENT.SERVICE_REGISTRATION_CHECK_FAILURE,
@@ -1129,6 +1313,95 @@ export class LegendStudioTelemetryHelper {
1129
1313
  );
1130
1314
  }
1131
1315
 
1316
+ // Unified LegendAI suggest (service / dataspace / data product)
1317
+ static logEvent_LegendAISuggestExposure(
1318
+ service: TelemetryService,
1319
+ sourceInfo: LegendSourceInfo | undefined,
1320
+ data: LegendAISuggestExposureData,
1321
+ ): void {
1322
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__EXPOSURE, {
1323
+ sourceInfo,
1324
+ ...data,
1325
+ });
1326
+ }
1327
+
1328
+ static logEvent_LegendAISuggestLaunched(
1329
+ service: TelemetryService,
1330
+ sourceInfo: LegendSourceInfo | undefined,
1331
+ data: LegendAISuggestLaunchData,
1332
+ ): void {
1333
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__LAUNCH, {
1334
+ sourceInfo,
1335
+ ...data,
1336
+ });
1337
+ }
1338
+
1339
+ static logEvent_LegendAISuggestSucceeded(
1340
+ service: TelemetryService,
1341
+ sourceInfo: LegendSourceInfo | undefined,
1342
+ data: LegendAISuggestSuccessData,
1343
+ ): void {
1344
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__SUCCESS, {
1345
+ sourceInfo,
1346
+ ...data,
1347
+ });
1348
+ }
1349
+
1350
+ static logEvent_LegendAISuggestFailure(
1351
+ service: TelemetryService,
1352
+ sourceInfo: LegendSourceInfo | undefined,
1353
+ data: LegendAISuggestFailureData,
1354
+ ): void {
1355
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__FAILURE, {
1356
+ sourceInfo,
1357
+ ...data,
1358
+ });
1359
+ }
1360
+
1361
+ static logEvent_LegendAISuggestApplied(
1362
+ service: TelemetryService,
1363
+ sourceInfo: LegendSourceInfo | undefined,
1364
+ data: LegendAISuggestApplyData,
1365
+ ): void {
1366
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__APPLY, {
1367
+ sourceInfo,
1368
+ ...data,
1369
+ });
1370
+ }
1371
+
1372
+ static logEvent_LegendAISuggestDiscarded(
1373
+ service: TelemetryService,
1374
+ sourceInfo: LegendSourceInfo | undefined,
1375
+ data: LegendAISuggestDiscardData,
1376
+ ): void {
1377
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__DISCARD, {
1378
+ sourceInfo,
1379
+ ...data,
1380
+ });
1381
+ }
1382
+
1383
+ static logEvent_LegendAISuggestAbandoned(
1384
+ service: TelemetryService,
1385
+ sourceInfo: LegendSourceInfo | undefined,
1386
+ data: LegendAISuggestAbandonData,
1387
+ ): void {
1388
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__ABANDON, {
1389
+ sourceInfo,
1390
+ ...data,
1391
+ });
1392
+ }
1393
+
1394
+ static logEvent_LegendAISuggestPersisted(
1395
+ service: TelemetryService,
1396
+ sourceInfo: LegendSourceInfo | undefined,
1397
+ data: LegendAISuggestPersistedData,
1398
+ ): void {
1399
+ service.logEvent(LEGEND_STUDIO_APP_EVENT.LEGENDAI_SUGGEST__PERSISTED, {
1400
+ sourceInfo,
1401
+ ...data,
1402
+ });
1403
+ }
1404
+
1132
1405
  // Push to Dev Metadata
1133
1406
  static logEvent_DevMetadataPushLaunched(
1134
1407
  service: TelemetryService,
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { useEffect, useState } from 'react';
18
+ import type { EditorStore } from '../../../stores/editor/EditorStore.js';
19
+ import { LegendAISuggestTelemetryTracker } from '../../../stores/editor/LegendAISuggestTelemetry.js';
20
+ import type { LegendAISuggestTarget } from '../../../__lib__/LegendStudioTelemetryHelper.js';
21
+
22
+ /**
23
+ * Creates a {@link LegendAISuggestTelemetryTracker} bound to the lifetime of
24
+ * the calling component: it reports `exposure` on mount (only when a LegendAI
25
+ * URL is configured, so deployments without LegendAI emit nothing) and
26
+ * `abandon` on unmount if a suggestion is still pending or on screen.
27
+ */
28
+ export const useLegendAISuggestTelemetry = (
29
+ editorStore: EditorStore,
30
+ target: LegendAISuggestTarget,
31
+ exposure: {
32
+ legendAIUrl: string | undefined;
33
+ available: boolean;
34
+ isReadOnly: boolean;
35
+ },
36
+ ): LegendAISuggestTelemetryTracker => {
37
+ const [tracker] = useState(
38
+ () => new LegendAISuggestTelemetryTracker(editorStore, target),
39
+ );
40
+ const { surface, elementPath, accessPointGroupId } = target;
41
+ useEffect(() => {
42
+ tracker.setTarget({ surface, elementPath, accessPointGroupId });
43
+ }, [tracker, surface, elementPath, accessPointGroupId]);
44
+
45
+ const hasLegendAIUrl = Boolean(exposure.legendAIUrl);
46
+ const { available, isReadOnly } = exposure;
47
+ useEffect(() => {
48
+ if (hasLegendAIUrl) {
49
+ tracker.reportExposure({ available, isReadOnly });
50
+ }
51
+ return () => tracker.dispose();
52
+ // NOTE: exposure is reported once per mount on purpose; re-reporting on
53
+ // every read-only / availability flip would inflate the funnel denominator.
54
+ // eslint-disable-next-line react-hooks/exhaustive-deps
55
+ }, [tracker]);
56
+ return tracker;
57
+ };