@sap-ux/odata-service-inquirer 0.5.29 → 0.5.31
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.
|
@@ -133,7 +133,7 @@ class ErrorHandler {
|
|
|
133
133
|
[ERROR_TYPE.DESTINATION_BAD_GATEWAY_503]: (0, i18n_1.t)('errors.destinationUnavailable'),
|
|
134
134
|
[ERROR_TYPE.REDIRECT]: (0, i18n_1.t)('errors.redirectError'),
|
|
135
135
|
[ERROR_TYPE.NO_SUCH_HOST]: (0, i18n_1.t)('errors.noSuchHostError'),
|
|
136
|
-
[ERROR_TYPE.NO_ABAP_ENVS]: (0, i18n_1.t)('
|
|
136
|
+
[ERROR_TYPE.NO_ABAP_ENVS]: (0, i18n_1.t)('errors.abapEnvsUnavailable')
|
|
137
137
|
});
|
|
138
138
|
/**
|
|
139
139
|
* Get the Guided Answers (help) node for the specified error type.
|
|
@@ -152,6 +152,13 @@ export declare class ConnectionValidator {
|
|
|
152
152
|
* @param connectConfig.odataVersion the odata version to restrict the catalog requests if only a specific version is required
|
|
153
153
|
*/
|
|
154
154
|
private createSystemConnection;
|
|
155
|
+
/**
|
|
156
|
+
* Check if we should attempt to use the v4 catalog service as a fallback.
|
|
157
|
+
*
|
|
158
|
+
* @param statusCode http status code, if not provided will return false as we cannot determine the reason for v2 catalog request failure
|
|
159
|
+
* @returns true if we should attempt the v4 catalog service
|
|
160
|
+
*/
|
|
161
|
+
private shouldAttemptV4Catalog;
|
|
155
162
|
/**
|
|
156
163
|
* Callback for when the refresh token changes.
|
|
157
164
|
*
|
|
@@ -281,12 +281,22 @@ class ConnectionValidator {
|
|
|
281
281
|
if (!odataVersion || odataVersion === axios_extension_1.ODataVersion.v4) {
|
|
282
282
|
this._catalogV4 = this._serviceProvider.catalog(axios_extension_1.ODataVersion.v4);
|
|
283
283
|
}
|
|
284
|
+
let v4Requested = false;
|
|
284
285
|
try {
|
|
285
|
-
|
|
286
|
+
if (this._catalogV2) {
|
|
287
|
+
await this._catalogV2?.listServices();
|
|
288
|
+
}
|
|
289
|
+
else if (this._catalogV4) {
|
|
290
|
+
v4Requested = true;
|
|
291
|
+
await this._catalogV4?.listServices();
|
|
292
|
+
}
|
|
286
293
|
}
|
|
287
294
|
catch (error) {
|
|
288
|
-
// We will try the v4 catalog if v2 returns a 404
|
|
289
|
-
|
|
295
|
+
// We will try the v4 catalog if v2 returns a 404 or an auth code. Try the v4 catalog with the credentials provided also
|
|
296
|
+
// as the user may not be authorized for the v2 catalog specifically.
|
|
297
|
+
if (this._catalogV4 &&
|
|
298
|
+
!v4Requested &&
|
|
299
|
+
this.shouldAttemptV4Catalog(error.response?.status)) {
|
|
290
300
|
await this._catalogV4.listServices();
|
|
291
301
|
}
|
|
292
302
|
else {
|
|
@@ -294,6 +304,19 @@ class ConnectionValidator {
|
|
|
294
304
|
}
|
|
295
305
|
}
|
|
296
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Check if we should attempt to use the v4 catalog service as a fallback.
|
|
309
|
+
*
|
|
310
|
+
* @param statusCode http status code, if not provided will return false as we cannot determine the reason for v2 catalog request failure
|
|
311
|
+
* @returns true if we should attempt the v4 catalog service
|
|
312
|
+
*/
|
|
313
|
+
shouldAttemptV4Catalog(statusCode) {
|
|
314
|
+
if (!statusCode) {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
const errorType = error_handler_1.ErrorHandler.getErrorType(statusCode);
|
|
318
|
+
return errorType === error_handler_1.ERROR_TYPE.NOT_FOUND || errorType === error_handler_1.ERROR_TYPE.AUTH;
|
|
319
|
+
}
|
|
297
320
|
/**
|
|
298
321
|
* Callback for when the refresh token changes.
|
|
299
322
|
*
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getCFDiscoverPrompts = exports.getAbapOnBTPSystemQuestions = void 0;
|
|
7
|
-
const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
8
7
|
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
9
8
|
const cf_tools_1 = require("@sap/cf-tools");
|
|
10
9
|
const error_handler_1 = require("../../../../error-handler/error-handler");
|
|
@@ -147,18 +146,13 @@ function getCFDiscoverPrompts(connectionValidator) {
|
|
|
147
146
|
if (abapService) {
|
|
148
147
|
return await validateServiceInfo(abapService, connectionValidator);
|
|
149
148
|
}
|
|
150
|
-
return false;
|
|
151
|
-
},
|
|
152
|
-
additionalMessages: () => {
|
|
153
149
|
const errorType = prompt_helpers_1.errorHandler.getCurrentErrorType();
|
|
154
150
|
if (errorType === error_handler_1.ERROR_TYPE.NO_ABAP_ENVS) {
|
|
155
151
|
const errorMsg = prompt_helpers_1.errorHandler.getErrorMsg(true);
|
|
156
152
|
const seeLogMsg = (0, i18n_1.t)('texts.seeLogForDetails');
|
|
157
|
-
return {
|
|
158
|
-
message: `${errorMsg} ${seeLogMsg}`,
|
|
159
|
-
severity: yeoman_ui_types_1.Severity.warning
|
|
160
|
-
};
|
|
153
|
+
return `${errorMsg} ${seeLogMsg}`;
|
|
161
154
|
}
|
|
155
|
+
return false;
|
|
162
156
|
}
|
|
163
157
|
}
|
|
164
158
|
];
|
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": "0.5.
|
|
4
|
+
"version": "0.5.31",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@sap-ux/axios-extension": "1.16.5",
|
|
30
30
|
"@sap-ux/btp-utils": "0.15.2",
|
|
31
31
|
"@sap-ux/guided-answers-helper": "0.0.1",
|
|
32
|
-
"@sap-ux/telemetry": "0.5.
|
|
32
|
+
"@sap-ux/telemetry": "0.5.25",
|
|
33
33
|
"@sap-ux/inquirer-common": "0.4.6",
|
|
34
34
|
"@sap-ux/logger": "0.6.0",
|
|
35
|
-
"@sap-ux/project-access": "1.26.
|
|
35
|
+
"@sap-ux/project-access": "1.26.9",
|
|
36
36
|
"@sap-ux/project-input-validator": "0.3.3",
|
|
37
37
|
"@sap-ux/store": "0.9.1"
|
|
38
38
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/lodash": "4.14.202",
|
|
44
44
|
"jest-extended": "3.2.4",
|
|
45
45
|
"lodash": "4.17.21",
|
|
46
|
-
"@sap-ux/odata-service-writer": "0.22.
|
|
46
|
+
"@sap-ux/odata-service-writer": "0.22.4",
|
|
47
47
|
"@sap-ux/feature-toggle": "0.2.0"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|