@sap-ux/odata-service-inquirer 2.14.10 → 2.14.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.
|
@@ -32,6 +32,7 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
32
32
|
let previousSystemUrl;
|
|
33
33
|
let previousClient;
|
|
34
34
|
let previousService;
|
|
35
|
+
let previousServiceFilter;
|
|
35
36
|
// State shared across validate and additionalMessages functions
|
|
36
37
|
let hasBackendAnnotations;
|
|
37
38
|
// Wrap to allow pass by ref to nested prompts
|
|
@@ -55,12 +56,14 @@ function getSystemServiceQuestion(connectValidator, promptNamespace, promptOptio
|
|
|
55
56
|
choices: async (answers) => {
|
|
56
57
|
if (serviceChoices.length === 0 ||
|
|
57
58
|
previousSystemUrl !== connectValidator.validatedUrl ||
|
|
58
|
-
previousClient !== connectValidator.validatedClient
|
|
59
|
+
previousClient !== connectValidator.validatedClient ||
|
|
60
|
+
!(0, utils_1.areArraysEquivalent)(previousServiceFilter, promptOptions?.serviceFilter)) {
|
|
59
61
|
// if we have a catalog, use it to list services
|
|
60
62
|
if (connectValidator.catalogs[odata_service_writer_1.OdataVersion.v2] || connectValidator.catalogs[odata_service_writer_1.OdataVersion.v4]) {
|
|
61
63
|
serviceChoices = await createServiceChoicesFromCatalog(connectValidator.catalogs, requiredOdataVersion, promptOptions?.serviceFilter);
|
|
62
64
|
previousSystemUrl = connectValidator.validatedUrl;
|
|
63
65
|
previousClient = connectValidator.validatedClient;
|
|
66
|
+
previousServiceFilter = promptOptions?.serviceFilter ? [...promptOptions.serviceFilter] : undefined;
|
|
64
67
|
// Telemetry event for successful service listing using a destination
|
|
65
68
|
if (answers?.[`${types_1.promptNames.systemSelection}`]?.type === 'destination') {
|
|
66
69
|
(0, service_helper_1.sendDestinationServiceSuccessTelemetryEvent)(answers?.[`${types_1.promptNames.systemSelection}`]?.system);
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -73,5 +73,12 @@ export declare function removeCircularFromServiceProvider(serviceProvider: Servi
|
|
|
73
73
|
* @returns the backend system if found or undefined
|
|
74
74
|
*/
|
|
75
75
|
export declare function isBackendSystemKeyExisting(backendSystems: BackendSystem[], url: string, client?: string): BackendSystem | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Compare 2 string arrays without considering ordering.
|
|
78
|
+
*
|
|
79
|
+
* @param array1
|
|
80
|
+
* @param array2
|
|
81
|
+
*/
|
|
82
|
+
export declare function areArraysEquivalent(array1: Array<string> | undefined, array2: Array<string> | undefined): boolean;
|
|
76
83
|
export { PromptState };
|
|
77
84
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/utils/index.js
CHANGED
|
@@ -12,6 +12,7 @@ exports.convertODataVersionType = convertODataVersionType;
|
|
|
12
12
|
exports.getDefaultChoiceIndex = getDefaultChoiceIndex;
|
|
13
13
|
exports.removeCircularFromServiceProvider = removeCircularFromServiceProvider;
|
|
14
14
|
exports.isBackendSystemKeyExisting = isBackendSystemKeyExisting;
|
|
15
|
+
exports.areArraysEquivalent = areArraysEquivalent;
|
|
15
16
|
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
16
17
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
17
18
|
const fiori_generator_shared_1 = require("@sap-ux/fiori-generator-shared");
|
|
@@ -160,4 +161,21 @@ function isBackendSystemKeyExisting(backendSystems, url, client) {
|
|
|
160
161
|
const newBackendSystemId = new store_1.BackendSystemKey({ url, client }).getId();
|
|
161
162
|
return backendSystems.find((backendSystem) => store_1.BackendSystemKey.from(backendSystem).getId() === newBackendSystemId);
|
|
162
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Compare 2 string arrays without considering ordering.
|
|
166
|
+
*
|
|
167
|
+
* @param array1
|
|
168
|
+
* @param array2
|
|
169
|
+
*/
|
|
170
|
+
function areArraysEquivalent(array1, array2) {
|
|
171
|
+
// Both undefined, same length or same object ref
|
|
172
|
+
if ((!array1 && !array2) || (array1?.length === 0 && array2?.length === 0) || array1 === array2) {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
// If either undefined must be different due to earlier condition
|
|
176
|
+
if (!array1 || !array2) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
return [...array1].sort().toString() === [...array2].sort().toString();
|
|
180
|
+
}
|
|
163
181
|
//# sourceMappingURL=index.js.map
|
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.14.
|
|
4
|
+
"version": "2.14.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"@sap-devx/yeoman-ui-types": "1.14.4",
|
|
47
47
|
"@types/inquirer-autocomplete-prompt": "2.0.2",
|
|
48
48
|
"@types/inquirer": "8.2.6",
|
|
49
|
-
"@types/lodash": "4.14.202",
|
|
50
49
|
"jest-extended": "6.0.0",
|
|
51
50
|
"@sap-ux/fiori-generator-shared": "0.13.54",
|
|
52
51
|
"@sap-ux/fiori-elements-writer": "2.8.42",
|