@finos/legend-extension-dsl-data-space 6.1.9 → 6.1.12

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 (69) hide show
  1. package/lib/DSLDataSpace_Const.d.ts +2 -0
  2. package/lib/DSLDataSpace_Const.d.ts.map +1 -1
  3. package/lib/DSLDataSpace_Const.js +2 -0
  4. package/lib/DSLDataSpace_Const.js.map +1 -1
  5. package/lib/components/DSLDataSpace_Icon.d.ts +18 -0
  6. package/lib/components/DSLDataSpace_Icon.d.ts.map +1 -0
  7. package/lib/components/DSLDataSpace_Icon.js +19 -0
  8. package/lib/components/DSLDataSpace_Icon.js.map +1 -0
  9. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts +3 -2
  10. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  11. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js +99 -8
  12. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  13. package/lib/components/query/DataSpaceQueryBuilder.d.ts +18 -0
  14. package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -0
  15. package/lib/components/query/DataSpaceQueryBuilder.js +126 -0
  16. package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -0
  17. package/lib/components/query/{DataSpaceQueryEditor.d.ts → DataSpaceQueryCreator.d.ts} +2 -2
  18. package/lib/components/query/DataSpaceQueryCreator.d.ts.map +1 -0
  19. package/lib/components/query/{DataSpaceQueryEditor.js → DataSpaceQueryCreator.js} +11 -11
  20. package/lib/components/query/DataSpaceQueryCreator.js.map +1 -0
  21. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
  22. package/lib/components/query/DataSpaceQuerySetup.js +6 -8
  23. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  24. package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
  25. package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js +2 -2
  26. package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js.map +1 -1
  27. package/lib/index.css +2 -2
  28. package/lib/index.css.map +1 -1
  29. package/lib/package.json +7 -7
  30. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts +11 -8
  31. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts.map +1 -1
  32. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js +15 -11
  33. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js.map +1 -1
  34. package/lib/stores/query/DataSpaceInfo.d.ts +31 -0
  35. package/lib/stores/query/DataSpaceInfo.d.ts.map +1 -0
  36. package/lib/stores/query/DataSpaceInfo.js +34 -0
  37. package/lib/stores/query/DataSpaceInfo.js.map +1 -0
  38. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +52 -0
  39. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -0
  40. package/lib/stores/query/DataSpaceQueryBuilderState.js +112 -0
  41. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -0
  42. package/lib/stores/query/{DataSpaceQueryEditorStore.d.ts → DataSpaceQueryCreatorStore.d.ts} +6 -4
  43. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -0
  44. package/lib/stores/query/DataSpaceQueryCreatorStore.js +113 -0
  45. package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -0
  46. package/lib/stores/query/DataSpaceQuerySetupState.d.ts +5 -12
  47. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
  48. package/lib/stores/query/DataSpaceQuerySetupState.js +9 -19
  49. package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
  50. package/package.json +17 -17
  51. package/src/DSLDataSpace_Const.ts +3 -0
  52. package/src/components/DSLDataSpace_Icon.tsx +23 -0
  53. package/src/components/query/DSLDataSpace_LegendQueryApplicationPlugin.tsx +170 -8
  54. package/src/components/query/DataSpaceQueryBuilder.tsx +344 -0
  55. package/src/components/query/{DataSpaceQueryEditor.tsx → DataSpaceQueryCreator.tsx} +13 -13
  56. package/src/components/query/DataSpaceQuerySetup.tsx +10 -14
  57. package/src/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.tsx +2 -6
  58. package/src/stores/query/DSLDataSpace_LegendQueryRouter.ts +17 -15
  59. package/src/stores/query/DataSpaceInfo.ts +57 -0
  60. package/src/stores/query/DataSpaceQueryBuilderState.ts +178 -0
  61. package/src/stores/query/DataSpaceQueryCreatorStore.ts +241 -0
  62. package/src/stores/query/DataSpaceQuerySetupState.ts +18 -32
  63. package/tsconfig.json +6 -2
  64. package/lib/components/query/DataSpaceQueryEditor.d.ts.map +0 -1
  65. package/lib/components/query/DataSpaceQueryEditor.js.map +0 -1
  66. package/lib/stores/query/DataSpaceQueryEditorStore.d.ts.map +0 -1
  67. package/lib/stores/query/DataSpaceQueryEditorStore.js +0 -98
  68. package/lib/stores/query/DataSpaceQueryEditorStore.js.map +0 -1
  69. package/src/stores/query/DataSpaceQueryEditorStore.ts +0 -173
@@ -1,173 +0,0 @@
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 Query,
19
- extractElementNameFromPath,
20
- QueryTaggedValue,
21
- RuntimePointer,
22
- PackageableElementExplicitReference,
23
- getAllClassMappings,
24
- isSystemElement,
25
- } from '@finos/legend-graph';
26
- import {
27
- QueryEditorStore,
28
- type QueryExportConfiguration,
29
- type LegendQueryPluginManager,
30
- type LegendQueryApplicationStore,
31
- } from '@finos/legend-application-query';
32
- import type {
33
- DepotServerClient,
34
- ProjectGAVCoordinates,
35
- } from '@finos/legend-server-depot';
36
- import {
37
- getNullableFirstElement,
38
- guaranteeNonNullable,
39
- uuid,
40
- } from '@finos/legend-shared';
41
- import {
42
- QUERY_PROFILE_PATH,
43
- QUERY_PROFILE_TAG_DATA_SPACE,
44
- } from '../../DSLDataSpace_Const.js';
45
- import { getDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
46
-
47
- const createQueryDataSpaceTaggedValue = (
48
- dataSpacePath: string,
49
- ): QueryTaggedValue => {
50
- const taggedValue = new QueryTaggedValue();
51
- taggedValue.profile = QUERY_PROFILE_PATH;
52
- taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
53
- taggedValue.value = dataSpacePath;
54
- return taggedValue;
55
- };
56
-
57
- export class DataSpaceQueryEditorStore extends QueryEditorStore {
58
- groupId: string;
59
- artifactId: string;
60
- versionId: string;
61
- dataSpacePath: string;
62
- executionContext: string;
63
- runtimePath: string | undefined;
64
- classPath: string | undefined;
65
-
66
- constructor(
67
- applicationStore: LegendQueryApplicationStore,
68
- depotServerClient: DepotServerClient,
69
- pluginManager: LegendQueryPluginManager,
70
- groupId: string,
71
- artifactId: string,
72
- versionId: string,
73
- dataSpacePath: string,
74
- executionContext: string,
75
- runtimePath: string | undefined,
76
- executionKey: string | undefined,
77
- ) {
78
- super(applicationStore, depotServerClient, pluginManager);
79
-
80
- this.groupId = groupId;
81
- this.artifactId = artifactId;
82
- this.versionId = versionId;
83
- this.dataSpacePath = dataSpacePath;
84
- this.executionContext = executionContext;
85
- this.runtimePath = runtimePath;
86
- this.classPath = executionKey;
87
- }
88
-
89
- getProjectInfo(): ProjectGAVCoordinates {
90
- return {
91
- groupId: this.groupId,
92
- artifactId: this.artifactId,
93
- versionId: this.versionId,
94
- };
95
- }
96
-
97
- async setUpBuilderState(): Promise<void> {
98
- this.queryBuilderState.querySetupState.setMappingIsReadOnly(true);
99
- this.queryBuilderState.querySetupState.setRuntimeIsReadOnly(true);
100
-
101
- const dataSpace = getDataSpace(
102
- this.dataSpacePath,
103
- this.graphManagerState.graph,
104
- );
105
- const executionContext = guaranteeNonNullable(
106
- dataSpace.executionContexts.find(
107
- (context) => context.name === this.executionContext,
108
- ),
109
- `Can't find execution context '${this.executionContext}'`,
110
- );
111
- this.queryBuilderState.querySetupState.setMapping(
112
- executionContext.mapping.value,
113
- );
114
- this.queryBuilderState.querySetupState.setRuntimeValue(
115
- new RuntimePointer(
116
- PackageableElementExplicitReference.create(
117
- this.runtimePath
118
- ? this.graphManagerState.graph.getRuntime(this.runtimePath)
119
- : executionContext.defaultRuntime.value,
120
- ),
121
- ),
122
- );
123
-
124
- if (this.classPath) {
125
- this.queryBuilderState.changeClass(
126
- this.queryBuilderState.graphManagerState.graph.getClass(this.classPath),
127
- );
128
- this.queryBuilderState.querySetupState.setClassIsReadOnly(true);
129
- } else {
130
- // try to find a class to set
131
- // first, find classes which is mapped by the mapping
132
- // then, find any classes except for class coming from system
133
- // if none found, default to a dummy blank query
134
- const defaultClass =
135
- getNullableFirstElement(
136
- this.queryBuilderState.querySetupState.mapping
137
- ? getAllClassMappings(
138
- this.queryBuilderState.querySetupState.mapping,
139
- ).map((classMapping) => classMapping.class.value)
140
- : [],
141
- ) ??
142
- getNullableFirstElement(
143
- this.queryBuilderState.graphManagerState.graph.classes.filter(
144
- (el) => !isSystemElement(el),
145
- ),
146
- );
147
- if (defaultClass) {
148
- this.queryBuilderState.changeClass(defaultClass);
149
- } else {
150
- this.queryBuilderState.initialize(
151
- this.queryBuilderState.graphManagerState.graphManager.createDefaultBasicRawLambda(),
152
- );
153
- }
154
- }
155
- }
156
-
157
- async getExportConfiguration(): Promise<QueryExportConfiguration> {
158
- return {
159
- defaultName: `New Query for ${extractElementNameFromPath(
160
- this.dataSpacePath,
161
- )}[${this.executionContext}]`,
162
- decorator: (query: Query): void => {
163
- query.id = uuid();
164
- query.groupId = this.groupId;
165
- query.artifactId = this.artifactId;
166
- query.versionId = this.versionId;
167
- query.taggedValues = [
168
- createQueryDataSpaceTaggedValue(this.dataSpacePath),
169
- ];
170
- },
171
- };
172
- }
173
- }