@finos/legend-application-studio 28.19.2 → 28.19.4

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 (79) hide show
  1. package/lib/application/LegendIngestionConfiguration.d.ts +1 -0
  2. package/lib/application/LegendIngestionConfiguration.d.ts.map +1 -1
  3. package/lib/application/LegendIngestionConfiguration.js +2 -0
  4. package/lib/application/LegendIngestionConfiguration.js.map +1 -1
  5. package/lib/components/ElementIconUtils.d.ts.map +1 -1
  6. package/lib/components/ElementIconUtils.js +3 -1
  7. package/lib/components/ElementIconUtils.js.map +1 -1
  8. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  9. package/lib/components/editor/editor-group/EditorGroup.js +6 -0
  10. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  11. package/lib/components/editor/editor-group/RuntimeEditor.d.ts +8 -1
  12. package/lib/components/editor/editor-group/RuntimeEditor.d.ts.map +1 -1
  13. package/lib/components/editor/editor-group/RuntimeEditor.js +102 -29
  14. package/lib/components/editor/editor-group/RuntimeEditor.js.map +1 -1
  15. package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts +1 -0
  16. package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
  17. package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +19 -0
  18. package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
  19. package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.d.ts +19 -0
  20. package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.d.ts.map +1 -0
  21. package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js +89 -0
  22. package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js.map +1 -0
  23. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  24. package/lib/components/editor/side-bar/CreateNewElementModal.js +18 -7
  25. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/index.d.ts +2 -0
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +2 -0
  31. package/lib/index.js.map +1 -1
  32. package/lib/package.json +1 -1
  33. package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
  34. package/lib/stores/editor/EditorGraphState.js +4 -1
  35. package/lib/stores/editor/EditorGraphState.js.map +1 -1
  36. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  37. package/lib/stores/editor/EditorTabManagerState.js +5 -1
  38. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  39. package/lib/stores/editor/NewElementState.d.ts +6 -0
  40. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  41. package/lib/stores/editor/NewElementState.js +28 -5
  42. package/lib/stores/editor/NewElementState.js.map +1 -1
  43. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.d.ts.map +1 -1
  44. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js +15 -1
  45. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js.map +1 -1
  46. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts +44 -14
  47. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts.map +1 -1
  48. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js +111 -20
  49. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js.map +1 -1
  50. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.d.ts +35 -0
  51. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.d.ts.map +1 -0
  52. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js +94 -0
  53. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js.map +1 -0
  54. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +1 -0
  55. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
  56. package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
  57. package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
  58. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.d.ts +20 -0
  59. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.d.ts.map +1 -0
  60. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js +30 -0
  61. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js.map +1 -0
  62. package/package.json +14 -14
  63. package/src/application/LegendIngestionConfiguration.ts +2 -0
  64. package/src/components/ElementIconUtils.tsx +3 -0
  65. package/src/components/editor/editor-group/EditorGroup.tsx +11 -0
  66. package/src/components/editor/editor-group/RuntimeEditor.tsx +221 -28
  67. package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +35 -0
  68. package/src/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.tsx +291 -0
  69. package/src/components/editor/side-bar/CreateNewElementModal.tsx +56 -16
  70. package/src/index.ts +2 -0
  71. package/src/stores/editor/EditorGraphState.ts +3 -0
  72. package/src/stores/editor/EditorTabManagerState.ts +7 -0
  73. package/src/stores/editor/NewElementState.ts +30 -5
  74. package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorState.ts +16 -0
  75. package/src/stores/editor/editor-state/element-editor-state/RuntimeEditorState.ts +143 -29
  76. package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.ts +143 -0
  77. package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
  78. package/src/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.ts +49 -0
  79. package/tsconfig.json +3 -0
@@ -0,0 +1,291 @@
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 {
18
+ type SelectComponent,
19
+ Panel,
20
+ PanelHeader,
21
+ PanelContent,
22
+ PanelForm,
23
+ PanelFormTextField,
24
+ PURE_FunctionIcon,
25
+ LongArrowRightIcon,
26
+ PanelLoadingIndicator,
27
+ PURE_ConnectionIcon,
28
+ CustomSelectorInput,
29
+ createFilter,
30
+ } from '@finos/legend-art';
31
+ import {
32
+ type PackageableConnection,
33
+ generateFunctionPrettyName,
34
+ RelationalDatabaseConnection,
35
+ DatabaseType,
36
+ } from '@finos/legend-graph';
37
+ import { observer } from 'mobx-react-lite';
38
+ import { useApplicationStore } from '@finos/legend-application';
39
+ import { useEditorStore } from '../../EditorStoreProvider.js';
40
+ import { SnowflakeM2MUdfFunctionActivatorEdtiorState } from '../../../../stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js';
41
+ import { flowResult } from 'mobx';
42
+ import { useRef } from 'react';
43
+ import {
44
+ type RelationalDatabaseConnectionOption,
45
+ buildRelationalDatabaseConnectionOption,
46
+ } from '../connection-editor/RelationalDatabaseConnectionEditor.js';
47
+ import { ActivatorOwnershipForm } from './ActivatorFormComponents.js';
48
+
49
+ export const SnowflakeM2MUdfFunctionActivatorEditor = observer(() => {
50
+ const editorStore = useEditorStore();
51
+ const applicationStore = useApplicationStore();
52
+ const editorState = editorStore.tabManagerState.getCurrentEditorState(
53
+ SnowflakeM2MUdfFunctionActivatorEdtiorState,
54
+ );
55
+ const isReadOnly = editorState.isReadOnly;
56
+ const activator = editorState.activator;
57
+
58
+ const connectionSelectorRef = useRef<SelectComponent>(null);
59
+ const connectionFilterOption = createFilter({
60
+ ignoreCase: true,
61
+ ignoreAccents: false,
62
+ stringify: (option: { data: RelationalDatabaseConnectionOption }): string =>
63
+ option.data.value.path,
64
+ });
65
+ const connectionOptions = editorStore.graphManagerState.usableConnections
66
+ .filter(
67
+ (connection) =>
68
+ connection.connectionValue instanceof RelationalDatabaseConnection &&
69
+ connection.connectionValue.type === DatabaseType.Snowflake,
70
+ )
71
+ .map(buildRelationalDatabaseConnectionOption);
72
+
73
+ const initializeActivationConnection = (
74
+ val: PackageableConnection | undefined,
75
+ ): PackageableConnection | undefined => {
76
+ if (val) {
77
+ editorState.updateConnection(val);
78
+ }
79
+ return !val
80
+ ? undefined
81
+ : activator.activationConfiguration.activationConnection
82
+ ?.packageableConnection.value;
83
+ };
84
+
85
+ const activationConnection = activator.activationConfiguration
86
+ .activationConnection
87
+ ? activator.activationConfiguration.activationConnection
88
+ .packageableConnection.value
89
+ : initializeActivationConnection(connectionOptions.at(0)?.value);
90
+
91
+ const changeConnection = (val: RelationalDatabaseConnectionOption): void => {
92
+ if (!isReadOnly && val.value === activationConnection) {
93
+ return;
94
+ }
95
+ editorState.updateConnection(val.value);
96
+ };
97
+ const changeDescription: React.ChangeEventHandler<HTMLTextAreaElement> = (
98
+ event,
99
+ ) => {
100
+ if (!isReadOnly) {
101
+ editorState.updateAppDescription(event.target.value);
102
+ }
103
+ };
104
+ const visitFunction = (): void =>
105
+ editorState.editorStore.graphEditorMode.openElement(
106
+ activator.function.value,
107
+ );
108
+ const visitConnection = (): void => {
109
+ if (activationConnection) {
110
+ editorState.editorStore.graphEditorMode.openElement(activationConnection);
111
+ }
112
+ };
113
+ const validate = (): void => {
114
+ flowResult(editorState.validate()).catch(
115
+ applicationStore.alertUnhandledError,
116
+ );
117
+ };
118
+ const deploy = (): void => {
119
+ flowResult(editorState.deployToSandbox()).catch(
120
+ applicationStore.alertUnhandledError,
121
+ );
122
+ };
123
+
124
+ return (
125
+ <div className="snowflake-m2m-udf-function-activator-editor">
126
+ <Panel>
127
+ <PanelHeader title="Snowflake M2M Udf Application" />
128
+ <PanelLoadingIndicator
129
+ isLoading={Boolean(
130
+ editorState.validateState.isInProgress ||
131
+ editorState.deployState.isInProgress,
132
+ )}
133
+ />
134
+ <PanelContent>
135
+ <div className="snowflake-m2m-udf-function-activator-editor__header">
136
+ <div className="snowflake-m2m-udf-function-activator-editor__header__label">
137
+ Snowflake Activator Metadata
138
+ </div>
139
+ <div className="snowflake-m2m-udf-function-activator-editor__header__actions">
140
+ <button
141
+ className="snowflake-m2m-udf-function-activator-editor__header__actions__action snowflake-m2m-udf-function-activator-editor__header__actions__action--primary"
142
+ onClick={validate}
143
+ disabled={editorState.validateState.isInProgress}
144
+ tabIndex={-1}
145
+ title="Click Validate to verify your activator before deployment"
146
+ >
147
+ Validate
148
+ </button>
149
+ <button
150
+ className="snowflake-m2m-udf-function-activator-editor__header__actions__action snowflake-m2m-udf-function-activator-editor__header__actions__action--primary"
151
+ onClick={deploy}
152
+ disabled={editorState.deployState.isInProgress}
153
+ title="Deploy to sandbox"
154
+ tabIndex={-1}
155
+ >
156
+ Deploy to Sandbox
157
+ </button>
158
+ </div>
159
+ </div>
160
+ <PanelForm>
161
+ <div className="panel__content__form__section">
162
+ <div className="panel__content__form__section__header__label">
163
+ Function
164
+ </div>
165
+ </div>
166
+ <div className="snowflake-m2m-udf-function-activator-editor__configuration__items">
167
+ <div className="snowflake-m2m-udf-function-activator-editor__configuration__item">
168
+ <div className="btn--sm snowflake-m2m-udf-function-activator-editor__configuration__item__label">
169
+ <PURE_FunctionIcon />
170
+ </div>
171
+ <input
172
+ className="panel__content__form__section__input"
173
+ spellCheck={false}
174
+ disabled={true}
175
+ value={generateFunctionPrettyName(activator.function.value, {
176
+ fullPath: true,
177
+ spacing: false,
178
+ })}
179
+ />
180
+ <button
181
+ className="btn--dark btn--sm snowflake-m2m-udf-function-activator-editor__configuration__item__btn"
182
+ onClick={visitFunction}
183
+ tabIndex={-1}
184
+ title="See Function"
185
+ >
186
+ <LongArrowRightIcon />
187
+ </button>
188
+ </div>
189
+ </div>
190
+ </PanelForm>
191
+ <PanelForm>
192
+ <div className="panel__content__form__section">
193
+ <div className="panel__content__form__section__header__label">
194
+ Connection
195
+ </div>
196
+ </div>
197
+ <div className="snowflake-m2m-udf-function-activator-editor__configuration__items">
198
+ <div className="snowflake-m2m-udf-function-activator-editor__configuration__item">
199
+ <div className="btn--sm snowflake-m2m-udf-function-activator-editor__configuration__item__label">
200
+ <PURE_ConnectionIcon />
201
+ </div>
202
+ <CustomSelectorInput
203
+ inputRef={connectionSelectorRef}
204
+ className="snowflake-m2m-udf-function-activator-editor__config__connection-selector__input"
205
+ options={connectionOptions}
206
+ onChange={changeConnection}
207
+ value={
208
+ activationConnection
209
+ ? buildRelationalDatabaseConnectionOption(
210
+ activationConnection,
211
+ )
212
+ : undefined
213
+ }
214
+ darkMode={
215
+ !applicationStore.layoutService
216
+ .TEMPORARY__isLightColorThemeEnabled
217
+ }
218
+ placeholder="Choose a connection"
219
+ filterOption={connectionFilterOption}
220
+ />
221
+ <button
222
+ className="btn--dark btn--sm snowflake-m2m-udf-function-activator-editor__configuration__item__btn"
223
+ onClick={visitConnection}
224
+ disabled={!activationConnection}
225
+ tabIndex={-1}
226
+ title="See Connection"
227
+ >
228
+ <LongArrowRightIcon />
229
+ </button>
230
+ </div>
231
+ </div>
232
+ </PanelForm>
233
+ <PanelForm>
234
+ <PanelFormTextField
235
+ value={activator.udfName}
236
+ isReadOnly={isReadOnly}
237
+ name="Activator Identifer"
238
+ placeholder="Specify the name of the UDF for this activator..."
239
+ update={(value: string | undefined): void =>
240
+ editorState.updateUdfName(value ?? '')
241
+ }
242
+ />
243
+ </PanelForm>
244
+ <PanelForm>
245
+ <PanelFormTextField
246
+ value={activator.deploymentSchema}
247
+ isReadOnly={isReadOnly}
248
+ name="Deployment Schema"
249
+ placeholder="Specify the deployment schema"
250
+ update={(value: string | undefined): void =>
251
+ editorState.updateDeploymentSchema(value)
252
+ }
253
+ />
254
+ </PanelForm>
255
+ <PanelForm>
256
+ <PanelFormTextField
257
+ value={activator.deploymentStage}
258
+ isReadOnly={isReadOnly}
259
+ name="Deployment Stage"
260
+ placeholder="Specify the deployment stage"
261
+ update={(value: string | undefined): void =>
262
+ editorState.updateDeploymentStage(value)
263
+ }
264
+ />
265
+ </PanelForm>
266
+ <PanelForm>
267
+ <div className="panel__content__form__section">
268
+ <div className="panel__content__form__section__header__label">
269
+ Description
270
+ </div>
271
+ <div className="panel__content__form__section__header__prompt">{`Provide a brief description of Snowflake M2M Udf`}</div>
272
+ <textarea
273
+ className="panel__content__form__section__textarea service-editor__documentation__input"
274
+ spellCheck={false}
275
+ disabled={isReadOnly}
276
+ value={activator.description}
277
+ onChange={changeDescription}
278
+ />
279
+ </div>
280
+ </PanelForm>
281
+ <PanelForm>
282
+ <ActivatorOwnershipForm
283
+ activator={activator}
284
+ isReadOnly={isReadOnly}
285
+ />
286
+ </PanelForm>
287
+ </PanelContent>
288
+ </Panel>
289
+ </div>
290
+ );
291
+ });
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useRef } from 'react';
17
+ import React, { useRef } from 'react';
18
18
  import { LEGEND_STUDIO_TEST_ID } from '../../../__lib__/LegendStudioTesting.js';
19
19
  import { observer } from 'mobx-react-lite';
20
20
  import {
@@ -28,6 +28,7 @@ import {
28
28
  CONNECTION_TYPE,
29
29
  type RuntimeOption,
30
30
  NewLakehouseDataProductDriver,
31
+ NewRuntimeType,
31
32
  } from '../../../stores/editor/NewElementState.js';
32
33
  import { Dialog, compareLabelFn, CustomSelectorInput } from '@finos/legend-art';
33
34
  import type { EditorStore } from '../../../stores/editor/EditorStore.js';
@@ -178,7 +179,23 @@ const NewRuntimeDriverEditor = observer(() => {
178
179
  const newRuntimeDriver = editorStore.newElementState.getNewElementDriver(
179
180
  NewPackageableRuntimeDriver,
180
181
  );
182
+ const type = newRuntimeDriver.type;
183
+ const typeOptions = Object.values(NewRuntimeType).map((typeOption) => ({
184
+ label: prettyCONSTName(typeOption),
185
+ value: typeOption,
186
+ }));
187
+ const typeOption = {
188
+ value: type,
189
+ label: prettyCONSTName(type),
190
+ };
191
+ const onTypeChange = (val: {
192
+ value: NewRuntimeType;
193
+ label: string;
194
+ }): void => {
195
+ newRuntimeDriver.setType(val.value);
196
+ };
181
197
  // mapping
198
+ const isStandard = type === NewRuntimeType.LEGACY;
182
199
  const mapping = newRuntimeDriver.mapping;
183
200
  const mappingOptions =
184
201
  editorStore.graphManagerState.usableMappings.map(buildElementOption);
@@ -193,22 +210,45 @@ const NewRuntimeDriverEditor = observer(() => {
193
210
  }
194
211
  };
195
212
 
196
- if (!mapping) {
197
- // TODO: show warning
198
- return <div>no mapping found</div>;
199
- }
200
213
  return (
201
- <div className="explorer__new-element-modal__driver">
202
- <CustomSelectorInput
203
- className="explorer__new-element-modal__driver__dropdown"
204
- options={mappingOptions}
205
- onChange={onMappingSelectionChange}
206
- value={selectedMappingOption}
207
- darkMode={
208
- !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
209
- }
210
- />
211
- </div>
214
+ <>
215
+ <div className="panel__content__form__section__header__label">
216
+ Runtime Type
217
+ </div>
218
+ <div className="explorer__new-element-modal__driver">
219
+ <CustomSelectorInput
220
+ className="explorer__new-element-modal__driver__dropdown"
221
+ options={typeOptions}
222
+ onChange={onTypeChange}
223
+ value={typeOption}
224
+ darkMode={
225
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
226
+ }
227
+ />
228
+ </div>
229
+ {isStandard &&
230
+ (mapping ? (
231
+ <>
232
+ <div className="panel__content__form__section__header__label">
233
+ Mapping
234
+ </div>
235
+ <div className="explorer__new-element-modal__driver">
236
+ <CustomSelectorInput
237
+ className="explorer__new-element-modal__driver__dropdown"
238
+ options={mappingOptions}
239
+ onChange={onMappingSelectionChange}
240
+ value={selectedMappingOption}
241
+ darkMode={
242
+ !applicationStore.layoutService
243
+ .TEMPORARY__isLightColorThemeEnabled
244
+ }
245
+ />
246
+ </div>
247
+ </>
248
+ ) : (
249
+ <div>no mapping found</div>
250
+ ))}
251
+ </>
212
252
  );
213
253
  });
214
254
 
package/src/index.ts CHANGED
@@ -119,6 +119,8 @@ export type { EmbeddedDataTypeOption } from './stores/editor/editor-state/elemen
119
119
 
120
120
  export { SnowflakeAppFunctionActivatorEdtiorState } from './stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
121
121
  export { SnowflakeAppFunctionActivatorEditor } from './components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js';
122
+ export { SnowflakeM2MUdfFunctionActivatorEdtiorState } from './stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js';
123
+ export { SnowflakeM2MUdfFunctionActivatorEditor } from './components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js';
122
124
  export { HostedServiceFunctionActivatorEditorState } from './stores/editor/editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
123
125
  export { MemSQLFunctionActivatorEditorState } from './stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js';
124
126
  export { MemSQLFunctionActivatorEditor } from './components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.js';
@@ -88,6 +88,7 @@ import {
88
88
  createGraphBuilderReport,
89
89
  ExecutionEnvironmentInstance,
90
90
  SnowflakeApp,
91
+ SnowflakeM2MUdf,
91
92
  GraphEntities,
92
93
  HostedService,
93
94
  DataProduct,
@@ -855,6 +856,8 @@ export class EditorGraphState {
855
856
  return PACKAGEABLE_ELEMENT_TYPE.EXECUTION_ENVIRONMENT;
856
857
  } else if (element instanceof SnowflakeApp) {
857
858
  return PACKAGEABLE_ELEMENT_TYPE.SNOWFLAKE_APP;
859
+ } else if (element instanceof SnowflakeM2MUdf) {
860
+ return PACKAGEABLE_ELEMENT_TYPE.SNOWFLAKE_M2M_UDF;
858
861
  } else if (element instanceof HostedService) {
859
862
  return PACKAGEABLE_ELEMENT_TYPE.HOSTED_SERVICE;
860
863
  } else if (element instanceof DataProduct) {
@@ -34,6 +34,7 @@ import {
34
34
  Service,
35
35
  INTERNAL__UnknownFunctionActivator,
36
36
  SnowflakeApp,
37
+ SnowflakeM2MUdf,
37
38
  HostedService,
38
39
  DataProduct,
39
40
  IngestDefinition,
@@ -65,6 +66,7 @@ import type { DSL_LegendStudioApplicationPlugin_Extension } from '../LegendStudi
65
66
  import { TabManagerState, type TabState } from '@finos/legend-lego/application';
66
67
  import { INTERNAL__UnknownFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js';
67
68
  import { SnowflakeAppFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js';
69
+ import { SnowflakeM2MUdfFunctionActivatorEdtiorState } from './editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js';
68
70
  import { HostedServiceFunctionActivatorEditorState } from './editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
69
71
  import { MemSQLFunctionActivatorEditorState } from './editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.js';
70
72
  import { ArtifactGenerationViewerState } from './editor-state/ArtifactGenerationViewerState.js';
@@ -196,6 +198,11 @@ export class EditorTabManagerState extends TabManagerState {
196
198
  this.editorStore,
197
199
  element,
198
200
  );
201
+ } else if (element instanceof SnowflakeM2MUdf) {
202
+ return new SnowflakeM2MUdfFunctionActivatorEdtiorState(
203
+ this.editorStore,
204
+ element,
205
+ );
199
206
  } else if (element instanceof HostedService) {
200
207
  return new HostedServiceFunctionActivatorEditorState(
201
208
  this.editorStore,
@@ -39,7 +39,6 @@ import {
39
39
  } from './editor-state/GraphGenerationState.js';
40
40
  import {
41
41
  type PackageableElement,
42
- type Runtime,
43
42
  type Store,
44
43
  ModelStore,
45
44
  type Connection,
@@ -85,6 +84,8 @@ import {
85
84
  GenericTypeExplicitReference,
86
85
  GenericType,
87
86
  DataProduct,
87
+ LakehouseRuntime,
88
+ type Runtime,
88
89
  } from '@finos/legend-graph';
89
90
  import type { DSL_Mapping_LegendStudioApplicationPlugin_Extension } from '../extensions/DSL_Mapping_LegendStudioApplicationPlugin_Extension.js';
90
91
  import {
@@ -203,8 +204,14 @@ export abstract class NewElementDriver<T extends PackageableElement> {
203
204
  abstract createElement(name: string): T;
204
205
  }
205
206
 
207
+ export enum NewRuntimeType {
208
+ LEGACY = 'LEGACY',
209
+ LAKEHOUSE = 'LAKEHOUSE',
210
+ }
211
+
206
212
  export class NewPackageableRuntimeDriver extends NewElementDriver<PackageableRuntime> {
207
213
  mapping?: Mapping | undefined;
214
+ type = NewRuntimeType.LEGACY;
208
215
 
209
216
  constructor(editorStore: EditorStore) {
210
217
  super(editorStore);
@@ -213,24 +220,42 @@ export class NewPackageableRuntimeDriver extends NewElementDriver<PackageableRun
213
220
  mapping: observable,
214
221
  setMapping: action,
215
222
  isValid: computed,
223
+ type: observable,
224
+ setType: action,
216
225
  });
217
226
 
218
- const mappings = this.editorStore.graphManagerState.graph.mappings;
219
- if (mappings.length) {
220
- this.mapping = mappings[0];
227
+ const firstMapping = this.editorStore.graphManagerState.graph.mappings[0];
228
+ this.mapping = firstMapping;
229
+ if (!firstMapping) {
230
+ this.type = NewRuntimeType.LAKEHOUSE;
221
231
  }
222
232
  }
223
233
 
234
+ setType(val: NewRuntimeType): void {
235
+ this.type = val;
236
+ }
237
+
224
238
  setMapping(mapping: Mapping): void {
225
239
  this.mapping = mapping;
226
240
  }
227
241
 
228
242
  get isValid(): boolean {
229
- return Boolean(this.mapping);
243
+ if (this.type === NewRuntimeType.LEGACY) {
244
+ return Boolean(this.mapping);
245
+ }
246
+ return true;
230
247
  }
231
248
 
232
249
  createElement(name: string): PackageableRuntime {
233
250
  const runtime = new PackageableRuntime(name);
251
+ if (this.type === NewRuntimeType.LAKEHOUSE) {
252
+ const lakehouseRuntime = new LakehouseRuntime();
253
+ lakehouseRuntime.environment = '';
254
+ lakehouseRuntime.warehouse = '';
255
+ lakehouseRuntime.connectionPointer = undefined;
256
+ runtime.runtimeValue = lakehouseRuntime;
257
+ return runtime;
258
+ }
234
259
  runtime.runtimeValue = new EngineRuntime();
235
260
  runtime_addMapping(
236
261
  runtime.runtimeValue,
@@ -21,9 +21,11 @@ import {
21
21
  type FunctionActivator,
22
22
  PackageableElementExplicitReference,
23
23
  SnowflakeApp,
24
+ SnowflakeM2MUdf,
24
25
  extractElementNameFromPath,
25
26
  extractPackagePathFromPath,
26
27
  SnowflakeAppDeploymentConfiguration,
28
+ SnowflakeM2MUdfDeploymentConfiguration,
27
29
  DeploymentOwner,
28
30
  HostedService,
29
31
  MemSQLFunction,
@@ -89,6 +91,20 @@ export class FunctionActivatorState {
89
91
  ): FunctionActivator | undefined {
90
92
  const type = this.activateType;
91
93
  switch (type) {
94
+ case FUNCTION_ACTIVATE_TYPE.SNOWFLAKE_M2M_UDF: {
95
+ const activatorName = this.activatorPath.includes('::')
96
+ ? extractElementNameFromPath(this.activatorPath)
97
+ : this.activatorPath;
98
+ const snowflakeM2MUdf = new SnowflakeM2MUdf(activatorName);
99
+ snowflakeM2MUdf.udfName = '';
100
+ snowflakeM2MUdf.description = '';
101
+ snowflakeM2MUdf.ownership = new DeploymentOwner('', snowflakeM2MUdf);
102
+ snowflakeM2MUdf.function =
103
+ PackageableElementExplicitReference.create(functionElement);
104
+ snowflakeM2MUdf.activationConfiguration =
105
+ new SnowflakeM2MUdfDeploymentConfiguration();
106
+ return snowflakeM2MUdf;
107
+ }
92
108
  case FUNCTION_ACTIVATE_TYPE.SNOWFLAKE_NATIVE_APP: {
93
109
  const activatorName = this.activatorPath.includes('::')
94
110
  ? extractElementNameFromPath(this.activatorPath)