@finos/legend-application-query 13.8.28 → 13.8.30

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 (66) hide show
  1. package/lib/__lib__/LegendQueryNavigation.d.ts +12 -0
  2. package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendQueryNavigation.js +16 -0
  4. package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
  5. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/Core_LegendQueryApplicationPlugin.js +15 -0
  7. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  8. package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
  9. package/lib/components/LegendQueryWebApplication.js +2 -1
  10. package/lib/components/LegendQueryWebApplication.js.map +1 -1
  11. package/lib/components/QueryEditor.d.ts.map +1 -1
  12. package/lib/components/QueryEditor.js +5 -1
  13. package/lib/components/QueryEditor.js.map +1 -1
  14. package/lib/components/data-product/LegendQueryDataProductQueryBuilder.d.ts.map +1 -1
  15. package/lib/components/data-product/LegendQueryDataProductQueryBuilder.js +6 -40
  16. package/lib/components/data-product/LegendQueryDataProductQueryBuilder.js.map +1 -1
  17. package/lib/components/ingest/IngestInfo.d.ts +32 -0
  18. package/lib/components/ingest/IngestInfo.d.ts.map +1 -0
  19. package/lib/components/ingest/IngestInfo.js +63 -0
  20. package/lib/components/ingest/IngestInfo.js.map +1 -0
  21. package/lib/components/ingest/IngestQueryBuilderSetupPanel.d.ts +18 -0
  22. package/lib/components/ingest/IngestQueryBuilderSetupPanel.d.ts.map +1 -0
  23. package/lib/components/ingest/IngestQueryBuilderSetupPanel.js +77 -0
  24. package/lib/components/ingest/IngestQueryBuilderSetupPanel.js.map +1 -0
  25. package/lib/components/ingest/IngestQueryCreator.d.ts +27 -0
  26. package/lib/components/ingest/IngestQueryCreator.d.ts.map +1 -0
  27. package/lib/components/ingest/IngestQueryCreator.js +45 -0
  28. package/lib/components/ingest/IngestQueryCreator.js.map +1 -0
  29. package/lib/components/shared/LakehouseRuntimeConfigModal.d.ts +29 -0
  30. package/lib/components/shared/LakehouseRuntimeConfigModal.d.ts.map +1 -0
  31. package/lib/components/shared/LakehouseRuntimeConfigModal.js +60 -0
  32. package/lib/components/shared/LakehouseRuntimeConfigModal.js.map +1 -0
  33. package/lib/index.css +1 -1
  34. package/lib/light-mode.css +1 -1
  35. package/lib/package.json +1 -1
  36. package/lib/stores/QueryEditorStore.d.ts +10 -0
  37. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  38. package/lib/stores/QueryEditorStore.js +81 -2
  39. package/lib/stores/QueryEditorStore.js.map +1 -1
  40. package/lib/stores/ingest/IngestLegendQueryBuilderState.d.ts +122 -0
  41. package/lib/stores/ingest/IngestLegendQueryBuilderState.d.ts.map +1 -0
  42. package/lib/stores/ingest/IngestLegendQueryBuilderState.js +191 -0
  43. package/lib/stores/ingest/IngestLegendQueryBuilderState.js.map +1 -0
  44. package/lib/stores/ingest/IngestQueryCreatorStore.d.ts +75 -0
  45. package/lib/stores/ingest/IngestQueryCreatorStore.d.ts.map +1 -0
  46. package/lib/stores/ingest/IngestQueryCreatorStore.js +169 -0
  47. package/lib/stores/ingest/IngestQueryCreatorStore.js.map +1 -0
  48. package/lib/stores/ingest/IngestQueryGraphHelper.d.ts +58 -0
  49. package/lib/stores/ingest/IngestQueryGraphHelper.d.ts.map +1 -0
  50. package/lib/stores/ingest/IngestQueryGraphHelper.js +72 -0
  51. package/lib/stores/ingest/IngestQueryGraphHelper.js.map +1 -0
  52. package/package.json +12 -12
  53. package/src/__lib__/LegendQueryNavigation.ts +35 -0
  54. package/src/components/Core_LegendQueryApplicationPlugin.tsx +20 -0
  55. package/src/components/LegendQueryWebApplication.tsx +14 -0
  56. package/src/components/QueryEditor.tsx +12 -0
  57. package/src/components/data-product/LegendQueryDataProductQueryBuilder.tsx +7 -127
  58. package/src/components/ingest/IngestInfo.tsx +197 -0
  59. package/src/components/ingest/IngestQueryBuilderSetupPanel.tsx +204 -0
  60. package/src/components/ingest/IngestQueryCreator.tsx +75 -0
  61. package/src/components/shared/LakehouseRuntimeConfigModal.tsx +148 -0
  62. package/src/stores/QueryEditorStore.ts +131 -1
  63. package/src/stores/ingest/IngestLegendQueryBuilderState.ts +259 -0
  64. package/src/stores/ingest/IngestQueryCreatorStore.ts +262 -0
  65. package/src/stores/ingest/IngestQueryGraphHelper.ts +120 -0
  66. package/tsconfig.json +7 -0
@@ -0,0 +1,191 @@
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
+ import { LakehouseRuntime, QueryIngestExecutionContext, } from '@finos/legend-graph';
17
+ import { AccessorQueryBuilderState, } from '@finos/legend-query-builder';
18
+ import { action, makeObservable, observable, runInAction } from 'mobx';
19
+ import { assertErrorThrown } from '@finos/legend-shared';
20
+ import { renderIngestQueryBuilderSetupPanelContent } from '../../components/ingest/IngestQueryBuilderSetupPanel.js';
21
+ import { generateIngestQueryCreatorRoute } from '../../__lib__/LegendQueryNavigation.js';
22
+ /**
23
+ * Query builder state for an ingest-backed query.
24
+ *
25
+ * Extends {@link AccessorQueryBuilderState} because an ingest definition is
26
+ * already an `AccessorOwner` (see `AccessorQueryBuilderState.accessorOwners`)
27
+ * and ingest queries don't require a mapping (`requiresMappingForExecution`
28
+ * is already `false` in the base class).
29
+ *
30
+ * The execution context produced here is a {@link QueryIngestExecutionContext}
31
+ * carrying `ingestDefinitionPath` and `dataSet` — the same two values the
32
+ * route handler resolved from the URL.
33
+ */
34
+ export class IngestLegendQueryBuilderState extends AccessorQueryBuilderState {
35
+ /**
36
+ * Currently selected & graph-resolved ingest definition. Observable so the
37
+ * setup panel re-renders when the user picks a different ingest from the
38
+ * source dropdown.
39
+ */
40
+ ingestDefinition;
41
+ /**
42
+ * All ingest definition paths discovered in the project (fetched up front
43
+ * via depot's classifier-scoped entities endpoint). Only `ingestDefinition`
44
+ * is actually built into the graph — the others are surfaced as paths so
45
+ * the user can switch without paying the cost of building them all.
46
+ */
47
+ allIngestPaths;
48
+ /**
49
+ * Swap callback wired by {@link IngestQueryCreatorStore}. Deletes the
50
+ * currently built ingest from the graph, builds the target one from its
51
+ * cached entity, and returns the new metamodel instance.
52
+ */
53
+ swapIngest;
54
+ project;
55
+ /**
56
+ * Adhoc lakehouse runtime built from the user's lakehouse environment +
57
+ * consumer warehouse, mirroring how `LegendQueryDataProductQueryBuilderState`
58
+ * builds its runtime for model-access / lakehouse access points. Created by
59
+ * the creator store (where the depot/lakehouse clients live) and injected
60
+ * here so the editor can execute against it without a packaged runtime.
61
+ */
62
+ adhocRuntime;
63
+ /**
64
+ * Loading flag flipped while {@link changeIngestDefinition} is fetching /
65
+ * rebuilding the newly selected ingest. Lets the setup panel disable the
66
+ * source dropdown during the swap so we don't get overlapping changes.
67
+ */
68
+ isSwappingIngest = false;
69
+ constructor(applicationStore, accessor, graphManagerState, workflow, actionConfig, ingestDefinition, allIngestPaths, swapIngest, adhocRuntime, project, config, sourceInfo) {
70
+ super(applicationStore, accessor, graphManagerState, workflow, actionConfig, config, sourceInfo);
71
+ makeObservable(this, {
72
+ ingestDefinition: observable,
73
+ isSwappingIngest: observable,
74
+ changeIngestDefinition: action,
75
+ });
76
+ this.ingestDefinition = ingestDefinition;
77
+ this.allIngestPaths = allIngestPaths;
78
+ this.swapIngest = swapIngest;
79
+ this.adhocRuntime = adhocRuntime;
80
+ this.project = project;
81
+ }
82
+ TEMPORARY__setupPanelContentRenderer = () => renderIngestQueryBuilderSetupPanelContent(this);
83
+ /**
84
+ * The currently selected data set. Derived from `sourceAccessor` so it
85
+ * stays in sync with `changeAccessor` (e.g. when the user picks a different
86
+ * data set, or when {@link changeIngestDefinition} re-points the source).
87
+ */
88
+ get dataSet() {
89
+ return this.sourceAccessor?.accessor ?? '';
90
+ }
91
+ getQueryExecutionContext() {
92
+ const exec = new QueryIngestExecutionContext();
93
+ exec.ingestDefinitionPath = this.ingestDefinition.path;
94
+ exec.dataSet = this.dataSet;
95
+ return exec;
96
+ }
97
+ /**
98
+ * The deep-link flow opens the editor against a single, pre-resolved ingest
99
+ * definition. The user shouldn't be picking a different owner, but we still
100
+ * surface the current ingest so the source dropdown reflects the selection
101
+ * instead of rendering the empty "Choose a source..." placeholder.
102
+ *
103
+ * The full list of selectable ingests is exposed separately via
104
+ * {@link allIngestPaths} (the others aren't built into the graph yet — see
105
+ * {@link changeIngestDefinition}).
106
+ */
107
+ get accessorOwners() {
108
+ return [this.ingestDefinition];
109
+ }
110
+ /**
111
+ * Execution always goes through {@link adhocRuntime} (selected by the
112
+ * creator store). Return an empty list so the runtime dropdown is hidden
113
+ * and the user can't override it.
114
+ */
115
+ get compatibleRuntimes() {
116
+ return [];
117
+ }
118
+ /**
119
+ * The adhoc lakehouse runtime is registered on the graph under the
120
+ * `_internal_` package so the editor can resolve it, but it is not part
121
+ * of the published project. Surface it as a floating execution element so
122
+ * it's bundled into the execution payload at run time (mirrors what the
123
+ * data-product flow does for its lakehouse runtime).
124
+ */
125
+ get floatingExecutionElements() {
126
+ return this.graphManagerState.graph.origin !== undefined
127
+ ? [this.adhocRuntime]
128
+ : undefined;
129
+ }
130
+ /**
131
+ * Convenience accessor: the underlying {@link LakehouseRuntime} on the
132
+ * adhoc runtime, if any. Used by the setup panel to feed the runtime
133
+ * configuration modal.
134
+ */
135
+ get lakehouseRuntime() {
136
+ return this.adhocRuntime.runtimeValue instanceof LakehouseRuntime
137
+ ? this.adhocRuntime.runtimeValue
138
+ : undefined;
139
+ }
140
+ /**
141
+ * Swap the active ingest definition to the one at `path`. Triggered by the
142
+ * source dropdown in {@link IngestQueryBuilderSetupPanel}. Delegates the
143
+ * graph mutation (delete current, build new) to {@link swapIngest} and then
144
+ * rewires the source accessor so the editor reflects the new ingest's
145
+ * datasets.
146
+ */
147
+ async changeIngestDefinition(path) {
148
+ if (path === this.ingestDefinition.path || this.isSwappingIngest) {
149
+ return;
150
+ }
151
+ runInAction(() => {
152
+ this.isSwappingIngest = true;
153
+ });
154
+ try {
155
+ const next = await this.swapIngest(path);
156
+ runInAction(() => {
157
+ this.ingestDefinition = next;
158
+ });
159
+ // Re-derive `sourceAccessor` against the new ingest. The previously
160
+ // selected data set most likely doesn't exist on the new ingest, so
161
+ // pick the first available one (if any).
162
+ await this.changeAccessorOwner(next);
163
+ const firstAccessor = this.accessors[0];
164
+ if (firstAccessor) {
165
+ await this.changeAccessor(firstAccessor);
166
+ }
167
+ }
168
+ catch (error) {
169
+ assertErrorThrown(error);
170
+ this.applicationStore.notificationService.notifyError(error);
171
+ }
172
+ finally {
173
+ runInAction(() => {
174
+ this.isSwappingIngest = false;
175
+ });
176
+ }
177
+ }
178
+ /**
179
+ * Copies the deep-link to this ingest query set up (GAV + ingest definition
180
+ * path + data set) to the user's clipboard. Mirrors
181
+ * `LegendQueryDataProductQueryBuilderState.copyDataProductLinkToClipBoard`.
182
+ */
183
+ copyIngestQueryLinkToClipBoard() {
184
+ const route = this.applicationStore.navigationService.navigator.generateAddress(generateIngestQueryCreatorRoute(this.project.groupId, this.project.artifactId, this.project.versionId, this.ingestDefinition.path, this.dataSet));
185
+ navigator.clipboard
186
+ .writeText(route)
187
+ .then(() => this.applicationStore.notificationService.notifySuccess('Copied ingest query set up link to clipboard'))
188
+ .catch(() => this.applicationStore.notificationService.notifyError('Error copying ingest query set up link to clipboard'));
189
+ }
190
+ }
191
+ //# sourceMappingURL=IngestLegendQueryBuilderState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IngestLegendQueryBuilderState.js","sourceRoot":"","sources":["../../../src/stores/ingest/IngestLegendQueryBuilderState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAQL,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,GAI1B,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,yCAAyC,EAAE,MAAM,yDAAyD,CAAC;AACpH,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AAEzF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,6BAA8B,SAAQ,yBAAyB;IAC1E;;;;OAIG;IACH,gBAAgB,CAAmB;IACnC;;;;;OAKG;IACM,cAAc,CAAW;IAClC;;;;OAIG;IACM,UAAU,CAA8C;IACxD,OAAO,CAAwB;IACxC;;;;;;OAMG;IACM,YAAY,CAAqB;IAC1C;;;;OAIG;IACH,gBAAgB,GAAG,KAAK,CAAC;IAEzB,YACE,gBAA+C,EAC/C,QAA8B,EAC9B,iBAAoC,EACpC,QAAmC,EACnC,YAAsC,EACtC,gBAAkC,EAClC,cAAwB,EACxB,UAAuD,EACvD,YAAgC,EAChC,OAA8B,EAC9B,MAAuC,EACvC,UAA4C;QAE5C,KAAK,CACH,gBAAgB,EAChB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAU,CACX,CAAC;QACF,cAAc,CAAC,IAAI,EAAE;YACnB,gBAAgB,EAAE,UAAU;YAC5B,gBAAgB,EAAE,UAAU;YAC5B,sBAAsB,EAAE,MAAM;SAC/B,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,C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,SAAS,CAAC,SAAS;aAChB,SAAS,CAAC,KAAK,CAAC;aAChB,IAAI,CAAC,GAAG,EAAE,CACT,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,aAAa,CACrD,8CAA8C,CAC/C,CACF;aACA,KAAK,CAAC,GAAG,EAAE,CACV,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,WAAW,CACnD,qDAAqD,CACtD,CACF,CAAC;IACN,CAAC;CACF"}
@@ -0,0 +1,75 @@
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
+ import { type GeneratorFn } from '@finos/legend-shared';
17
+ import type { DepotServerClient } from '@finos/legend-server-depot';
18
+ import { type ProjectGAVCoordinates } from '@finos/legend-storage';
19
+ import { type QueryBuilderState } from '@finos/legend-query-builder';
20
+ import { type RawLambda, IngestDefinition } from '@finos/legend-graph';
21
+ import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
22
+ import { QueryEditorStore, type QueryPersistConfiguration } from '../QueryEditorStore.js';
23
+ import { IngestLegendQueryBuilderState } from './IngestLegendQueryBuilderState.js';
24
+ /**
25
+ * Creator store backing the `INGEST_QUERY` route.
26
+ *
27
+ * Unlike the data-product creator (which builds a full graph to back the
28
+ * editor's element browsing), the ingest flow only needs the single ingest
29
+ * definition entity. We therefore override {@link QueryEditorStore.buildGraph}
30
+ * to fetch JUST that entity from Depot and build a minimal graph containing
31
+ * it — no dependency resolution, no full project entity fetch.
32
+ */
33
+ export declare class IngestQueryCreatorStore extends QueryEditorStore {
34
+ readonly groupId: string;
35
+ readonly artifactId: string;
36
+ readonly versionId: string;
37
+ readonly ingestDefinitionPath: string;
38
+ readonly dataSet: string;
39
+ /**
40
+ * All ingest definition entities for this project version, keyed by path.
41
+ * Populated up front by {@link buildGraph} so the source dropdown can list
42
+ * every ingest without forcing us to build them all into the graph. The
43
+ * entity payloads are kept so {@link swapIngestDefinition} can build a
44
+ * different one on demand.
45
+ */
46
+ private _ingestEntitiesByPath;
47
+ queryBuilderState: IngestLegendQueryBuilderState | undefined;
48
+ constructor(applicationStore: LegendQueryApplicationStore, depotServerClient: DepotServerClient, groupId: string, artifactId: string, versionId: string, ingestDefinitionPath: string, dataSet: string);
49
+ getProjectInfo(): ProjectGAVCoordinates;
50
+ /**
51
+ * Fetch every ingest definition entity in the project (so the source
52
+ * dropdown can show them all) but only build the requested one into the
53
+ * graph. The remaining entity payloads are cached on
54
+ * {@link _ingestEntitiesByPath} and built on demand when the user swaps
55
+ * ingests via {@link swapIngestDefinition}.
56
+ *
57
+ * TODO: revisit once `IngestDefinition` is properly modelled. Today the
58
+ * entity is self-contained, but materialized views can reference other
59
+ * elements (mappings, classes, runtimes, etc.) — at that point we'll need
60
+ * to either fetch those dependent entities too, or fall back to a full
61
+ * project build like the data-product creator does.
62
+ */
63
+ buildGraph(): GeneratorFn<void>;
64
+ /**
65
+ * Remove the currently built ingest from the graph and build the entity at
66
+ * `path` in its place. Backs {@link IngestLegendQueryBuilderState.swapIngest}
67
+ * — see that callsite for why we don't pre-build every ingest.
68
+ */
69
+ swapIngestDefinition(path: string): Promise<IngestDefinition>;
70
+ initializeQueryBuilderState(): Promise<QueryBuilderState>;
71
+ getPersistConfiguration(lambda: RawLambda, options?: {
72
+ update?: boolean | undefined;
73
+ }): QueryPersistConfiguration;
74
+ }
75
+ //# sourceMappingURL=IngestQueryCreatorStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IngestQueryCreatorStore.d.ts","sourceRoot":"","sources":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IAmCzC;;;;OAIG;IACG,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAe7D,2BAA2B,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAmE/D,uBAAuB,CACrB,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GACzC,yBAAyB;CAkB7B"}
@@ -0,0 +1,169 @@
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
+ import { assertErrorThrown, guaranteeType, LogEvent, StopWatch, uuid, } from '@finos/legend-shared';
17
+ import { extractEntityNameFromPath, } from '@finos/legend-storage';
18
+ import { QueryBuilderDataBrowserWorkflow, } from '@finos/legend-query-builder';
19
+ import { GRAPH_MANAGER_EVENT, IngestDefinition, } from '@finos/legend-graph';
20
+ import { QueryEditorStore, QueryBuilderActionConfig_QueryApplication, } from '../QueryEditorStore.js';
21
+ import { LEGEND_QUERY_APP_EVENT } from '../../__lib__/LegendQueryEvent.js';
22
+ import { IngestLegendQueryBuilderState } from './IngestLegendQueryBuilderState.js';
23
+ import { fetchIngestEntitiesByClassifier, swapIngestInGraph, } from './IngestQueryGraphHelper.js';
24
+ /**
25
+ * Creator store backing the `INGEST_QUERY` route.
26
+ *
27
+ * Unlike the data-product creator (which builds a full graph to back the
28
+ * editor's element browsing), the ingest flow only needs the single ingest
29
+ * definition entity. We therefore override {@link QueryEditorStore.buildGraph}
30
+ * to fetch JUST that entity from Depot and build a minimal graph containing
31
+ * it — no dependency resolution, no full project entity fetch.
32
+ */
33
+ export class IngestQueryCreatorStore extends QueryEditorStore {
34
+ groupId;
35
+ artifactId;
36
+ versionId;
37
+ ingestDefinitionPath;
38
+ dataSet;
39
+ /**
40
+ * All ingest definition entities for this project version, keyed by path.
41
+ * Populated up front by {@link buildGraph} so the source dropdown can list
42
+ * every ingest without forcing us to build them all into the graph. The
43
+ * entity payloads are kept so {@link swapIngestDefinition} can build a
44
+ * different one on demand.
45
+ */
46
+ _ingestEntitiesByPath = new Map();
47
+ constructor(applicationStore, depotServerClient, groupId, artifactId, versionId, ingestDefinitionPath, dataSet) {
48
+ super(applicationStore, depotServerClient);
49
+ this.groupId = groupId;
50
+ this.artifactId = artifactId;
51
+ this.versionId = versionId;
52
+ this.ingestDefinitionPath = ingestDefinitionPath;
53
+ this.dataSet = dataSet;
54
+ }
55
+ getProjectInfo() {
56
+ return {
57
+ groupId: this.groupId,
58
+ artifactId: this.artifactId,
59
+ versionId: this.versionId,
60
+ };
61
+ }
62
+ /**
63
+ * Fetch every ingest definition entity in the project (so the source
64
+ * dropdown can show them all) but only build the requested one into the
65
+ * graph. The remaining entity payloads are cached on
66
+ * {@link _ingestEntitiesByPath} and built on demand when the user swaps
67
+ * ingests via {@link swapIngestDefinition}.
68
+ *
69
+ * TODO: revisit once `IngestDefinition` is properly modelled. Today the
70
+ * entity is self-contained, but materialized views can reference other
71
+ * elements (mappings, classes, runtimes, etc.) — at that point we'll need
72
+ * to either fetch those dependent entities too, or fall back to a full
73
+ * project build like the data-product creator does.
74
+ */
75
+ *buildGraph() {
76
+ const stopWatch = new StopWatch();
77
+ yield this.graphManagerState.initializeSystem();
78
+ stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH_SYSTEM__SUCCESS);
79
+ this.initState.setMessage(`Fetching ingest definitions...`);
80
+ this._ingestEntitiesByPath = (yield fetchIngestEntitiesByClassifier(this.depotServerClient, this.groupId, this.artifactId, this.versionId));
81
+ this.initState.setMessage(undefined);
82
+ stopWatch.record(GRAPH_MANAGER_EVENT.FETCH_GRAPH_ENTITIES__SUCCESS);
83
+ const target = this._ingestEntitiesByPath.get(this.ingestDefinitionPath);
84
+ if (!target) {
85
+ throw new Error(`Can't find ingest definition '${this.ingestDefinitionPath}' in project ${this.groupId}:${this.artifactId}:${this.versionId}`);
86
+ }
87
+ yield swapIngestInGraph(this.graphManagerState, target, {
88
+ groupId: this.groupId,
89
+ artifactId: this.artifactId,
90
+ versionId: this.versionId,
91
+ });
92
+ stopWatch.record(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS);
93
+ this.applicationStore.logService.info(LogEvent.create(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS));
94
+ }
95
+ /**
96
+ * Remove the currently built ingest from the graph and build the entity at
97
+ * `path` in its place. Backs {@link IngestLegendQueryBuilderState.swapIngest}
98
+ * — see that callsite for why we don't pre-build every ingest.
99
+ */
100
+ async swapIngestDefinition(path) {
101
+ const entity = this._ingestEntitiesByPath.get(path);
102
+ if (!entity) {
103
+ throw new Error(`Can't find ingest definition '${path}' in project ${this.groupId}:${this.artifactId}:${this.versionId}`);
104
+ }
105
+ return swapIngestInGraph(this.graphManagerState, entity, {
106
+ currentPath: this.ingestDefinitionPath,
107
+ groupId: this.groupId,
108
+ artifactId: this.artifactId,
109
+ versionId: this.versionId,
110
+ });
111
+ }
112
+ async initializeQueryBuilderState() {
113
+ const ingestDefinition = guaranteeType(this.graphManagerState.graph.getElement(this.ingestDefinitionPath), IngestDefinition, `Can't find ingest definition '${this.ingestDefinitionPath}'`);
114
+ const sourceInfo = {
115
+ groupId: this.groupId,
116
+ artifactId: this.artifactId,
117
+ versionId: this.versionId,
118
+ };
119
+ // Build an adhoc lakehouse runtime using the user's lakehouse env +
120
+ // consumer warehouse — same machinery used by the data product flow for
121
+ // model-access / lakehouse access points. Register it on the graph as an
122
+ // `_internal_` element so the editor can resolve it.
123
+ const adhocRuntime = await this.createLakehousePackageableRuntime(this.ingestDefinitionPath, {
124
+ groupId: this.groupId,
125
+ artifactId: this.artifactId,
126
+ versionId: this.versionId,
127
+ });
128
+ this.graphManagerState.graph.addElement(adhocRuntime, '_internal_');
129
+ const queryBuilderState = new IngestLegendQueryBuilderState(this.applicationStore, undefined, this.graphManagerState, QueryBuilderDataBrowserWorkflow.INSTANCE, new QueryBuilderActionConfig_QueryApplication(this), ingestDefinition, Array.from(this._ingestEntitiesByPath.keys()), (path) => this.swapIngestDefinition(path), adhocRuntime, {
130
+ groupId: this.groupId,
131
+ artifactId: this.artifactId,
132
+ versionId: this.versionId,
133
+ }, undefined, sourceInfo);
134
+ try {
135
+ // Resolve the accessor for the requested data set on this ingest
136
+ // definition. This drives the editor source panel + compatible runtimes.
137
+ await queryBuilderState.changeAccessorOwner(ingestDefinition);
138
+ await queryBuilderState.changeAccessor({ tableName: this.dataSet });
139
+ // Select the adhoc lakehouse runtime so the editor can execute the
140
+ // query without the user having to pick one from `compatibleRuntimes`.
141
+ // Mirrors what `LegendQueryDataProductQueryBuilderState.prepareAccessForExecution`
142
+ // does for model-access / lakehouse access points in the data product flow.
143
+ queryBuilderState.changeSelectedRuntime(adhocRuntime);
144
+ }
145
+ catch (error) {
146
+ assertErrorThrown(error);
147
+ this.applicationStore.logService.error(LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE), error);
148
+ }
149
+ return queryBuilderState;
150
+ }
151
+ getPersistConfiguration(lambda, options) {
152
+ const queryBuilderState = this.queryBuilderState;
153
+ const ingestPath = queryBuilderState?.ingestDefinition.path ?? this.ingestDefinitionPath;
154
+ const dataSet = queryBuilderState?.dataSet ?? this.dataSet;
155
+ const ingestName = extractEntityNameFromPath(ingestPath);
156
+ return {
157
+ defaultName: options?.update
158
+ ? `${ingestName}[${dataSet}]`
159
+ : `New Query for ${ingestName}[${dataSet}]`,
160
+ decorator: (query) => {
161
+ query.id = uuid();
162
+ query.groupId = this.groupId;
163
+ query.artifactId = this.artifactId;
164
+ query.versionId = this.versionId;
165
+ },
166
+ };
167
+ }
168
+ }
169
+ //# sourceMappingURL=IngestQueryCreatorStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IngestQueryCreatorStore.js","sourceRoot":"","sources":["../../../src/stores/ingest/IngestQueryCreatorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,IAAI,GACL,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,yBAAyB,GAE1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,gBAAgB,EAEhB,yCAAyC,GAC1C,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAwB,SAAQ,gBAAgB;IAClD,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,oBAAoB,CAAS;IAC7B,OAAO,CAAS;IAEzB;;;;;;OAMG;IACK,qBAAqB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAI1D,YACE,gBAA6C,EAC7C,iBAAoC,EACpC,OAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,oBAA4B,EAC5B,OAAe;QAEf,KAAK,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU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C;YACf,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CACpC,QAAQ,CAAC,MAAM,CAAC,sBAAsB,CAAC,eAAe,CAAC,EACvD,KAAK,CACN,CAAC;QACJ,CAAC;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,uBAAuB,CACrB,MAAiB,EACjB,OAA0C;QAE1C,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACjD,MAAM,UAAU,GACd,iBAAiB,EAAE,gBAAgB,CAAC,IAAI,IAAI,IAAI,CAAC,oBAAoB,CAAC;QACxE,MAAM,OAAO,GAAG,iBAAiB,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;QAC3D,MAAM,UAAU,GAAG,yBAAyB,CAAC,UAAU,CAAC,CAAC;QACzD,OAAO;YACL,WAAW,EAAE,OAAO,EAAE,MAAM;gBAC1B,CAAC,CAAC,GAAG,UAAU,IAAI,OAAO,GAAG;gBAC7B,CAAC,CAAC,iBAAiB,UAAU,IAAI,OAAO,GAAG;YAC7C,SAAS,EAAE,CAAC,KAAY,EAAQ,EAAE;gBAChC,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;gBAClB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;gBAC7B,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;gBACnC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;YACnC,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,58 @@
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
+ import { type DepotServerClient } from '@finos/legend-server-depot';
17
+ import type { Entity } from '@finos/legend-storage';
18
+ import { type GraphManagerState, IngestDefinition } from '@finos/legend-graph';
19
+ /**
20
+ * Shared helpers for ingest-backed query flows (creator + existing-query
21
+ * loader). Centralizes how we list / cache / swap ingest definitions in the
22
+ * graph so both flows stay in lockstep.
23
+ *
24
+ * Why these live outside the stores: both
25
+ * {@link IngestQueryCreatorStore} (deep-link flow) and
26
+ * {@link ExistingQueryEditorStore} (saved-query flow) need to:
27
+ * 1. fetch every ingest entity in a project version (cheap, classifier-
28
+ * scoped depot call) so the source dropdown can list them all, and
29
+ * 2. build only the active ingest into the graph, swapping it out when the
30
+ * user picks a different one.
31
+ * Keeping the logic in one module avoids the two stores drifting apart.
32
+ */
33
+ /**
34
+ * Fetch every {@link IngestDefinition} entity for a project version via the
35
+ * classifier-scoped variant of `getVersionEntities`. The endpoint returns
36
+ * {@link EntityWithOrigin}-shaped payloads (entity wrapped with GAV) rather
37
+ * than raw entities, so we unwrap explicitly.
38
+ *
39
+ * Filters by `classifierPath` defensively in case the server returns extras.
40
+ */
41
+ export declare const fetchIngestEntitiesByClassifier: (depotServerClient: DepotServerClient, groupId: string, artifactId: string, versionId: string) => Promise<Map<string, Entity>>;
42
+ /**
43
+ * Build the given ingest entity into `graph`. If `currentPath` is provided
44
+ * and resolves to an existing ingest on the graph, that ingest is removed
45
+ * first — this is the swap path used when the user picks a different ingest
46
+ * from the source dropdown.
47
+ *
48
+ * The SDLC origin is only set when the graph has none yet, so subsequent
49
+ * swaps (which run after the initial graph build set the origin) don't
50
+ * clobber it.
51
+ */
52
+ export declare const swapIngestInGraph: (graphManagerState: GraphManagerState, entity: Entity, options: {
53
+ currentPath?: string | undefined;
54
+ groupId: string;
55
+ artifactId: string;
56
+ versionId: string;
57
+ }) => Promise<IngestDefinition>;
58
+ //# sourceMappingURL=IngestQueryGraphHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IngestQueryGraphHelper.d.ts","sourceRoot":"","sources":["../../../src/stores/ingest/IngestQueryGraphHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAoB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EACL,KAAK,iBAAiB,EAGtB,gBAAgB,EAEjB,MAAM,qBAAqB,CAAC;AAG7B;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,+BAA+B,GAC1C,mBAAmB,iBAAiB,EACpC,SAAS,MAAM,EACf,YAAY,MAAM,EAClB,WAAW,MAAM,KAChB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAW7B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAC5B,mBAAmB,iBAAiB,EACpC,QAAQ,MAAM,EACd,SAAS;IACP,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,KACA,OAAO,CAAC,gBAAgB,CA6B1B,CAAC"}
@@ -0,0 +1,72 @@
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
+ import { resolveVersion, } from '@finos/legend-server-depot';
17
+ import { CORE_PURE_PATH, createGraphBuilderReport, IngestDefinition, LegendSDLC, } from '@finos/legend-graph';
18
+ import { guaranteeType } from '@finos/legend-shared';
19
+ /**
20
+ * Shared helpers for ingest-backed query flows (creator + existing-query
21
+ * loader). Centralizes how we list / cache / swap ingest definitions in the
22
+ * graph so both flows stay in lockstep.
23
+ *
24
+ * Why these live outside the stores: both
25
+ * {@link IngestQueryCreatorStore} (deep-link flow) and
26
+ * {@link ExistingQueryEditorStore} (saved-query flow) need to:
27
+ * 1. fetch every ingest entity in a project version (cheap, classifier-
28
+ * scoped depot call) so the source dropdown can list them all, and
29
+ * 2. build only the active ingest into the graph, swapping it out when the
30
+ * user picks a different one.
31
+ * Keeping the logic in one module avoids the two stores drifting apart.
32
+ */
33
+ /**
34
+ * Fetch every {@link IngestDefinition} entity for a project version via the
35
+ * classifier-scoped variant of `getVersionEntities`. The endpoint returns
36
+ * {@link EntityWithOrigin}-shaped payloads (entity wrapped with GAV) rather
37
+ * than raw entities, so we unwrap explicitly.
38
+ *
39
+ * Filters by `classifierPath` defensively in case the server returns extras.
40
+ */
41
+ export const fetchIngestEntitiesByClassifier = async (depotServerClient, groupId, artifactId, versionId) => {
42
+ const wrapped = (await depotServerClient.getVersionEntities(groupId, artifactId, resolveVersion(versionId), CORE_PURE_PATH.INGEST_DEFINITION));
43
+ const entities = wrapped
44
+ .map((w) => w.entity)
45
+ .filter((e) => e.classifierPath === CORE_PURE_PATH.INGEST_DEFINITION);
46
+ return new Map(entities.map((e) => [e.path, e]));
47
+ };
48
+ /**
49
+ * Build the given ingest entity into `graph`. If `currentPath` is provided
50
+ * and resolves to an existing ingest on the graph, that ingest is removed
51
+ * first — this is the swap path used when the user picks a different ingest
52
+ * from the source dropdown.
53
+ *
54
+ * The SDLC origin is only set when the graph has none yet, so subsequent
55
+ * swaps (which run after the initial graph build set the origin) don't
56
+ * clobber it.
57
+ */
58
+ export const swapIngestInGraph = async (graphManagerState, entity, options) => {
59
+ if (options.currentPath !== undefined) {
60
+ const current = graphManagerState.graph.ingests.find((i) => i.path === options.currentPath);
61
+ if (current) {
62
+ graphManagerState.graph.deleteElement(current);
63
+ }
64
+ }
65
+ await graphManagerState.graphManager.buildGraph(graphManagerState.graph, [entity], graphManagerState.graphBuildState, graphManagerState.graph.origin === undefined
66
+ ? {
67
+ origin: new LegendSDLC(options.groupId, options.artifactId, resolveVersion(options.versionId)),
68
+ }
69
+ : undefined, createGraphBuilderReport());
70
+ return guaranteeType(graphManagerState.graph.getElement(entity.path), IngestDefinition, `Can't find ingest definition '${entity.path}' after build`);
71
+ };
72
+ //# sourceMappingURL=IngestQueryGraphHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IngestQueryGraphHelper.js","sourceRoot":"","sources":["../../../src/stores/ingest/IngestQueryGraphHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,cAAc,GACf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAEL,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,EAClD,iBAAoC,EACpC,OAAe,EACf,UAAkB,EAClB,SAAiB,EACa,EAAE;IAChC,MAAM,OAAO,GAAG,CAAC,MAAM,iBAAiB,CAAC,kBAAkB,CACzD,OAAO,EACP,UAAU,EACV,cAAc,CAAC,SAAS,CAAC,EACzB,cAAc,CAAC,iBAAiB,CACjC,CAAkC,CAAC;IACpC,MAAM,QAAQ,GAAG,OAAO;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;SACp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C;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-query",
3
- "version": "13.8.28",
3
+ "version": "13.8.30",
4
4
  "description": "Legend Query application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -44,18 +44,18 @@
44
44
  "test:watch": "jest --watch"
45
45
  },
46
46
  "dependencies": {
47
- "@finos/legend-application": "16.0.113",
47
+ "@finos/legend-application": "16.0.114",
48
48
  "@finos/legend-art": "7.1.154",
49
- "@finos/legend-code-editor": "2.0.182",
50
- "@finos/legend-data-cube": "0.3.99",
51
- "@finos/legend-extension-dsl-data-space": "10.4.231",
52
- "@finos/legend-graph": "32.6.13",
53
- "@finos/legend-lego": "2.0.202",
54
- "@finos/legend-query-builder": "4.18.21",
55
- "@finos/legend-server-depot": "6.1.14",
56
- "@finos/legend-server-lakehouse": "0.3.62",
49
+ "@finos/legend-code-editor": "2.0.184",
50
+ "@finos/legend-data-cube": "0.3.101",
51
+ "@finos/legend-extension-dsl-data-space": "10.4.233",
52
+ "@finos/legend-graph": "32.6.15",
53
+ "@finos/legend-lego": "2.0.204",
54
+ "@finos/legend-query-builder": "4.18.23",
55
+ "@finos/legend-server-depot": "6.1.15",
56
+ "@finos/legend-server-lakehouse": "0.3.64",
57
57
  "@finos/legend-shared": "11.0.26",
58
- "@finos/legend-storage": "3.0.147",
58
+ "@finos/legend-storage": "3.0.148",
59
59
  "@testing-library/dom": "10.4.0",
60
60
  "@testing-library/react": "16.2.0",
61
61
  "@types/react": "19.0.10",
@@ -70,7 +70,7 @@
70
70
  "serializr": "3.0.3"
71
71
  },
72
72
  "devDependencies": {
73
- "@finos/legend-dev-utils": "2.2.6",
73
+ "@finos/legend-dev-utils": "2.2.7",
74
74
  "@jest/globals": "29.7.0",
75
75
  "cross-env": "7.0.3",
76
76
  "eslint": "9.22.0",