@finos/legend-application-studio 28.21.40 → 28.21.42

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 (60) hide show
  1. package/lib/components/ElementIconUtils.d.ts.map +1 -1
  2. package/lib/components/ElementIconUtils.js +3 -1
  3. package/lib/components/ElementIconUtils.js.map +1 -1
  4. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  5. package/lib/components/editor/editor-group/EditorGroup.js +5 -0
  6. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  7. package/lib/components/editor/editor-group/compute-editor/ComputeEditor.d.ts +19 -0
  8. package/lib/components/editor/editor-group/compute-editor/ComputeEditor.d.ts.map +1 -0
  9. package/lib/components/editor/editor-group/compute-editor/ComputeEditor.js +111 -0
  10. package/lib/components/editor/editor-group/compute-editor/ComputeEditor.js.map +1 -0
  11. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  12. package/lib/components/editor/side-bar/CreateNewElementModal.js +2 -0
  13. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  14. package/lib/index.css +2 -2
  15. package/lib/index.css.map +1 -1
  16. package/lib/index.d.ts +1 -0
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +1 -0
  19. package/lib/index.js.map +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  22. package/lib/stores/editor/EditorStore.js +1 -0
  23. package/lib/stores/editor/EditorStore.js.map +1 -1
  24. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  25. package/lib/stores/editor/EditorTabManagerState.js +5 -1
  26. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  27. package/lib/stores/editor/NewElementState.d.ts +5 -1
  28. package/lib/stores/editor/NewElementState.d.ts.map +1 -1
  29. package/lib/stores/editor/NewElementState.js +21 -1
  30. package/lib/stores/editor/NewElementState.js.map +1 -1
  31. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeEditorState.d.ts +28 -0
  32. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeEditorState.d.ts.map +1 -0
  33. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeEditorState.js +63 -0
  34. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeEditorState.js.map +1 -0
  35. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeFormDescriptor.d.ts +75 -0
  36. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeFormDescriptor.d.ts.map +1 -0
  37. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeFormDescriptor.js +54 -0
  38. package/lib/stores/editor/editor-state/element-editor-state/compute/ComputeFormDescriptor.js.map +1 -0
  39. package/lib/stores/editor/editor-state/element-editor-state/compute/SnowflakeComputeFormDescriptor.d.ts +18 -0
  40. package/lib/stores/editor/editor-state/element-editor-state/compute/SnowflakeComputeFormDescriptor.d.ts.map +1 -0
  41. package/lib/stores/editor/editor-state/element-editor-state/compute/SnowflakeComputeFormDescriptor.js +211 -0
  42. package/lib/stores/editor/editor-state/element-editor-state/compute/SnowflakeComputeFormDescriptor.js.map +1 -0
  43. package/lib/stores/graph-modifier/DSL_Compute_GraphModifierHelper.d.ts +2 -3
  44. package/lib/stores/graph-modifier/DSL_Compute_GraphModifierHelper.d.ts.map +1 -1
  45. package/lib/stores/graph-modifier/DSL_Compute_GraphModifierHelper.js +3 -7
  46. package/lib/stores/graph-modifier/DSL_Compute_GraphModifierHelper.js.map +1 -1
  47. package/package.json +16 -16
  48. package/src/components/ElementIconUtils.tsx +3 -0
  49. package/src/components/editor/editor-group/EditorGroup.tsx +4 -0
  50. package/src/components/editor/editor-group/compute-editor/ComputeEditor.tsx +337 -0
  51. package/src/components/editor/side-bar/CreateNewElementModal.tsx +2 -0
  52. package/src/index.ts +1 -0
  53. package/src/stores/editor/EditorStore.ts +1 -0
  54. package/src/stores/editor/EditorTabManagerState.ts +4 -0
  55. package/src/stores/editor/NewElementState.ts +26 -0
  56. package/src/stores/editor/editor-state/element-editor-state/compute/ComputeEditorState.ts +84 -0
  57. package/src/stores/editor/editor-state/element-editor-state/compute/ComputeFormDescriptor.ts +122 -0
  58. package/src/stores/editor/editor-state/element-editor-state/compute/SnowflakeComputeFormDescriptor.ts +270 -0
  59. package/src/stores/graph-modifier/DSL_Compute_GraphModifierHelper.ts +7 -13
  60. package/tsconfig.json +4 -0
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ type SnowflakeComputeSpecification,
19
+ SnowflakeResourceConstraint,
20
+ SnowflakeScalingPolicy,
21
+ SnowflakeWarehouseSize,
22
+ SnowflakeWarehouseType,
23
+ } from '@finos/legend-graph';
24
+ import {
25
+ type ComputeEnumOption,
26
+ type ComputeEnumOptionValue,
27
+ type ComputeFormDescriptor,
28
+ } from './ComputeFormDescriptor.js';
29
+ import {
30
+ snowflakeSpec_setAutoSuspend,
31
+ snowflakeSpec_setComment,
32
+ snowflakeSpec_setEnableQueryAcceleration,
33
+ snowflakeSpec_setGeneration,
34
+ snowflakeSpec_setMaxClusterCount,
35
+ snowflakeSpec_setMaxConcurrencyLevel,
36
+ snowflakeSpec_setMaxQueryPerformanceLevel,
37
+ snowflakeSpec_setMinClusterCount,
38
+ snowflakeSpec_setQueryAccelerationMaxScaleFactor,
39
+ snowflakeSpec_setQueryThroughputMultiplier,
40
+ snowflakeSpec_setResourceConstraint,
41
+ snowflakeSpec_setScalingPolicy,
42
+ snowflakeSpec_setStatementQueuedTimeoutInSeconds,
43
+ snowflakeSpec_setStatementTimeoutInSeconds,
44
+ snowflakeSpec_setWarehouseSize,
45
+ snowflakeSpec_setWarehouseType,
46
+ } from '../../../../graph-modifier/DSL_Compute_GraphModifierHelper.js';
47
+
48
+ const toEnumOptions = (values: string[]): ComputeEnumOption[] =>
49
+ values.map((value) => ({ label: value, value }));
50
+
51
+ const WAREHOUSE_TYPE_OPTIONS = toEnumOptions(
52
+ Object.values(SnowflakeWarehouseType),
53
+ );
54
+ const WAREHOUSE_SIZE_OPTIONS = toEnumOptions(
55
+ Object.values(SnowflakeWarehouseSize),
56
+ );
57
+ const RESOURCE_CONSTRAINT_OPTIONS = toEnumOptions(
58
+ Object.values(SnowflakeResourceConstraint),
59
+ );
60
+ const SCALING_POLICY_OPTIONS = toEnumOptions(
61
+ Object.values(SnowflakeScalingPolicy),
62
+ );
63
+ const GENERATION_OPTIONS: ComputeEnumOption[] = [
64
+ { label: '1', value: 1 },
65
+ { label: '2', value: 2 },
66
+ ];
67
+
68
+ /** Typed as a warehouse size; the engine rejects the two above `X4LARGE`. */
69
+ const MAX_QUERY_PERFORMANCE_LEVEL_OPTIONS: ComputeEnumOption[] = [
70
+ { label: 'XSMALL', value: SnowflakeWarehouseSize.XSMALL },
71
+ { label: 'SMALL', value: SnowflakeWarehouseSize.SMALL },
72
+ { label: 'MEDIUM', value: SnowflakeWarehouseSize.MEDIUM },
73
+ { label: 'LARGE', value: SnowflakeWarehouseSize.LARGE },
74
+ { label: 'XLARGE', value: SnowflakeWarehouseSize.XLARGE },
75
+ { label: 'XXLARGE', value: SnowflakeWarehouseSize.XXLARGE },
76
+ { label: 'XXXLARGE', value: SnowflakeWarehouseSize.XXXLARGE },
77
+ { label: 'X4LARGE', value: SnowflakeWarehouseSize.X4LARGE },
78
+ ];
79
+
80
+ /** Safe because a field's options are drawn from that enum's members. */
81
+ const asEnumSetter =
82
+ <T extends string>(
83
+ setter: (spec: SnowflakeComputeSpecification, value: T | undefined) => void,
84
+ ) =>
85
+ (
86
+ spec: SnowflakeComputeSpecification,
87
+ value: ComputeEnumOptionValue | undefined,
88
+ ): void =>
89
+ setter(spec, value as T | undefined);
90
+
91
+ const isAdaptive = (spec: SnowflakeComputeSpecification): boolean =>
92
+ spec.warehouseType === SnowflakeWarehouseType.ADAPTIVE;
93
+ const isNotAdaptive = (spec: SnowflakeComputeSpecification): boolean =>
94
+ !isAdaptive(spec);
95
+
96
+ export const SNOWFLAKE_COMPUTE_FORM_DESCRIPTOR: ComputeFormDescriptor = {
97
+ label: 'snowflake compute',
98
+ leadField: {
99
+ key: 'warehouseType',
100
+ label: 'Warehouse Type',
101
+ widget: 'enum',
102
+ options: WAREHOUSE_TYPE_OPTIONS,
103
+ // never absent: it decides which other properties are legal
104
+ defaultValue: SnowflakeWarehouseType.STANDARD,
105
+ visible: () => true,
106
+ get: (spec) => spec.warehouseType,
107
+ set: asEnumSetter(snowflakeSpec_setWarehouseType),
108
+ },
109
+ sections: [
110
+ {
111
+ title: 'Warehouse',
112
+ fields: [
113
+ {
114
+ key: 'warehouseSize',
115
+ label: 'Warehouse Size',
116
+ widget: 'enum',
117
+ options: WAREHOUSE_SIZE_OPTIONS,
118
+ visible: isNotAdaptive,
119
+ get: (spec) => spec.warehouseSize,
120
+ set: asEnumSetter(snowflakeSpec_setWarehouseSize),
121
+ },
122
+ {
123
+ key: 'generation',
124
+ label: 'Generation',
125
+ widget: 'enum',
126
+ options: GENERATION_OPTIONS,
127
+ visible: (spec) =>
128
+ spec.warehouseType === SnowflakeWarehouseType.STANDARD,
129
+ get: (spec) => spec.generation,
130
+ set: (spec, value) =>
131
+ snowflakeSpec_setGeneration(
132
+ spec,
133
+ value === undefined ? undefined : Number(value),
134
+ ),
135
+ },
136
+ {
137
+ key: 'resourceConstraint',
138
+ label: 'Resource Constraint',
139
+ widget: 'enum',
140
+ options: RESOURCE_CONSTRAINT_OPTIONS,
141
+ visible: (spec) =>
142
+ spec.warehouseType === SnowflakeWarehouseType.SNOWPARK_OPTIMIZED,
143
+ get: (spec) => spec.resourceConstraint,
144
+ set: asEnumSetter(snowflakeSpec_setResourceConstraint),
145
+ },
146
+ ],
147
+ },
148
+ {
149
+ title: 'Cluster',
150
+ fields: [
151
+ {
152
+ key: 'minClusterCount',
153
+ label: 'Min Cluster Count',
154
+ widget: 'number',
155
+ visible: isNotAdaptive,
156
+ get: (spec) => spec.minClusterCount,
157
+ set: snowflakeSpec_setMinClusterCount,
158
+ },
159
+ {
160
+ key: 'maxClusterCount',
161
+ label: 'Max Cluster Count',
162
+ widget: 'number',
163
+ visible: isNotAdaptive,
164
+ get: (spec) => spec.maxClusterCount,
165
+ set: snowflakeSpec_setMaxClusterCount,
166
+ },
167
+ {
168
+ key: 'scalingPolicy',
169
+ label: 'Scaling Policy',
170
+ widget: 'enum',
171
+ options: SCALING_POLICY_OPTIONS,
172
+ visible: isNotAdaptive,
173
+ get: (spec) => spec.scalingPolicy,
174
+ set: asEnumSetter(snowflakeSpec_setScalingPolicy),
175
+ },
176
+ ],
177
+ },
178
+ {
179
+ title: 'Adaptive Sizing',
180
+ fields: [
181
+ {
182
+ key: 'maxQueryPerformanceLevel',
183
+ label: 'Max Query Performance Level',
184
+ widget: 'enum',
185
+ options: MAX_QUERY_PERFORMANCE_LEVEL_OPTIONS,
186
+ visible: isAdaptive,
187
+ get: (spec) => spec.maxQueryPerformanceLevel,
188
+ set: asEnumSetter(snowflakeSpec_setMaxQueryPerformanceLevel),
189
+ },
190
+ {
191
+ key: 'queryThroughputMultiplier',
192
+ label: 'Query Throughput Multiplier',
193
+ widget: 'number',
194
+ visible: isAdaptive,
195
+ get: (spec) => spec.queryThroughputMultiplier,
196
+ set: snowflakeSpec_setQueryThroughputMultiplier,
197
+ },
198
+ ],
199
+ },
200
+ {
201
+ title: 'Concurrency & Timeouts',
202
+ fields: [
203
+ {
204
+ key: 'maxConcurrencyLevel',
205
+ label: 'Max Concurrency Level',
206
+ widget: 'number',
207
+ visible: isNotAdaptive,
208
+ get: (spec) => spec.maxConcurrencyLevel,
209
+ set: snowflakeSpec_setMaxConcurrencyLevel,
210
+ },
211
+ {
212
+ key: 'statementQueuedTimeoutInSeconds',
213
+ label: 'Statement Queued Timeout (seconds)',
214
+ widget: 'number',
215
+ visible: () => true,
216
+ get: (spec) => spec.statementQueuedTimeoutInSeconds,
217
+ set: snowflakeSpec_setStatementQueuedTimeoutInSeconds,
218
+ },
219
+ {
220
+ key: 'statementTimeoutInSeconds',
221
+ label: 'Statement Timeout (seconds)',
222
+ widget: 'number',
223
+ visible: () => true,
224
+ get: (spec) => spec.statementTimeoutInSeconds,
225
+ set: snowflakeSpec_setStatementTimeoutInSeconds,
226
+ },
227
+ ],
228
+ },
229
+ {
230
+ title: 'Advanced',
231
+ fields: [
232
+ {
233
+ key: 'autoSuspend',
234
+ label: 'Auto Suspend (seconds)',
235
+ widget: 'number',
236
+ visible: isNotAdaptive,
237
+ get: (spec) => spec.autoSuspend,
238
+ set: snowflakeSpec_setAutoSuspend,
239
+ },
240
+ {
241
+ key: 'comment',
242
+ label: 'Comment',
243
+ widget: 'text',
244
+ visible: () => true,
245
+ get: (spec) => spec.comment,
246
+ set: snowflakeSpec_setComment,
247
+ },
248
+ {
249
+ key: 'enableQueryAcceleration',
250
+ label: 'Query Acceleration',
251
+ widget: 'boolean',
252
+ // a checkbox is two-state: unchecked means `false`, never absent
253
+ defaultValue: false,
254
+ visible: isNotAdaptive,
255
+ get: (spec) => spec.enableQueryAcceleration,
256
+ set: snowflakeSpec_setEnableQueryAcceleration,
257
+ },
258
+ {
259
+ key: 'queryAccelerationMaxScaleFactor',
260
+ label: 'Query Acceleration Max Scale Factor',
261
+ widget: 'number',
262
+ visible: (spec) =>
263
+ isNotAdaptive(spec) && spec.enableQueryAcceleration === true,
264
+ get: (spec) => spec.queryAccelerationMaxScaleFactor,
265
+ set: snowflakeSpec_setQueryAccelerationMaxScaleFactor,
266
+ },
267
+ ],
268
+ },
269
+ ],
270
+ };
@@ -14,17 +14,11 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import type { AppDirComputeOwner, AppDirNode } from '@finos/legend-graph';
18
- import { action } from 'mobx';
17
+ // Compute's owner is the same `AppDirOwner` DataProduct uses
18
+ export {
19
+ appDirNode_setAppDirId,
20
+ appDirOwner_setProdParallel,
21
+ appDirOwner_setProduction,
22
+ } from './DSL_DataProduct_GraphModifierHelper.js';
19
23
 
20
- export const appDirComputeOwner_setProduction = action(
21
- (owner: AppDirComputeOwner, node: AppDirNode | undefined) => {
22
- owner.production = node;
23
- },
24
- );
25
-
26
- export const appDirComputeOwner_setProdParallel = action(
27
- (owner: AppDirComputeOwner, node: AppDirNode | undefined) => {
28
- owner.prodParallel = node;
29
- },
30
- );
24
+ export * from './DSL_Compute_Snowflake_GraphModifierHelper.js';
package/tsconfig.json CHANGED
@@ -127,6 +127,9 @@
127
127
  "./src/stores/editor/editor-state/element-editor-state/UMLEditorState.ts",
128
128
  "./src/stores/editor/editor-state/element-editor-state/availability/AvailabilityEditorState.ts",
129
129
  "./src/stores/editor/editor-state/element-editor-state/availability/testable/AvailabilityTestableState.ts",
130
+ "./src/stores/editor/editor-state/element-editor-state/compute/ComputeEditorState.ts",
131
+ "./src/stores/editor/editor-state/element-editor-state/compute/ComputeFormDescriptor.ts",
132
+ "./src/stores/editor/editor-state/element-editor-state/compute/SnowflakeComputeFormDescriptor.ts",
130
133
  "./src/stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.ts",
131
134
  "./src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts",
132
135
  "./src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderWizardState.ts",
@@ -262,6 +265,7 @@
262
265
  "./src/components/editor/editor-group/accessor/AccessorQueryBuilderHelper.tsx",
263
266
  "./src/components/editor/editor-group/availability/AvailabilityEditor.tsx",
264
267
  "./src/components/editor/editor-group/availability/testable/AvailabilityTestableEditor.tsx",
268
+ "./src/components/editor/editor-group/compute-editor/ComputeEditor.tsx",
265
269
  "./src/components/editor/editor-group/connection-editor/ConnectionEditor.tsx",
266
270
  "./src/components/editor/editor-group/connection-editor/DatabaseBuilderWizard.tsx",
267
271
  "./src/components/editor/editor-group/connection-editor/DatabaseEditorHelper.tsx",