@finos/legend-application-query 13.8.8 → 13.8.9

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 +16 -2
  2. package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
  3. package/lib/__lib__/LegendQueryNavigation.js +21 -2
  4. package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
  5. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +2 -1
  6. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  7. package/lib/components/Core_LegendQueryApplicationPlugin.js +13 -0
  8. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  9. package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
  10. package/lib/components/LegendQueryWebApplication.js +2 -1
  11. package/lib/components/LegendQueryWebApplication.js.map +1 -1
  12. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts +14 -2
  13. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  14. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +91 -5
  15. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
  16. package/lib/components/data-product/DataProductSampleQueryCreator.d.ts +19 -0
  17. package/lib/components/data-product/DataProductSampleQueryCreator.d.ts.map +1 -0
  18. package/lib/components/data-product/DataProductSampleQueryCreator.js +53 -0
  19. package/lib/components/data-product/DataProductSampleQueryCreator.js.map +1 -0
  20. package/lib/components/data-product/DataProductSampleQueryPanel.d.ts +23 -0
  21. package/lib/components/data-product/DataProductSampleQueryPanel.d.ts.map +1 -0
  22. package/lib/components/data-product/DataProductSampleQueryPanel.js +95 -0
  23. package/lib/components/data-product/DataProductSampleQueryPanel.js.map +1 -0
  24. package/lib/index.css +1 -1
  25. package/lib/light-mode.css +1 -1
  26. package/lib/package.json +1 -1
  27. package/lib/stores/BaseTemplateQueryCreatorStore.d.ts +68 -0
  28. package/lib/stores/BaseTemplateQueryCreatorStore.d.ts.map +1 -0
  29. package/lib/stores/BaseTemplateQueryCreatorStore.js +120 -0
  30. package/lib/stores/BaseTemplateQueryCreatorStore.js.map +1 -0
  31. package/lib/stores/QueryEditorStore.d.ts +1 -1
  32. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  33. package/lib/stores/QueryEditorStore.js +42 -30
  34. package/lib/stores/QueryEditorStore.js.map +1 -1
  35. package/lib/stores/data-product/DataProductSampleQueryCreatorStore.d.ts +37 -0
  36. package/lib/stores/data-product/DataProductSampleQueryCreatorStore.d.ts.map +1 -0
  37. package/lib/stores/data-product/DataProductSampleQueryCreatorStore.js +60 -0
  38. package/lib/stores/data-product/DataProductSampleQueryCreatorStore.js.map +1 -0
  39. package/lib/stores/data-product/query-builder/DataProductArtifactHelper.d.ts.map +1 -1
  40. package/lib/stores/data-product/query-builder/DataProductArtifactHelper.js +9 -0
  41. package/lib/stores/data-product/query-builder/DataProductArtifactHelper.js.map +1 -1
  42. package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts +12 -2
  43. package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts.map +1 -1
  44. package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js +22 -2
  45. package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js.map +1 -1
  46. package/lib/stores/data-space/DataProductQueryCreatorStore.js +1 -1
  47. package/lib/stores/data-space/DataProductQueryCreatorStore.js.map +1 -1
  48. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts +14 -18
  49. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  50. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +15 -80
  51. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  52. package/package.json +13 -13
  53. package/src/__lib__/LegendQueryNavigation.ts +43 -5
  54. package/src/components/Core_LegendQueryApplicationPlugin.tsx +17 -0
  55. package/src/components/LegendQueryWebApplication.tsx +5 -0
  56. package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +227 -3
  57. package/src/components/data-product/DataProductSampleQueryCreator.tsx +114 -0
  58. package/src/components/data-product/DataProductSampleQueryPanel.tsx +219 -0
  59. package/src/stores/BaseTemplateQueryCreatorStore.ts +203 -0
  60. package/src/stores/QueryEditorStore.ts +60 -46
  61. package/src/stores/data-product/DataProductSampleQueryCreatorStore.ts +135 -0
  62. package/src/stores/data-product/query-builder/DataProductArtifactHelper.ts +13 -0
  63. package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +36 -4
  64. package/src/stores/data-space/DataProductQueryCreatorStore.ts +1 -1
  65. package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +31 -126
  66. package/tsconfig.json +4 -0
@@ -14,36 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import {
18
- type Query,
19
- type QuerySearchSpecification,
20
- type RawLambda,
21
- type ValueSpecification,
22
- QueryProjectCoordinates,
23
- extractElementNameFromPath,
24
- } from '@finos/legend-graph';
25
- import { type DepotServerClient } from '@finos/legend-server-depot';
26
- import {
27
- assertErrorThrown,
28
- IllegalStateError,
29
- LogEvent,
30
- uuid,
31
- type GeneratorFn,
32
- } from '@finos/legend-shared';
17
+ import { IllegalStateError } from '@finos/legend-shared';
33
18
  import {
34
19
  type QueryBuilderState,
35
20
  QueryBuilderDataBrowserWorkflow,
36
21
  } from '@finos/legend-query-builder';
37
- import {
38
- type ProjectGAVCoordinates,
39
- parseGACoordinates,
40
- } from '@finos/legend-storage';
41
- import {
42
- type QueryPersistConfiguration,
43
- QueryBuilderActionConfig_QueryApplication,
44
- QueryEditorStore,
45
- } from '../QueryEditorStore.js';
22
+ import { QueryBuilderActionConfig_QueryApplication } from '../QueryEditorStore.js';
46
23
  import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
24
+ import type { DepotServerClient } from '@finos/legend-server-depot';
47
25
  import { generateDataSpaceTemplateQueryCreatorRoute } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
48
26
  import {
49
27
  DataSpacePackageableElementExecutable,
@@ -53,22 +31,14 @@ import {
53
31
  } from '@finos/legend-extension-dsl-data-space/graph';
54
32
  import {
55
33
  type ResolvedDataSpaceEntityWithOrigin,
56
- createQueryClassTaggedValue,
57
34
  createQueryDataSpaceTaggedValue,
58
35
  } from '@finos/legend-extension-dsl-data-space/application';
59
36
  import { LegendQueryDataSpaceQueryBuilderState } from './query-builder/LegendQueryDataSpaceQueryBuilderState.js';
60
37
  import { DataProductSelectorState } from './DataProductSelectorState.js';
61
- import { processQueryParameters } from '../../components/utils/QueryParameterUtils.js';
62
- import { LEGEND_QUERY_APP_EVENT } from '../../__lib__/LegendQueryEvent.js';
38
+ import { BaseTemplateQueryCreatorStore } from '../BaseTemplateQueryCreatorStore.js';
63
39
 
64
- export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
65
- readonly groupId: string;
66
- readonly artifactId: string;
67
- readonly versionId: string;
40
+ export class DataSpaceTemplateQueryCreatorStore extends BaseTemplateQueryCreatorStore {
68
41
  readonly dataSpacePath: string;
69
- readonly templateQueryId: string;
70
- templateQueryTitle?: string;
71
- urlQueryParamValues: Record<string, string> | undefined;
72
42
 
73
43
  constructor(
74
44
  applicationStore: LegendQueryApplicationStore,
@@ -80,22 +50,16 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
80
50
  templateQueryId: string,
81
51
  urlQueryParamValues: Record<string, string> | undefined,
82
52
  ) {
83
- super(applicationStore, depotServerClient);
84
-
85
- this.groupId = groupId;
86
- this.artifactId = artifactId;
87
- this.versionId = versionId;
53
+ super(
54
+ applicationStore,
55
+ depotServerClient,
56
+ groupId,
57
+ artifactId,
58
+ versionId,
59
+ templateQueryId,
60
+ urlQueryParamValues,
61
+ );
88
62
  this.dataSpacePath = dataSpacePath;
89
- this.templateQueryId = templateQueryId;
90
- this.urlQueryParamValues = urlQueryParamValues;
91
- }
92
-
93
- getProjectInfo(): ProjectGAVCoordinates {
94
- return {
95
- groupId: this.groupId,
96
- artifactId: this.artifactId,
97
- versionId: this.versionId,
98
- };
99
63
  }
100
64
 
101
65
  override getEditorRoute(): string {
@@ -108,8 +72,22 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
108
72
  );
109
73
  }
110
74
 
111
- override *buildGraph(): GeneratorFn<void> {
112
- // do nothing
75
+ override getEntityPath(): string {
76
+ return this.dataSpacePath;
77
+ }
78
+
79
+ override getSearchTaggedValues(): {
80
+ profile: string;
81
+ tag: string;
82
+ value: string;
83
+ }[] {
84
+ return [createQueryDataSpaceTaggedValue(this.dataSpacePath)];
85
+ }
86
+
87
+ override getQueryDecoratorTaggedValues():
88
+ | { profile: string; tag: string; value: string }[]
89
+ | undefined {
90
+ return undefined;
113
91
  }
114
92
 
115
93
  async initializeQueryBuilderState(): Promise<QueryBuilderState> {
@@ -232,81 +210,8 @@ export class DataSpaceTemplateQueryCreatorStore extends QueryEditorStore {
232
210
  queryBuilderState.setExecutionContext(executionContext);
233
211
  await queryBuilderState.propagateExecutionContextChange(true);
234
212
 
235
- let defaultParameters: Map<string, ValueSpecification> | undefined =
236
- undefined;
237
- const processedQueryParamValues = processQueryParameters(
238
- query,
239
- undefined,
240
- this.urlQueryParamValues,
241
- this.graphManagerState,
242
- );
243
- if (processedQueryParamValues?.size) {
244
- try {
245
- defaultParameters =
246
- await this.graphManagerState.graphManager.pureCodeToValueSpecifications(
247
- processedQueryParamValues,
248
- this.graphManagerState.graph,
249
- );
250
- } catch (error) {
251
- assertErrorThrown(error);
252
- this.applicationStore.logService.error(
253
- LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
254
- `Error resolving preset query param values: ${error.message}`,
255
- );
256
- }
257
- }
213
+ const defaultParameters = await this.resolveDefaultParameters(query);
258
214
  queryBuilderState.initializeWithQuery(query, defaultParameters);
259
215
  return queryBuilderState;
260
216
  }
261
-
262
- getPersistConfiguration(
263
- lambda: RawLambda,
264
- options?: { update?: boolean | undefined },
265
- ): QueryPersistConfiguration {
266
- return {
267
- defaultName: options?.update
268
- ? `${extractElementNameFromPath(this.dataSpacePath)}`
269
- : `New Query for ${extractElementNameFromPath(this.dataSpacePath)}[${
270
- this.templateQueryId
271
- }]`,
272
- decorator: (query: Query): void => {
273
- query.id = uuid();
274
- query.groupId = this.groupId;
275
- query.artifactId = this.artifactId;
276
- query.versionId = this.versionId;
277
- if (this.queryBuilderState?.sourceClass) {
278
- query.taggedValues = [
279
- createQueryClassTaggedValue(
280
- this.queryBuilderState.sourceClass.path,
281
- ),
282
- ];
283
- }
284
- },
285
- };
286
- }
287
-
288
- override decorateSearchSpecification(
289
- val: QuerySearchSpecification,
290
- ): QuerySearchSpecification {
291
- const currentProjectCoordinates = new QueryProjectCoordinates();
292
- currentProjectCoordinates.groupId = this.groupId;
293
- currentProjectCoordinates.artifactId = this.artifactId;
294
- val.projectCoordinates = [
295
- // either get queries for the current project
296
- currentProjectCoordinates,
297
- // or any of its dependencies
298
- ...Array.from(
299
- this.graphManagerState.graph.dependencyManager.projectDependencyModelsIndex.keys(),
300
- ).map((dependencyKey) => {
301
- const { groupId, artifactId } = parseGACoordinates(dependencyKey);
302
- const coordinates = new QueryProjectCoordinates();
303
- coordinates.groupId = groupId;
304
- coordinates.artifactId = artifactId;
305
- return coordinates;
306
- }),
307
- ];
308
- val.taggedValues = [createQueryDataSpaceTaggedValue(this.dataSpacePath)];
309
- val.combineTaggedValuesCondition = true;
310
- return val;
311
- }
312
217
  }
package/tsconfig.json CHANGED
@@ -67,6 +67,7 @@
67
67
  "./src/components/data-product/QueryDataProductUtil.ts",
68
68
  "./src/components/data-space/QueryDataSpaceUtil.ts",
69
69
  "./src/components/utils/QueryParameterUtils.ts",
70
+ "./src/stores/BaseTemplateQueryCreatorStore.ts",
70
71
  "./src/stores/CloneServiceQuerySetupStore.ts",
71
72
  "./src/stores/CreateMappingQuerySetupStore.ts",
72
73
  "./src/stores/EditExistingQuerySetupStore.ts",
@@ -78,6 +79,7 @@
78
79
  "./src/stores/UpdateExistingServiceQuerySetupStore.ts",
79
80
  "./src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts",
80
81
  "./src/stores/data-cube/ExistingQueryDataCubeViewer.ts",
82
+ "./src/stores/data-product/DataProductSampleQueryCreatorStore.ts",
81
83
  "./src/stores/data-product/query-builder/DataProductArtifactHelper.ts",
82
84
  "./src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts",
83
85
  "./src/stores/data-space/DataProductQueryCreatorStore.ts",
@@ -105,6 +107,8 @@
105
107
  "./src/components/data-cube/ExistingQueryDataCubeViewer.tsx",
106
108
  "./src/components/data-cube/ExistingQueryEditorStoreProviderProvider.tsx",
107
109
  "./src/components/data-product/DataProductInfo.tsx",
110
+ "./src/components/data-product/DataProductSampleQueryCreator.tsx",
111
+ "./src/components/data-product/DataProductSampleQueryPanel.tsx",
108
112
  "./src/components/data-product/LegendQueryDataProductQueryBuilder.tsx",
109
113
  "./src/components/data-space/DataProductQueryCreator.tsx",
110
114
  "./src/components/data-space/DataSpaceInfo.tsx",