@finos/legend-application-studio 28.19.3 → 28.19.5
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.
- package/lib/components/ElementIconUtils.d.ts.map +1 -1
- package/lib/components/ElementIconUtils.js +3 -1
- package/lib/components/ElementIconUtils.js.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +6 -0
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts +1 -0
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +19 -0
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.d.ts +19 -0
- package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js +89 -0
- package/lib/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +4 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.js +5 -1
- package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js +15 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.d.ts +35 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js +94 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.js.map +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/package.json +14 -14
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/editor/editor-group/EditorGroup.tsx +11 -0
- package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +35 -0
- package/src/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.tsx +291 -0
- package/src/index.ts +2 -0
- package/src/stores/editor/EditorGraphState.ts +3 -0
- package/src/stores/editor/EditorTabManagerState.ts +7 -0
- package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorState.ts +16 -0
- package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.ts +143 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
- package/tsconfig.json +2 -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
|
+
});
|
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,
|
@@ -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)
|
@@ -0,0 +1,143 @@
|
|
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 PackageableConnection,
|
19
|
+
SnowflakeM2MUdf,
|
20
|
+
ConnectionPointer,
|
21
|
+
InMemoryGraphData,
|
22
|
+
PackageableElementExplicitReference,
|
23
|
+
observe_SnowflakeM2MUdfDeploymentConfiguration,
|
24
|
+
observe_SnowflakeM2MUdf,
|
25
|
+
DeploymentOwner,
|
26
|
+
observe_DeploymentOwnership,
|
27
|
+
} from '@finos/legend-graph';
|
28
|
+
import {
|
29
|
+
type GeneratorFn,
|
30
|
+
ActionState,
|
31
|
+
assertErrorThrown,
|
32
|
+
guaranteeType,
|
33
|
+
} from '@finos/legend-shared';
|
34
|
+
import { makeObservable, action, flow, computed } from 'mobx';
|
35
|
+
import type { EditorStore } from '../../../EditorStore.js';
|
36
|
+
import { ElementEditorState } from '../ElementEditorState.js';
|
37
|
+
|
38
|
+
export class SnowflakeM2MUdfFunctionActivatorEdtiorState extends ElementEditorState {
|
39
|
+
readonly validateState = ActionState.create();
|
40
|
+
readonly deployState = ActionState.create();
|
41
|
+
|
42
|
+
constructor(editorStore: EditorStore, element: SnowflakeM2MUdf) {
|
43
|
+
super(editorStore, element);
|
44
|
+
|
45
|
+
makeObservable(this, {
|
46
|
+
activator: computed,
|
47
|
+
reprocess: action,
|
48
|
+
updateOwnership: action,
|
49
|
+
updateDeploymentSchema: action,
|
50
|
+
updateDeploymentStage: action,
|
51
|
+
updateAppDescription: action,
|
52
|
+
updateUdfName: action,
|
53
|
+
updateConnection: action,
|
54
|
+
validate: flow,
|
55
|
+
deployToSandbox: flow,
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
get activator(): SnowflakeM2MUdf {
|
60
|
+
return observe_SnowflakeM2MUdf(
|
61
|
+
guaranteeType(
|
62
|
+
this.element,
|
63
|
+
SnowflakeM2MUdf,
|
64
|
+
'Element inside snowflake m2m udf function editor state must be a SnowflakeM2MUdf',
|
65
|
+
),
|
66
|
+
);
|
67
|
+
}
|
68
|
+
|
69
|
+
updateConnection(val: PackageableConnection): void {
|
70
|
+
this.activator.activationConfiguration.activationConnection =
|
71
|
+
new ConnectionPointer(PackageableElementExplicitReference.create(val));
|
72
|
+
observe_SnowflakeM2MUdfDeploymentConfiguration(
|
73
|
+
this.activator.activationConfiguration,
|
74
|
+
);
|
75
|
+
}
|
76
|
+
|
77
|
+
updateOwnership(val: string): void {
|
78
|
+
this.activator.ownership = new DeploymentOwner(val, this.activator);
|
79
|
+
observe_DeploymentOwnership(this.activator.ownership);
|
80
|
+
}
|
81
|
+
|
82
|
+
updateUdfName(val: string): void {
|
83
|
+
this.activator.udfName = val;
|
84
|
+
}
|
85
|
+
|
86
|
+
updateDeploymentSchema(val: string | undefined): void {
|
87
|
+
this.activator.deploymentSchema = val;
|
88
|
+
}
|
89
|
+
|
90
|
+
updateDeploymentStage(val: string | undefined): void {
|
91
|
+
this.activator.deploymentStage = val;
|
92
|
+
}
|
93
|
+
|
94
|
+
updateAppDescription(val: string): void {
|
95
|
+
this.activator.description = val;
|
96
|
+
}
|
97
|
+
|
98
|
+
*validate(): GeneratorFn<void> {
|
99
|
+
this.validateState.inProgress();
|
100
|
+
try {
|
101
|
+
yield this.editorStore.graphManagerState.graphManager.validateFunctionActivator(
|
102
|
+
this.activator,
|
103
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
104
|
+
);
|
105
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(
|
106
|
+
`Function activator is valid`,
|
107
|
+
);
|
108
|
+
} catch (error) {
|
109
|
+
assertErrorThrown(error);
|
110
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
111
|
+
} finally {
|
112
|
+
this.validateState.complete();
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
*deployToSandbox(): GeneratorFn<void> {
|
117
|
+
this.deployState.inProgress();
|
118
|
+
try {
|
119
|
+
yield this.editorStore.graphManagerState.graphManager.publishFunctionActivatorToSandbox(
|
120
|
+
this.activator,
|
121
|
+
new InMemoryGraphData(this.editorStore.graphManagerState.graph),
|
122
|
+
);
|
123
|
+
this.editorStore.applicationStore.notificationService.notifySuccess(
|
124
|
+
'SnowflakeM2MUdf Function Activator has been deployed successfully',
|
125
|
+
);
|
126
|
+
} catch (error) {
|
127
|
+
assertErrorThrown(error);
|
128
|
+
this.editorStore.applicationStore.notificationService.notifyError(error);
|
129
|
+
} finally {
|
130
|
+
this.deployState.complete();
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
reprocess(
|
135
|
+
newElement: SnowflakeM2MUdf,
|
136
|
+
editorStore: EditorStore,
|
137
|
+
): SnowflakeM2MUdfFunctionActivatorEdtiorState {
|
138
|
+
return new SnowflakeM2MUdfFunctionActivatorEdtiorState(
|
139
|
+
editorStore,
|
140
|
+
newElement,
|
141
|
+
);
|
142
|
+
}
|
143
|
+
}
|
@@ -70,6 +70,7 @@ export enum PACKAGEABLE_ELEMENT_TYPE {
|
|
70
70
|
SECTION_INDEX = 'SECTION_INDEX',
|
71
71
|
DATA = 'DATA',
|
72
72
|
SNOWFLAKE_APP = 'SNOWFLAKE_APP',
|
73
|
+
SNOWFLAKE_M2M_UDF = 'SNOWFLAKE_M2M_UDF',
|
73
74
|
HOSTED_SERVICE = 'HOSTED_SERVICE',
|
74
75
|
MEM_SQL_FUNCTION = 'MEM_SQL_FUNCTION',
|
75
76
|
// New Strategical Data Product
|
package/tsconfig.json
CHANGED
@@ -136,6 +136,7 @@
|
|
136
136
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/MemSQLFunctionActivatorEditorState.ts",
|
137
137
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/PostDeploymentActionEditorState.ts",
|
138
138
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts",
|
139
|
+
"./src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeM2MUdfFunctionActivatorEditorState.ts",
|
139
140
|
"./src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts",
|
140
141
|
"./src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts",
|
141
142
|
"./src/stores/editor/editor-state/element-editor-state/mapping/FlatDataInstanceSetImplementationState.ts",
|
@@ -272,6 +273,7 @@
|
|
272
273
|
"./src/components/editor/editor-group/function-activator/INTERNAL__UnknownFunctionActivatorEdtior.tsx",
|
273
274
|
"./src/components/editor/editor-group/function-activator/MemSQLFunctionActivatorEditor.tsx",
|
274
275
|
"./src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx",
|
276
|
+
"./src/components/editor/editor-group/function-activator/SnowflakeM2MUdfFunctionActivatorEditor.tsx",
|
275
277
|
"./src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx",
|
276
278
|
"./src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx",
|
277
279
|
"./src/components/editor/editor-group/mapping-editor/ClassMappingEditor.tsx",
|