@sap-ux/odata-service-inquirer 2.4.2 → 2.4.4
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/dist/prompts/datasources/sap-system/service-selection/questions.js +4 -3
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.d.ts +2 -1
- package/dist/prompts/datasources/sap-system/service-selection/service-helper.js +6 -2
- package/dist/types.d.ts +4 -0
- package/package.json +5 -5
|
@@ -52,7 +52,7 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
52
52
|
previousClient !== connectValidator.validatedClient) {
|
|
53
53
|
// if we have a catalog, use it to list services
|
|
54
54
|
if (connectValidator.catalogs[odata_service_writer_1.OdataVersion.v2] || connectValidator.catalogs[odata_service_writer_1.OdataVersion.v4]) {
|
|
55
|
-
serviceChoices = await createServiceChoicesFromCatalog(connectValidator.catalogs, requiredOdataVersion);
|
|
55
|
+
serviceChoices = await createServiceChoicesFromCatalog(connectValidator.catalogs, requiredOdataVersion, promptOptions?.serviceFilter);
|
|
56
56
|
previousSystemUrl = connectValidator.validatedUrl;
|
|
57
57
|
previousClient = connectValidator.validatedClient;
|
|
58
58
|
// Telemetry event for successful service listing using a destination
|
|
@@ -158,9 +158,10 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
158
158
|
*
|
|
159
159
|
* @param availableCatalogs catalogs that can be used to list services
|
|
160
160
|
* @param requiredOdataVersion the required OData version to list services for, if not provided all available catalogs will be used
|
|
161
|
+
* @param serviceFilter list of service ids used for filtering the choices
|
|
161
162
|
* @returns service choices
|
|
162
163
|
*/
|
|
163
|
-
async function createServiceChoicesFromCatalog(availableCatalogs, requiredOdataVersion) {
|
|
164
|
+
async function createServiceChoicesFromCatalog(availableCatalogs, requiredOdataVersion, serviceFilter) {
|
|
164
165
|
let catalogs = [];
|
|
165
166
|
if (requiredOdataVersion && availableCatalogs[requiredOdataVersion]) {
|
|
166
167
|
catalogs.push(availableCatalogs[requiredOdataVersion]);
|
|
@@ -168,6 +169,6 @@ async function createServiceChoicesFromCatalog(availableCatalogs, requiredOdataV
|
|
|
168
169
|
else {
|
|
169
170
|
catalogs = Object.values(availableCatalogs).filter((cat) => cat !== undefined);
|
|
170
171
|
}
|
|
171
|
-
return await (0, service_helper_1.getServiceChoices)(catalogs);
|
|
172
|
+
return await (0, service_helper_1.getServiceChoices)(catalogs, serviceFilter);
|
|
172
173
|
}
|
|
173
174
|
//# sourceMappingURL=questions.js.map
|
|
@@ -11,9 +11,10 @@ export declare const telemEventBASServiceSuccess = "SERVICE_INQUIRER_BAS_SUCCESS
|
|
|
11
11
|
* Get the service choices from the specified catalogs.
|
|
12
12
|
*
|
|
13
13
|
* @param catalogs catalogs to get the services from. There should be one per odata version required.
|
|
14
|
+
* @param serviceFilter list of service ids used for filtering the choices
|
|
14
15
|
* @returns service choices based on the provided catalogs
|
|
15
16
|
*/
|
|
16
|
-
export declare function getServiceChoices(catalogs: CatalogService[]): Promise<ListChoiceOptions<ServiceAnswer>[]>;
|
|
17
|
+
export declare function getServiceChoices(catalogs: CatalogService[], serviceFilter?: string[]): Promise<ListChoiceOptions<ServiceAnswer>[]>;
|
|
17
18
|
/**
|
|
18
19
|
* Generates a telemetry event for successfully listing service(s) using a destination.
|
|
19
20
|
*
|
|
@@ -81,9 +81,10 @@ function logServiceCatalogErrorsForHelp(requestErrors, numOfRequests) {
|
|
|
81
81
|
* Get the service choices from the specified catalogs.
|
|
82
82
|
*
|
|
83
83
|
* @param catalogs catalogs to get the services from. There should be one per odata version required.
|
|
84
|
+
* @param serviceFilter list of service ids used for filtering the choices
|
|
84
85
|
* @returns service choices based on the provided catalogs
|
|
85
86
|
*/
|
|
86
|
-
async function getServiceChoices(catalogs) {
|
|
87
|
+
async function getServiceChoices(catalogs, serviceFilter) {
|
|
87
88
|
const requestErrors = {};
|
|
88
89
|
const listServicesRequests = catalogs.map(async (catalog) => {
|
|
89
90
|
try {
|
|
@@ -103,11 +104,14 @@ async function getServiceChoices(catalogs) {
|
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
106
|
const serviceInfos = await Promise.all(listServicesRequests);
|
|
106
|
-
|
|
107
|
+
let flatServices = serviceInfos?.flat() ?? [];
|
|
107
108
|
logger_helper_1.default.logger.debug(`Number of services available: ${flatServices.length}`);
|
|
108
109
|
if (flatServices.length === 0) {
|
|
109
110
|
logServiceCatalogErrorsForHelp(requestErrors, catalogs.length);
|
|
110
111
|
}
|
|
112
|
+
if (serviceFilter) {
|
|
113
|
+
flatServices = flatServices.filter((service) => serviceFilter.includes(service.id));
|
|
114
|
+
}
|
|
111
115
|
return createServiceChoices(flatServices);
|
|
112
116
|
}
|
|
113
117
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -294,6 +294,10 @@ export type ServiceSelectionPromptOptions = {
|
|
|
294
294
|
* This is used to indicate that the service does not support collaborative draft.
|
|
295
295
|
*/
|
|
296
296
|
showCollaborativeDraftWarning?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* A list of service ids ({@link ODataServiceInfo.id}), used to filter the catalog results
|
|
299
|
+
*/
|
|
300
|
+
serviceFilter?: string[];
|
|
297
301
|
} & Pick<CommonPromptOptions, 'additionalMessages'>;
|
|
298
302
|
export type SystemNamePromptOptions = {
|
|
299
303
|
/**
|
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.4.
|
|
4
|
+
"version": "2.4.4",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"i18next": "23.5.1",
|
|
29
29
|
"inquirer-autocomplete-prompt": "2.0.1",
|
|
30
30
|
"os-name": "4.0.1",
|
|
31
|
-
"@sap-ux/axios-extension": "1.21.
|
|
31
|
+
"@sap-ux/axios-extension": "1.21.1",
|
|
32
32
|
"@sap-ux/btp-utils": "1.1.0",
|
|
33
33
|
"@sap-ux/fiori-generator-shared": "0.12.1",
|
|
34
34
|
"@sap-ux/guided-answers-helper": "0.3.0",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
"@types/lodash": "4.14.202",
|
|
48
48
|
"jest-extended": "3.2.4",
|
|
49
49
|
"@sap-ux/fiori-generator-shared": "0.12.1",
|
|
50
|
-
"@sap-ux/fiori-elements-writer": "2.4.
|
|
51
|
-
"@sap-ux/fiori-freestyle-writer": "2.4.
|
|
50
|
+
"@sap-ux/fiori-elements-writer": "2.4.5",
|
|
51
|
+
"@sap-ux/fiori-freestyle-writer": "2.4.2",
|
|
52
52
|
"@sap-ux/feature-toggle": "0.3.0",
|
|
53
|
-
"@sap-ux/odata-service-writer": "0.27.
|
|
53
|
+
"@sap-ux/odata-service-writer": "0.27.2",
|
|
54
54
|
"@sap-ux/cap-config-writer": "0.10.1"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|