@finos/legend-application-studio 28.18.130 → 28.18.132

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 (80) hide show
  1. package/lib/__lib__/LegendStudioDocumentation.d.ts +1 -0
  2. package/lib/__lib__/LegendStudioDocumentation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioDocumentation.js +1 -0
  4. package/lib/__lib__/LegendStudioDocumentation.js.map +1 -1
  5. package/lib/application/LegendStudioApplicationConfig.d.ts +6 -0
  6. package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
  7. package/lib/application/LegendStudioApplicationConfig.js +7 -0
  8. package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
  9. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.d.ts.map +1 -1
  10. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js +67 -15
  11. package/lib/components/editor/editor-group/dataProduct/DataPoductEditor.js.map +1 -1
  12. package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
  13. package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +43 -5
  14. package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
  15. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  16. package/lib/components/editor/side-bar/CreateNewElementModal.js +11 -1
  17. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  18. package/lib/index.css +2 -2
  19. package/lib/index.css.map +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/stores/editor/EditorTabManagerState.js +1 -1
  22. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  23. package/lib/stores/editor/NewElementState.d.ts +8 -1
  24. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  25. package/lib/stores/editor/NewElementState.js +28 -1
  26. package/lib/stores/editor/NewElementState.js.map +1 -1
  27. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.d.ts +5 -0
  28. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.d.ts.map +1 -1
  29. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.js +13 -0
  30. package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.js.map +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +2 -1
  32. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
  33. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +16 -2
  34. package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
  35. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +33 -11
  36. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  37. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +139 -36
  38. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  39. package/lib/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.d.ts +4 -1
  40. package/lib/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.d.ts.map +1 -1
  41. package/lib/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.js +7 -0
  42. package/lib/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.js.map +1 -1
  43. package/lib/stores/editor/editor-state/element-editor-state/mapping/relational/RelationalInstanceSetImplementationState.d.ts +4 -1
  44. package/lib/stores/editor/editor-state/element-editor-state/mapping/relational/RelationalInstanceSetImplementationState.d.ts.map +1 -1
  45. package/lib/stores/editor/editor-state/element-editor-state/mapping/relational/RelationalInstanceSetImplementationState.js +7 -0
  46. package/lib/stores/editor/editor-state/element-editor-state/mapping/relational/RelationalInstanceSetImplementationState.js.map +1 -1
  47. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +1 -0
  48. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
  49. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +3 -0
  50. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
  51. package/lib/stores/ingestion/AdhocDataProductDeployResponse.d.ts +21 -0
  52. package/lib/stores/ingestion/AdhocDataProductDeployResponse.d.ts.map +1 -0
  53. package/lib/stores/ingestion/AdhocDataProductDeployResponse.js +24 -0
  54. package/lib/stores/ingestion/AdhocDataProductDeployResponse.js.map +1 -0
  55. package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts +4 -0
  56. package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts.map +1 -1
  57. package/lib/stores/ingestion/IngestDeploymentServerClient.js +5 -0
  58. package/lib/stores/ingestion/IngestDeploymentServerClient.js.map +1 -1
  59. package/lib/stores/ingestion/IngestionManager.d.ts +2 -0
  60. package/lib/stores/ingestion/IngestionManager.d.ts.map +1 -1
  61. package/lib/stores/ingestion/IngestionManager.js +8 -0
  62. package/lib/stores/ingestion/IngestionManager.js.map +1 -1
  63. package/package.json +6 -6
  64. package/src/__lib__/LegendStudioDocumentation.ts +1 -0
  65. package/src/application/LegendStudioApplicationConfig.ts +8 -1
  66. package/src/components/editor/editor-group/dataProduct/DataPoductEditor.tsx +178 -8
  67. package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +108 -6
  68. package/src/components/editor/side-bar/CreateNewElementModal.tsx +29 -0
  69. package/src/stores/editor/EditorTabManagerState.ts +1 -1
  70. package/src/stores/editor/NewElementState.ts +34 -1
  71. package/src/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.ts +22 -0
  72. package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +25 -2
  73. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +212 -48
  74. package/src/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.ts +9 -0
  75. package/src/stores/editor/editor-state/element-editor-state/mapping/relational/RelationalInstanceSetImplementationState.ts +10 -0
  76. package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +6 -0
  77. package/src/stores/ingestion/AdhocDataProductDeployResponse.ts +29 -0
  78. package/src/stores/ingestion/IngestDeploymentServerClient.ts +18 -0
  79. package/src/stores/ingestion/IngestionManager.ts +25 -0
  80. package/tsconfig.json +1 -0
@@ -18,6 +18,7 @@ import {
18
18
  DataProduct,
19
19
  LakehouseAccessPoint,
20
20
  type PackageableElement,
21
+ type IngestDefinition,
21
22
  type AccessPoint,
22
23
  stub_RawLambda,
23
24
  LakehouseTargetEnv,
@@ -27,6 +28,7 @@ import {
27
28
  GRAPH_MANAGER_EVENT,
28
29
  isStubbed_RawLambda,
29
30
  AccessPointGroup,
31
+ CodeCompletionResult,
30
32
  } from '@finos/legend-graph';
31
33
  import type { EditorStore } from '../../../EditorStore.js';
32
34
  import { ElementEditorState } from '../ElementEditorState.js';
@@ -39,6 +41,9 @@ import {
39
41
  LogEvent,
40
42
  deleteEntry,
41
43
  filterByType,
44
+ ActionState,
45
+ guaranteeNonNullable,
46
+ assertTrue,
42
47
  } from '@finos/legend-shared';
43
48
  import {
44
49
  dataProduct_addAccessPoint,
@@ -46,12 +51,19 @@ import {
46
51
  dataProduct_deleteAccessPoint,
47
52
  } from '../../../../graph-modifier/DSL_DataProduct_GraphModifierHelper.js';
48
53
  import { LambdaEditorState } from '@finos/legend-query-builder';
54
+ import type { IngestionManager } from '../../../../ingestion/IngestionManager.js';
55
+ import {
56
+ DataProductElementEditorInitialConfiguration,
57
+ EditorInitialConfiguration,
58
+ } from '../ElementEditorInitialConfiguration.js';
59
+ import { EXTERNAL_APPLICATION_NAVIGATION__generateUrlWithEditorConfig } from '../../../../../__lib__/LegendStudioNavigation.js';
60
+ import type { AdhocDataProductDeployResponse } from '../../../../ingestion/AdhocDataProductDeployResponse.js';
49
61
 
50
62
  export class AccessPointState {
51
- readonly state: DataProductEditorState;
63
+ readonly state: AccessPointGroupState;
52
64
  accessPoint: AccessPoint;
53
65
 
54
- constructor(val: AccessPoint, editorState: DataProductEditorState) {
66
+ constructor(val: AccessPoint, editorState: AccessPointGroupState) {
55
67
  this.accessPoint = val;
56
68
  this.state = editorState;
57
69
  }
@@ -62,9 +74,11 @@ export class AccessPointLambdaEditorState extends LambdaEditorState {
62
74
  readonly val: LakehouseAccessPointState;
63
75
 
64
76
  constructor(val: LakehouseAccessPointState) {
65
- super('', LAMBDA_PIPE);
77
+ super('', LAMBDA_PIPE, {
78
+ typeAheadEnabled: true,
79
+ });
66
80
  this.val = val;
67
- this.editorStore = val.state.editorStore;
81
+ this.editorStore = val.state.state.editorStore;
68
82
  }
69
83
 
70
84
  override get lambdaId(): string {
@@ -104,7 +118,7 @@ export class AccessPointLambdaEditorState extends LambdaEditorState {
104
118
  }): GeneratorFn<void> {
105
119
  if (
106
120
  !isStubbed_RawLambda(this.val.accessPoint.func) &&
107
- !this.val.state.isConvertingTransformLambdaObjects
121
+ !this.val.state.state.isConvertingTransformLambdaObjects
108
122
  ) {
109
123
  try {
110
124
  const lambdas = new Map<string, RawLambda>();
@@ -135,12 +149,33 @@ export class AccessPointLambdaEditorState extends LambdaEditorState {
135
149
  this.setLambdaString('');
136
150
  }
137
151
  }
152
+
153
+ override async getCodeComplete(input: string): Promise<CodeCompletionResult> {
154
+ try {
155
+ return (await this.editorStore.graphManagerState.graphManager.getCodeComplete(
156
+ input,
157
+ this.editorStore.graphManagerState.graph,
158
+ undefined,
159
+ {
160
+ ignoreElements: [this.val.state.state.product.path],
161
+ },
162
+ )) as unknown as CodeCompletionResult;
163
+ } catch (error) {
164
+ assertErrorThrown(error);
165
+ this.editorStore.applicationStore.logService.error(
166
+ LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
167
+ error,
168
+ );
169
+ return new CodeCompletionResult();
170
+ }
171
+ }
138
172
  }
173
+
139
174
  export class LakehouseAccessPointState extends AccessPointState {
140
175
  declare accessPoint: LakehouseAccessPoint;
141
176
  lambdaState: AccessPointLambdaEditorState;
142
177
 
143
- constructor(val: LakehouseAccessPoint, editorState: DataProductEditorState) {
178
+ constructor(val: LakehouseAccessPoint, editorState: AccessPointGroupState) {
144
179
  super(val, editorState);
145
180
  makeObservable(this, {
146
181
  lambdaState: observable,
@@ -150,36 +185,122 @@ export class LakehouseAccessPointState extends AccessPointState {
150
185
  }
151
186
  }
152
187
 
188
+ export class AccessPointGroupState {
189
+ readonly state: DataProductEditorState;
190
+ value: AccessPointGroup;
191
+ accessPointStates: AccessPointState[] = [];
192
+
193
+ constructor(val: AccessPointGroup, editorState: DataProductEditorState) {
194
+ this.value = val;
195
+ this.state = editorState;
196
+ this.accessPointStates = val.accessPoints.map((e) =>
197
+ this.buildAccessPointState(e),
198
+ );
199
+ makeObservable(this, {
200
+ value: observable,
201
+ accessPointStates: observable,
202
+ addAccessPoint: action,
203
+ deleteAccessPoint: action,
204
+ });
205
+ }
206
+
207
+ deleteAccessPoint(val: AccessPointState): void {
208
+ const state = this.accessPointStates.find((a) => a === val);
209
+ deleteEntry(this.accessPointStates, state);
210
+ dataProduct_deleteAccessPoint(this.value, val.accessPoint);
211
+ }
212
+
213
+ addAccessPoint(point: AccessPoint): void {
214
+ const accessPointState = this.buildAccessPointState(point);
215
+ addUniqueEntry(this.accessPointStates, accessPointState);
216
+ dataProduct_addAccessPoint(this.value, point);
217
+ }
218
+
219
+ buildAccessPointState(val: AccessPoint): AccessPointState {
220
+ if (val instanceof LakehouseAccessPoint) {
221
+ return new LakehouseAccessPointState(val, this);
222
+ }
223
+ return new AccessPointState(val, this);
224
+ }
225
+ }
226
+
227
+ const createEditorInitialConfiguration = (): EditorInitialConfiguration => {
228
+ const config = new EditorInitialConfiguration();
229
+ const ingest = new DataProductElementEditorInitialConfiguration();
230
+ ingest.deployOnOpen = true;
231
+ config.elementEditorConfiguration = ingest;
232
+ return config;
233
+ };
234
+
235
+ const editorInitialConfigToBase64 = (val: EditorInitialConfiguration): string =>
236
+ btoa(JSON.stringify(EditorInitialConfiguration.serialization.toJson(val)));
237
+
238
+ export const generateUrlToDeployOnOpen = (
239
+ val: DataProductEditorState,
240
+ ): string => {
241
+ return val.editorStore.applicationStore.navigationService.navigator.generateAddress(
242
+ EXTERNAL_APPLICATION_NAVIGATION__generateUrlWithEditorConfig(
243
+ val.editorStore.editorMode.generateElementLink(val.product.path),
244
+ editorInitialConfigToBase64(createEditorInitialConfiguration()),
245
+ ),
246
+ );
247
+ };
248
+
153
249
  export class DataProductEditorState extends ElementEditorState {
154
250
  accessPointModal = false;
155
- accessPointStates: AccessPointState[] = [];
251
+ deploymentState = ActionState.create();
252
+ accessPointGroupStates: AccessPointGroupState[] = [];
156
253
  isConvertingTransformLambdaObjects = false;
254
+ deployOnOpen = false;
255
+ deployResponse: AdhocDataProductDeployResponse | undefined;
157
256
 
158
- constructor(editorStore: EditorStore, element: PackageableElement) {
257
+ constructor(
258
+ editorStore: EditorStore,
259
+ element: PackageableElement,
260
+ config?: EditorInitialConfiguration,
261
+ ) {
159
262
  super(editorStore, element);
160
263
 
161
264
  makeObservable(this, {
162
265
  product: computed,
163
266
  accessPointModal: observable,
164
- accessPointStates: observable,
165
- deleteAccessPoint: observable,
267
+ accessPointGroupStates: observable,
166
268
  isConvertingTransformLambdaObjects: observable,
269
+ deploy: flow,
270
+ deployOnOpen: observable,
271
+ deployResponse: observable,
272
+ setDeployOnOpen: action,
273
+ setDeployResponse: action,
167
274
  setAccessPointModal: action,
168
275
  addAccessPoint: action,
169
276
  convertAccessPointsFuncObjects: flow,
170
277
  });
171
- this.accessPointStates = this.product.accessPointGroups
172
- .map((e) => e.accessPoints)
173
- .flat()
174
- .map((e) => this.buildAccessPointState(e));
278
+ this.accessPointGroupStates = this.product.accessPointGroups.map(
279
+ (e) => new AccessPointGroupState(e, this),
280
+ );
281
+ const elementConfig = config?.elementEditorConfiguration;
282
+ if (elementConfig instanceof DataProductElementEditorInitialConfiguration) {
283
+ this.deployOnOpen = elementConfig.deployOnOpen ?? false;
284
+ }
285
+ }
286
+
287
+ setDeployOnOpen(value: boolean): void {
288
+ this.deployOnOpen = value;
289
+ }
290
+
291
+ setDeployResponse(
292
+ response: AdhocDataProductDeployResponse | undefined,
293
+ ): void {
294
+ this.deployResponse = response;
175
295
  }
176
296
 
177
297
  *convertAccessPointsFuncObjects(): GeneratorFn<void> {
178
298
  const lambdas = new Map<string, RawLambda>();
179
299
  const index = new Map<string, LakehouseAccessPointState>();
180
- const states = this.accessPointStates.filter(
181
- filterByType(LakehouseAccessPointState),
182
- );
300
+ const states = this.accessPointGroupStates
301
+ .map((e) => e.accessPointStates)
302
+ .flat()
303
+ .filter(filterByType(LakehouseAccessPointState));
183
304
  states.forEach((pm) => {
184
305
  if (!isStubbed_RawLambda(pm.accessPoint.func)) {
185
306
  lambdas.set(pm.lambdaState.lambdaId, pm.accessPoint.func);
@@ -211,50 +332,66 @@ export class DataProductEditorState extends ElementEditorState {
211
332
  }
212
333
  }
213
334
 
214
- buildAccessPointState(val: AccessPoint): AccessPointState {
215
- if (val instanceof LakehouseAccessPoint) {
216
- return new LakehouseAccessPointState(val, this);
217
- }
218
- return new AccessPointState(val, this);
219
- }
220
-
221
335
  setAccessPointModal(val: boolean): void {
222
336
  this.accessPointModal = val;
223
337
  }
224
338
 
225
- deleteAccessPoint(val: AccessPointState): void {
226
- const ap = val.accessPoint;
227
- // find group
228
- const group = this.product.accessPointGroups.find((g) =>
229
- Boolean(g.accessPoints.find((v) => v === ap)),
230
- );
231
- if (group) {
232
- dataProduct_deleteAccessPoint(group, ap);
233
- deleteEntry(this.accessPointStates, val);
234
- }
235
- }
236
-
237
- addAccessPoint(id: string): void {
339
+ addAccessPoint(
340
+ id: string,
341
+ description: string | undefined,
342
+ accessPointGroup: AccessPointGroupState | string,
343
+ ): void {
238
344
  const accesspoint = new LakehouseAccessPoint(
239
345
  id,
240
346
  LakehouseTargetEnv.Snowflake,
241
347
  stub_RawLambda(),
242
348
  );
243
-
244
- const group =
245
- this.product.accessPointGroups[0] ?? this.createBareGroupAndAdd();
246
- dataProduct_addAccessPoint(group, accesspoint);
247
- addUniqueEntry(
248
- this.accessPointStates,
249
- this.buildAccessPointState(accesspoint),
250
- );
349
+ accesspoint.description = description;
350
+ const groupState =
351
+ accessPointGroup instanceof AccessPointGroupState
352
+ ? accessPointGroup
353
+ : this.createBareGroupAndAdd(accessPointGroup);
354
+ groupState.addAccessPoint(accesspoint);
355
+ addUniqueEntry(this.accessPointGroupStates, groupState);
251
356
  }
252
357
 
253
- createBareGroupAndAdd(): AccessPointGroup {
358
+ createBareGroupAndAdd(id: string): AccessPointGroupState {
254
359
  const group = new AccessPointGroup();
255
- group.id = 'default';
360
+ group.id = 'id';
256
361
  dataProduct_addAccessPointGroup(this.product, group);
257
- return group;
362
+ return new AccessPointGroupState(group, this);
363
+ }
364
+
365
+ *deploy(token: string | undefined): GeneratorFn<void> {
366
+ try {
367
+ assertTrue(
368
+ this.validForDeployment,
369
+ 'Data product definition is not valid for deployment',
370
+ );
371
+ this.deploymentState.inProgress();
372
+ // The grammar we provide will be for the current data product + all ingests (used for compilation)
373
+ const grammar =
374
+ (yield this.editorStore.graphManagerState.graphManager.elementsToPureCode(
375
+ [...this.editorStore.graphManagerState.graph.ingests, this.product],
376
+ )) as unknown as string;
377
+
378
+ const response = (yield guaranteeNonNullable(
379
+ this.ingestionManager,
380
+ ).deployDataProduct(
381
+ grammar,
382
+ guaranteeNonNullable(this.associatedIngest?.appDirDeployment),
383
+ this.deploymentState,
384
+ token,
385
+ )) as unknown as AdhocDataProductDeployResponse;
386
+ this.setDeployResponse(response);
387
+ } catch (error) {
388
+ assertErrorThrown(error);
389
+ this.editorStore.applicationStore.notificationService.notifyError(
390
+ `Ingest definition failed to deploy: ${error.message}`,
391
+ );
392
+ } finally {
393
+ this.deploymentState.complete();
394
+ }
258
395
  }
259
396
 
260
397
  get product(): DataProduct {
@@ -265,10 +402,37 @@ export class DataProductEditorState extends ElementEditorState {
265
402
  );
266
403
  }
267
404
 
405
+ get validForDeployment(): boolean {
406
+ return Boolean(
407
+ this.associatedIngest?.appDirDeployment && this.ingestionManager,
408
+ );
409
+ }
410
+
268
411
  get accessPoints(): AccessPoint[] {
269
412
  return this.product.accessPointGroups.map((e) => e.accessPoints).flat();
270
413
  }
271
414
 
415
+ get ingestionManager(): IngestionManager | undefined {
416
+ return this.editorStore.ingestionManager;
417
+ }
418
+
419
+ get deployValidationMessage(): string {
420
+ if (!this.associatedIngest?.appDirDeployment) {
421
+ return 'No app dir deployment found';
422
+ } else if (!this.ingestionManager) {
423
+ return 'No ingestion manager found';
424
+ }
425
+ return 'Deploy';
426
+ }
427
+
428
+ // We need to get the associated Ingest to get the app dir deployment
429
+ // We could do a more in depth check on the access point lambdas to check which ingest it uses but for now
430
+ // we will assume all ingests have the same DID
431
+ // we get the last one, to prioritize the ones in the current project followed by dependency ones
432
+ get associatedIngest(): IngestDefinition | undefined {
433
+ return this.editorStore.graphManagerState.graph.ingests.slice(-1)[0];
434
+ }
435
+
272
436
  override reprocess(
273
437
  newElement: PackageableElement,
274
438
  editorStore: EditorStore,
@@ -50,6 +50,7 @@ import {
50
50
  stub_RawLambda,
51
51
  isStubbed_RawLambda,
52
52
  SetImplementationExplicitReference,
53
+ type CodeCompletionResult,
53
54
  } from '@finos/legend-graph';
54
55
  import { MAPPING_ELEMENT_TYPE } from './MappingEditorState.js';
55
56
 
@@ -297,6 +298,14 @@ export class EmbeddedFlatDataInstanceSetImplementationState
297
298
  setImplementation.propertyMappings,
298
299
  );
299
300
  }
301
+ typeAheadEnabled = false;
302
+ getCodeComplete(input: string): Promise<CodeCompletionResult> {
303
+ throw new Error('Method not implemented.');
304
+ }
305
+
306
+ setTypeAhead(val: boolean): void {
307
+ this.typeAheadEnabled = val;
308
+ }
300
309
 
301
310
  get lambdaId(): string {
302
311
  throw new IllegalStateError(
@@ -43,6 +43,7 @@ import {
43
43
  buildSourceInformationSourceId,
44
44
  isStubbed_RawRelationalOperationElement,
45
45
  stub_RawRelationalOperationElement,
46
+ type CodeCompletionResult,
46
47
  } from '@finos/legend-graph';
47
48
 
48
49
  export class RelationalPropertyMappingState extends PropertyMappingState {
@@ -158,6 +159,7 @@ export class EmbeddedRelationalInstanceSetImplementationState
158
159
  declare instanceSetImplementationState: RelationalInstanceSetImplementationState;
159
160
  declare mappingElement: EmbeddedRelationalInstanceSetImplementation;
160
161
  declare propertyMapping: EmbeddedRelationalInstanceSetImplementation;
162
+ typeAheadEnabled = false;
161
163
 
162
164
  constructor(
163
165
  editorStore: EditorStore,
@@ -173,6 +175,10 @@ export class EmbeddedRelationalInstanceSetImplementationState
173
175
  );
174
176
  }
175
177
 
178
+ setTypeAhead(val: boolean): void {
179
+ this.typeAheadEnabled = val;
180
+ }
181
+
176
182
  get lambdaId(): string {
177
183
  throw new IllegalStateError(
178
184
  `Can't build lambda ID for embedded relational instance set implementation state`,
@@ -234,6 +240,10 @@ export class EmbeddedRelationalInstanceSetImplementationState
234
240
  }): GeneratorFn<void> {
235
241
  throw new UnsupportedOperationError();
236
242
  }
243
+
244
+ getCodeComplete(input: string): Promise<CodeCompletionResult> {
245
+ throw new Error('Method not implemented.');
246
+ }
237
247
  }
238
248
 
239
249
  export class RootRelationalInstanceSetImplementationState extends RelationalInstanceSetImplementationState {
@@ -51,3 +51,9 @@ export const dataProduct_deleteAccessPointGroup = action(
51
51
  deleteEntry(product.accessPointGroups, accessPointGroup);
52
52
  },
53
53
  );
54
+
55
+ export const dataProduct_setTitle = action(
56
+ (product: DataProduct, title: string) => {
57
+ product.title = title;
58
+ },
59
+ );
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2020-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 type { PlainObject } from '@finos/legend-shared';
18
+
19
+ export class AdhocDataProductDeployResponse {
20
+ content!: PlainObject;
21
+ }
22
+
23
+ export const createAdhocDataProductDeployResponse = (
24
+ json: PlainObject<AdhocDataProductDeployResponse>,
25
+ ): AdhocDataProductDeployResponse => {
26
+ const response = new AdhocDataProductDeployResponse();
27
+ response.content = json;
28
+ return response;
29
+ };
@@ -26,9 +26,12 @@ import type {
26
26
  IngestDefinitionValidationResponse,
27
27
  } from './IngestionDeploymentResponse.js';
28
28
  import type { IngestDeploymentServerConfig } from '../../application/LegendIngestionConfiguration.js';
29
+ import type { AdhocDataProductDeployResponse } from './AdhocDataProductDeployResponse.js';
29
30
 
30
31
  export class IngestDeploymentServerClient extends AbstractServerClient {
31
32
  environmentClassification: string;
33
+
34
+ private DATA_PRODUCT_URL = 'data-product';
32
35
  constructor(config: IngestDeploymentServerConfig) {
33
36
  super({
34
37
  baseUrl: config.ingestServerUrl,
@@ -49,6 +52,9 @@ export class IngestDeploymentServerClient extends AbstractServerClient {
49
52
  Authorization: `Bearer ${token}`,
50
53
  });
51
54
 
55
+ private _dataProduct = (): string =>
56
+ `${this.baseUrl}/${this.DATA_PRODUCT_URL}/api/entitlements/sdlc/deploy/definitions`;
57
+
52
58
  private _ingest = (): string =>
53
59
  `${this.baseUrl}/api/ingest/sdlc/deploy/definitions`;
54
60
 
@@ -80,4 +86,16 @@ export class IngestDeploymentServerClient extends AbstractServerClient {
80
86
  this._tokenWithTextPlain(token),
81
87
  );
82
88
  }
89
+
90
+ deployDataProduct(
91
+ fullGrammar: string,
92
+ token: string | undefined,
93
+ ): Promise<PlainObject<AdhocDataProductDeployResponse>> {
94
+ return this.post(
95
+ `${this._dataProduct()}`,
96
+ fullGrammar,
97
+ undefined,
98
+ this._tokenWithTextPlain(token),
99
+ );
100
+ }
83
101
  }
@@ -30,6 +30,10 @@ import {
30
30
  IngestDeploymentServerConfig,
31
31
  type LegendIngestionConfiguration,
32
32
  } from '../../application/LegendIngestionConfiguration.js';
33
+ import {
34
+ createAdhocDataProductDeployResponse,
35
+ type AdhocDataProductDeployResponse,
36
+ } from './AdhocDataProductDeployResponse.js';
33
37
 
34
38
  export class IngestionManager {
35
39
  private ingestDiscoveryServerClient: IngestDiscoveryServerClient;
@@ -109,6 +113,27 @@ export class IngestionManager {
109
113
  return fullResponse;
110
114
  }
111
115
 
116
+ async deployDataProduct(
117
+ grammarText: string,
118
+ appDirNode: AppDirNode,
119
+ actionState: ActionState | undefined,
120
+ token: string | undefined,
121
+ ): Promise<AdhocDataProductDeployResponse> {
122
+ actionState?.setMessage(
123
+ `Discovering associated data product environment for DID ${appDirNode.appDirId}...`,
124
+ );
125
+ await this.identifyIngestDeploymentServer(appDirNode, token);
126
+ actionState?.setMessage(
127
+ `Deploying data product with server ${this.ingestDeploymentServerClient.baseUrl ?? ''} for realm ${this.ingestDeploymentServerClient.environmentClassification}...`,
128
+ );
129
+ const deployResponse =
130
+ await this.ingestDeploymentServerClient.deployDataProduct(
131
+ grammarText,
132
+ token,
133
+ );
134
+ return createAdhocDataProductDeployResponse(deployResponse);
135
+ }
136
+
112
137
  private async _validate(
113
138
  ingestDefinition: string,
114
139
  appDirNode: AppDirNode | undefined,
package/tsconfig.json CHANGED
@@ -205,6 +205,7 @@
205
205
  "./src/stores/graph-modifier/STO_FlatData_GraphModifierHelper.ts",
206
206
  "./src/stores/graph-modifier/STO_Relational_GraphModifierHelper.ts",
207
207
  "./src/stores/graph-modifier/Testable_GraphModifierHelper.ts",
208
+ "./src/stores/ingestion/AdhocDataProductDeployResponse.ts",
208
209
  "./src/stores/ingestion/IngestDeploymentServerClient.ts",
209
210
  "./src/stores/ingestion/IngestDiscoveryServerClient.ts",
210
211
  "./src/stores/ingestion/IngestionDeploymentResponse.ts",