@finos/legend-application-query 13.8.56 → 13.8.58
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/__lib__/LegendQueryNavigation.d.ts +0 -13
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +0 -13
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +1 -2
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +0 -13
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryWebApplication.js +1 -2
- package/lib/components/LegendQueryWebApplication.js.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +1 -17
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +2 -175
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/light-mode.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryEditorStore.d.ts +4 -4
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +9 -53
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.d.ts.map +1 -1
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.js +1 -10
- package/lib/stores/data-product/query-builder/DataProductArtifactHelper.js.map +1 -1
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts +3 -2
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js +21 -19
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js.map +1 -1
- package/package.json +14 -14
- package/src/__lib__/LegendQueryNavigation.ts +0 -45
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +0 -17
- package/src/components/LegendQueryWebApplication.tsx +0 -5
- package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +0 -430
- package/src/index.ts +0 -1
- package/src/stores/QueryEditorStore.ts +10 -68
- package/src/stores/data-product/query-builder/DataProductArtifactHelper.ts +1 -13
- package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +33 -43
- package/tsconfig.json +0 -3
- package/lib/components/data-product/DataProductSampleQueryCreator.d.ts +0 -19
- package/lib/components/data-product/DataProductSampleQueryCreator.d.ts.map +0 -1
- package/lib/components/data-product/DataProductSampleQueryCreator.js +0 -53
- package/lib/components/data-product/DataProductSampleQueryCreator.js.map +0 -1
- package/lib/components/data-product/DataProductSampleQueryPanel.d.ts +0 -23
- package/lib/components/data-product/DataProductSampleQueryPanel.d.ts.map +0 -1
- package/lib/components/data-product/DataProductSampleQueryPanel.js +0 -95
- package/lib/components/data-product/DataProductSampleQueryPanel.js.map +0 -1
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.d.ts +0 -39
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.d.ts.map +0 -1
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.js +0 -71
- package/lib/stores/data-product/DataProductSampleQueryCreatorStore.js.map +0 -1
- package/src/components/data-product/DataProductSampleQueryCreator.tsx +0 -114
- package/src/components/data-product/DataProductSampleQueryPanel.tsx +0 -219
- package/src/stores/data-product/DataProductSampleQueryCreatorStore.ts +0 -152
|
@@ -1,219 +0,0 @@
|
|
|
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
|
-
PanelHeader,
|
|
19
|
-
BasePopover,
|
|
20
|
-
ClickAwayListener,
|
|
21
|
-
ShareIcon,
|
|
22
|
-
TagIcon,
|
|
23
|
-
} from '@finos/legend-art';
|
|
24
|
-
import { observer } from 'mobx-react-lite';
|
|
25
|
-
import { useRef, useState } from 'react';
|
|
26
|
-
import {
|
|
27
|
-
ActionAlertActionType,
|
|
28
|
-
ActionAlertType,
|
|
29
|
-
useApplicationStore,
|
|
30
|
-
} from '@finos/legend-application';
|
|
31
|
-
import type { V1_SampleQuery } from '@finos/legend-graph';
|
|
32
|
-
import { flowResult } from 'mobx';
|
|
33
|
-
import type { LegendQueryDataProductQueryBuilderState } from '../../stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js';
|
|
34
|
-
import { generateDataProductSampleQueryRoute } from '../../__lib__/LegendQueryNavigation.js';
|
|
35
|
-
|
|
36
|
-
const DataProductSampleQueryDialog = observer(
|
|
37
|
-
(props: {
|
|
38
|
-
triggerElement: HTMLElement | null;
|
|
39
|
-
queryBuilderState: LegendQueryDataProductQueryBuilderState;
|
|
40
|
-
sampleQueries: V1_SampleQuery[];
|
|
41
|
-
onClose: () => void;
|
|
42
|
-
}) => {
|
|
43
|
-
const { triggerElement, queryBuilderState, sampleQueries, onClose } = props;
|
|
44
|
-
const applicationStore = useApplicationStore();
|
|
45
|
-
|
|
46
|
-
const loadSampleQuery = async (
|
|
47
|
-
sampleQuery: V1_SampleQuery,
|
|
48
|
-
): Promise<void> => {
|
|
49
|
-
const query =
|
|
50
|
-
await queryBuilderState.graphManagerState.graphManager.pureCodeToLambda(
|
|
51
|
-
sampleQuery.info.query,
|
|
52
|
-
);
|
|
53
|
-
queryBuilderState.initializeWithQuery(query);
|
|
54
|
-
onClose();
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const loadQuery = async (sampleQuery: V1_SampleQuery): Promise<void> => {
|
|
58
|
-
if (queryBuilderState.changeDetectionState.hasChanged) {
|
|
59
|
-
applicationStore.alertService.setActionAlertInfo({
|
|
60
|
-
message:
|
|
61
|
-
'Unsaved changes will be lost if you continue. Do you still want to proceed?',
|
|
62
|
-
type: ActionAlertType.CAUTION,
|
|
63
|
-
actions: [
|
|
64
|
-
{
|
|
65
|
-
label: 'Proceed',
|
|
66
|
-
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
|
67
|
-
handler: (): void => {
|
|
68
|
-
flowResult(loadSampleQuery(sampleQuery));
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
label: 'Abort',
|
|
73
|
-
type: ActionAlertActionType.PROCEED,
|
|
74
|
-
default: true,
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
});
|
|
78
|
-
} else {
|
|
79
|
-
flowResult(loadSampleQuery(sampleQuery));
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const visitSampleQuery = (sampleQuery: V1_SampleQuery): void => {
|
|
84
|
-
const id = sampleQuery.info.id;
|
|
85
|
-
if (!id) {
|
|
86
|
-
applicationStore.notificationService.notifyWarning(
|
|
87
|
-
'Sample query does not have an ID and cannot be visited via URL',
|
|
88
|
-
);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const project = queryBuilderState.project;
|
|
92
|
-
applicationStore.navigationService.navigator.visitAddress(
|
|
93
|
-
applicationStore.navigationService.navigator.generateAddress(
|
|
94
|
-
generateDataProductSampleQueryRoute(
|
|
95
|
-
project.groupId,
|
|
96
|
-
project.artifactId,
|
|
97
|
-
project.versionId,
|
|
98
|
-
queryBuilderState.dataProduct.path,
|
|
99
|
-
id,
|
|
100
|
-
),
|
|
101
|
-
),
|
|
102
|
-
);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<ClickAwayListener onClickAway={onClose}>
|
|
107
|
-
<div>
|
|
108
|
-
<BasePopover
|
|
109
|
-
open={true}
|
|
110
|
-
slotProps={{
|
|
111
|
-
paper: {
|
|
112
|
-
classes: {
|
|
113
|
-
root: '"query-builder__data-space__template-query-panel__container__root',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
}}
|
|
117
|
-
className="query-builder__data-space__template-query-panel__container"
|
|
118
|
-
onClose={onClose}
|
|
119
|
-
anchorEl={triggerElement}
|
|
120
|
-
anchorOrigin={{
|
|
121
|
-
vertical: 'bottom',
|
|
122
|
-
horizontal: 'left',
|
|
123
|
-
}}
|
|
124
|
-
transformOrigin={{
|
|
125
|
-
vertical: 'top',
|
|
126
|
-
horizontal: 'center',
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
<div className="query-builder__data-space__template-query-panel">
|
|
130
|
-
<div className="query-builder__data-space__template-query-panel__header">
|
|
131
|
-
Sample Queries
|
|
132
|
-
</div>
|
|
133
|
-
{sampleQueries.map((sampleQuery) => (
|
|
134
|
-
<div
|
|
135
|
-
key={sampleQuery.info.id ?? sampleQuery.title}
|
|
136
|
-
className="query-builder__data-space__template-query-panel__query"
|
|
137
|
-
>
|
|
138
|
-
<TagIcon className="query-builder__data-space__template-query-panel__query__icon" />
|
|
139
|
-
<button
|
|
140
|
-
className="query-builder__data-space__template-query-panel__query__entry"
|
|
141
|
-
title="click to load sample query"
|
|
142
|
-
onClick={() => {
|
|
143
|
-
flowResult(loadQuery(sampleQuery));
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
146
|
-
<div className="query-builder__data-space__template-query-panel__query__entry__content">
|
|
147
|
-
<div className="query-builder__data-space__template-query-panel__query__entry__content__title">
|
|
148
|
-
{sampleQuery.title}
|
|
149
|
-
</div>
|
|
150
|
-
{sampleQuery.description && (
|
|
151
|
-
<div className="query-builder__data-space__template-query-panel__query__entry__content__description">
|
|
152
|
-
{sampleQuery.description}
|
|
153
|
-
</div>
|
|
154
|
-
)}
|
|
155
|
-
</div>
|
|
156
|
-
</button>
|
|
157
|
-
<button
|
|
158
|
-
className="query-builder__data-space__template-query-panel__query__share"
|
|
159
|
-
title="Visit..."
|
|
160
|
-
disabled={!sampleQuery.info.id}
|
|
161
|
-
onClick={() => visitSampleQuery(sampleQuery)}
|
|
162
|
-
>
|
|
163
|
-
<ShareIcon />
|
|
164
|
-
<div className="query-builder__data-space__template-query-panel__query__share__label">
|
|
165
|
-
Visit
|
|
166
|
-
</div>
|
|
167
|
-
</button>
|
|
168
|
-
</div>
|
|
169
|
-
))}
|
|
170
|
-
</div>
|
|
171
|
-
</BasePopover>
|
|
172
|
-
</div>
|
|
173
|
-
</ClickAwayListener>
|
|
174
|
-
);
|
|
175
|
-
},
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
export const DataProductSampleQueryPanel = observer(
|
|
179
|
-
(props: { queryBuilderState: LegendQueryDataProductQueryBuilderState }) => {
|
|
180
|
-
const { queryBuilderState } = props;
|
|
181
|
-
const templateQueryButtonRef = useRef<HTMLButtonElement>(null);
|
|
182
|
-
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
183
|
-
|
|
184
|
-
const sampleQueries = queryBuilderState.isNativeMode
|
|
185
|
-
? (queryBuilderState.dataProductArtifact?.nativeModelAccess
|
|
186
|
-
?.sampleQueries ?? [])
|
|
187
|
-
: [];
|
|
188
|
-
|
|
189
|
-
if (sampleQueries.length === 0) {
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return (
|
|
194
|
-
<PanelHeader className="query-builder__data-space__template-query">
|
|
195
|
-
<button
|
|
196
|
-
className="query-builder__data-space__template-query__btn"
|
|
197
|
-
ref={templateQueryButtonRef}
|
|
198
|
-
onClick={() => setIsDialogOpen(true)}
|
|
199
|
-
>
|
|
200
|
-
Sample Queries ( {sampleQueries.length} )
|
|
201
|
-
</button>
|
|
202
|
-
{isDialogOpen && (
|
|
203
|
-
<DataProductSampleQueryDialog
|
|
204
|
-
triggerElement={templateQueryButtonRef.current}
|
|
205
|
-
queryBuilderState={queryBuilderState}
|
|
206
|
-
sampleQueries={sampleQueries}
|
|
207
|
-
onClose={() => setIsDialogOpen(false)}
|
|
208
|
-
/>
|
|
209
|
-
)}
|
|
210
|
-
</PanelHeader>
|
|
211
|
-
);
|
|
212
|
-
},
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
export const renderDataProductSampleQueryPanelContent = (
|
|
216
|
-
queryBuilderState: LegendQueryDataProductQueryBuilderState,
|
|
217
|
-
): React.ReactNode => (
|
|
218
|
-
<DataProductSampleQueryPanel queryBuilderState={queryBuilderState} />
|
|
219
|
-
);
|
|
@@ -1,152 +0,0 @@
|
|
|
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 { DataProductAccessType } from '@finos/legend-graph';
|
|
18
|
-
import { type DepotServerClient } from '@finos/legend-server-depot';
|
|
19
|
-
import { IllegalStateError, guaranteeNonNullable } from '@finos/legend-shared';
|
|
20
|
-
import type { QueryBuilderState } from '@finos/legend-query-builder';
|
|
21
|
-
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
|
22
|
-
import { generateDataProductSampleQueryRoute } from '../../__lib__/LegendQueryNavigation.js';
|
|
23
|
-
import { DataProductSelectorState } from '../data-space/DataProductSelectorState.js';
|
|
24
|
-
import { createQueryDataProductTaggedValue } from '../../components/data-product/QueryDataProductUtil.js';
|
|
25
|
-
import { BaseTemplateQueryCreatorStore } from '../BaseTemplateQueryCreatorStore.js';
|
|
26
|
-
import {
|
|
27
|
-
type LegendQueryDataProductSampleSourceInfo,
|
|
28
|
-
LegendQuerySourceType,
|
|
29
|
-
} from '../../__lib__/LegendQuerySourceInfo.js';
|
|
30
|
-
|
|
31
|
-
export class DataProductSampleQueryCreatorStore extends BaseTemplateQueryCreatorStore {
|
|
32
|
-
readonly dataProductPath: string;
|
|
33
|
-
|
|
34
|
-
constructor(
|
|
35
|
-
applicationStore: LegendQueryApplicationStore,
|
|
36
|
-
depotServerClient: DepotServerClient,
|
|
37
|
-
groupId: string,
|
|
38
|
-
artifactId: string,
|
|
39
|
-
versionId: string,
|
|
40
|
-
dataProductPath: string,
|
|
41
|
-
sampleQueryId: string,
|
|
42
|
-
urlQueryParamValues: Record<string, string> | undefined,
|
|
43
|
-
) {
|
|
44
|
-
super(
|
|
45
|
-
applicationStore,
|
|
46
|
-
depotServerClient,
|
|
47
|
-
groupId,
|
|
48
|
-
artifactId,
|
|
49
|
-
versionId,
|
|
50
|
-
sampleQueryId,
|
|
51
|
-
urlQueryParamValues,
|
|
52
|
-
);
|
|
53
|
-
this.dataProductPath = dataProductPath;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
override getEditorRoute(): string {
|
|
57
|
-
return generateDataProductSampleQueryRoute(
|
|
58
|
-
this.groupId,
|
|
59
|
-
this.artifactId,
|
|
60
|
-
this.versionId,
|
|
61
|
-
this.dataProductPath,
|
|
62
|
-
this.templateQueryId,
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
override getEntityPath(): string {
|
|
67
|
-
return this.dataProductPath;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
override getSearchTaggedValues(): {
|
|
71
|
-
profile: string;
|
|
72
|
-
tag: string;
|
|
73
|
-
value: string;
|
|
74
|
-
}[] {
|
|
75
|
-
return [createQueryDataProductTaggedValue(this.dataProductPath)];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
override getQueryDecoratorTaggedValues():
|
|
79
|
-
| { profile: string; tag: string; value: string }[]
|
|
80
|
-
| undefined {
|
|
81
|
-
return [createQueryDataProductTaggedValue(this.dataProductPath)];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
override getSourceInfo(): LegendQueryDataProductSampleSourceInfo {
|
|
85
|
-
return {
|
|
86
|
-
sourceType: LegendQuerySourceType.DATA_PRODUCT_SAMPLE,
|
|
87
|
-
groupId: this.groupId,
|
|
88
|
-
artifactId: this.artifactId,
|
|
89
|
-
versionId: this.versionId,
|
|
90
|
-
dataProduct: this.dataProductPath,
|
|
91
|
-
sampleQueryId: this.templateQueryId,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async initializeQueryBuilderState(): Promise<QueryBuilderState> {
|
|
96
|
-
const artifact = await this.fetchDataProductArtifact(
|
|
97
|
-
this.groupId,
|
|
98
|
-
this.artifactId,
|
|
99
|
-
this.versionId,
|
|
100
|
-
this.dataProductPath,
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
const nativeModelAccess = guaranteeNonNullable(
|
|
104
|
-
artifact.nativeModelAccess,
|
|
105
|
-
`Data product '${this.dataProductPath}' does not have native model access`,
|
|
106
|
-
);
|
|
107
|
-
const sampleQuery = nativeModelAccess.sampleQueries?.find(
|
|
108
|
-
(sq) => sq.info.id === this.templateQueryId,
|
|
109
|
-
);
|
|
110
|
-
if (!sampleQuery) {
|
|
111
|
-
throw new IllegalStateError(
|
|
112
|
-
`Can't find sample query with id '${this.templateQueryId}' in data product '${this.dataProductPath}'`,
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
this.templateQueryTitle = sampleQuery.title;
|
|
116
|
-
|
|
117
|
-
const accessId =
|
|
118
|
-
sampleQuery.info.executionContextKey ??
|
|
119
|
-
nativeModelAccess.defaultExecutionContext;
|
|
120
|
-
|
|
121
|
-
const queryBuilderState = await this.buildDataProductQueryBuilderState(
|
|
122
|
-
this.groupId,
|
|
123
|
-
this.artifactId,
|
|
124
|
-
this.versionId,
|
|
125
|
-
this.dataProductPath,
|
|
126
|
-
artifact,
|
|
127
|
-
accessId,
|
|
128
|
-
DataProductAccessType.NATIVE,
|
|
129
|
-
async () => {
|
|
130
|
-
this.applicationStore.notificationService.notifyWarning(
|
|
131
|
-
`Can't switch data product while visiting a sample query`,
|
|
132
|
-
);
|
|
133
|
-
},
|
|
134
|
-
undefined,
|
|
135
|
-
new DataProductSelectorState(
|
|
136
|
-
this.depotServerClient,
|
|
137
|
-
this.applicationStore,
|
|
138
|
-
this.lakehouseState?.contractServerClient,
|
|
139
|
-
),
|
|
140
|
-
this.getSourceInfo(),
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
const query = await this.graphManagerState.graphManager.pureCodeToLambda(
|
|
144
|
-
sampleQuery.info.query,
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
const defaultParameters = await this.resolveDefaultParameters(query);
|
|
148
|
-
queryBuilderState.initializeWithQuery(query, defaultParameters);
|
|
149
|
-
|
|
150
|
-
return queryBuilderState;
|
|
151
|
-
}
|
|
152
|
-
}
|