@sap-ux/odata-service-inquirer 0.5.34 → 0.5.35
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.
|
@@ -8,8 +8,8 @@ const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
|
8
8
|
const i18n_1 = require("../../../i18n");
|
|
9
9
|
const types_1 = require("../../../types");
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
|
-
const logger_helper_1 = __importDefault(require("../../logger-helper"));
|
|
12
11
|
const connectionValidator_1 = require("../../connectionValidator");
|
|
12
|
+
const logger_helper_1 = __importDefault(require("../../logger-helper"));
|
|
13
13
|
const types_2 = require("./types");
|
|
14
14
|
const validators_1 = require("./validators");
|
|
15
15
|
/**
|
|
@@ -39,7 +39,7 @@ function getServiceUrlPrompt(connectValidator, requiredVersion) {
|
|
|
39
39
|
if (!connectValidator.validity.authRequired && connectValidator.odataService) {
|
|
40
40
|
return (0, validators_1.validateService)(url, {
|
|
41
41
|
odataService: connectValidator.odataService,
|
|
42
|
-
|
|
42
|
+
axiosConfig: connectValidator.axiosConfig
|
|
43
43
|
}, requiredVersion);
|
|
44
44
|
}
|
|
45
45
|
return true;
|
|
@@ -82,7 +82,7 @@ function getIgnoreCertErrorsPrompt(connectValidator, requiredVersion) {
|
|
|
82
82
|
if (!connectValidator.validity.authRequired && connectValidator.odataService) {
|
|
83
83
|
return (0, validators_1.validateService)(serviceUrl, {
|
|
84
84
|
odataService: connectValidator.odataService,
|
|
85
|
-
|
|
85
|
+
axiosConfig: connectValidator.axiosConfig
|
|
86
86
|
}, requiredVersion, ignoreCertError);
|
|
87
87
|
}
|
|
88
88
|
return true;
|
|
@@ -123,7 +123,7 @@ function getCliIgnoreCertValidatePrompt(connectValidator, requiredVersion) {
|
|
|
123
123
|
// Will log on CLI
|
|
124
124
|
const validService = await (0, validators_1.validateService)(serviceUrl, {
|
|
125
125
|
odataService: connectValidator.odataService,
|
|
126
|
-
|
|
126
|
+
axiosConfig: connectValidator.axiosConfig
|
|
127
127
|
}, requiredVersion, true);
|
|
128
128
|
if (validService !== true) {
|
|
129
129
|
throw new Error((0, i18n_1.t)('errors.exitingGeneration', { exitReason: validService.toString() }));
|
|
@@ -183,7 +183,7 @@ function getPasswordPrompt(connectValidator, requiredVersion) {
|
|
|
183
183
|
if (validAuth === true && connectValidator.odataService) {
|
|
184
184
|
return (0, validators_1.validateService)(serviceUrl, {
|
|
185
185
|
odataService: connectValidator.odataService,
|
|
186
|
-
|
|
186
|
+
axiosConfig: connectValidator.axiosConfig
|
|
187
187
|
}, requiredVersion, ignoreCertError);
|
|
188
188
|
}
|
|
189
189
|
return validAuth;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AxiosRequestConfig, type ODataService } from '@sap-ux/axios-extension';
|
|
2
2
|
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
3
3
|
/**
|
|
4
4
|
* Validates that a service specified by the service url is accessible, has the required version and returns valid metadata.
|
|
@@ -7,13 +7,13 @@ import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
|
7
7
|
* @param url the full odata service url including query parameters
|
|
8
8
|
* @param connectionConfig the connection configuration to use for the validation, a subset of the ConnectionValidator properties
|
|
9
9
|
* @param connectionConfig.odataService the odata service instance used to retrieve the metadata (as used by ConnectionValidator)
|
|
10
|
-
* @param connectionConfig.
|
|
10
|
+
* @param connectionConfig.axiosConfig the axios config to use for the annotations request (as used by ConnectionValidator)
|
|
11
11
|
* @param requiredVersion if specified and the service odata version does not match this version, an error is returned
|
|
12
12
|
* @param ignoreCertError if true some certificate errors are ignored
|
|
13
13
|
* @returns true if a valid odata service was returned, false or an error message string otherwise
|
|
14
14
|
*/
|
|
15
|
-
export declare function validateService(url: string, { odataService,
|
|
15
|
+
export declare function validateService(url: string, { odataService, axiosConfig }: {
|
|
16
16
|
odataService: ODataService;
|
|
17
|
-
|
|
17
|
+
axiosConfig: AxiosRequestConfig;
|
|
18
18
|
}, requiredVersion?: OdataVersion | undefined, ignoreCertError?: boolean): Promise<boolean | string>;
|
|
19
19
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.validateService = void 0;
|
|
7
|
+
const axios_extension_1 = require("@sap-ux/axios-extension");
|
|
7
8
|
const error_handler_1 = require("../../../error-handler/error-handler");
|
|
8
9
|
const i18n_1 = require("../../../i18n");
|
|
9
10
|
const types_1 = require("../../../types");
|
|
@@ -18,12 +19,12 @@ const prompt_helpers_1 = require("../../prompt-helpers");
|
|
|
18
19
|
* @param url the full odata service url including query parameters
|
|
19
20
|
* @param connectionConfig the connection configuration to use for the validation, a subset of the ConnectionValidator properties
|
|
20
21
|
* @param connectionConfig.odataService the odata service instance used to retrieve the metadata (as used by ConnectionValidator)
|
|
21
|
-
* @param connectionConfig.
|
|
22
|
+
* @param connectionConfig.axiosConfig the axios config to use for the annotations request (as used by ConnectionValidator)
|
|
22
23
|
* @param requiredVersion if specified and the service odata version does not match this version, an error is returned
|
|
23
24
|
* @param ignoreCertError if true some certificate errors are ignored
|
|
24
25
|
* @returns true if a valid odata service was returned, false or an error message string otherwise
|
|
25
26
|
*/
|
|
26
|
-
async function validateService(url, { odataService,
|
|
27
|
+
async function validateService(url, { odataService, axiosConfig }, requiredVersion = undefined, ignoreCertError = false) {
|
|
27
28
|
try {
|
|
28
29
|
if (ignoreCertError === true) {
|
|
29
30
|
connectionValidator_1.ConnectionValidator.setGlobalRejectUnauthorized(!ignoreCertError);
|
|
@@ -49,7 +50,8 @@ async function validateService(url, { odataService, abapServiceProvider }, requi
|
|
|
49
50
|
// Best effort attempt to get annotations but dont throw an error if it fails as this may not even be an Abap system
|
|
50
51
|
try {
|
|
51
52
|
// Create an abap provider instance to get the annotations using the same request config
|
|
52
|
-
const
|
|
53
|
+
const abapProvider = (0, axios_extension_1.createForAbap)(axiosConfig);
|
|
54
|
+
const catalogService = abapProvider.catalog(serviceOdataVersion);
|
|
53
55
|
logger_helper_1.default.attachAxiosLogger(catalogService.interceptors);
|
|
54
56
|
logger_helper_1.default.logger.debug('Getting annotations for service');
|
|
55
57
|
const annotations = await catalogService.getAnnotations({ path: fullUrl.pathname });
|
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.35",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@sap-ux/btp-utils": "0.15.2",
|
|
31
31
|
"@sap-ux/guided-answers-helper": "0.0.2",
|
|
32
32
|
"@sap-ux/telemetry": "0.5.26",
|
|
33
|
-
"@sap-ux/logger": "0.6.0",
|
|
34
33
|
"@sap-ux/inquirer-common": "0.4.6",
|
|
34
|
+
"@sap-ux/logger": "0.6.0",
|
|
35
35
|
"@sap-ux/project-access": "1.27.0",
|
|
36
36
|
"@sap-ux/project-input-validator": "0.3.3",
|
|
37
37
|
"@sap-ux/store": "0.9.1"
|