Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/btp-utils

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/btp-utils - npm Package Compare versions

Comparing version 0.14.4 to 0.15.0

84

dist/app-studio.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -47,22 +38,19 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

*/
function getCredentialsForDestinationService(instance) {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () {
try {
const serviceInfo = yield (0, cf_tools_1.cfGetInstanceKeyParameters)(instance);
if (!serviceInfo) {
throw new Error(`No destination instance ${instance} found`);
}
const serviceCredentials = serviceInfo.credentials;
if (!serviceCredentials) {
throw new Error(`No credentials for destination instance ${instance} found`);
}
const clientId = ((_a = serviceCredentials.uaa) === null || _a === void 0 ? void 0 : _a.clientid) || serviceCredentials.clientid;
const clientSecret = ((_b = serviceCredentials.uaa) === null || _b === void 0 ? void 0 : _b.clientsecret) || serviceCredentials.clientsecret;
return Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64');
async function getCredentialsForDestinationService(instance) {
try {
const serviceInfo = await (0, cf_tools_1.cfGetInstanceKeyParameters)(instance);
if (!serviceInfo) {
throw new Error(`No destination instance ${instance} found`);
}
catch (error) {
throw new Error(`An error occurred while retrieving service key for the destination instance ${instance}: ${error}`);
const serviceCredentials = serviceInfo.credentials;
if (!serviceCredentials) {
throw new Error(`No credentials for destination instance ${instance} found`);
}
});
const clientId = serviceCredentials.uaa?.clientid || serviceCredentials.clientid;
const clientSecret = serviceCredentials.uaa?.clientsecret || serviceCredentials.clientsecret;
return Buffer.from(`${encodeURIComponent(clientId)}:${encodeURIComponent(clientSecret)}`).toString('base64');
}
catch (error) {
throw new Error(`An error occurred while retrieving service key for the destination instance ${instance}: ${error}`);
}
}

@@ -87,15 +75,13 @@ exports.getCredentialsForDestinationService = getCredentialsForDestinationService;

*/
function listDestinations() {
return __awaiter(this, void 0, void 0, function* () {
const destinations = {};
yield axios_1.default.get('/reload', { baseURL: process.env[app_studio_env_1.ENV.PROXY_URL] });
const response = yield axios_1.default.get('/api/listDestinations', { baseURL: process.env[app_studio_env_1.ENV.H2O_URL] });
const list = Array.isArray(response.data) ? response.data : [];
list.forEach((destination) => {
if (destination.WebIDEEnabled) {
destinations[destination.Name] = destination;
}
});
return destinations;
async function listDestinations() {
const destinations = {};
await axios_1.default.get('/reload', { baseURL: process.env[app_studio_env_1.ENV.PROXY_URL] });
const response = await axios_1.default.get('/api/listDestinations', { baseURL: process.env[app_studio_env_1.ENV.H2O_URL] });
const list = Array.isArray(response.data) ? response.data : [];
list.forEach((destination) => {
if (destination.WebIDEEnabled) {
destinations[destination.Name] = destination;
}
});
return destinations;
}

@@ -110,15 +96,13 @@ exports.listDestinations = listDestinations;

*/
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 '';
}
});
async function exposePort(port, logger) {
try {
const response = await axios_1.default.get(`http://localhost:3001/AppStudio/api/getHostByPort?port=${port}`);
return `${response.data.result}`;
}
catch (error) {
logger?.error(`Port ${port} was not exposed!`);
return '';
}
}
exports.exposePort = exposePort;
//# sourceMappingURL=app-studio.js.map

@@ -68,6 +68,5 @@ "use strict";

function isAbapSystem(destination) {
var _a, _b;
return Boolean(((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.includes('abap')) ||
return Boolean(destination.WebIDEUsage?.includes('abap') ||
destination['sap-client'] ||
((_b = destination['sap-platform']) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === 'abap');
destination['sap-platform']?.toLocaleLowerCase() === 'abap');
}

@@ -82,5 +81,4 @@ exports.isAbapSystem = isAbapSystem;

function isAbapEnvironmentOnBtp(destination) {
var _a, _b;
return Boolean(((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.includes(WebIDEUsage.ABAP_CLOUD)) ||
((_b = destination['sap-platform']) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === 'abap');
return Boolean(destination.WebIDEUsage?.includes(WebIDEUsage.ABAP_CLOUD) ||
destination['sap-platform']?.toLocaleLowerCase() === 'abap');
}

@@ -97,4 +95,3 @@ exports.isAbapEnvironmentOnBtp = isAbapEnvironmentOnBtp;

function isGenericODataDestination(destination) {
var _a;
return Boolean(((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.includes(WebIDEUsage.ODATA_GENERIC)) &&
return Boolean(destination.WebIDEUsage?.includes(WebIDEUsage.ODATA_GENERIC) &&
!destination.WebIDEUsage.includes(WebIDEUsage.ODATA_ABAP));

@@ -110,4 +107,3 @@ }

function isPartialUrlDestination(destination) {
var _a;
return Boolean(!((_a = destination.WebIDEAdditionalData) === null || _a === void 0 ? void 0 : _a.includes(WebIDEAdditionalData.FULL_URL)) &&
return Boolean(!destination.WebIDEAdditionalData?.includes(WebIDEAdditionalData.FULL_URL) &&
isGenericODataDestination(destination));

@@ -123,4 +119,3 @@ }

function isFullUrlDestination(destination) {
var _a;
return Boolean(((_a = destination.WebIDEAdditionalData) === null || _a === void 0 ? void 0 : _a.includes(WebIDEAdditionalData.FULL_URL)) &&
return Boolean(destination.WebIDEAdditionalData?.includes(WebIDEAdditionalData.FULL_URL) &&
isGenericODataDestination(destination));

@@ -200,4 +195,3 @@ }

function isS4HC(destination) {
var _a;
return Boolean(((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.includes(WebIDEUsage.ODATA_ABAP)) &&
return Boolean(destination.WebIDEUsage?.includes(WebIDEUsage.ODATA_ABAP) &&
destination.Authentication === Authentication.SAML_ASSERTION &&

@@ -204,0 +198,0 @@ destination.ProxyType === ProxyType.INTERNET);

{
"name": "@sap-ux/btp-utils",
"version": "0.14.4",
"version": "0.15.0",
"description": "Library to simplify working with SAP BTP specific features especially in SAP Business Application",

@@ -22,3 +22,3 @@ "repository": {

"nock": "13.4.0",
"@sap-ux/logger": "0.5.1"
"@sap-ux/logger": "0.6.0"
},

@@ -25,0 +25,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc