@sap-ux/btp-utils
Version:
Library to simplify working with SAP BTP specific features especially in SAP Business Application
225 lines • 7.66 kB
TypeScript
/**
* Support different Token Service URL Types
*/
export declare enum DestinationType {
HTTP = "HTTP",
LDAP = "LDAP",
MAIL = "MAIL",
RFC = "RFC"
}
/**
* Support different Token Service URL Types
*/
export declare enum OAuthUrlType {
DEDICATED = "Dedicated",
COMMON = "Common"
}
/**
* 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 {
ON_PREMISE = "OnPremise",
INTERNET = "Internet",
PRIVATE_LINK = "PrivateLink"
}
/**
* Relevant values for the WebIDEUsage property used to identify different types of destinations.
*/
export declare enum WebIDEUsage {
ODATA_GENERIC = "odata_gen",
ODATA_ABAP = "odata_abap",
DEV_ABAP = "dev_abap",
ABAP_CLOUD = "abap_cloud"
}
/**
* Possible values for the WebIDEAdditionalData property
*/
export declare enum WebIDEAdditionalData {
FULL_URL = "full_url",
API_MGMT = "api_mgmt"
}
/**
* Relevant values for DestinationProxyType property
*/
export declare enum DestinationProxyType {
ON_PREMISE = "OnPremise",
INTERNET = "Internet",
PRIVATE_LINK = "PrivateLink"
}
export type DestinationProperty = 'WebIDEEnabled' | 'WebIDESystem' | 'WebIDEUsage' | 'WebIDEAdditionalData' | 'sap-client' | 'sap-platform' | 'TrustAll' | 'HTML5.DynamicDestination';
export type AdditionalDestinationProperties = {
[property in DestinationProperty]: string;
};
/**
* Mandatory destination properties combined with the known/relevant optional properties.
*/
export interface Destination extends Partial<AdditionalDestinationProperties> {
Name: string;
Type: string;
Authentication: string;
ProxyType: string;
Description: string;
/**
* N.B. Not the host but the full destination URL property!
*/
Host: string;
}
export interface ListDestinationOpts {
stripS4HCApiHosts?: boolean;
}
/**
* Checks whether the provided destination is configured to point to an ABAP system (both cloud and on-premise).
*
* @param destination destination info
* @returns true of the destination is configured for an ABAP system
*/
export declare function isAbapSystem(destination: Partial<Destination>): boolean;
/**
* Checks whether the provided destination is configured to point to an ABAP environment on BTP (aka steampunk).
*
* @param destination destination info
* @returns true of the destination is configured for a steampunk system
*/
export declare function isAbapEnvironmentOnBtp(destination: Destination): boolean;
/**
* Checks if the destination attributes WebIDEUsage is configured with odata_gen, and not odata_abap
* We want to maintain existing destinations, perhaps accidentally configured with both, continue
* working as abap catalogs.
*
* @param destination destination info
* @returns true, if this destination has the the 'odata_gen', and not the 'odata_abap' attribute set
*/
export declare function isGenericODataDestination(destination: Destination): boolean;
/**
* A destination configured as generic odata without the 'full_url' attribute are considered partial url destinations.
*
* @param destination destination info
* @returns true, if this destination is generic odata and 'full_url' attribute is not set
*/
export declare function isPartialUrlDestination(destination: Destination): boolean;
/**
* A destination configured as generic odata WITH the 'full_url' attribute are considered full url destinations.
*
* @param destination destination info
* @returns true, if this destination has the generic odata and 'full_url' attribute is set
*/
export declare function isFullUrlDestination(destination: Destination): boolean;
/**
* Checks whether the provided destination is configured as an on-premise system.
*
* @param destination destination info
* @returns true if the destination is configured as an on-premise system
*/
export declare function isOnPremiseDestination(destination: Destination): boolean;
/**
* Validate if a destination has the property `HTML5.DynamicDestination` configured.
*
* @param destination destination info
* @returns true, if this destination has HTML5.DynamicDestination configured
*/
export declare function isHTML5DynamicConfigured(destination: Destination): boolean;
/**
* 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;
/**
* Checks if the destination attributes WebIDEUsage is configured with odata_abap.
* This is a non-strict check, as we want to maintain existing destinations, perhaps accidentally configured with other conflicting configurations.
*
* @param destination destination configuration properties
* @returns true, if this destination has the 'odata_abap' attribute set
*/
export declare function isAbapODataDestination(destination: Destination): boolean;
/**
* Cloud Foundry instance types
*/
export declare const AbapEnvType: {
/**
* ABAP instance type
*/
readonly ABAP: "abap";
/**
* ABAP trial instance type
*/
readonly ABAP_TRIAL: "abap-trial";
/**
* ABAP CANARY trial instance type
*/
readonly ABAP_CANARY: "abap-canary";
/**
* ABAP OEM instance type
*/
readonly ABAP_OEM: "abap-oem";
/**
* ABAP OEM CANARY instance type
*/
readonly ABAP_OEM_CANARY: "abap-oem-canary";
/**
* ABAP HAAS instance type
*/
readonly ABAP_HAAS: "abap-haas";
/**
* Destination service instance type
*/
readonly DESTINATION: "destination";
/**
* ABAP Staging service instance type
*/
readonly ABAP_STAGING: "abap-staging";
/**
* ABAP Internal Staging service instance type
*/
readonly ABAP_INTERNAL_STAGING: "abap-internal-staging";
};
export type AbapEnvType = (typeof AbapEnvType)[keyof typeof AbapEnvType];
/**
* OAuth destination properties.
*/
export interface OAuth2Destination extends Omit<Destination, 'Host'>, Partial<AdditionalDestinationProperties> {
URL: string;
clientSecret: string;
clientId: string;
tokenServiceURL: string;
tokenServiceURLType?: 'Dedicated';
}
export interface CloudFoundryServiceInfo {
label: string;
serviceName: string;
guid?: string;
tags?: string[];
alwaysShow?: boolean;
plan_guid?: string;
plan?: string;
credentials?: any;
}
//# sourceMappingURL=destination.d.ts.map