Socket
Socket
Sign inDemoInstall

@sap-ux/btp-utils

Package Overview
Dependencies
22
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.14.1 to 0.14.2

44

dist/destination.d.ts

@@ -0,1 +1,23 @@

/**
* Support destination authentication types
*/
export declare enum Authentication {
BASIC_AUTHENTICATION = "BasicAuthentication",
CLIENT_CERT_AUTHENTICATION = "ClientCertificateAuthentication",
NO_AUTHENTICATION = "NoAuthentication",
OAUTH2_CLIENT_CREDENTIALS = "OAuth2ClientCredentials",
OAUTH2_JWT_BEARER = "OAuth2JWTBearer",
OAUTH2_PASSWORD = "OAuth2Password",
OAUTH2_REFRESH_TOKEN = "OAuth2RefreshToken",
OAUTH2_SAML_BEARER_ASSERTION = "OAuth2SAMLBearerAssertion",
OAUTH2_USER_TOKEN_EXCHANGE = "OAuth2UserTokenExchange",
SAML_ASSERTION = "SAMLAssertion"
}
/**
* Relevant values for display extended destination properties to the UI
*/
export declare enum Suffix {
S4HC = "S4HC",
BTP = "BTP"
}
export declare enum ProxyType {

@@ -30,4 +52,4 @@ ON_PREMISE = "OnPremise",

}
type DestinationProperty = 'WebIDEEnabled' | 'WebIDESystem' | 'WebIDEUsage' | 'WebIDEAdditionalData' | 'sap-client' | 'sap-platform' | 'TrustAll' | 'HTML5.DynamicDestination';
type AdditionalDestinationProperties = {
export type DestinationProperty = 'WebIDEEnabled' | 'WebIDESystem' | 'WebIDEUsage' | 'WebIDEAdditionalData' | 'sap-client' | 'sap-platform' | 'TrustAll' | 'HTML5.DynamicDestination';
export type AdditionalDestinationProperties = {
[property in DestinationProperty]: string;

@@ -93,7 +115,21 @@ };

*
* @param destination
* @param destination destination info
* @returns true, if this destination has HTML5.DynamicDestination configured
*/
export declare function isHTML5DynamicConfigured(destination: Destination): boolean;
export {};
/**
* Generate a display name using the destination name, username if supplied and the appropriate suffix i.e. BTP | S4HC.
*
* @param destination destination info
* @param displayUsername name to display with destination
* @returns string a newly generated string value with the name of the destination, username if present and the system type
*/
export declare function getDisplayName(destination: Destination, displayUsername?: string): string;
/**
* Checks whether the provided destination is configured to point to an S/4 HANA system.
*
* @param destination destination info
* @returns boolean if the destination is configured for an SAP S/4HANA system
*/
export declare function isS4HC(destination: Destination): boolean;
//# sourceMappingURL=destination.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isHTML5DynamicConfigured = exports.isOnPremiseDestination = exports.isFullUrlDestination = exports.isPartialUrlDestination = exports.isGenericODataDestination = exports.isAbapEnvironmentOnBtp = exports.isAbapSystem = exports.DestinationProxyType = exports.WebIDEAdditionalData = exports.WebIDEUsage = exports.ProxyType = void 0;
exports.isS4HC = exports.getDisplayName = exports.isHTML5DynamicConfigured = exports.isOnPremiseDestination = exports.isFullUrlDestination = exports.isPartialUrlDestination = exports.isGenericODataDestination = exports.isAbapEnvironmentOnBtp = exports.isAbapSystem = exports.DestinationProxyType = exports.WebIDEAdditionalData = exports.WebIDEUsage = exports.ProxyType = exports.Suffix = exports.Authentication = void 0;
/**
* Support destination authentication types
*/
var Authentication;
(function (Authentication) {
Authentication["BASIC_AUTHENTICATION"] = "BasicAuthentication";
Authentication["CLIENT_CERT_AUTHENTICATION"] = "ClientCertificateAuthentication";
Authentication["NO_AUTHENTICATION"] = "NoAuthentication";
Authentication["OAUTH2_CLIENT_CREDENTIALS"] = "OAuth2ClientCredentials";
Authentication["OAUTH2_JWT_BEARER"] = "OAuth2JWTBearer";
Authentication["OAUTH2_PASSWORD"] = "OAuth2Password";
Authentication["OAUTH2_REFRESH_TOKEN"] = "OAuth2RefreshToken";
Authentication["OAUTH2_SAML_BEARER_ASSERTION"] = "OAuth2SAMLBearerAssertion";
Authentication["OAUTH2_USER_TOKEN_EXCHANGE"] = "OAuth2UserTokenExchange";
Authentication["SAML_ASSERTION"] = "SAMLAssertion";
})(Authentication || (exports.Authentication = Authentication = {}));
/**
* Relevant values for display extended destination properties to the UI
*/
var Suffix;
(function (Suffix) {
Suffix["S4HC"] = "S4HC";
Suffix["BTP"] = "BTP";
})(Suffix || (exports.Suffix = Suffix = {}));
var ProxyType;

@@ -113,3 +137,3 @@ (function (ProxyType) {

*
* @param destination
* @param destination destination info
* @returns true, if this destination has HTML5.DynamicDestination configured

@@ -121,2 +145,59 @@ */

exports.isHTML5DynamicConfigured = isHTML5DynamicConfigured;
/**
* Escape any special RegExp character that we want to use literally.
*
* @param str string input
* @returns string a cleansed version of the input
*/
function escapeRegExp(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
/**
* Trim, cleanse and return a system name appended with the appropriate suffix i.e. BTP | S4HC.
*
* @param destinationName name of the destination
* @param suffix the appropriate suffix appended, BTP | S4HC
* @returns string return an escaped string, appended with the appropriate suffix
*/
function addSuffix(destinationName, suffix) {
const suffixStr = ` (${suffix})`;
return RegExp(`${escapeRegExp(suffixStr)}$`).exec(destinationName.trim())
? destinationName
: `${destinationName} (${suffix})`;
}
/**
* Generate a display name using the destination name, username if supplied and the appropriate suffix i.e. BTP | S4HC.
*
* @param destination destination info
* @param displayUsername name to display with destination
* @returns string a newly generated string value with the name of the destination, username if present and the system type
*/
function getDisplayName(destination, displayUsername) {
const userDisplayName = displayUsername ? ` [${displayUsername}]` : '';
let systemDisplayName;
if (isAbapEnvironmentOnBtp(destination)) {
systemDisplayName = addSuffix(destination.Name, Suffix.BTP);
}
else if (isS4HC(destination)) {
systemDisplayName = addSuffix(destination.Name, Suffix.S4HC);
}
else {
systemDisplayName = destination.Name;
}
return `${systemDisplayName}${userDisplayName}`;
}
exports.getDisplayName = getDisplayName;
/**
* Checks whether the provided destination is configured to point to an S/4 HANA system.
*
* @param destination destination info
* @returns boolean if the destination is configured for an SAP S/4HANA system
*/
function isS4HC(destination) {
var _a;
return Boolean(((_a = destination.WebIDEUsage) === null || _a === void 0 ? void 0 : _a.includes(WebIDEUsage.ODATA_ABAP)) &&
destination.Authentication === Authentication.SAML_ASSERTION &&
destination.ProxyType === ProxyType.INTERNET);
}
exports.isS4HC = isS4HC;
//# sourceMappingURL=destination.js.map

2

package.json
{
"name": "@sap-ux/btp-utils",
"version": "0.14.1",
"version": "0.14.2",
"description": "Library to simplify working with SAP BTP specific features especially in SAP Business Application",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc