@finos/legend-extension-dsl-data-space 10.1.94 → 10.1.95

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { LegendApplicationPlugin, type LegendApplicationSetup, type LegendApplicationPluginManager, type KeyedCommandConfigEntry } from '@finos/legend-application';
17
- import type { LoadQueryFilterOption, QueryBuilder_LegendApplicationPlugin_Extension, TemplateQueryPanelContentRenderer } from '@finos/legend-query-builder';
17
+ import type { CuratedTemplateQuerySpecification, LoadQueryFilterOption, QueryBuilderState, QueryBuilder_LegendApplicationPlugin_Extension, TemplateQueryPanelContentRenderer } from '@finos/legend-query-builder';
18
18
  export declare class DSL_DataSpace_LegendApplicationPlugin extends LegendApplicationPlugin implements QueryBuilder_LegendApplicationPlugin_Extension {
19
19
  static NAME: string;
20
20
  constructor();
@@ -22,6 +22,8 @@ export declare class DSL_DataSpace_LegendApplicationPlugin extends LegendApplica
22
22
  getExtraKeyedCommandConfigEntries(): KeyedCommandConfigEntry[];
23
23
  getExtraApplicationSetups(): LegendApplicationSetup[];
24
24
  getExtraLoadQueryFilterOptions(): LoadQueryFilterOption[];
25
+ getQueryFilterOptionsRelatedToTemplateQuery(): (queryBuilderState: QueryBuilderState) => string[];
25
26
  getExtraTemplateQueryPanelContentRenderer(): TemplateQueryPanelContentRenderer[];
27
+ getCuratedTemplateQuerySpecifications(): CuratedTemplateQuerySpecification[];
26
28
  }
27
29
  //# sourceMappingURL=DSL_DataSpace_LegendApplicationPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DSL_DataSpace_LegendApplicationPlugin.d.ts","sourceRoot":"","sources":["../../src/components/DSL_DataSpace_LegendApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EAEnC,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,qBAAqB,EAErB,8CAA8C,EAC9C,iCAAiC,EAClC,MAAM,6BAA6B,CAAC;AAWrC,qBAAa,qCACX,SAAQ,uBACR,YAAW,8CAA8C;IAEzD,MAAM,CAAC,IAAI,SAA4C;;IAMvD,OAAO,CACL,aAAa,EAAE,8BAA8B,CAAC,uBAAuB,CAAC,GACrE,IAAI;IAIE,iCAAiC,IAAI,uBAAuB,EAAE;IAM9D,yBAAyB,IAAI,sBAAsB,EAAE;IAQ9D,8BAA8B,IAAI,qBAAqB,EAAE;IAkDzD,yCAAyC,IAAI,iCAAiC,EAAE;CAYjF"}
1
+ {"version":3,"file":"DSL_DataSpace_LegendApplicationPlugin.d.ts","sourceRoot":"","sources":["../../src/components/DSL_DataSpace_LegendApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EAEnC,KAAK,uBAAuB,EAC7B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAEV,iCAAiC,EACjC,qBAAqB,EACrB,iBAAiB,EACjB,8CAA8C,EAC9C,iCAAiC,EAClC,MAAM,6BAA6B,CAAC;AAarC,qBAAa,qCACX,SAAQ,uBACR,YAAW,8CAA8C;IAEzD,MAAM,CAAC,IAAI,SAA4C;;IAMvD,OAAO,CACL,aAAa,EAAE,8BAA8B,CAAC,uBAAuB,CAAC,GACrE,IAAI;IAIE,iCAAiC,IAAI,uBAAuB,EAAE;IAM9D,yBAAyB,IAAI,sBAAsB,EAAE;IAQ9D,8BAA8B,IAAI,qBAAqB,EAAE;IAkDzD,2CAA2C,IAAI,CAC7C,iBAAiB,EAAE,iBAAiB,KACjC,MAAM,EAAE;IASb,yCAAyC,IAAI,iCAAiC,EAAE;IAahF,qCAAqC,IAAI,iCAAiC,EAAE;CAyD7E"}
@@ -20,6 +20,8 @@ import { createQueryClassTaggedValue, createQueryDataSpaceTaggedValue, } from '.
20
20
  import { DSL_DATA_SPACE_LEGEND_APPLICATION_COMMAND_CONFIG } from '../__lib__/DSL_DataSpace_LegendApplicationCommand.js';
21
21
  import { configureDataGridComponent } from '@finos/legend-lego/data-grid';
22
22
  import { renderDataSpaceQueryBuilderTemplateQueryPanelContent } from './query/DataSpaceQueryBuilderTemplateQueryPanelContent.js';
23
+ import { DataSpaceExecutableTemplate } from '../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
24
+ import { filterByType } from '@finos/legend-shared';
23
25
  export class DSL_DataSpace_LegendApplicationPlugin extends LegendApplicationPlugin {
24
26
  static NAME = packageJson.extensions.applicationPlugin;
25
27
  constructor() {
@@ -79,6 +81,14 @@ export class DSL_DataSpace_LegendApplicationPlugin extends LegendApplicationPlug
79
81
  },
80
82
  ];
81
83
  }
84
+ getQueryFilterOptionsRelatedToTemplateQuery() {
85
+ return (queryBuilderState) => {
86
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
87
+ return ['Current Data Space'];
88
+ }
89
+ return [];
90
+ };
91
+ }
82
92
  getExtraTemplateQueryPanelContentRenderer() {
83
93
  return [
84
94
  (queryBuilderState) => {
@@ -89,5 +99,44 @@ export class DSL_DataSpace_LegendApplicationPlugin extends LegendApplicationPlug
89
99
  },
90
100
  ];
91
101
  }
102
+ getCuratedTemplateQuerySpecifications() {
103
+ return [
104
+ {
105
+ getCuratedTemplateQueries: (queryBuilderState) => {
106
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
107
+ const executableTemplates = queryBuilderState.dataSpace.executables?.filter(filterByType(DataSpaceExecutableTemplate));
108
+ return executableTemplates
109
+ ? executableTemplates.map((e) => ({
110
+ title: e.title,
111
+ description: e.description,
112
+ query: e.query,
113
+ executionContextKey: e.executionContextKey ??
114
+ queryBuilderState.dataSpace.defaultExecutionContext
115
+ .name,
116
+ }))
117
+ : [];
118
+ }
119
+ return [];
120
+ },
121
+ loadCuratedTemplateQuery: (templateQuery, queryBuilderState) => {
122
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
123
+ if (queryBuilderState.executionContext.name !==
124
+ templateQuery.executionContextKey) {
125
+ const executionContext = queryBuilderState.dataSpace.executionContexts.find((c) => c.name === templateQuery.executionContextKey);
126
+ if (executionContext) {
127
+ queryBuilderState.setExecutionContext(executionContext);
128
+ queryBuilderState.propagateExecutionContextChange(executionContext);
129
+ queryBuilderState.initializeWithQuery(templateQuery.query);
130
+ queryBuilderState.onExecutionContextChange?.(executionContext);
131
+ }
132
+ }
133
+ else {
134
+ queryBuilderState.initializeWithQuery(templateQuery.query);
135
+ }
136
+ }
137
+ },
138
+ },
139
+ ];
140
+ }
92
141
  }
93
142
  //# sourceMappingURL=DSL_DataSpace_LegendApplicationPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DSL_DataSpace_LegendApplicationPlugin.js","sourceRoot":"","sources":["../../src/components/DSL_DataSpace_LegendApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EAGvB,0CAA0C,GAE3C,MAAM,2BAA2B,CAAC;AACnC,OAAO,WAAW,MAAM,oBAAoB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AAOrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,gDAAgD,EAAE,MAAM,sDAAsD,CAAC;AAExH,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,oDAAoD,EAAE,MAAM,2DAA2D,CAAC;AAEjI,MAAM,OAAO,qCACX,SAAQ,uBAAuB;IAG/B,MAAM,CAAC,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,iBAAiB,CAAC;IAEvD;QACE,KAAK,CAAC,qCAAqC,CAAC,IAAI,EAAE,WAAW,CAAC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B,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC;yBAC1D,CAAC;wBACF,mBAAmB,CAAC,4BAA4B,GAAG,IAAI,CAAC;qBACzD;oBACD,OAAO,mBAAmB,CAAC;gBAC7B,CAAC;aACF;SACF,CAAC;IACJ,CAAC;IAED,yCAAyC;QACvC,OAAO;YACL,CAAC,iBAAoC,EAAmB,EAAE;gBACxD,IAAI,iBAAiB,YAAY,0BAA0B,EAAE;oBAC3D,OAAO,oDAAoD,CACzD,iBAAiB,CAClB,CAAC;iBACH;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC"}
1
+ {"version":3,"file":"DSL_DataSpace_LegendApplicationPlugin.js","sourceRoot":"","sources":["../../src/components/DSL_DataSpace_LegendApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,uBAAuB,EAGvB,0CAA0C,GAE3C,MAAM,2BAA2B,CAAC;AACnC,OAAO,WAAW,MAAM,oBAAoB,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;AASrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,gDAAgD,EAAE,MAAM,sDAAsD,CAAC;AAExH,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,oDAAoD,EAAE,MAAM,2DAA2D,CAAC;AACjI,OAAO,EAAE,2BAA2B,EAAE,MAAM,wFAAwF,CAAC;AACrI,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,MAAM,OAAO,qCACX,SAAQ,uBAAuB;IAG/B,MAAM,CAAC,IAAI,GAAG,WAAW,CAAC,UAAU,CAAC,iBAAiB,CAAC;IAEvD;QACE,KAAK,CAAC,qCAAqC,CAAC,IAAI,EAAE,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C;gBACZ,CAAC;gBACD,wBAAwB,EAAE,CACxB,aAAmC,EACnC,iBAAoC,EAC9B,EAAE;oBACR,IAAI,iBAAiB,YAAY,0BAA0B,EAAE;wBAC3D,IACE,iBAAiB,CAAC,gBAAgB,CAAC,IAAI;4BACvC,aAAa,CAAC,mBAAmB,EACjC;4BACA,MAAM,gBAAgB,GACpB,iBAAiB,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAChD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,mBAAmB,CACpD,CAAC;4BACJ,IAAI,gBAAgB,EAAE;gCACpB,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;gCACxD,iBAAiB,CAAC,+BAA+B,CAC/C,gBAAgB,CACjB,CAAC;gCACF,iBAAiB,CAAC,mBAAmB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;gCAC3D,iBAAiB,CAAC,wBAAwB,EAAE,CAAC,gBAAgB,CAAC,CAAC;6BAChE;yBACF;6BAAM;4BACL,iBAAiB,CAAC,mBAAmB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;yBAC5D;qBACF;gBACH,CAAC;aACF;SACF,CAAC;IACJ,CAAC"}
package/lib/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /** @license @finos/legend-extension-dsl-data-space v10.1.94
1
+ /** @license @finos/legend-extension-dsl-data-space v10.1.95
2
2
  * Copyright (c) 2020-present, Goldman Sachs
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-data-space",
3
- "version": "10.1.94",
3
+ "version": "10.1.95",
4
4
  "description": "Legend extension for Data Space DSL",
5
5
  "keywords": [
6
6
  "legend",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-data-space",
3
- "version": "10.1.94",
3
+ "version": "10.1.95",
4
4
  "description": "Legend extension for Data Space DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -45,13 +45,13 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@finos/legend-application": "15.0.73",
48
- "@finos/legend-application-query": "13.2.19",
49
- "@finos/legend-application-studio": "28.16.6",
48
+ "@finos/legend-application-query": "13.2.20",
49
+ "@finos/legend-application-studio": "28.16.7",
50
50
  "@finos/legend-art": "7.1.25",
51
- "@finos/legend-extension-dsl-diagram": "8.0.150",
51
+ "@finos/legend-extension-dsl-diagram": "8.0.151",
52
52
  "@finos/legend-graph": "31.9.6",
53
53
  "@finos/legend-lego": "1.2.19",
54
- "@finos/legend-query-builder": "4.14.19",
54
+ "@finos/legend-query-builder": "4.14.20",
55
55
  "@finos/legend-server-depot": "6.0.38",
56
56
  "@finos/legend-shared": "10.0.34",
57
57
  "@finos/legend-storage": "3.0.84",
@@ -23,6 +23,8 @@ import {
23
23
  } from '@finos/legend-application';
24
24
  import packageJson from '../../package.json' assert { type: 'json' };
25
25
  import type {
26
+ CuratedTemplateQuery,
27
+ CuratedTemplateQuerySpecification,
26
28
  LoadQueryFilterOption,
27
29
  QueryBuilderState,
28
30
  QueryBuilder_LegendApplicationPlugin_Extension,
@@ -37,6 +39,8 @@ import { DSL_DATA_SPACE_LEGEND_APPLICATION_COMMAND_CONFIG } from '../__lib__/DSL
37
39
  import type { QuerySearchSpecification } from '@finos/legend-graph';
38
40
  import { configureDataGridComponent } from '@finos/legend-lego/data-grid';
39
41
  import { renderDataSpaceQueryBuilderTemplateQueryPanelContent } from './query/DataSpaceQueryBuilderTemplateQueryPanelContent.js';
42
+ import { DataSpaceExecutableTemplate } from '../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
43
+ import { filterByType } from '@finos/legend-shared';
40
44
 
41
45
  export class DSL_DataSpace_LegendApplicationPlugin
42
46
  extends LegendApplicationPlugin
@@ -118,6 +122,17 @@ export class DSL_DataSpace_LegendApplicationPlugin
118
122
  ];
119
123
  }
120
124
 
125
+ getQueryFilterOptionsRelatedToTemplateQuery(): (
126
+ queryBuilderState: QueryBuilderState,
127
+ ) => string[] {
128
+ return (queryBuilderState): string[] => {
129
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
130
+ return ['Current Data Space'];
131
+ }
132
+ return [];
133
+ };
134
+ }
135
+
121
136
  getExtraTemplateQueryPanelContentRenderer(): TemplateQueryPanelContentRenderer[] {
122
137
  return [
123
138
  (queryBuilderState: QueryBuilderState): React.ReactNode => {
@@ -130,4 +145,62 @@ export class DSL_DataSpace_LegendApplicationPlugin
130
145
  },
131
146
  ];
132
147
  }
148
+
149
+ getCuratedTemplateQuerySpecifications(): CuratedTemplateQuerySpecification[] {
150
+ return [
151
+ {
152
+ getCuratedTemplateQueries: (
153
+ queryBuilderState,
154
+ ): CuratedTemplateQuery[] => {
155
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
156
+ const executableTemplates =
157
+ queryBuilderState.dataSpace.executables?.filter(
158
+ filterByType(DataSpaceExecutableTemplate),
159
+ );
160
+ return executableTemplates
161
+ ? executableTemplates.map(
162
+ (e) =>
163
+ ({
164
+ title: e.title,
165
+ description: e.description,
166
+ query: e.query,
167
+ executionContextKey:
168
+ e.executionContextKey ??
169
+ queryBuilderState.dataSpace.defaultExecutionContext
170
+ .name,
171
+ }) as CuratedTemplateQuery,
172
+ )
173
+ : [];
174
+ }
175
+ return [];
176
+ },
177
+ loadCuratedTemplateQuery: (
178
+ templateQuery: CuratedTemplateQuery,
179
+ queryBuilderState: QueryBuilderState,
180
+ ): void => {
181
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
182
+ if (
183
+ queryBuilderState.executionContext.name !==
184
+ templateQuery.executionContextKey
185
+ ) {
186
+ const executionContext =
187
+ queryBuilderState.dataSpace.executionContexts.find(
188
+ (c) => c.name === templateQuery.executionContextKey,
189
+ );
190
+ if (executionContext) {
191
+ queryBuilderState.setExecutionContext(executionContext);
192
+ queryBuilderState.propagateExecutionContextChange(
193
+ executionContext,
194
+ );
195
+ queryBuilderState.initializeWithQuery(templateQuery.query);
196
+ queryBuilderState.onExecutionContextChange?.(executionContext);
197
+ }
198
+ } else {
199
+ queryBuilderState.initializeWithQuery(templateQuery.query);
200
+ }
201
+ }
202
+ },
203
+ },
204
+ ];
205
+ }
133
206
  }