@sap-ux/environment-check 0.7.1 → 0.8.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/README.md +14 -2
- package/dist/checks/destination.d.ts +16 -8
- package/dist/checks/destination.d.ts.map +1 -1
- package/dist/checks/destination.js +42 -130
- package/dist/checks/destination.js.map +1 -1
- package/dist/checks/endpoint.d.ts +23 -0
- package/dist/checks/endpoint.d.ts.map +1 -0
- package/dist/checks/endpoint.js +76 -0
- package/dist/checks/endpoint.js.map +1 -0
- package/dist/checks/environment.d.ts +20 -3
- package/dist/checks/environment.d.ts.map +1 -1
- package/dist/checks/environment.js +49 -40
- package/dist/checks/environment.js.map +1 -1
- package/dist/checks/get-installed.d.ts.map +1 -1
- package/dist/checks/get-installed.js +29 -33
- package/dist/checks/get-installed.js.map +1 -1
- package/dist/checks/index.d.ts +1 -0
- package/dist/checks/index.d.ts.map +1 -1
- package/dist/checks/index.js +4 -1
- package/dist/checks/index.js.map +1 -1
- package/dist/checks/service-checks.d.ts +53 -0
- package/dist/checks/service-checks.d.ts.map +1 -0
- package/dist/checks/service-checks.js +240 -0
- package/dist/checks/service-checks.js.map +1 -0
- package/dist/checks/stored-system.d.ts +21 -0
- package/dist/checks/stored-system.d.ts.map +1 -0
- package/dist/checks/stored-system.js +112 -0
- package/dist/checks/stored-system.js.map +1 -0
- package/dist/checks/workspace.d.ts.map +1 -1
- package/dist/checks/workspace.js +46 -9
- package/dist/checks/workspace.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/output/markdown.d.ts.map +1 -1
- package/dist/output/markdown.js +75 -14
- package/dist/output/markdown.js.map +1 -1
- package/dist/translations/env-check.i18n.json +82 -55
- package/dist/types.d.ts +31 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist/types.js.map +1 -1
- package/package.json +4 -2
- package/dist/checks/project-utils.d.ts +0 -17
- package/dist/checks/project-utils.d.ts.map +0 -1
- package/dist/checks/project-utils.js +0 -173
- package/dist/checks/project-utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -18,7 +18,9 @@ Pnpm
|
|
|
18
18
|
import {
|
|
19
19
|
getEnvironment,
|
|
20
20
|
checkBASDestinations,
|
|
21
|
-
checkBASDestination
|
|
21
|
+
checkBASDestination,
|
|
22
|
+
checkEndpoints,
|
|
23
|
+
checkEndpoint,
|
|
22
24
|
} from '@sap-ux/environment-check';
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -36,6 +38,16 @@ const destinationResults = await checkBASDestinations();
|
|
|
36
38
|
*/
|
|
37
39
|
const destResult = await checkBASDestination(destination, username, password);
|
|
38
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Checks the stored SAP Systems (or destinations on BAS) and returns a list
|
|
43
|
+
*/
|
|
44
|
+
const endpointResults = await checkEndpoints();
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Check the stored SAP System (or destination on BAS) for v2 & v4 catalog service and other services
|
|
48
|
+
*/
|
|
49
|
+
const endpointResult = await checkEndpoint(destination, username, password);
|
|
50
|
+
|
|
39
51
|
```
|
|
40
52
|
|
|
41
53
|
## CLI
|
|
@@ -51,7 +63,7 @@ Usage
|
|
|
51
63
|
$ envcheck --destination <DESTINATION> --output <OUTPUT> <WORKSPACE_ROOT>
|
|
52
64
|
|
|
53
65
|
Options
|
|
54
|
-
--destination destination to perform deep check, multiple
|
|
66
|
+
--destination destination or stored SAP system to perform deep check, multiple destinations can be passed
|
|
55
67
|
--output json | markdown | verbose | zip format for output, if not specified all messages except 'info' are shown
|
|
56
68
|
|
|
57
69
|
<WORKSPACE_ROOT*> path the root folder of a workspace. Multiple roots can be defined. We search for apps with destinations in workspaces
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Endpoint, ResultMessage, EndpointResults } from '../types';
|
|
2
|
+
import { UrlServiceType } from '../types';
|
|
2
3
|
/**
|
|
3
4
|
* Check a BAS destination, like catalog service v2 & v4.
|
|
4
5
|
*
|
|
5
6
|
* @param destination - Destination from list of all destinations
|
|
6
|
-
* @param username username
|
|
7
|
-
* @param password password
|
|
7
|
+
* @param username - username
|
|
8
|
+
* @param password - password
|
|
8
9
|
* @returns messages and destination results
|
|
9
10
|
*/
|
|
10
|
-
export declare function checkBASDestination(destination:
|
|
11
|
+
export declare function checkBASDestination(destination: Endpoint, username?: string | undefined, password?: string | undefined): Promise<{
|
|
11
12
|
messages: ResultMessage[];
|
|
12
|
-
destinationResults:
|
|
13
|
+
destinationResults: EndpointResults;
|
|
13
14
|
}>;
|
|
14
15
|
/**
|
|
15
16
|
* Returns whether a given destination requires username/password.
|
|
@@ -17,14 +18,21 @@ export declare function checkBASDestination(destination: Destination, username?:
|
|
|
17
18
|
* @param destination - the destination to check
|
|
18
19
|
* @returns boolean if basic auth is required
|
|
19
20
|
*/
|
|
20
|
-
export declare function needsUsernamePassword(destination:
|
|
21
|
+
export declare function needsUsernamePassword(destination: Endpoint): boolean;
|
|
21
22
|
/**
|
|
22
|
-
* Checks the destinations and returns a list.
|
|
23
|
+
* Checks the destinations and returns a list.
|
|
23
24
|
*
|
|
24
25
|
* @returns messages, destinations
|
|
25
26
|
*/
|
|
26
27
|
export declare function checkBASDestinations(): Promise<{
|
|
27
28
|
messages: ResultMessage[];
|
|
28
|
-
destinations:
|
|
29
|
+
destinations: Endpoint[];
|
|
29
30
|
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Return the URL service type for a given destination.
|
|
33
|
+
*
|
|
34
|
+
* @param destination - destination to check
|
|
35
|
+
* @returns - URL service type, like 'Full Service URL', 'Catalog Service', 'Partial URL'
|
|
36
|
+
*/
|
|
37
|
+
export declare function getUrlServiceTypeForDest(destination: Endpoint): UrlServiceType;
|
|
30
38
|
//# sourceMappingURL=destination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../src/checks/destination.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"destination.d.ts","sourceRoot":"","sources":["../../src/checks/destination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAKzE,OAAO,EAAE,cAAc,EAAY,MAAM,UAAU,CAAC;AAIpD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACrC,WAAW,EAAE,QAAQ,EACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,kBAAkB,EAAE,eAAe,CAAA;CAAE,CAAC,CA6B7E;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAEpE;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC;IAClD,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,YAAY,EAAE,QAAQ,EAAE,CAAC;CAC5B,CAAC,CAiDD;AA2CD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,QAAQ,GAAG,cAAc,CAc9E"}
|
|
@@ -12,129 +12,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.checkBASDestinations = exports.needsUsernamePassword = exports.checkBASDestination = void 0;
|
|
15
|
+
exports.getUrlServiceTypeForDest = exports.checkBASDestinations = exports.needsUsernamePassword = exports.checkBASDestination = void 0;
|
|
16
16
|
const bas_sdk_1 = require("@sap/bas-sdk");
|
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
|
18
18
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
19
19
|
const logger_1 = require("../logger");
|
|
20
|
-
const formatter_1 = require("../formatter");
|
|
21
20
|
const i18n_1 = require("../i18n");
|
|
22
|
-
const
|
|
23
|
-
const catalogMessages = {
|
|
24
|
-
401: (destination, odataVersion) => i18n_1.t('error.401', { odataVersion, destination: destination.Name }),
|
|
25
|
-
403: (destination, odataVersion) => i18n_1.t('error.403', { odataVersion, destination: destination.Name })
|
|
26
|
-
};
|
|
21
|
+
const service_checks_1 = require("./service-checks");
|
|
27
22
|
/**
|
|
28
23
|
* Check a BAS destination, like catalog service v2 & v4.
|
|
29
24
|
*
|
|
30
25
|
* @param destination - Destination from list of all destinations
|
|
31
|
-
* @param username username
|
|
32
|
-
* @param password password
|
|
26
|
+
* @param username - username
|
|
27
|
+
* @param password - password
|
|
33
28
|
* @returns messages and destination results
|
|
34
29
|
*/
|
|
35
30
|
function checkBASDestination(destination, username, password) {
|
|
36
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
32
|
const logger = logger_1.getLogger();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
messages: logger.getMessages(),
|
|
43
|
-
destinationResults
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
exports.checkBASDestination = checkBASDestination;
|
|
48
|
-
/**
|
|
49
|
-
* Checks for services from catalog requests.
|
|
50
|
-
*
|
|
51
|
-
* @param destination sap detination
|
|
52
|
-
* @param username username
|
|
53
|
-
* @param password password
|
|
54
|
-
* @returns Result messages and results of catalog requests
|
|
55
|
-
*/
|
|
56
|
-
function checkCatalogServices(destination, username, password) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const messages = [];
|
|
59
|
-
const v2results = yield catalogRequest(axios_extension_1.ODataVersion.v2, destination, username, password);
|
|
60
|
-
messages.push(...v2results.messages);
|
|
61
|
-
const v4results = yield catalogRequest(axios_extension_1.ODataVersion.v4, destination, username, password);
|
|
62
|
-
messages.push(...v4results.messages);
|
|
33
|
+
const abapServiceProvider = service_checks_1.getServiceProvider(destination, username, password);
|
|
34
|
+
// catalog service request
|
|
35
|
+
const { messages: catalogMsgs, result: catalogServiceResult } = yield service_checks_1.checkCatalogServices(abapServiceProvider, destination.Name);
|
|
36
|
+
logger.push(...catalogMsgs);
|
|
63
37
|
const html5DynamicDestination = !!destination['HTML5.DynamicDestination'];
|
|
64
38
|
if (!html5DynamicDestination) {
|
|
65
|
-
|
|
39
|
+
logger.push({
|
|
66
40
|
severity: "error" /* Error */,
|
|
67
41
|
text: i18n_1.t('error.missingDynamicDestProperty', { destination: destination.Name })
|
|
68
42
|
});
|
|
69
43
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
v4: { results: v4results.result, status: v4results.responseStatus },
|
|
44
|
+
const destinationResults = {
|
|
45
|
+
catalogService: catalogServiceResult,
|
|
73
46
|
HTML5DynamicDestination: html5DynamicDestination
|
|
74
47
|
};
|
|
75
|
-
return {
|
|
76
|
-
messages,
|
|
77
|
-
result
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Performs a catalog request for the given odata version and destination.
|
|
83
|
-
*
|
|
84
|
-
* @param odataVersion odataVersion to be used
|
|
85
|
-
* @param destination destination to be checked
|
|
86
|
-
* @param username username
|
|
87
|
-
* @param password password
|
|
88
|
-
* @returns messages, catalog results, response status
|
|
89
|
-
*/
|
|
90
|
-
function catalogRequest(odataVersion, destination, username, password) {
|
|
91
|
-
var _a, _b, _c, _d;
|
|
92
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const logger = logger_1.getLogger();
|
|
94
|
-
let result;
|
|
95
|
-
let url;
|
|
96
|
-
let responseStatus;
|
|
97
|
-
try {
|
|
98
|
-
const auth = username !== undefined && password !== undefined
|
|
99
|
-
? {
|
|
100
|
-
username,
|
|
101
|
-
password
|
|
102
|
-
}
|
|
103
|
-
: undefined;
|
|
104
|
-
const axiosConfig = {
|
|
105
|
-
baseURL: destination.Host,
|
|
106
|
-
auth: auth
|
|
107
|
-
};
|
|
108
|
-
const provider = axios_extension_1.createForDestination(axiosConfig, destination);
|
|
109
|
-
const catalog = provider.catalog(odataVersion);
|
|
110
|
-
result = yield catalog.listServices();
|
|
111
|
-
if (result.length > 0) {
|
|
112
|
-
const numberOfServices = formatter_1.countNumberOfServices(result);
|
|
113
|
-
logger.info(i18n_1.t('info.numServicesForDestination', {
|
|
114
|
-
odataVersion,
|
|
115
|
-
destination: destination.Name,
|
|
116
|
-
numServicesForDest: formatter_1.getServiceCountText(numberOfServices)
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
catch (error) {
|
|
121
|
-
responseStatus = ((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) || ((_b = error === null || error === void 0 ? void 0 : error.cause) === null || _b === void 0 ? void 0 : _b.status);
|
|
122
|
-
logger.error(catalogMessages[responseStatus]
|
|
123
|
-
? catalogMessages[responseStatus](destination, odataVersion)
|
|
124
|
-
: i18n_1.t('error.queryFailure', { odataVersion, destination: destination.Name }));
|
|
125
|
-
const errorJson = error.toJSON ? error.toJSON() : {};
|
|
126
|
-
if ((_d = (_c = errorJson === null || errorJson === void 0 ? void 0 : errorJson.config) === null || _c === void 0 ? void 0 : _c.auth) === null || _d === void 0 ? void 0 : _d.password) {
|
|
127
|
-
delete errorJson.config.auth.password;
|
|
128
|
-
}
|
|
129
|
-
logger.debug(i18n_1.t('error.urlRequestFailure', { url, error: error.message, errorObj: error }));
|
|
130
|
-
}
|
|
131
48
|
return {
|
|
132
49
|
messages: logger.getMessages(),
|
|
133
|
-
|
|
134
|
-
responseStatus
|
|
50
|
+
destinationResults
|
|
135
51
|
};
|
|
136
52
|
});
|
|
137
53
|
}
|
|
54
|
+
exports.checkBASDestination = checkBASDestination;
|
|
138
55
|
/**
|
|
139
56
|
* Returns whether a given destination requires username/password.
|
|
140
57
|
*
|
|
@@ -146,7 +63,7 @@ function needsUsernamePassword(destination) {
|
|
|
146
63
|
}
|
|
147
64
|
exports.needsUsernamePassword = needsUsernamePassword;
|
|
148
65
|
/**
|
|
149
|
-
* Checks the destinations and returns a list.
|
|
66
|
+
* Checks the destinations and returns a list.
|
|
150
67
|
*
|
|
151
68
|
* @returns messages, destinations
|
|
152
69
|
*/
|
|
@@ -169,14 +86,8 @@ function checkBASDestinations() {
|
|
|
169
86
|
}
|
|
170
87
|
// Destinations request
|
|
171
88
|
try {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const response = yield bas_sdk_1.destinations.getDestinations();
|
|
175
|
-
retrievedDestinations = transformDestination(response);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
// Destination check for VSCode would go here
|
|
179
|
-
}
|
|
89
|
+
const response = yield bas_sdk_1.destinations.getDestinations();
|
|
90
|
+
const retrievedDestinations = transformDestinations(response);
|
|
180
91
|
for (const destination of retrievedDestinations) {
|
|
181
92
|
destination.UrlServiceType = getUrlServiceTypeForDest(destination);
|
|
182
93
|
destinations.push(destination);
|
|
@@ -205,35 +116,12 @@ function checkBASDestinations() {
|
|
|
205
116
|
}
|
|
206
117
|
exports.checkBASDestinations = checkBASDestinations;
|
|
207
118
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* @param destination - destination to check
|
|
211
|
-
* @returns - URL service type, like 'Full Service URL', 'Catalog Service', 'Partial URL'
|
|
212
|
-
*/
|
|
213
|
-
function getUrlServiceTypeForDest(destination) {
|
|
214
|
-
var _a, _b;
|
|
215
|
-
let urlServiceType = "Invalid URL" /* InvalidUrl */;
|
|
216
|
-
const odataGen = !!((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.split(',').find((entry) => entry.trim() === 'odata_gen'));
|
|
217
|
-
const odataAbap = !!((_b = destination.WebIDEUsage) === null || _b === void 0 ? void 0 : _b.split(',').find((entry) => entry.trim() === 'odata_abap'));
|
|
218
|
-
const fullUrl = destination.WebIDEAdditionalData === 'full_url';
|
|
219
|
-
if (odataGen && fullUrl && !odataAbap) {
|
|
220
|
-
urlServiceType = "Full Service URL" /* FullServiceUrl */;
|
|
221
|
-
}
|
|
222
|
-
else if (!odataGen && !fullUrl && odataAbap) {
|
|
223
|
-
urlServiceType = "Catalog Service" /* CatalogServiceUrl */;
|
|
224
|
-
}
|
|
225
|
-
else if (odataGen && !fullUrl && !odataAbap) {
|
|
226
|
-
urlServiceType = "Partial URL" /* PartialUrl */;
|
|
227
|
-
}
|
|
228
|
-
return urlServiceType;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Transforms the destination format to align with @sap-ux/btp-utils Destination type.
|
|
119
|
+
* Transforms the destination format into generic Endpoint type.
|
|
232
120
|
*
|
|
233
121
|
* @param destinationInfo DestinationListInfo[] from '@sap/bas-sdk'
|
|
234
122
|
* @returns list of destinations in new (flat) format
|
|
235
123
|
*/
|
|
236
|
-
function
|
|
124
|
+
function transformDestinations(destinationInfo) {
|
|
237
125
|
var _a, _b, _c, _d;
|
|
238
126
|
const destinations = [];
|
|
239
127
|
for (const destInfo of destinationInfo) {
|
|
@@ -261,4 +149,28 @@ function transformDestination(destinationInfo) {
|
|
|
261
149
|
}
|
|
262
150
|
return destinations;
|
|
263
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Return the URL service type for a given destination.
|
|
154
|
+
*
|
|
155
|
+
* @param destination - destination to check
|
|
156
|
+
* @returns - URL service type, like 'Full Service URL', 'Catalog Service', 'Partial URL'
|
|
157
|
+
*/
|
|
158
|
+
function getUrlServiceTypeForDest(destination) {
|
|
159
|
+
var _a, _b;
|
|
160
|
+
let urlServiceType = "Invalid URL" /* InvalidUrl */;
|
|
161
|
+
const odataGen = !!((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.split(',').find((entry) => entry.trim() === 'odata_gen'));
|
|
162
|
+
const odataAbap = !!((_b = destination.WebIDEUsage) === null || _b === void 0 ? void 0 : _b.split(',').find((entry) => entry.trim() === 'odata_abap'));
|
|
163
|
+
const fullUrl = destination.WebIDEAdditionalData === 'full_url';
|
|
164
|
+
if (odataGen && fullUrl && !odataAbap) {
|
|
165
|
+
urlServiceType = "Full Service URL" /* FullServiceUrl */;
|
|
166
|
+
}
|
|
167
|
+
else if (!odataGen && !fullUrl && odataAbap) {
|
|
168
|
+
urlServiceType = "Catalog Service" /* CatalogServiceUrl */;
|
|
169
|
+
}
|
|
170
|
+
else if (odataGen && !fullUrl && !odataAbap) {
|
|
171
|
+
urlServiceType = "Partial URL" /* PartialUrl */;
|
|
172
|
+
}
|
|
173
|
+
return urlServiceType;
|
|
174
|
+
}
|
|
175
|
+
exports.getUrlServiceTypeForDest = getUrlServiceTypeForDest;
|
|
264
176
|
//# sourceMappingURL=destination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../src/checks/destination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0CAA+D;AAC/D,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"destination.js","sourceRoot":"","sources":["../../src/checks/destination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0CAA+D;AAC/D,kDAA0B;AAC1B,iDAAyD;AACzD,sCAAsC;AAEtC,kCAA4B;AAC5B,qDAA4E;AAE5E;;;;;;;GAOG;AACH,SAAsB,mBAAmB,CACrC,WAAqB,EACrB,QAA6B,EAC7B,QAA6B;;QAE7B,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;QAE3B,MAAM,mBAAmB,GAAG,mCAAkB,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEhF,0BAA0B;QAC1B,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,qCAAoB,CACtF,mBAAmB,EACnB,WAAW,CAAC,IAAI,CACnB,CAAC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;IAC/D,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAA,MAAA,WAAW,CAAC,WAAW,0CAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,CAAA,CAAC;IACrG,MAAM,SAAS,GAAG,CAAC,CAAC,CAAA,MAAA,WAAW,CAAC,WAAW,0CAAE,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,YAAY,CAAC,CAAA,CAAC;IACvG,MAAM,OAAO,GAAG,WAAW,CAAC,oBAAoB,KAAK,UAAU,CAAC;IAEhE,IAAI,QAAQ,IAAI,OAAO,IAAI,CAAC,SAAS,EAAE;QACnC,cAAc,0CAAgC,CAAC;KAClD;SAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,IAAI,SAAS,EAAE;QAC3C,cAAc,4CAAmC,CAAC;KACrD;SAAM,IAAI,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE;QAC3C,cAAc,iCAA4B,CAAC;KAC9C;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC;AAdD,4DAcC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResultMessage, Endpoint, EndpointResults } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks the endpoints (SAP Systems or BAS Destinations) and returns a list.
|
|
4
|
+
*
|
|
5
|
+
* @returns messages, SAP systems
|
|
6
|
+
*/
|
|
7
|
+
export declare function checkEndpoints(): Promise<{
|
|
8
|
+
messages: ResultMessage[];
|
|
9
|
+
endpoints: Endpoint[];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Check an endpoint for information including results of v2 & v4 catalog service requests.
|
|
13
|
+
*
|
|
14
|
+
* @param endpoint - endpoint from list of all endpoints
|
|
15
|
+
* @param username - destination username
|
|
16
|
+
* @param password - destination password
|
|
17
|
+
* @returns messages and sapSystem results
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkEndpoint(endpoint: Endpoint, username?: string | undefined, password?: string | undefined): Promise<{
|
|
20
|
+
messages: ResultMessage[];
|
|
21
|
+
endpointResults: EndpointResults;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/checks/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAOzE;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAC5C,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,EAAE,QAAQ,EAAE,CAAC;CACzB,CAAC,CAkBD;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CAC/B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,EAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,eAAe,EAAE,eAAe,CAAA;CAAE,CAAC,CAyB1E"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.checkEndpoint = exports.checkEndpoints = void 0;
|
|
13
|
+
const logger_1 = require("../logger");
|
|
14
|
+
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
15
|
+
const destination_1 = require("./destination");
|
|
16
|
+
const stored_system_1 = require("./stored-system");
|
|
17
|
+
const i18n_1 = require("../i18n");
|
|
18
|
+
/**
|
|
19
|
+
* Checks the endpoints (SAP Systems or BAS Destinations) and returns a list.
|
|
20
|
+
*
|
|
21
|
+
* @returns messages, SAP systems
|
|
22
|
+
*/
|
|
23
|
+
function checkEndpoints() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const logger = logger_1.getLogger();
|
|
26
|
+
let endpoints = [];
|
|
27
|
+
if (btp_utils_1.isAppStudio()) {
|
|
28
|
+
const { messages: basDestMsgs, destinations } = yield destination_1.checkBASDestinations();
|
|
29
|
+
endpoints = destinations;
|
|
30
|
+
logger.push(...basDestMsgs);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const { messages: storedSysMsgs, storedSystems } = yield stored_system_1.checkStoredSystems();
|
|
34
|
+
endpoints = storedSystems;
|
|
35
|
+
logger.push(...storedSysMsgs);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
messages: logger.getMessages(),
|
|
39
|
+
endpoints: endpoints
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
exports.checkEndpoints = checkEndpoints;
|
|
44
|
+
/**
|
|
45
|
+
* Check an endpoint for information including results of v2 & v4 catalog service requests.
|
|
46
|
+
*
|
|
47
|
+
* @param endpoint - endpoint from list of all endpoints
|
|
48
|
+
* @param username - destination username
|
|
49
|
+
* @param password - destination password
|
|
50
|
+
* @returns messages and sapSystem results
|
|
51
|
+
*/
|
|
52
|
+
function checkEndpoint(endpoint, username, password) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const logger = logger_1.getLogger();
|
|
55
|
+
logger.info(i18n_1.t('info.checkingSapSystem', { sapSystem: endpoint.Name }));
|
|
56
|
+
let destinationResults;
|
|
57
|
+
let storedSystemResults;
|
|
58
|
+
if (btp_utils_1.isAppStudio()) {
|
|
59
|
+
const checkBASDestinationResult = yield destination_1.checkBASDestination(endpoint, username, password);
|
|
60
|
+
destinationResults = checkBASDestinationResult.destinationResults;
|
|
61
|
+
logger.push(...checkBASDestinationResult.messages);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const checkStoredSystemResult = yield stored_system_1.checkStoredSystem(endpoint);
|
|
65
|
+
storedSystemResults = checkStoredSystemResult.storedSystemResults;
|
|
66
|
+
logger.push(...checkStoredSystemResult.messages);
|
|
67
|
+
}
|
|
68
|
+
const endpointResults = Object.assign(Object.assign({}, destinationResults), storedSystemResults);
|
|
69
|
+
return {
|
|
70
|
+
messages: logger.getMessages(),
|
|
71
|
+
endpointResults
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.checkEndpoint = checkEndpoint;
|
|
76
|
+
//# sourceMappingURL=endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../src/checks/endpoint.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,sCAAsC;AACtC,iDAAgD;AAChD,+CAA0E;AAC1E,mDAAwE;AACxE,kCAA4B;AAE5B;;;;GAIG;AACH,SAAsB,cAAc;;QAIhC,MAAM,MAAM,GAAG,kBAAS,EAAE,CAAC;QAC3B,IAAI,SAAS,GAAe,EAAE,CAAC;QAE/B,IAAI,uBAAW,EAAE,EAAE;YACf,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,MAAM,kCAAoB,EAAE,CAAC;YAC7E,SAAS,GAAG,YAAY,CA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,eAAe;SAClB,CAAC;IACN,CAAC;CAAA;AA7BD,sCA6BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CheckEnvironmentOptions, Environment, EnvironmentCheckResult, ResultMessage } from '../types';
|
|
1
|
+
import type { CheckEnvironmentOptions, Environment, EnvironmentCheckResult, ResultMessage, EndpointResults, Endpoint } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Return the environment.
|
|
4
4
|
*
|
|
@@ -9,9 +9,26 @@ export declare function getEnvironment(): Promise<{
|
|
|
9
9
|
messages: ResultMessage[];
|
|
10
10
|
}>;
|
|
11
11
|
/**
|
|
12
|
-
* Check
|
|
12
|
+
* Check a set of endpoints (SAP systems and BAS Destinations) (deep dive into them).
|
|
13
13
|
*
|
|
14
|
-
* @param
|
|
14
|
+
* @param deepDiveEndpoints - endpoints selected for a closer look
|
|
15
|
+
* @param endpoints - array of all endpoints found
|
|
16
|
+
* @param credentialCallback - callback in case user credentials are required to query a destination
|
|
17
|
+
* @returns - messages and the map of detailed endpoints check results
|
|
18
|
+
*/
|
|
19
|
+
export declare function getEndpointsResults(deepDiveEndpoints: Set<string>, endpoints: Endpoint[], credentialCallback?: (destination: Endpoint) => Promise<{
|
|
20
|
+
username: string;
|
|
21
|
+
password: string;
|
|
22
|
+
}>): Promise<{
|
|
23
|
+
messages: ResultMessage[];
|
|
24
|
+
systemResults: {
|
|
25
|
+
[dest: string]: EndpointResults;
|
|
26
|
+
};
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Check environment includes process.env, list of SAP systems or BAS Destinations and their details.
|
|
30
|
+
*
|
|
31
|
+
* @param options - see type CheckEnvironmentOptions, includes endpoint for deep dive, workspace roots, ...
|
|
15
32
|
* @returns the result, currently as JSON
|
|
16
33
|
*/
|
|
17
34
|
export declare function checkEnvironment(options?: CheckEnvironmentOptions): Promise<EnvironmentCheckResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/checks/environment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/checks/environment.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,uBAAuB,EACvB,WAAW,EACX,sBAAsB,EACtB,aAAa,EAEb,eAAe,EACf,QAAQ,EACX,MAAM,UAAU,CAAC;AAKlB;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAAE,CAAC,CA+BvG;AAoHD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACrC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,EAC9B,SAAS,EAAE,QAAQ,EAAE,EACrB,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,KAAK,OAAO,CAAC;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC,GACH,OAAO,CAAC;IAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;IAAC,aAAa,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;KAAE,CAAA;CAAE,CAAC,CA2B5F;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA8CzG"}
|