@sap-ux/btp-utils
Advanced tools
Comparing version 0.14.3 to 0.14.4
@@ -0,1 +1,2 @@ | ||
import type { Logger } from '@sap-ux/logger'; | ||
import type { Destination } from './destination'; | ||
@@ -42,2 +43,10 @@ /** | ||
export declare function listDestinations(): Promise<Destinations>; | ||
/** | ||
* Exposes port in SAP Business Application Studio. | ||
* | ||
* @param port Port that needs to be exposed | ||
* @param logger Logger | ||
* @returns url on which the port is exposed | ||
*/ | ||
export declare function exposePort(port: number, logger?: Logger): Promise<string>; | ||
//# sourceMappingURL=app-studio.d.ts.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.listDestinations = exports.getDestinationUrlForAppStudio = exports.getCredentialsForDestinationService = exports.getAppStudioProxyURL = exports.isAppStudio = exports.BAS_DEST_INSTANCE_CRED_HEADER = void 0; | ||
exports.exposePort = exports.listDestinations = exports.getDestinationUrlForAppStudio = exports.getCredentialsForDestinationService = exports.getAppStudioProxyURL = exports.isAppStudio = exports.BAS_DEST_INSTANCE_CRED_HEADER = void 0; | ||
const axios_1 = __importDefault(require("axios")); | ||
@@ -102,2 +102,22 @@ const cf_tools_1 = require("@sap/cf-tools"); | ||
exports.listDestinations = listDestinations; | ||
/** | ||
* Exposes port in SAP Business Application Studio. | ||
* | ||
* @param port Port that needs to be exposed | ||
* @param logger Logger | ||
* @returns url on which the port is exposed | ||
*/ | ||
function exposePort(port, logger) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
const response = yield axios_1.default.get(`http://localhost:3001/AppStudio/api/getHostByPort?port=${port}`); | ||
return `${response.data.result}`; | ||
} | ||
catch (error) { | ||
logger === null || logger === void 0 ? void 0 : logger.error(`Port ${port} was not exposed!`); | ||
return ''; | ||
} | ||
}); | ||
} | ||
exports.exposePort = exposePort; | ||
//# sourceMappingURL=app-studio.js.map |
{ | ||
"name": "@sap-ux/btp-utils", | ||
"version": "0.14.3", | ||
"version": "0.14.4", | ||
"description": "Library to simplify working with SAP BTP specific features especially in SAP Business Application", | ||
@@ -21,3 +21,4 @@ "repository": { | ||
"devDependencies": { | ||
"nock": "13.4.0" | ||
"nock": "13.4.0", | ||
"@sap-ux/logger": "0.5.1" | ||
}, | ||
@@ -24,0 +25,0 @@ "files": [ |
36675
562
2