@sap-ux/odata-service-inquirer 2.5.25 → 2.5.27
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
2
2
|
import type { ConvertedMetadata, EntitySet } from '@sap-ux/vocabularies-types';
|
|
3
3
|
import type { ListChoiceOptions } from 'inquirer';
|
|
4
|
+
import type { TableType, TemplateType } from '@sap-ux/fiori-elements-writer';
|
|
4
5
|
export type EntityAnswer = {
|
|
5
6
|
entitySetName: string;
|
|
6
7
|
entitySetType: string;
|
|
@@ -49,14 +50,6 @@ export declare function getEntityChoices(edmx: string, { entitySetFilter, defaul
|
|
|
49
50
|
* @returns the navigation entity choices
|
|
50
51
|
*/
|
|
51
52
|
export declare function getNavigationEntityChoices(metadata: ConvertedMetadata, odataVersion: OdataVersion, mainEntityName: string): ListChoiceOptions<NavigationEntityAnswer>[];
|
|
52
|
-
/**
|
|
53
|
-
* Returns only entity sets that have the `Aggregation.ApplySupported` annotation term with the `Transformations` property.
|
|
54
|
-
* This can be found within the entity set annotations or the entity type annotations.
|
|
55
|
-
*
|
|
56
|
-
* @param entitySets the entity sets to filter
|
|
57
|
-
* @returns the filtered entity sets
|
|
58
|
-
*/
|
|
59
|
-
export declare function filterAggregateTransformations(entitySets: EntitySet[]): EntitySet[];
|
|
60
53
|
/**
|
|
61
54
|
* Returns only entities that have a type property of 'HasDraftEnabled'.
|
|
62
55
|
*
|
|
@@ -64,4 +57,18 @@ export declare function filterAggregateTransformations(entitySets: EntitySet[]):
|
|
|
64
57
|
* @returns the filtered entity sets
|
|
65
58
|
*/
|
|
66
59
|
export declare function filterDraftEnabledEntities(entitySets: EntitySet[]): EntitySet[] | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Get the default table type based on the template type and previous answers.
|
|
62
|
+
*
|
|
63
|
+
* @param templateType the template type of the application to be generated from the prompt answers
|
|
64
|
+
* @param metadata the metadata (edmx) string of the service
|
|
65
|
+
* @param odataVersion the OData version of the service
|
|
66
|
+
* @param mainEntitySetName the name of the main entity set
|
|
67
|
+
* @param currentTableType the current table type selected by the user
|
|
68
|
+
* @returns the default table type and a boolean indicating if AnalyticalTable should be set as default
|
|
69
|
+
*/
|
|
70
|
+
export declare function getDefaultTableType(templateType: TemplateType, metadata: ConvertedMetadata, odataVersion: OdataVersion, mainEntitySetName?: string, currentTableType?: TableType): {
|
|
71
|
+
tableType: TableType;
|
|
72
|
+
setAnalyticalTableDefault: boolean;
|
|
73
|
+
};
|
|
67
74
|
//# sourceMappingURL=entity-helper.d.ts.map
|
|
@@ -5,13 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getEntityChoices = getEntityChoices;
|
|
7
7
|
exports.getNavigationEntityChoices = getNavigationEntityChoices;
|
|
8
|
-
exports.filterAggregateTransformations = filterAggregateTransformations;
|
|
9
8
|
exports.filterDraftEnabledEntities = filterDraftEnabledEntities;
|
|
9
|
+
exports.getDefaultTableType = getDefaultTableType;
|
|
10
10
|
const annotation_converter_1 = require("@sap-ux/annotation-converter");
|
|
11
11
|
const edmx_parser_1 = require("@sap-ux/edmx-parser");
|
|
12
12
|
const odata_service_writer_1 = require("@sap-ux/odata-service-writer");
|
|
13
13
|
const i18n_1 = require("../../i18n");
|
|
14
14
|
const logger_helper_1 = __importDefault(require("../logger-helper"));
|
|
15
|
+
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
15
16
|
/**
|
|
16
17
|
* Finds the navigation property name that links a parameterised entity set to its target entity set.
|
|
17
18
|
*
|
|
@@ -85,7 +86,7 @@ function getEntityChoices(edmx, { entitySetFilter, defaultMainEntityName } = {})
|
|
|
85
86
|
}
|
|
86
87
|
else if (entitySetFilter === 'filterAggregateTransformationsOnly' && odataVersion === odata_service_writer_1.OdataVersion.v4) {
|
|
87
88
|
// Only for v4 odata version, if a v2 metadata is passed, this will be ignored
|
|
88
|
-
entitySets = filterAggregateTransformations(convertedMetadata.entitySets);
|
|
89
|
+
entitySets = (0, inquirer_common_1.filterAggregateTransformations)(convertedMetadata.entitySets);
|
|
89
90
|
}
|
|
90
91
|
else {
|
|
91
92
|
entitySets = convertedMetadata.entitySets;
|
|
@@ -168,19 +169,6 @@ function getNavigationEntityChoices(metadata, odataVersion, mainEntityName) {
|
|
|
168
169
|
}
|
|
169
170
|
return choices;
|
|
170
171
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Returns only entity sets that have the `Aggregation.ApplySupported` annotation term with the `Transformations` property.
|
|
173
|
-
* This can be found within the entity set annotations or the entity type annotations.
|
|
174
|
-
*
|
|
175
|
-
* @param entitySets the entity sets to filter
|
|
176
|
-
* @returns the filtered entity sets
|
|
177
|
-
*/
|
|
178
|
-
function filterAggregateTransformations(entitySets) {
|
|
179
|
-
return entitySets.filter((entitySet) => {
|
|
180
|
-
return (!!entitySet.annotations?.Aggregation?.ApplySupported?.Transformations ||
|
|
181
|
-
!!entitySet.entityType?.annotations?.Aggregation?.ApplySupported?.Transformations);
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
172
|
/**
|
|
185
173
|
* Returns only entities that have a type property of 'HasDraftEnabled'.
|
|
186
174
|
*
|
|
@@ -193,4 +181,41 @@ function filterDraftEnabledEntities(entitySets) {
|
|
|
193
181
|
return !!entitySetTypeProperties.find((property) => property.name === 'HasDraftEntity');
|
|
194
182
|
});
|
|
195
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Get the default table type based on the template type and previous answers.
|
|
186
|
+
*
|
|
187
|
+
* @param templateType the template type of the application to be generated from the prompt answers
|
|
188
|
+
* @param metadata the metadata (edmx) string of the service
|
|
189
|
+
* @param odataVersion the OData version of the service
|
|
190
|
+
* @param mainEntitySetName the name of the main entity set
|
|
191
|
+
* @param currentTableType the current table type selected by the user
|
|
192
|
+
* @returns the default table type and a boolean indicating if AnalyticalTable should be set as default
|
|
193
|
+
*/
|
|
194
|
+
function getDefaultTableType(templateType, metadata, odataVersion, mainEntitySetName, currentTableType) {
|
|
195
|
+
let tableType;
|
|
196
|
+
let setAnalyticalTableDefault = false;
|
|
197
|
+
if ((templateType === 'lrop' || templateType === 'worklist') &&
|
|
198
|
+
odataVersion === odata_service_writer_1.OdataVersion.v4 &&
|
|
199
|
+
(0, inquirer_common_1.hasAggregateTransformationsForEntity)(metadata, mainEntitySetName)) {
|
|
200
|
+
// For V4, if the selected entity has aggregate transformations, use AnalyticalTable as default
|
|
201
|
+
tableType = 'AnalyticalTable';
|
|
202
|
+
setAnalyticalTableDefault = true;
|
|
203
|
+
}
|
|
204
|
+
else if (templateType === 'alp') {
|
|
205
|
+
// For ALP, use AnalyticalTable as default
|
|
206
|
+
tableType = 'AnalyticalTable';
|
|
207
|
+
}
|
|
208
|
+
else if (currentTableType) {
|
|
209
|
+
// If the user has already selected a table type use it
|
|
210
|
+
tableType = currentTableType;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
// Default to ResponsiveTable for other cases
|
|
214
|
+
tableType = 'ResponsiveTable';
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
tableType,
|
|
218
|
+
setAnalyticalTableDefault
|
|
219
|
+
};
|
|
220
|
+
}
|
|
196
221
|
//# sourceMappingURL=entity-helper.js.map
|
|
@@ -171,7 +171,7 @@ function getTableLayoutQuestions(templateType, odataVersion, isCapService, metad
|
|
|
171
171
|
},
|
|
172
172
|
choices: tableTypeChoices,
|
|
173
173
|
default: (prevAnswers) => {
|
|
174
|
-
const tableTypeDefault = getDefaultTableType(templateType, metadata, odataVersion, prevAnswers?.mainEntity?.entitySetName, prevAnswers?.tableType);
|
|
174
|
+
const tableTypeDefault = (0, entity_helper_1.getDefaultTableType)(templateType, metadata, odataVersion, prevAnswers?.mainEntity?.entitySetName, prevAnswers?.tableType);
|
|
175
175
|
setAnalyticalTableDefault = tableTypeDefault.setAnalyticalTableDefault;
|
|
176
176
|
return tableTypeDefault.tableType;
|
|
177
177
|
},
|
|
@@ -218,56 +218,6 @@ function getEdmxSizeInKb(edmx) {
|
|
|
218
218
|
}
|
|
219
219
|
return 0;
|
|
220
220
|
}
|
|
221
|
-
/**
|
|
222
|
-
* Get the default table type based on the template type and previous answers.
|
|
223
|
-
*
|
|
224
|
-
* @param templateType the template type of the application to be generated from the prompt answers
|
|
225
|
-
* @param metadata the metadata (edmx) string of the service
|
|
226
|
-
* @param odataVersion the OData version of the service
|
|
227
|
-
* @param mainEntitySetName the name of the main entity set
|
|
228
|
-
* @param currentTableType the current table type selected by the user
|
|
229
|
-
* @returns the default table type and a boolean indicating if AnalyticalTable should be set as default
|
|
230
|
-
*/
|
|
231
|
-
function getDefaultTableType(templateType, metadata, odataVersion, mainEntitySetName, currentTableType) {
|
|
232
|
-
let tableType;
|
|
233
|
-
let setAnalyticalTableDefault = false;
|
|
234
|
-
if ((templateType === 'lrop' || templateType === 'worklist') &&
|
|
235
|
-
odataVersion === odata_service_writer_1.OdataVersion.v4 &&
|
|
236
|
-
hasAggregateTransformationsForEntity(metadata, mainEntitySetName)) {
|
|
237
|
-
// For V4, if the selected entity has aggregate transformations, use AnalyticalTable as default
|
|
238
|
-
tableType = 'AnalyticalTable';
|
|
239
|
-
setAnalyticalTableDefault = true;
|
|
240
|
-
}
|
|
241
|
-
else if (templateType === 'alp') {
|
|
242
|
-
// For ALP, use AnalyticalTable as default
|
|
243
|
-
tableType = 'AnalyticalTable';
|
|
244
|
-
}
|
|
245
|
-
else if (currentTableType) {
|
|
246
|
-
// If the user has already selected a table type use it
|
|
247
|
-
tableType = currentTableType;
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
// Default to ResponsiveTable for other cases
|
|
251
|
-
tableType = 'ResponsiveTable';
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
tableType,
|
|
255
|
-
setAnalyticalTableDefault
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Checks if the given entity set name has aggregate transformations in the metadata.
|
|
260
|
-
*
|
|
261
|
-
* @param metadata The metadata (edmx) string of the service.
|
|
262
|
-
* @param entitySetName The entity set name to check for aggregate transformations.
|
|
263
|
-
* @returns true if the entity set has aggregate transformations, false otherwise.
|
|
264
|
-
*/
|
|
265
|
-
function hasAggregateTransformationsForEntity(metadata, entitySetName) {
|
|
266
|
-
if (!entitySetName) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
return (0, entity_helper_1.filterAggregateTransformations)(metadata.entitySets).some((entitySet) => entitySet.name === entitySetName);
|
|
270
|
-
}
|
|
271
221
|
/**
|
|
272
222
|
* Get the questions that may be used to prompt for adding annotations. Only a subset of the questions will be returned based on the template type and OData version.
|
|
273
223
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/odata-service-inquirer",
|
|
3
3
|
"description": "Prompts module that can prompt users for inputs required for odata service writing",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.27",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"os-name": "4.0.1",
|
|
31
31
|
"@sap-ux/axios-extension": "1.22.4",
|
|
32
32
|
"@sap-ux/btp-utils": "1.1.0",
|
|
33
|
-
"@sap-ux/fiori-generator-shared": "0.13.
|
|
33
|
+
"@sap-ux/fiori-generator-shared": "0.13.5",
|
|
34
34
|
"@sap-ux/guided-answers-helper": "0.3.1",
|
|
35
|
-
"@sap-ux/telemetry": "0.6.
|
|
36
|
-
"@sap-ux/inquirer-common": "0.7.
|
|
35
|
+
"@sap-ux/telemetry": "0.6.12",
|
|
36
|
+
"@sap-ux/inquirer-common": "0.7.30",
|
|
37
37
|
"@sap-ux/logger": "0.7.0",
|
|
38
38
|
"@sap-ux/nodejs-utils": "0.2.2",
|
|
39
|
-
"@sap-ux/project-access": "1.30.
|
|
40
|
-
"@sap-ux/project-input-validator": "0.6.
|
|
39
|
+
"@sap-ux/project-access": "1.30.9",
|
|
40
|
+
"@sap-ux/project-input-validator": "0.6.14",
|
|
41
41
|
"@sap-ux/store": "1.1.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@types/inquirer": "8.2.6",
|
|
48
48
|
"@types/lodash": "4.14.202",
|
|
49
49
|
"jest-extended": "6.0.0",
|
|
50
|
-
"@sap-ux/fiori-generator-shared": "0.13.
|
|
51
|
-
"@sap-ux/fiori-elements-writer": "2.5.
|
|
52
|
-
"@sap-ux/fiori-freestyle-writer": "2.4.
|
|
50
|
+
"@sap-ux/fiori-generator-shared": "0.13.5",
|
|
51
|
+
"@sap-ux/fiori-elements-writer": "2.5.18",
|
|
52
|
+
"@sap-ux/fiori-freestyle-writer": "2.4.29",
|
|
53
53
|
"@sap-ux/feature-toggle": "0.3.0",
|
|
54
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
55
|
-
"@sap-ux/cap-config-writer": "0.10.
|
|
54
|
+
"@sap-ux/odata-service-writer": "0.27.14",
|
|
55
|
+
"@sap-ux/cap-config-writer": "0.10.23"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=20.x"
|