@sap-ux/odata-service-inquirer 0.4.9 → 0.5.0
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/index.d.ts +14 -3
- package/dist/index.js +30 -5
- package/dist/prompts/connectionValidator.d.ts +160 -0
- package/dist/prompts/{datasources/service-url/connectionValidator.js → connectionValidator.js} +145 -41
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.d.ts +44 -0
- package/dist/prompts/datasources/sap-system/abap-on-prem/questions.js +253 -0
- package/dist/prompts/datasources/sap-system/abap-on-prem/service-helper.d.ts +33 -0
- package/dist/prompts/datasources/sap-system/abap-on-prem/service-helper.js +122 -0
- package/dist/prompts/datasources/sap-system/new-system/questions.d.ts +35 -0
- package/dist/prompts/datasources/sap-system/new-system/questions.js +107 -0
- package/dist/prompts/datasources/sap-system/prompt-helpers.d.ts +9 -0
- package/dist/prompts/datasources/sap-system/prompt-helpers.js +37 -0
- package/dist/prompts/datasources/sap-system/validators.d.ts +8 -0
- package/dist/prompts/datasources/sap-system/validators.js +36 -0
- package/dist/prompts/datasources/service-url/questions.js +14 -5
- package/dist/prompts/datasources/service-url/validators.d.ts +1 -1
- package/dist/prompts/datasources/service-url/validators.js +2 -2
- package/dist/prompts/logger-helper.js +5 -4
- package/dist/prompts/prompts.js +10 -4
- package/dist/translations/odata-service-inquirer.i18n.json +48 -3
- package/dist/types.d.ts +45 -11
- package/dist/types.js +8 -0
- package/package.json +6 -3
- package/dist/prompts/datasources/service-url/connectionValidator.d.ts +0 -99
|
@@ -9,7 +9,7 @@ const i18n_1 = require("../../../i18n");
|
|
|
9
9
|
const types_1 = require("../../../types");
|
|
10
10
|
const utils_1 = require("../../../utils");
|
|
11
11
|
const logger_helper_1 = __importDefault(require("../../logger-helper"));
|
|
12
|
-
const connectionValidator_1 = require("
|
|
12
|
+
const connectionValidator_1 = require("../../connectionValidator");
|
|
13
13
|
const types_2 = require("./types");
|
|
14
14
|
const validators_1 = require("./validators");
|
|
15
15
|
/**
|
|
@@ -71,7 +71,10 @@ function getIgnoreCertErrorsPrompt(connectValidator, requiredVersion) {
|
|
|
71
71
|
if (ignoreCertError) {
|
|
72
72
|
logger_helper_1.default.logger.warn((0, i18n_1.t)('prompts.validationMessages.warningCertificateValidationDisabled'));
|
|
73
73
|
}
|
|
74
|
-
const validUrl = await connectValidator.validateUrl(serviceUrl,
|
|
74
|
+
const validUrl = await connectValidator.validateUrl(serviceUrl, {
|
|
75
|
+
ignoreCertError,
|
|
76
|
+
forceReValidation: true
|
|
77
|
+
});
|
|
75
78
|
if (validUrl === true) {
|
|
76
79
|
if (!connectValidator.validity.authRequired) {
|
|
77
80
|
return (0, validators_1.validateService)(serviceUrl, connectValidator, requiredVersion, ignoreCertError);
|
|
@@ -103,7 +106,10 @@ function getCliIgnoreCertValidatePrompt(connectValidator, requiredVersion) {
|
|
|
103
106
|
// If the user choose to ignore cert errors, we need to re-validate
|
|
104
107
|
logger_helper_1.default.logger.warn((0, i18n_1.t)('prompts.validationMessages.warningCertificateValidationDisabled'));
|
|
105
108
|
// Re-check if auth required as the cert error would have prevented this check earlier
|
|
106
|
-
const validUrl = await connectValidator.validateUrl(serviceUrl,
|
|
109
|
+
const validUrl = await connectValidator.validateUrl(serviceUrl, {
|
|
110
|
+
ignoreCertError,
|
|
111
|
+
forceReValidation: true
|
|
112
|
+
});
|
|
107
113
|
if (validUrl !== true) {
|
|
108
114
|
throw new Error(validUrl.toString()); // exit
|
|
109
115
|
}
|
|
@@ -157,11 +163,14 @@ function getPasswordPrompt(connectValidator, requiredVersion) {
|
|
|
157
163
|
message: (0, i18n_1.t)('prompts.servicePassword.message'),
|
|
158
164
|
guiType: 'login',
|
|
159
165
|
mask: '*',
|
|
160
|
-
validate: async (password, { username, serviceUrl, ignoreCertError }) => {
|
|
166
|
+
validate: async (password, { username, serviceUrl, ignoreCertError, sapClient }) => {
|
|
161
167
|
if (!serviceUrl || !username || !password) {
|
|
162
168
|
return false;
|
|
163
169
|
}
|
|
164
|
-
const validAuth = await connectValidator.validateAuth(serviceUrl, username, password,
|
|
170
|
+
const validAuth = await connectValidator.validateAuth(serviceUrl, username, password, {
|
|
171
|
+
ignoreCertError,
|
|
172
|
+
sapClient
|
|
173
|
+
});
|
|
165
174
|
if (validAuth === true) {
|
|
166
175
|
return (0, validators_1.validateService)(serviceUrl, connectValidator, requiredVersion, ignoreCertError);
|
|
167
176
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
* Validates that a service specified by the
|
|
4
|
+
* Validates that a service specified by the service url is accessible, has the required version and returns valid metadata.
|
|
5
5
|
* Retrieves annotations (from Abap backends) if available and stores them in the PromptState.
|
|
6
6
|
*
|
|
7
7
|
* @param url the full odata service url including query parameters
|
|
@@ -11,9 +11,9 @@ const types_1 = require("../../../types");
|
|
|
11
11
|
const utils_1 = require("../../../utils");
|
|
12
12
|
const logger_helper_1 = __importDefault(require("../../logger-helper"));
|
|
13
13
|
const prompt_helpers_1 = require("../../prompt-helpers");
|
|
14
|
-
const connectionValidator_1 = require("
|
|
14
|
+
const connectionValidator_1 = require("../../connectionValidator");
|
|
15
15
|
/**
|
|
16
|
-
* Validates that a service specified by the
|
|
16
|
+
* Validates that a service specified by the service url is accessible, has the required version and returns valid metadata.
|
|
17
17
|
* Retrieves annotations (from Abap backends) if available and stores them in the PromptState.
|
|
18
18
|
*
|
|
19
19
|
* @param url the full odata service url including query parameters
|
|
@@ -54,17 +54,18 @@ class LoggerHelper {
|
|
|
54
54
|
* @param interceptors.response the axios response interceptor
|
|
55
55
|
*/
|
|
56
56
|
static attachAxiosLogger(interceptors) {
|
|
57
|
+
const debugLogger = LoggerHelper.logger.debug.bind(LoggerHelper.logger);
|
|
57
58
|
interceptors.request.use((request) => {
|
|
58
59
|
return AxiosLogger.requestLogger(request, {
|
|
59
60
|
url: true,
|
|
60
61
|
data: true,
|
|
61
62
|
prefixText: '@sap-ux/odata-service-inquirer',
|
|
62
63
|
headers: true,
|
|
63
|
-
logger:
|
|
64
|
+
logger: debugLogger
|
|
64
65
|
});
|
|
65
66
|
}, (error) => {
|
|
66
67
|
return AxiosLogger.errorLogger(error, {
|
|
67
|
-
logger:
|
|
68
|
+
logger: debugLogger
|
|
68
69
|
});
|
|
69
70
|
});
|
|
70
71
|
interceptors.response.use((response) => {
|
|
@@ -73,11 +74,11 @@ class LoggerHelper {
|
|
|
73
74
|
prefixText: '@sap-ux/odata-service-inquirer',
|
|
74
75
|
status: true,
|
|
75
76
|
headers: true,
|
|
76
|
-
logger:
|
|
77
|
+
logger: debugLogger
|
|
77
78
|
});
|
|
78
79
|
}, (err) => {
|
|
79
80
|
return AxiosLogger.errorLogger(err, {
|
|
80
|
-
logger:
|
|
81
|
+
logger: debugLogger
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
84
|
}
|
package/dist/prompts/prompts.js
CHANGED
|
@@ -8,11 +8,13 @@ const yeoman_ui_types_1 = require("@sap-devx/yeoman-ui-types");
|
|
|
8
8
|
const inquirer_common_1 = require("@sap-ux/inquirer-common");
|
|
9
9
|
const i18n_1 = require("../i18n");
|
|
10
10
|
const types_1 = require("../types");
|
|
11
|
-
const metadata_file_1 = require("./datasources/metadata-file");
|
|
12
|
-
const prompt_helpers_1 = require("./prompt-helpers");
|
|
13
11
|
const questions_1 = require("./datasources/cap-project/questions");
|
|
12
|
+
const metadata_file_1 = require("./datasources/metadata-file");
|
|
13
|
+
const questions_2 = require("./datasources/sap-system/abap-on-prem/questions");
|
|
14
|
+
const questions_3 = require("./datasources/sap-system/new-system/questions");
|
|
15
|
+
const questions_4 = require("./datasources/service-url/questions");
|
|
14
16
|
const logger_helper_1 = __importDefault(require("./logger-helper"));
|
|
15
|
-
const
|
|
17
|
+
const prompt_helpers_1 = require("./prompt-helpers");
|
|
16
18
|
/**
|
|
17
19
|
* Get the prompts for the OData service inquirer.
|
|
18
20
|
*
|
|
@@ -77,7 +79,11 @@ async function getDatasourceTypeConditionalQuestions(promptOptions) {
|
|
|
77
79
|
const conditionalQuestions = [];
|
|
78
80
|
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)([(0, metadata_file_1.getMetadataFileQuestion)(promptOptions?.metadataFilePath)], (answers) => answers.datasourceType === types_1.DatasourceType.metadataFile));
|
|
79
81
|
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0, questions_1.getLocalCapProjectPrompts)(promptOptions), (answers) => answers.datasourceType === types_1.DatasourceType.capProject));
|
|
80
|
-
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0,
|
|
82
|
+
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0, questions_4.getServiceUrlQuestions)(promptOptions), (answers) => answers.datasourceType === types_1.DatasourceType.odataServiceUrl));
|
|
83
|
+
// Temp integration into Service Inquirer new system questions
|
|
84
|
+
conditionalQuestions.push(...(0, inquirer_common_1.withCondition)((0, questions_2.getAbapOnPremQuestions)(promptOptions), (answers) => answers.datasourceType === types_1.DatasourceType.sapSystem &&
|
|
85
|
+
answers.system === questions_3.newSystemChoiceValue &&
|
|
86
|
+
answers.newSystemType === 'abapOnPrem'));
|
|
81
87
|
//...further data sources to be added here
|
|
82
88
|
return conditionalQuestions;
|
|
83
89
|
}
|
|
@@ -60,7 +60,46 @@
|
|
|
60
60
|
"warningCertificateValidationDisabled": "User has disabled certificate validation",
|
|
61
61
|
"annotationsNotFound": "Annotations not found for specified service"
|
|
62
62
|
},
|
|
63
|
-
"
|
|
63
|
+
"warnings": {
|
|
64
|
+
"nonUIServiceTypeWarningMessage": "Please note that {{serviceType}} services are not intended to be used for the generation of SAP Fiori UI applications",
|
|
65
|
+
"noServicesAvailable": "No services available for the selected system, see logs for further details.",
|
|
66
|
+
"noServicesAvailableForOdataVersion": "There are no V{{odataVersion}} OData services available from the selected system and the template you have chosen supports V{{odataVersion}} OData services only"
|
|
67
|
+
},
|
|
68
|
+
"systemUrl": {
|
|
69
|
+
"message": "System URL",
|
|
70
|
+
"description": "Enter the URL of the SAP System",
|
|
71
|
+
"placeholder": "https://<host>:<port>"
|
|
72
|
+
},
|
|
73
|
+
"sapClient": {
|
|
74
|
+
"message": "SAP client (leave empty for default)",
|
|
75
|
+
"breadcrumb": "SAP Client"
|
|
76
|
+
},
|
|
77
|
+
"systemUsername": {
|
|
78
|
+
"message": "Username"
|
|
79
|
+
},
|
|
80
|
+
"systemPassword": {
|
|
81
|
+
"message": "Password"
|
|
82
|
+
},
|
|
83
|
+
"systemService": {
|
|
84
|
+
"message": "Service name",
|
|
85
|
+
"breadcrumb": "Service",
|
|
86
|
+
"noServicesWarning": "No services available for the selected system, see logs for further details."
|
|
87
|
+
},
|
|
88
|
+
"systemType": {
|
|
89
|
+
"choiceAbapOnPrem": "ABAP On Premise",
|
|
90
|
+
"choiceAbapOnBtp": "ABAP Environment on SAP Business Technology Platform",
|
|
91
|
+
"message": "System type",
|
|
92
|
+
"notYetImplementedWarningMessage": "The selected system type: {{ systemType }} is not yet implemented."
|
|
93
|
+
},
|
|
94
|
+
"systemName": {
|
|
95
|
+
"message": "System name",
|
|
96
|
+
"hint": "Entering a system name will save the connection for re-use.",
|
|
97
|
+
"systemNameExistsWarning": "A system with that name already exists in the secure storage. Please try a different name.",
|
|
98
|
+
"reservedSystemNameWarning": "'{{ systemName }}' is a reserved system name. Please try a different name."
|
|
99
|
+
},
|
|
100
|
+
"systemSelection": {
|
|
101
|
+
"newSystemChoiceLabel": "New system"
|
|
102
|
+
}
|
|
64
103
|
},
|
|
65
104
|
"errors": {
|
|
66
105
|
"cannotReadCapServiceMetadata": "An error occurred reading CAP service metadata: {{serviceName}}. See log for more details.",
|
|
@@ -92,13 +131,19 @@
|
|
|
92
131
|
"serviceUrlNotFound": "Please verify the service url: {{- url}}, target system configuration and network connectivity",
|
|
93
132
|
"urlRedirect": "The service URL is redirecting",
|
|
94
133
|
"certValidationRequired": "Certificate validation is required to continue.",
|
|
95
|
-
"exitingGeneration": "Exiting generation. {{exitReason}}"
|
|
134
|
+
"exitingGeneration": "Exiting generation. {{exitReason}}",
|
|
135
|
+
"serviceMetadataError": "An error occurred reading service metadata for service: {{- servicePath}}",
|
|
136
|
+
"serviceMetadataErrorUI": "$t(errors.serviceMetadataError, {\"servicePath\": \"{{- servicePath}}\" }). $t(texts.seeLogForDetails)",
|
|
137
|
+
"serviceMetadataErrorLog": "$t(errors.serviceMetadataError, {\"servicePath\": \"{{- servicePath}}\" }). {{error}}",
|
|
138
|
+
"serviceTypeRequestError": "Error retrieving service type: {{- error}}"
|
|
96
139
|
},
|
|
97
140
|
"texts": {
|
|
98
141
|
"anExpiredCert": "an expired",
|
|
99
142
|
"aSelfSignedCert": "a self-signed",
|
|
100
143
|
"anUnknownOrInvalidCert": "an unknown or invalid",
|
|
101
|
-
"anUntrustedRootCert": "an untrusted root"
|
|
144
|
+
"anUntrustedRootCert": "an untrusted root",
|
|
145
|
+
"suggestedSystemNameClient": ", client {{client}}",
|
|
146
|
+
"seeLogForDetails": "See log for more details."
|
|
102
147
|
},
|
|
103
148
|
"guidedAnswers": {
|
|
104
149
|
"validationErrorHelpText": "Need help with this error?"
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { IValidationLink } from '@sap-devx/yeoman-ui-types';
|
|
2
|
-
import type { Annotations } from '@sap-ux/axios-extension';
|
|
2
|
+
import type { Annotations, ServiceProvider } from '@sap-ux/axios-extension';
|
|
3
3
|
import type { CommonPromptOptions, YUIQuestion } from '@sap-ux/inquirer-common';
|
|
4
4
|
import type { OdataVersion } from '@sap-ux/odata-service-writer';
|
|
5
5
|
import type { CdsVersionInfo } from '@sap-ux/project-access';
|
|
6
6
|
import type { ListChoiceOptions } from 'inquirer';
|
|
7
|
+
import type { BackendSystem } from '../../store/src';
|
|
7
8
|
/**
|
|
8
9
|
* This file contains types that are exported by the module and are needed for consumers using the APIs `prompt` and `getPrompts`.
|
|
9
10
|
*/
|
|
@@ -16,6 +17,7 @@ export declare enum DatasourceType {
|
|
|
16
17
|
metadataFile = "metadataFile",
|
|
17
18
|
projectSpecificDestination = "projectSpecificDestination"
|
|
18
19
|
}
|
|
20
|
+
export type SapSystemType = 'abapOnPrem' | 'abapOnBtp';
|
|
19
21
|
/**
|
|
20
22
|
* Answers returned by the OdataServiceInquirer prompt API.
|
|
21
23
|
* These values may be used to write an OData service and may be derived from the user's input rather than direct answers.
|
|
@@ -53,18 +55,24 @@ export interface OdataServiceAnswers {
|
|
|
53
55
|
* The 'sap-client' value for the service.
|
|
54
56
|
*/
|
|
55
57
|
sapClient?: string;
|
|
56
|
-
/**
|
|
57
|
-
* User name for the service where basic authentication is required.
|
|
58
|
-
*/
|
|
59
|
-
username?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Password for the service where basic authentication is required.
|
|
62
|
-
*/
|
|
63
|
-
password?: string;
|
|
64
58
|
/**
|
|
65
59
|
* Metadata file path
|
|
66
60
|
*/
|
|
67
61
|
metadataFilePath?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The connected system will allow downstream consumers to access the connected system without creating new connections.
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
connectedSystem?: {
|
|
67
|
+
/**
|
|
68
|
+
* Convienence property to pass the connected system
|
|
69
|
+
*/
|
|
70
|
+
serviceProvider: ServiceProvider;
|
|
71
|
+
/**
|
|
72
|
+
* The persistable backend system representation of the connected service provider
|
|
73
|
+
*/
|
|
74
|
+
backendSystem?: BackendSystem;
|
|
75
|
+
};
|
|
68
76
|
}
|
|
69
77
|
/**
|
|
70
78
|
* Enumeration of prompt names used by OdataServiceInquirerPromptOptions
|
|
@@ -93,7 +101,15 @@ export declare enum promptNames {
|
|
|
93
101
|
/**
|
|
94
102
|
* password
|
|
95
103
|
*/
|
|
96
|
-
serviceUrlPassword = "serviceUrlPassword"
|
|
104
|
+
serviceUrlPassword = "serviceUrlPassword",
|
|
105
|
+
/**
|
|
106
|
+
* Service selection
|
|
107
|
+
*/
|
|
108
|
+
serviceSelection = "serviceSelection",
|
|
109
|
+
/**
|
|
110
|
+
* Newly created systems can be named for storage
|
|
111
|
+
*/
|
|
112
|
+
userSystemName = "userSystemName"
|
|
97
113
|
}
|
|
98
114
|
export type CapRuntime = 'Node.js' | 'Java';
|
|
99
115
|
export interface CapService {
|
|
@@ -166,6 +182,24 @@ export type MetadataPromptOptions = {
|
|
|
166
182
|
*/
|
|
167
183
|
requiredOdataVersion?: OdataVersion;
|
|
168
184
|
};
|
|
185
|
+
export type ServiceSelectionPromptOptions = {
|
|
186
|
+
/**
|
|
187
|
+
* Determines if the service selection prompt should use auto complete prompt for service names.
|
|
188
|
+
* Note that the auto-complete module must be registered with the inquirer instance to use this feature.
|
|
189
|
+
*/
|
|
190
|
+
useAutoComplete?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Used to validate the selected service is of the required odata version
|
|
193
|
+
*/
|
|
194
|
+
requiredOdataVersion?: OdataVersion;
|
|
195
|
+
} & Pick<CommonPromptOptions, 'additionalMessages'>;
|
|
196
|
+
export type SystemNamePromptOptions = {
|
|
197
|
+
/**
|
|
198
|
+
* This option allows the prompt to be excluded where later storage of the system with the provided name is not required.
|
|
199
|
+
* If this propmt is not included then a BackendSystem will not be returned for the connected system.
|
|
200
|
+
*/
|
|
201
|
+
exclude?: boolean;
|
|
202
|
+
};
|
|
169
203
|
export type OdataServiceUrlPromptOptions = {
|
|
170
204
|
/**
|
|
171
205
|
* Used to validate the service specified by the url is of the required odata version edmx
|
|
@@ -176,7 +210,7 @@ export type OdataServiceUrlPasswordOptions = Pick<CommonPromptOptions, 'addition
|
|
|
176
210
|
/**
|
|
177
211
|
* Provide the correct type checking for prompt options
|
|
178
212
|
*/
|
|
179
|
-
type odataServiceInquirerPromptOptions = Record<promptNames.datasourceType, DatasourceTypePromptOptions> & Record<promptNames.metadataFilePath, MetadataPromptOptions> & Record<promptNames.capProject, CapProjectPromptOptions> & Record<promptNames.capService, CapServicePromptOptions> & Record<promptNames.serviceUrl, OdataServiceUrlPromptOptions> & Record<promptNames.serviceUrlPassword, OdataServiceUrlPasswordOptions>;
|
|
213
|
+
type odataServiceInquirerPromptOptions = Record<promptNames.datasourceType, DatasourceTypePromptOptions> & Record<promptNames.metadataFilePath, MetadataPromptOptions> & Record<promptNames.capProject, CapProjectPromptOptions> & Record<promptNames.capService, CapServicePromptOptions> & Record<promptNames.serviceUrl, OdataServiceUrlPromptOptions> & Record<promptNames.serviceUrlPassword, OdataServiceUrlPasswordOptions> & Record<promptNames.serviceSelection, ServiceSelectionPromptOptions> & Record<promptNames.userSystemName, SystemNamePromptOptions>;
|
|
180
214
|
export type OdataServiceQuestion = YUIQuestion<OdataServiceAnswers>;
|
|
181
215
|
export type OdataServicePromptOptions = Partial<odataServiceInquirerPromptOptions>;
|
|
182
216
|
/**
|
package/dist/types.js
CHANGED
|
@@ -43,6 +43,14 @@ var promptNames;
|
|
|
43
43
|
* password
|
|
44
44
|
*/
|
|
45
45
|
promptNames["serviceUrlPassword"] = "serviceUrlPassword";
|
|
46
|
+
/**
|
|
47
|
+
* Service selection
|
|
48
|
+
*/
|
|
49
|
+
promptNames["serviceSelection"] = "serviceSelection";
|
|
50
|
+
/**
|
|
51
|
+
* Newly created systems can be named for storage
|
|
52
|
+
*/
|
|
53
|
+
promptNames["userSystemName"] = "userSystemName";
|
|
46
54
|
})(promptNames || (exports.promptNames = promptNames = {}));
|
|
47
55
|
/**
|
|
48
56
|
* Implementation of IValidationLink interface.
|
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.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -23,13 +23,16 @@
|
|
|
23
23
|
"axios-logger": "2.8.0",
|
|
24
24
|
"fast-xml-parser": "4.2.7",
|
|
25
25
|
"i18next": "23.5.1",
|
|
26
|
+
"inquirer-autocomplete-prompt": "2.0.1",
|
|
26
27
|
"os-name": "4.0.1",
|
|
27
28
|
"@sap-ux/axios-extension": "1.16.0",
|
|
28
29
|
"@sap-ux/btp-utils": "0.15.0",
|
|
29
30
|
"@sap-ux/telemetry": "0.5.7",
|
|
30
|
-
"@sap-ux/inquirer-common": "0.4.
|
|
31
|
+
"@sap-ux/inquirer-common": "0.4.1",
|
|
31
32
|
"@sap-ux/logger": "0.6.0",
|
|
32
|
-
"@sap-ux/project-access": "1.25.5"
|
|
33
|
+
"@sap-ux/project-access": "1.25.5",
|
|
34
|
+
"@sap-ux/project-input-validator": "0.3.1",
|
|
35
|
+
"@sap-ux/store": "0.7.0"
|
|
33
36
|
},
|
|
34
37
|
"devDependencies": {
|
|
35
38
|
"@sap-devx/yeoman-ui-types": "1.14.4",
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type { IValidationLink } from '@sap-devx/yeoman-ui-types';
|
|
2
|
-
import type { AxiosRequestConfig, ODataService } from '@sap-ux/axios-extension';
|
|
3
|
-
/**
|
|
4
|
-
* Structure to store validity information about url to be validated.
|
|
5
|
-
*/
|
|
6
|
-
interface Validity {
|
|
7
|
-
urlFormat?: boolean;
|
|
8
|
-
reachable?: boolean;
|
|
9
|
-
authRequired?: boolean;
|
|
10
|
-
authenticated?: boolean;
|
|
11
|
-
canSkipCertError?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Class that validates the connection to a service url or catalog url.
|
|
15
|
-
* This will determine if authentication is required and if the service/catalog is reachable, generating messages to guide the user.
|
|
16
|
-
* It is optimized for re-validation of the same url, so that the validation is not repeated if not required.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
export declare class ConnectionValidator {
|
|
20
|
-
readonly validity: Validity;
|
|
21
|
-
private _validatedUrl;
|
|
22
|
-
private _odataService;
|
|
23
|
-
private _axiosConfig;
|
|
24
|
-
/**
|
|
25
|
-
* Getter for the axios configuration.
|
|
26
|
-
*
|
|
27
|
-
* @returns the axios configuration
|
|
28
|
-
*/
|
|
29
|
-
get axiosConfig(): AxiosRequestConfig;
|
|
30
|
-
/**
|
|
31
|
-
* Get the odata service instance.
|
|
32
|
-
*
|
|
33
|
-
* @returns the odata service instance
|
|
34
|
-
*/
|
|
35
|
-
get odataService(): ODataService;
|
|
36
|
-
/**
|
|
37
|
-
* Calls a given service url to test its reachability and authentication requirements.
|
|
38
|
-
*
|
|
39
|
-
* @param url a service url (<protocol://<host>:<port>/<service-path>)
|
|
40
|
-
* @param username optional username
|
|
41
|
-
* @param password optional password
|
|
42
|
-
* @param [ignoreCertError] optional, ignore some certificate errors
|
|
43
|
-
* @returns the status code or error returned by the connection attempt
|
|
44
|
-
*/
|
|
45
|
-
private checkSapService;
|
|
46
|
-
/**
|
|
47
|
-
* Validates the service url format as well as its reachability.
|
|
48
|
-
*
|
|
49
|
-
* @param serviceUrl the odata service url to validate
|
|
50
|
-
* @param ignoreCertError ignore some certificate errors
|
|
51
|
-
* @param forceReValidation force re-validation of the url
|
|
52
|
-
* @returns true if the url is reachable, false if not, or an error message string
|
|
53
|
-
*/
|
|
54
|
-
validateUrl(serviceUrl: string, ignoreCertError?: boolean, forceReValidation?: boolean): Promise<boolean | string | IValidationLink>;
|
|
55
|
-
/**
|
|
56
|
-
* Translate the status code into a validation result.
|
|
57
|
-
* Sets the instance validity state based on the status code.
|
|
58
|
-
*
|
|
59
|
-
* @param status a http request status code used to determine the validation result
|
|
60
|
-
* @returns
|
|
61
|
-
*/
|
|
62
|
-
private getValidationResultFromStatusCode;
|
|
63
|
-
/**
|
|
64
|
-
* Is a string nil or whitespace only.
|
|
65
|
-
*
|
|
66
|
-
* @param url the string to test
|
|
67
|
-
* @returns true if the string is nil or whitespace
|
|
68
|
-
*/
|
|
69
|
-
private isEmptyString;
|
|
70
|
-
/**
|
|
71
|
-
* Tests if the url has already been validated.
|
|
72
|
-
*
|
|
73
|
-
* @param url the full url to test for previous validation
|
|
74
|
-
* @returns true if the url has already been validated
|
|
75
|
-
*/
|
|
76
|
-
private isUrlValidated;
|
|
77
|
-
/**
|
|
78
|
-
* Test the connectivity with the specified service url using the provided credentials.
|
|
79
|
-
*
|
|
80
|
-
* @param serviceUrl optional, the service url to validate
|
|
81
|
-
* @param username user name
|
|
82
|
-
* @param password password
|
|
83
|
-
* @param ignoreCertError optional, ignore some certificate errors
|
|
84
|
-
* @returns true if the authentication is successful, false if not, or an error message string
|
|
85
|
-
*/
|
|
86
|
-
validateAuth(serviceUrl: string, username: string, password: string, ignoreCertError?: boolean): Promise<boolean | string>;
|
|
87
|
-
/**
|
|
88
|
-
* Reset the validity state.
|
|
89
|
-
*/
|
|
90
|
-
private resetValidity;
|
|
91
|
-
/**
|
|
92
|
-
* Set the rejectUnauthorized option of the global https agent.
|
|
93
|
-
*
|
|
94
|
-
* @param rejectUnauthorized - true to reject unauthorized certificates, false to accept them
|
|
95
|
-
*/
|
|
96
|
-
static setGlobalRejectUnauthorized(rejectUnauthorized: boolean): void;
|
|
97
|
-
}
|
|
98
|
-
export {};
|
|
99
|
-
//# sourceMappingURL=connectionValidator.d.ts.map
|