@finos/legend-application-studio 28.21.8 → 28.21.9

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 (20) hide show
  1. package/lib/application/LegendStudioApplicationConfig.d.ts +4 -0
  2. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  3. package/lib/application/LegendStudioApplicationConfig.js +5 -0
  4. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  5. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +39 -6
  7. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  8. package/lib/index.css +2 -2
  9. package/lib/index.css.map +1 -1
  10. package/lib/package.json +1 -1
  11. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/testable/DataProductTestableState.d.ts.map +1 -1
  12. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/testable/DataProductTestableState.js +2 -4
  13. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/testable/DataProductTestableState.js.map +1 -1
  14. package/lib/stores/extensions/DSL_Service_LegendStudioApplicationPlugin_Extension.d.ts +6 -1
  15. package/lib/stores/extensions/DSL_Service_LegendStudioApplicationPlugin_Extension.d.ts.map +1 -1
  16. package/package.json +11 -11
  17. package/src/application/LegendStudioApplicationConfig.ts +9 -0
  18. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +93 -7
  19. package/src/stores/editor/editor-state/element-editor-state/dataProduct/testable/DataProductTestableState.ts +4 -8
  20. package/src/stores/extensions/DSL_Service_LegendStudioApplicationPlugin_Extension.ts +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-studio",
3
- "version": "28.21.8",
3
+ "version": "28.21.9",
4
4
  "description": "Legend Studio application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -47,17 +47,17 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@dagrejs/dagre": "1.1.4",
50
- "@finos/legend-application": "16.0.107",
51
- "@finos/legend-art": "7.1.148",
52
- "@finos/legend-code-editor": "2.0.173",
53
- "@finos/legend-data-cube": "0.3.90",
54
- "@finos/legend-extension-dsl-data-product": "0.0.83",
55
- "@finos/legend-extension-dsl-diagram": "8.1.237",
56
- "@finos/legend-graph": "32.6.5",
57
- "@finos/legend-lego": "2.0.193",
58
- "@finos/legend-query-builder": "4.18.12",
50
+ "@finos/legend-application": "16.0.108",
51
+ "@finos/legend-art": "7.1.149",
52
+ "@finos/legend-code-editor": "2.0.174",
53
+ "@finos/legend-data-cube": "0.3.91",
54
+ "@finos/legend-extension-dsl-data-product": "0.0.84",
55
+ "@finos/legend-extension-dsl-diagram": "8.1.238",
56
+ "@finos/legend-graph": "32.6.6",
57
+ "@finos/legend-lego": "2.0.194",
58
+ "@finos/legend-query-builder": "4.18.13",
59
59
  "@finos/legend-server-depot": "6.1.12",
60
- "@finos/legend-server-lakehouse": "0.3.54",
60
+ "@finos/legend-server-lakehouse": "0.3.55",
61
61
  "@finos/legend-server-sdlc": "5.4.3",
62
62
  "@finos/legend-server-showcase": "0.2.66",
63
63
  "@finos/legend-shared": "11.0.25",
@@ -191,6 +191,7 @@ export interface LegendStudioApplicationConfigurationData
191
191
  query?: { url: string };
192
192
  showcase?: { url: string };
193
193
  pct?: { reportUrl: string };
194
+ legendAI?: { url: string };
194
195
  }
195
196
 
196
197
  export class LegendStudioApplicationConfig extends LegendApplicationConfig {
@@ -205,6 +206,7 @@ export class LegendStudioApplicationConfig extends LegendApplicationConfig {
205
206
  readonly queryApplicationUrl?: string | undefined;
206
207
  readonly showcaseServerUrl?: string | undefined;
207
208
  readonly pctReportUrl?: string | undefined;
209
+ readonly legendAIUrl?: string | undefined;
208
210
 
209
211
  constructor(
210
212
  input: LegendApplicationConfigurationInput<LegendStudioApplicationConfigurationData>,
@@ -275,6 +277,13 @@ export class LegendStudioApplicationConfig extends LegendApplicationConfig {
275
277
  );
276
278
  }
277
279
 
280
+ // legend AI
281
+ if (input.configData.legendAI?.url) {
282
+ this.legendAIUrl = LegendApplicationConfig.resolveAbsoluteUrl(
283
+ input.configData.legendAI.url,
284
+ );
285
+ }
286
+
278
287
  // options
279
288
  this.options = LegendStudioApplicationCoreOptions.create(
280
289
  input.configData.extensions?.core ?? {},
@@ -35,6 +35,7 @@ import {
35
35
  CustomSelectorInput,
36
36
  PanelFormValidatedTextField,
37
37
  PanelContentLists,
38
+ SparkleIcon,
38
39
  } from '@finos/legend-art';
39
40
  import { debounce, prettyCONSTName } from '@finos/legend-shared';
40
41
  import { ServiceExecutionEditor } from './ServiceExecutionEditor.js';
@@ -72,6 +73,7 @@ import { flowResult } from 'mobx';
72
73
  import { LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../../../__lib__/LegendStudioDocumentation.js';
73
74
  import { DocumentationLink } from '@finos/legend-lego/application';
74
75
  import { ServicePostValidationsEditor } from './ServicePostValidationEditor.js';
76
+ import type { DSL_Service_LegendStudioApplicationPlugin_Extension } from '../../../../stores/extensions/DSL_Service_LegendStudioApplicationPlugin_Extension.js';
75
77
 
76
78
  type UserOption = { label: string; value: string };
77
79
 
@@ -242,6 +244,43 @@ const ServiceGeneralEditor = observer(() => {
242
244
  }
243
245
  };
244
246
 
247
+ // AI documentation suggestion
248
+ const legendAIUrl = editorStore.applicationStore.config.legendAIUrl;
249
+ const aiDocSuggester = legendAIUrl
250
+ ? editorStore.pluginManager
251
+ .getApplicationPlugins()
252
+ .map((p) =>
253
+ (
254
+ p as DSL_Service_LegendStudioApplicationPlugin_Extension
255
+ ).getExtraServiceDocumentationAISuggester?.(),
256
+ )
257
+ .find(Boolean)
258
+ : undefined;
259
+ const [isSuggestingWithAI, setIsSuggestingWithAI] = useState(false);
260
+ const [aiDocSuggestion, setAIDocSuggestion] = useState<string | undefined>(
261
+ undefined,
262
+ );
263
+ const suggestDocumentationWithAI = async (): Promise<void> => {
264
+ if (!aiDocSuggester || !legendAIUrl) {
265
+ return;
266
+ }
267
+ setIsSuggestingWithAI(true);
268
+ setAIDocSuggestion(undefined);
269
+ try {
270
+ const suggestion = await aiDocSuggester(service, legendAIUrl);
271
+ setAIDocSuggestion(suggestion);
272
+ } finally {
273
+ setIsSuggestingWithAI(false);
274
+ }
275
+ };
276
+ const applyAIDocSuggestion = (): void => {
277
+ if (!aiDocSuggestion) {
278
+ return;
279
+ }
280
+ service_setDocumentation(service, aiDocSuggestion);
281
+ setAIDocSuggestion(undefined);
282
+ };
283
+
245
284
  const changeTitle: React.ChangeEventHandler<HTMLInputElement> = (event) => {
246
285
  if (!isReadOnly) {
247
286
  service_setTitle(service, event.target.value);
@@ -392,29 +431,76 @@ const ServiceGeneralEditor = observer(() => {
392
431
  <div className="panel__content__form__section">
393
432
  <div className="panel__content__form__section__header__label">
394
433
  Documentation
434
+ {aiDocSuggestion && (
435
+ <span className="service-editor__ai-suggestion-badge">
436
+ <SparkleIcon />
437
+ AI Suggestion
438
+ </span>
439
+ )}
440
+ {aiDocSuggester && !aiDocSuggestion && (
441
+ <button
442
+ className="service-editor__ai-suggest-btn"
443
+ onClick={(): void => {
444
+ suggestDocumentationWithAI().catch(
445
+ editorStore.applicationStore.alertUnhandledError,
446
+ );
447
+ }}
448
+ disabled={isSuggestingWithAI || isReadOnly}
449
+ title="Use AI to suggest documentation for this service"
450
+ >
451
+ <SparkleIcon />
452
+ <span>
453
+ {isSuggestingWithAI ? 'Suggesting...' : 'Suggest with AI'}
454
+ </span>
455
+ </button>
456
+ )}
395
457
  </div>
396
458
  <div
397
459
  className={clsx('panel__content__form__section__header__prompt', {
398
- 'service-editor__general__warning-prompt': !service.documentation,
460
+ 'service-editor__general__warning-prompt':
461
+ !service.documentation && !aiDocSuggestion,
399
462
  })}
400
463
  >
401
- {!service.documentation && (
464
+ {!service.documentation && !aiDocSuggestion && (
402
465
  <ErrorWarnIcon style={{ fontSize: '1.2rem' }} />
403
466
  )}
404
467
  {`Provide a brief description of the service's functionalities and usage`}
405
468
  </div>
406
469
  <textarea
407
- className="panel__content__form__section__textarea service-editor__documentation__input"
470
+ className={clsx(
471
+ 'panel__content__form__section__textarea service-editor__documentation__input',
472
+ { 'textarea--ai-suggested': Boolean(aiDocSuggestion) },
473
+ )}
408
474
  spellCheck={false}
409
475
  disabled={isReadOnly}
410
- value={service.documentation}
476
+ readOnly={Boolean(aiDocSuggestion)}
477
+ value={aiDocSuggestion ?? service.documentation}
411
478
  onChange={changeDocumentation}
412
479
  style={{
413
- borderColor: !service.documentation
414
- ? 'var(--color-red-300)'
415
- : undefined,
480
+ borderColor:
481
+ !service.documentation && !aiDocSuggestion
482
+ ? 'var(--color-red-300)'
483
+ : undefined,
416
484
  }}
417
485
  />
486
+ {aiDocSuggestion && (
487
+ <div className="service-editor__ai-suggestion__actions">
488
+ <button
489
+ className="btn btn--dark service-editor__ai-suggestion__apply-btn"
490
+ onClick={applyAIDocSuggestion}
491
+ title="Apply AI suggestion to documentation"
492
+ >
493
+ Apply Suggestion
494
+ </button>
495
+ <button
496
+ className="btn service-editor__ai-suggestion__dismiss-btn"
497
+ onClick={(): void => setAIDocSuggestion(undefined)}
498
+ title="Dismiss AI suggestion"
499
+ >
500
+ Dismiss
501
+ </button>
502
+ </div>
503
+ )}
418
504
  </div>
419
505
  </PanelForm>
420
506
  <PanelForm>
@@ -576,10 +576,8 @@ export class DataProductTestSuiteState extends TestableTestSuiteEditorState {
576
576
  rawLambdaForTest,
577
577
  this.editorStore.graphManagerState.graph,
578
578
  )) as Accessor[];
579
- resolvedAccessors = all.filter(
580
- (accessor) =>
581
- isIngestOrDataProductAccessor(accessor) &&
582
- accessor.parentElement.path !== this.testableState.dataProduct.path,
579
+ resolvedAccessors = all.filter((accessor) =>
580
+ isIngestOrDataProductAccessor(accessor),
583
581
  );
584
582
  }
585
583
 
@@ -834,10 +832,8 @@ export class DataProductTestableState {
834
832
  rawLambdaForSuite,
835
833
  this.editorStore.graphManagerState.graph,
836
834
  )) as Accessor[];
837
- const externalAccessors = all.filter(
838
- (accessor) =>
839
- isIngestOrDataProductAccessor(accessor) &&
840
- accessor.parentElement.path !== dp.path,
835
+ const externalAccessors = all.filter((accessor) =>
836
+ isIngestOrDataProductAccessor(accessor),
841
837
  );
842
838
  const byElement = new Map<string, Accessor[]>();
843
839
  for (const acc of externalAccessors) {
@@ -23,6 +23,7 @@ import type {
23
23
  ObserverContext,
24
24
  PostDeploymentProperties,
25
25
  HostedService,
26
+ Service,
26
27
  } from '@finos/legend-graph';
27
28
 
28
29
  export type ServiceTestRuntimeConnectionBuilder = (
@@ -48,6 +49,11 @@ export type PostDeploymentActionTypeGetter = (
48
49
  metamodel: PostDeploymentProperties,
49
50
  ) => string | undefined;
50
51
 
52
+ export type ServiceDocumentationAISuggester = (
53
+ service: Service,
54
+ legendAIUrl: string,
55
+ ) => Promise<string>;
56
+
51
57
  export interface DSL_Service_LegendStudioApplicationPlugin_Extension
52
58
  extends DSL_LegendStudioApplicationPlugin_Extension {
53
59
  /**
@@ -70,4 +76,8 @@ export interface DSL_Service_LegendStudioApplicationPlugin_Extension
70
76
  * Get the list of the Classifiers for Post Deployment Actions.
71
77
  */
72
78
  getExtraPostDeploymentActionClassifierGetters?(): PostDeploymentActionTypeGetter[];
79
+ /**
80
+ * Get a suggester function that generates AI-suggested documentation for a service.
81
+ */
82
+ getExtraServiceDocumentationAISuggester?(): ServiceDocumentationAISuggester;
73
83
  }