@sap-ux/odata-service-inquirer 2.5.22 → 2.5.23

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.
@@ -22,7 +22,7 @@ const prompt_helpers_1 = require("../../../prompt-helpers");
22
22
  const validators_1 = require("../../../validators");
23
23
  const service_helpers_1 = require("../../service-helpers/service-helpers");
24
24
  // Service ids continaining these paths should not be offered as UI compatible services
25
- const nonUIServicePaths = ['/IWBEP/COMMON/'];
25
+ const nonUIServicePaths = ['/IWBEP/COMMON'];
26
26
  // Telemetry event name for successful service validation on BAS, note: legacy event names should not be changed
27
27
  exports.telemEventBASServiceSuccess = 'SERVICE_INQUIRER_BAS_SUCCESS';
28
28
  /**
@@ -41,7 +41,7 @@ const createServiceChoices = (serviceInfos) => {
41
41
  }
42
42
  serviceInfos
43
43
  // Exclude non-UI compatible services
44
- ?.filter((service) => !nonUIServicePaths.some((path) => service.path.includes(path)))
44
+ ?.filter((service) => !nonUIServicePaths.some((path) => service.id.includes(path)))
45
45
  .forEach((service) => {
46
46
  let serviceName = service.name;
47
47
  const servicePath = service.path;
@@ -60,6 +60,7 @@ const createServiceChoices = (serviceInfos) => {
60
60
  }
61
61
  });
62
62
  });
63
+ logger_helper_1.default.logger.debug(`Number of unique service choices: ${choices.length}`);
63
64
  return choices.sort((a, b) => (a.name ? a.name.localeCompare(b.name ?? '') : 0));
64
65
  };
65
66
  /**
@@ -87,9 +88,22 @@ function logServiceCatalogErrorsForHelp(requestErrors, numOfRequests) {
87
88
  */
88
89
  async function getServiceChoices(catalogs, serviceFilter) {
89
90
  const requestErrors = {};
90
- const listServicesRequests = catalogs.map(async (catalog) => {
91
+ // Performance tracking for the requests
92
+ const requestTimes = {}; // [v2, v4] request times in ms
93
+ const listServicesRequests = [];
94
+ for (const catalog of catalogs) {
95
+ const catalogVer = catalog instanceof axios_extension_1.V2CatalogService ? axios_extension_1.ODataVersion.v2 : axios_extension_1.ODataVersion.v4;
91
96
  try {
92
- return await catalog.listServices();
97
+ const startTime = Date.now();
98
+ const res = await catalog.listServices();
99
+ const endTime = Date.now();
100
+ const duration = endTime - startTime === 0 ? '<1 ms' : `${endTime - startTime}ms`;
101
+ requestTimes[`v${catalogVer}`] = {
102
+ serviceCount: res.length,
103
+ duration
104
+ };
105
+ logger_helper_1.default.logger.debug(`Number of service${catalogVer === axios_extension_1.ODataVersion.v4 ? ' groups' : 's'}: ${res.length} returned in: ${duration}}`);
106
+ listServicesRequests.push(res);
93
107
  }
94
108
  catch (error) {
95
109
  logger_helper_1.default.logger.error((0, i18n_1.t)('errors.serviceCatalogRequest', {
@@ -99,13 +113,15 @@ async function getServiceChoices(catalogs, serviceFilter) {
99
113
  }));
100
114
  // Save any errors for processing later as we may show more useful message to the user
101
115
  Object.assign(requestErrors, {
102
- [catalog instanceof axios_extension_1.V2CatalogService ? axios_extension_1.ODataVersion.v2 : axios_extension_1.ODataVersion.v4]: error
116
+ [catalogVer]: error
103
117
  });
104
- return [];
118
+ listServicesRequests.push([]);
105
119
  }
106
- });
107
- const serviceInfos = await Promise.all(listServicesRequests);
108
- let flatServices = serviceInfos?.flat() ?? [];
120
+ }
121
+ // Log the request times for debugging purposes
122
+ logger_helper_1.default.logger.debug(`Service catalog request times: ${JSON.stringify(requestTimes, undefined, ' ')}`);
123
+ // Flatten the array of arrays
124
+ let flatServices = listServicesRequests?.flat() ?? [];
109
125
  logger_helper_1.default.logger.debug(`Number of services available: ${flatServices.length}`);
110
126
  if (flatServices.length === 0) {
111
127
  logServiceCatalogErrorsForHelp(requestErrors, catalogs.length);
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.22",
4
+ "version": "2.5.23",
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": "25.3.0",
29
29
  "inquirer-autocomplete-prompt": "2.0.1",
30
30
  "os-name": "4.0.1",
31
- "@sap-ux/axios-extension": "1.22.3",
31
+ "@sap-ux/axios-extension": "1.22.4",
32
32
  "@sap-ux/btp-utils": "1.1.0",
33
33
  "@sap-ux/fiori-generator-shared": "0.13.3",
34
34
  "@sap-ux/guided-answers-helper": "0.3.1",
@@ -43,13 +43,13 @@
43
43
  "devDependencies": {
44
44
  "@sap-ux/vocabularies-types": "0.13.0",
45
45
  "@sap-devx/yeoman-ui-types": "1.14.4",
46
- "@types/inquirer-autocomplete-prompt": "2.0.1",
46
+ "@types/inquirer-autocomplete-prompt": "2.0.2",
47
47
  "@types/inquirer": "8.2.6",
48
48
  "@types/lodash": "4.14.202",
49
- "jest-extended": "3.2.4",
49
+ "jest-extended": "6.0.0",
50
50
  "@sap-ux/fiori-generator-shared": "0.13.3",
51
- "@sap-ux/fiori-elements-writer": "2.5.14",
52
- "@sap-ux/fiori-freestyle-writer": "2.4.25",
51
+ "@sap-ux/fiori-elements-writer": "2.5.15",
52
+ "@sap-ux/fiori-freestyle-writer": "2.4.26",
53
53
  "@sap-ux/feature-toggle": "0.3.0",
54
54
  "@sap-ux/odata-service-writer": "0.27.12",
55
55
  "@sap-ux/cap-config-writer": "0.10.21"
@@ -63,7 +63,7 @@
63
63
  "watch": "tsc --watch",
64
64
  "lint": "eslint . --ext .ts",
65
65
  "lint:fix": "eslint . --ext .ts --fix",
66
- "test": "jest --ci --forceExit --detectOpenHandles --colors --passWithNoTests",
66
+ "test": "jest --ci --forceExit --detectOpenHandles --colors",
67
67
  "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
68
68
  "link": "pnpm link --global",
69
69
  "unlink": "pnpm unlink --global"