Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @sap-cloud-sdk/core

SAP Cloud SDK for JavaScript Logo

@sap-cloud-sdk/core

This package contains the core functionality of the SAP Cloud SDK as well as the Cloud Platform abstractions.

Installation

$ npm install @sap-cloud-sdk/core

Usage

The core is the heart of the SAP Cloud SDK and contains the functionality that is essential to every project powered by the SDK. Any OData client built by the SAP Cloud SDK, be it the VDM or clients built by the generator are using the core. We recommend to install this in addition to your clients.

Below is an example showing how you can build and execute your request with multiple filters by using an function called and.

import { and } from '@sap-cloud-sdk/core';
import { BusinessPartner } from '@sap/cloud-sdk-vdm-business-partner-service';

// Build your filters
const firstNameFilter = BusinessPartner.FIRST_NAME.equals('firstName');
const lastNameFilter = BusinessPartner.LAST_NAME.equals('lastName');

// Execute your request with two filters
BusinessPartner.requestBuilder()
 .getAll()
 .filter(and(firstNameFilter, lastNameFilter))
 .execute(yourDestination);

Documentation

Getting started guide API documentation

Helpful Links

Index

References

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

References

ActionImportParameter

Renames and re-exports FunctionImportParameter

ActionImportParameters

Renames and re-exports FunctionImportParameters

ActionImportRequestBuilder

Re-exports ActionImportRequestBuilder

AllFields

Re-exports AllFields

AnyField

Re-exports AnyField

AuthenticationType

Re-exports AuthenticationType

BatchResponse

Re-exports BatchResponse

BigNumberField

Re-exports BigNumberField

BinaryField

Re-exports BinaryField

BinaryFieldBase

Re-exports BinaryFieldBase

BooleanField

Re-exports BooleanField

BooleanFieldBase

Re-exports BooleanFieldBase

BooleanFilterFunction

Re-exports BooleanFilterFunction

Cache

Re-exports Cache

CachingOptions

Re-exports CachingOptions

ClientCredentials

Re-exports ClientCredentials

CollectionField

Re-exports CollectionField

CompleteDecodedJWT

Re-exports CompleteDecodedJWT

ComplexTypeAnyPropertyField

Re-exports ComplexTypeAnyPropertyField

ComplexTypeBigNumberPropertyField

Re-exports ComplexTypeBigNumberPropertyField

ComplexTypeBinaryPropertyField

Re-exports ComplexTypeBinaryPropertyField

ComplexTypeBooleanPropertyField

Re-exports ComplexTypeBooleanPropertyField

ComplexTypeDatePropertyField

Re-exports ComplexTypeDatePropertyField

ComplexTypeDurationPropertyField

Re-exports ComplexTypeDurationPropertyField

ComplexTypeEnumPropertyField

Re-exports ComplexTypeEnumPropertyField

ComplexTypeField

Re-exports ComplexTypeField

ComplexTypeNamespace

Re-exports ComplexTypeNamespace

ComplexTypeNumberPropertyField

Re-exports ComplexTypeNumberPropertyField

ComplexTypeStringPropertyField

Re-exports ComplexTypeStringPropertyField

ComplexTypeTimePropertyField

Re-exports ComplexTypeTimePropertyField

ConstructorOrField

Re-exports ConstructorOrField

CreateRequestBuilder

Re-exports CreateRequestBuilder

CustomField

Re-exports CustomField

CustomFieldBase

Re-exports CustomFieldBase

DateField

Re-exports DateField

DateFieldBase

Re-exports DateFieldBase

DecodedJWT

Re-exports DecodedJWT

DeepFieldType

Re-exports DeepFieldType

DeleteRequestBuilder

Re-exports DeleteRequestBuilder

Destination

Re-exports Destination

DestinationAccessorOptions

Re-exports DestinationAccessorOptions

DestinationAuthToken

Re-exports DestinationAuthToken

DestinationCachingOptions

Re-exports DestinationCachingOptions

DestinationCertificate

Re-exports DestinationCertificate

DestinationConfiguration

Re-exports DestinationConfiguration

DestinationForServiceBindingsOptions

Re-exports DestinationForServiceBindingsOptions

DestinationHttpRequestConfig

Re-exports DestinationHttpRequestConfig

DestinationJson

Re-exports DestinationJson

DestinationNameAndJwt

Re-exports DestinationNameAndJwt

DestinationOptions

Re-exports DestinationOptions

DestinationOrigin

Re-exports DestinationOrigin

DestinationProxyType

Re-exports DestinationProxyType

DestinationRetrievalOptions

Re-exports DestinationRetrievalOptions

DestinationSelectionStrategies

Re-exports DestinationSelectionStrategies

DestinationSelectionStrategy

Re-exports DestinationSelectionStrategy

DestinationServiceCredentials

Re-exports DestinationServiceCredentials

DurationField

Re-exports DurationField

DurtionFieldBase

Re-exports DurtionFieldBase

EdmToPrimitive

Re-exports EdmToPrimitive

EdmType

Re-exports EdmType

EdmTypeCommon

Re-exports EdmTypeCommon

EdmTypeDifferentConverters

Re-exports EdmTypeDifferentConverters

EdmTypeField

Re-exports EdmTypeField

EdmTypeSameConverters

Re-exports EdmTypeSameConverters

EdmTypeSameConvertersUri

Re-exports EdmTypeSameConvertersUri

EdmTypeShared

Re-exports EdmTypeShared

EdmTypeV2

Re-exports EdmTypeV2

EdmTypeV4

Re-exports EdmTypeV4

Entity

Re-exports Entity

EntityBase

Re-exports EntityBase

EntityBuilderType

Re-exports EntityBuilderType

EnumField

Re-exports EnumField

EnvironmentAccessor

Re-exports EnvironmentAccessor

ErrorResponse

Re-exports ErrorResponse

ExecuteHttpRequestFn

Re-exports ExecuteHttpRequestFn

Field

Re-exports Field

FieldType

Re-exports FieldType

Filter

Re-exports Filter

FilterFunction

Re-exports FilterFunction

FilterFunctionParameterType

Re-exports FilterFunctionParameterType

FilterFunctionPrimitiveParameterType

Re-exports FilterFunctionPrimitiveParameterType

FilterLink

Re-exports FilterLink

FilterList

Re-exports FilterList

FilterOperator

Re-exports FilterOperator

FilterOperatorByType

Re-exports FilterOperatorByType

Filterable

Re-exports Filterable

FunctionImportParameter

Re-exports FunctionImportParameter

FunctionImportParameters

Re-exports FunctionImportParameters

FunctionImportRequestBuilder

Re-exports FunctionImportRequestBuilder

GetAllRequestBuilder

Re-exports GetAllRequestBuilder

GetByKeyRequestBuilder

Re-exports GetByKeyRequestBuilder

GetFilter

Re-exports GetFilter

HttpMethod

Re-exports HttpMethod

HttpReponse

Re-exports HttpReponse

HttpRequest

Re-exports HttpRequest

HttpRequestConfig

Re-exports HttpRequestConfig

HttpResponse

Re-exports HttpResponse

IsolationStrategy

Re-exports IsolationStrategy

JWTHeader

Re-exports JWTHeader

JWTPayload

Re-exports JWTPayload

JwtKeyMapping

Re-exports JwtKeyMapping

Link

Re-exports Link

MethodRequestBuilderBase

Re-exports MethodRequestBuilderBase

NumberField

Re-exports NumberField

NumberFieldBase

Re-exports NumberFieldBase

NumberFilterFunction

Re-exports NumberFilterFunction

ODataActionImportRequestConfig

Re-exports ODataActionImportRequestConfig

ODataBatchChangeSet

Re-exports ODataBatchChangeSet

ODataBatchRequestBuilder

Re-exports ODataBatchRequestBuilder

ODataRequest

Re-exports ODataRequest

ODataUri

Re-exports ODataUri

ODataVersionOf

Re-exports ODataVersionOf

OneToManyLink

Re-exports OneToManyLink

OneToOneLink

Re-exports OneToOneLink

Order

Re-exports Order

OrderLink

Re-exports OrderLink

Orderable

Re-exports Orderable

OrderableInput

Re-exports OrderableInput

PropertyMetadata

Re-exports PropertyMetadata

ProxyConfiguration

Re-exports ProxyConfiguration

ProxyStrategy

Re-exports ProxyStrategy

ReadResponse

Re-exports ReadResponse

RegisteredJWTClaims

Re-exports RegisteredJWTClaims

RegisteredJWTClaimsBasic

Re-exports RegisteredJWTClaimsBasic

RequestMethodType

Re-exports RequestMethodType

ResilienceOptions

Re-exports ResilienceOptions

Selectable

Re-exports Selectable

SelectableEdmTypeField

Re-exports SelectableEdmTypeField

Service

Re-exports Service

ServiceBinding

Re-exports ServiceBinding

ServiceCredentials

Re-exports ServiceCredentials

StringField

Re-exports StringField

StringFilterFunction

Re-exports StringFilterFunction

Time

Re-exports Time

TimeField

Re-exports TimeField

TimeFieldBase

Re-exports TimeFieldBase

TokenKey

Re-exports TokenKey

UpdateRequestBuilder

Re-exports UpdateRequestBuilder

UriConverter

Re-exports UriConverter

VerifyJwtOptions

Re-exports VerifyJwtOptions

WriteResponse

Re-exports WriteResponse

WriteResponses

Re-exports WriteResponses

XsuaaServiceCredentials

Re-exports XsuaaServiceCredentials

addAuthorizationHeader

Re-exports addAuthorizationHeader

addCsrfTokenAndCookies

Re-exports addCsrfTokenAndCookies

addDestinationToRequestConfig

Re-exports addDestinationToRequestConfig

addProxyConfiguration

Re-exports addProxyConfiguration

addProxyConfigurationInternet

Re-exports addProxyConfigurationInternet

addProxyConfigurationOnPrem

Re-exports addProxyConfigurationOnPrem

all

Re-exports all

alwaysProvider

Re-exports alwaysProvider

alwaysSubscriber

Re-exports alwaysSubscriber

and

Re-exports and

any

Re-exports any

asc

Re-exports asc

audiences

Re-exports audiences

basicHeader

Re-exports basicHeader

buildAndAddAuthorizationHeader

Re-exports buildAndAddAuthorizationHeader

buildAuthorizationHeaders

Re-exports buildAuthorizationHeaders

buildCsrfHeaders

Re-exports buildCsrfHeaders

buildHeaders

Re-exports buildHeaders

buildHttpRequest

Re-exports buildHttpRequest

checkMandatoryValue

Re-exports checkMandatoryValue

circuitBreakerDefaultOptions

Re-exports circuitBreakerDefaultOptions

clientCredentialsGrant

Re-exports clientCredentialsGrant

clientCredentialsTokenCache

Re-exports clientCredentialsTokenCache

contains

Re-exports contains

content_transfer_encoding_line

Re-exports content_transfer_encoding_line

createComplexType

Re-exports createComplexType

createGetFilter

Re-exports createGetFilter

createGetResourcePathForKeys

Re-exports createGetResourcePathForKeys

customAttributes

Re-exports customAttributes

decodeJwt

Re-exports decodeJwt

decodeJwtComplete

Re-exports decodeJwtComplete

desc

Re-exports desc

deserializeComplexType

Re-exports deserializeComplexType

deserializeEntity

Re-exports deserializeEntity

destinationCache

Re-exports destinationCache

destinationForServiceBinding

Re-exports destinationForServiceBinding

edmToTs

Re-exports edmToTs

execute

Re-exports execute

executeHttpRequest

Re-exports executeHttpRequest

extractClientCredentials

Re-exports extractClientCredentials

extractODataETag

Re-exports extractODataETag

fetchDestination

Re-exports fetchDestination

fetchInstanceDestinations

Re-exports fetchInstanceDestinations

fetchSubaccountDestinations

Re-exports fetchSubaccountDestinations

fetchVerificationKeys

Re-exports fetchVerificationKeys

filterFunction

Re-exports filterFunction

filterFunctions

Re-exports filterFunctions

filterNullishValues

Re-exports filterNullishValues

fractionalSeconds

Re-exports fractionalSeconds

getAgentConfig

Re-exports getAgentConfig

getAuthHeaders

Re-exports getAuthHeaders

getAxiosConfigWithDefaults

Re-exports getAxiosConfigWithDefaults

getDestination

Re-exports getDestination

getDestinationBasicCredentials

Re-exports getDestinationBasicCredentials

getDestinationByName

Re-exports getDestinationByName

getDestinationFromDestinationService

Re-exports getDestinationFromDestinationService

getDestinationFromEnvByName

Re-exports getDestinationFromEnvByName

getDestinationOptions

Re-exports getDestinationOptions

getDestinationServiceCredentials

Re-exports getDestinationServiceCredentials

getDestinationServiceCredentialsList

Re-exports getDestinationServiceCredentialsList

getDestinationServiceUri

Re-exports getDestinationServiceUri

getDestinations

Re-exports getDestinations

getDestinationsFromEnv

Re-exports getDestinationsFromEnv

getEdmType

Re-exports getEdmType

getEntityConstructor

Re-exports getEntityConstructor

getEntityKeys

Re-exports getEntityKeys

getEnvironmentVariable

Re-exports getEnvironmentVariable

getExpand

Re-exports getExpand

getGrantTokenCacheKey

Re-exports getGrantTokenCacheKey

getHeader

Re-exports getHeader

getHeaderValue

Re-exports getHeaderValue

getOAuth2ClientCredentialsToken

Re-exports getOAuth2ClientCredentialsToken

getOrderBy

Re-exports getOrderBy

getSelect

Re-exports getSelect

getService

Re-exports getService

getServiceCredentialsList

Re-exports getServiceCredentialsList

getServiceList

Re-exports getServiceList

getUrlProtocol

Re-exports getUrlProtocol

getVcapService

Re-exports getVcapService

getXsuaaServiceCredentials

Re-exports getXsuaaServiceCredentials

hasSubsequence

Re-exports hasSubsequence

hasSubset

Re-exports hasSubset

headerForClientCredentials

Re-exports headerForClientCredentials

http_version

Re-exports http_version

isComplexTypeNameSpace

Re-exports isComplexTypeNameSpace

isDestination

Re-exports isDestination

isDestinationNameAndJwt

Re-exports isDestinationNameAndJwt

isEdmType

Re-exports isEdmType

isFilter

Re-exports isFilter

isFilterLink

Re-exports isFilterLink

isFilterList

Re-exports isFilterList

isIdenticalTenant

Re-exports isIdenticalTenant

isWithETag

Re-exports isWithETag

issuerUrl

Re-exports issuerUrl

matchesPattern

Re-exports matchesPattern

maxDateTime

Re-exports maxDateTime

minDateTime

Re-exports minDateTime

nonEnumerable

Re-exports nonEnumerable

now

Re-exports now

oDataUri

Re-exports oDataUri

or

Re-exports or

parseDestination

Re-exports parseDestination

parseProxyEnv

Re-exports parseProxyEnv

part_content_type_line

Re-exports part_content_type_line

prependDollar

Re-exports prependDollar

proxyAgent

Re-exports proxyAgent

proxyStrategy

Re-exports proxyStrategy

refreshTokenGrant

Re-exports refreshTokenGrant

replaceDuplicateKeys

Re-exports replaceDuplicateKeys

resolveService

Re-exports resolveService

retrieveJwt

Re-exports retrieveJwt

sanitizeDestination

Re-exports sanitizeDestination

secondsToTime

Re-exports secondsToTime

serializeComplexType

Re-exports serializeComplexType

serializeEntity

Re-exports serializeEntity

serializeEntityNonCustomFields

Re-exports serializeEntityNonCustomFields

serviceToken

Re-exports serviceToken

subscriberFirst

Re-exports subscriberFirst

tenantId

Re-exports tenantId

tenantName

Re-exports tenantName

timeToSeconds

Re-exports timeToSeconds

toBatchChangeSet

Re-exports toBatchChangeSet

toBatchRetrieveBody

Re-exports toBatchRetrieveBody

toPascalCase

Re-exports toPascalCase

toPropertyFormat

Re-exports toPropertyFormat

toSanitizedHeaderObject

Re-exports toSanitizedHeaderObject

toStaticPropertyFormat

Re-exports toStaticPropertyFormat

toTitleFormat

Re-exports toTitleFormat

toTypeNameFormat

Re-exports toTypeNameFormat

totalOffsetMinutes

Re-exports totalOffsetMinutes

transformReturnValueForComplexType

Re-exports transformReturnValueForComplexType

transformReturnValueForComplexTypeList

Re-exports transformReturnValueForComplexTypeList

transformReturnValueForEdmType

Re-exports transformReturnValueForEdmType

transformReturnValueForEdmTypeList

Re-exports transformReturnValueForEdmTypeList

transformReturnValueForEntity

Re-exports transformReturnValueForEntity

transformReturnValueForEntityList

Re-exports transformReturnValueForEntityList

transformReturnValueForUndefined

Re-exports transformReturnValueForUndefined

tsToEdm

Re-exports tsToEdm

uriConverter

Re-exports uriConverter

uriConverters

Re-exports uriConverters

useOrFetchDestination

Re-exports useOrFetchDestination

userApprovedServiceToken

Re-exports userApprovedServiceToken

userEmail

Re-exports userEmail

userFamilyName

Re-exports userFamilyName

userGivenName

Re-exports userGivenName

userId

Re-exports userId

userName

Re-exports userName

userScopes

Re-exports userScopes

userTokenGrant

Re-exports userTokenGrant

verificationKeyCache

Re-exports verificationKeyCache

verifyJwt

Re-exports verifyJwt

verifyJwtWithKey

Re-exports verifyJwtWithKey

wrapJwtInHeader

Re-exports wrapJwtInHeader

Type aliases

AuthenticationType

AuthenticationType: "PrincipalPropagation" | "NoAuthentication" | "BasicAuthentication" | "OAuth2SAMLBearerAssertion" | "OAuth2ClientCredentials" | "ClientCertificateAuthentication"

BatchResponse

ConstructorOrField

ConstructorOrField<EntityT, ComplexT>: Constructable<EntityT> | ComplexTypeField<EntityT, ComplexT>

Union type to represent the parent of a field. This can either be an entity constructor or a complex type field.

Type parameters

DeepFieldType

DeepFieldType: FieldType | {}
deprecated

Since v1.18.0. Use FieldType instead. Represents types of nested fields.

DestinationOptions

DestinationProxyType

DestinationProxyType: "OnPremise" | "Internet" | null

DestinationRetrievalOptions

Options to use while fetching destinations. Encompasses both DestinationCachingOptions and ResilienceOptions interfaces.

DestinationSelectionStrategy

DestinationSelectionStrategy: (allDestinations: AllDestinations, destinationName: string) => Destination | null

Type declaration

    • (allDestinations: AllDestinations, destinationName: string): Destination | null
    • Parameters

      • allDestinations: AllDestinations
      • destinationName: string

      Returns Destination | null

EdmToPrimitive

EdmToPrimitive<T>: T extends "Edm.Int16" | "Edm.Int32" | "Edm.Single" | "Edm.Double" | "Edm.Float" | "Edm.Byte" | "Edm.SByte" ? number : T extends "Edm.Decimal" | "Edm.Int64" ? BigNumber : T extends "Edm.DateTime" | "Edm.DateTimeOffset" ? Moment : T extends "Edm.String" | "Edm.Guid" ? string : T extends "Edm.Boolean" ? boolean : T extends "Edm.Time" ? Time : any

Type parameters

EdmType

Allowed Edm types for OData v2.

EdmTypeCommon

EdmTypeDifferentConverters

EdmTypeDifferentConverters: "Edm.DateTimeOffset"

EdmTypeSameConverters

EdmTypeSameConverters: "Edm.String" | "Edm.Boolean" | "Edm.Decimal" | "Edm.Double" | "Edm.Single" | "Edm.Float" | "Edm.Int16" | "Edm.Int32" | "Edm.Int64" | "Edm.SByte" | "Edm.Binary" | "Edm.Guid" | "Edm.Byte" | "Edm.Any"

EdmTypeSameConvertersUri

EdmTypeSameConvertersUri: Exclude<EdmTypeSameConverters, "Edm.Guid" | "Edm.Decimal">

EdmTypeShared

EdmTypeShared<VersionT>: EdmTypeCommon | EdmTypeV2 | EdmTypeV4

Type parameters

EdmTypeV2

EdmTypeV2: "Edm.DateTime" | "Edm.Time"

EdmTypeV4

EdmTypeV4: "Edm.Date" | "Edm.Duration" | "Edm.TimeOfDay" | "Edm.Enum"

EntityBuilderType

EntityBuilderType<EntityT, EntityTypeForceMandatoryT>: {} & EntityBuilder<EntityT, EntityTypeForceMandatoryT>

Type parameters

ExecuteHttpRequestFn

ExecuteHttpRequestFn: (request: HttpRequest) => Promise<HttpResponse>

Type declaration

Expandable

Expandable<EntityT>: ODataVersionOf<EntityT> extends "v2" ? never : OneToOneLink<EntityT, any> | OneToManyLink<EntityT, any> | AllFields<EntityT>

Represents all expandables, i.e. everything that can be used in an .expand statement. Only relevant for OData v4 requests.

Type parameters

  • EntityT: EntityBase

    Type of the entity to be selected on

FieldType

FieldType: string | number | boolean | Time | Moment | Duration | BigNumber | null | undefined

Union type to represent all possible types of a field.

FilterFunctionParameterType

FilterFunctionParameterType<EntityT>: FilterFunctionPrimitiveParameterType | Field<EntityT> | FilterFunction<EntityT, FieldType | FieldType[]> | FilterFunctionPrimitiveParameterType[]

Type of a parameter of a filter function. This can either be a primitive type, a reference to a field or another filter function.

Type parameters

FilterFunctionPrimitiveParameterType

FilterFunctionPrimitiveParameterType: number | string | Moment

Primitive type of a parameter of a filter function.

FilterFunctionReturnType

FilterFunctionReturnType: "boolean" | "int" | "double" | "decimal" | "string"

FilterLambdaOperator

FilterLambdaOperator: "any" | "all"

hidden

FilterOperator

FilterOperator: FilterOperatorString | FilterOperatorBoolean | FilterOperatorNumber

FilterOperatorByType

FilterOperatorByType<FieldT>: FieldT extends string ? FilterOperatorString : FieldT extends number ? FilterOperatorNumber : FilterOperatorBoolean

Type parameters

Filterable

Filterable<EntityT>: Filter<EntityT, FieldType | FieldType[]> | FilterLink<EntityT> | FilterList<EntityT> | FilterLambdaExpression<EntityT, FieldType>

A union of all types that can be used for filtering.

Type parameters

  • EntityT: EntityBase

    Type of the entity to be filtered on

FunctionImportParameters

FunctionImportParameters<ParametersT>: {}

Internal representation of all parameters of a function import as a map

Type parameters

  • ParametersT

    External represenation of all parameters

Type declaration

HttpRequest

JwtKeyMapping

JwtKeyMapping<TypescriptKeys, JwtKeys>: {}

Type parameters

  • TypescriptKeys

  • JwtKeys

Type declaration

ODataVersionOf

ODataVersionOf<T>: T["_oDataVersion"]

Type parameters

Orderable

Orderable<EntityT>: Order<EntityT> | OrderLink<EntityT, EntityBase>

A union of all types that can be used for ordering.

Type parameters

  • EntityT: EntityBase

    Type of the entity to be ordered

OrderableInput

OrderableInput<EntityT>: SimpleTypeFields<EntityT> | Link<EntityT, EntityBase> | ComplexTypePropertyFields<EntityT, any>

A union of all types that can be used as input for ordering.

Type parameters

  • EntityT: EntityBase

    Type of the entity to be ordered

RegisteredJWTClaims

Interface to represent the registered claims of a JWT.

RequestMethodType

RequestMethodType: "get" | "post" | "patch" | "delete" | "put"

Selectable

Selectable<EntityT>: ODataVersionOf<EntityT> extends "v2" ? SimpleTypeFields<EntityT> | Link<EntityT> | ComplexTypeField<EntityT> | CustomFieldBase<EntityT> | CollectionField<EntityT> | AllFields<EntityT> : ODataVersionOf<EntityT> extends "v4" ? SimpleTypeFields<EntityT> | ComplexTypeField<EntityT> | CustomFieldBase<EntityT> | CollectionField<EntityT> | AllFields<EntityT> : never

Represents all selectables, i.e. everything that can be used in a .select statement.

Type parameters

  • EntityT: EntityBase

    Type of the entity to be selected on

Variables

Const clientCredentialsTokenCache

clientCredentialsTokenCache: { cacheRetrievedToken: any; clear: any; getCacheInstance: any; getGrantTokenFromCache: any } = ClientCredentialsTokenCache(new Cache<ClientCredentialsResponse>())

Type declaration

Const content_transfer_encoding_line

content_transfer_encoding_line: "Content-Transfer-Encoding: binary" = "Content-Transfer-Encoding: binary"

Const deserializeComplexType

deserializeComplexType: (json: MapType<any>, complexType: ComplexTypeNamespace<any>) => any = deserializer.deserializeComplexType

Type declaration

Const deserializeEntity

deserializeEntity: (json: any, entityConstructor: Constructable<EntityT>, requestHeader?: any) => EntityT = deserializer.deserializeEntity

Type declaration

    • (json: any, entityConstructor: Constructable<EntityT>, requestHeader?: any): EntityT
    • Parameters

      • json: any
      • entityConstructor: Constructable<EntityT>
      • Optional requestHeader: any

      Returns EntityT

Const destinationCache

destinationCache: { cacheRetrievedDestinations: any; clear: any; getCacheInstance: any; retrieveDestinationFromCache: any } = DestinationCache(new Cache<Destination>({ hours: 0, minutes: 5, seconds: 0 }))

Type declaration

Const executeHttpRequest

executeHttpRequest: (Anonymous function) = execute(executeWithAxios)

Builds a DestinationHttpRequestConfig for the given destination, merges it into the given requestConfig and executes it (using Axios).

param

A destination or a destination name and a JWT.

param

Any object representing an HTTP request.

returns

An HttpResponse.

Const http_version

http_version: "HTTP/1.1" = "HTTP/1.1"

Const part_content_type_line

part_content_type_line: "Content-Type: application/http" = "Content-Type: application/http"

Const serializeComplexType

serializeComplexType: (fieldValue: any, complexTypeNameSpace: ComplexTypeNamespaceT) => any = serializer.serializeComplexType

Type declaration

    • (fieldValue: any, complexTypeNameSpace: ComplexTypeNamespaceT): any
    • Parameters

      • fieldValue: any
      • complexTypeNameSpace: ComplexTypeNamespaceT

      Returns any

Const serializeEntity

serializeEntity: (entity: EntityT, entityConstructor: Constructable<EntityT>) => MapType<any> = serializer.serializeEntity

Type declaration

    • (entity: EntityT, entityConstructor: Constructable<EntityT>): MapType<any>
    • Parameters

      • entity: EntityT
      • entityConstructor: Constructable<EntityT>

      Returns MapType<any>

Const serializeEntityNonCustomFields

serializeEntityNonCustomFields: (entity: EntityT, entityConstructor: Constructable<EntityT>) => MapType<any> = serializer.serializeEntityNonCustomFields

Type declaration

    • (entity: EntityT, entityConstructor: Constructable<EntityT>): MapType<any>
    • Parameters

      • entity: EntityT
      • entityConstructor: Constructable<EntityT>

      Returns MapType<any>

Const verificationKeyCache

verificationKeyCache: Cache<unknown> = new Cache({ minutes: 15 })

Functions

addAuthorizationHeader

  • addAuthorizationHeader<RequestT>(request: ODataRequest<RequestT>, headers: MapType<string>): Promise<MapType<string>>
  • deprecated

    Since v1.20.0. Use buildAuthorizationHeaders instead. Adds authorization headers for a given ODataRequest to existing headers.

    Type parameters

    • RequestT: ODataRequestConfig

    Parameters

    • request: ODataRequest<RequestT>

      an ODataRequest.

    • headers: MapType<string>

      The headers that should be added to.

    Returns Promise<MapType<string>>

    The provided headers with the new authorization headers.

addCsrfTokenAndCookies

  • addCsrfTokenAndCookies<RequestT>(request: ODataRequest<RequestT>, headers: MapType<string>): Promise<MapType<string>>
  • deprecated

    Since v1.20.0, use buildCsrfHeaders instead.

    Add CSRF token and cookies for a request to destination related headers.

    Type parameters

    • RequestT: ODataRequestConfig

    Parameters

    • request: ODataRequest<RequestT>

      The request to get CSRF headers for.

    • headers: MapType<string>

      Destination related headers to include in the request.

    Returns Promise<MapType<string>>

    A promise to an object containing the CSRF related headers

addDestinationToRequestConfig

addProxyConfiguration

  • Given a destination and a JWT (required for subscriber destinations), this function will add a proxy configuration to a destination. See also ProxyConfiguration.

    This function will reject if no connectivity service is bound, no XSUAA service with plan application is bound or the client credentials grant with the XSUAA service fails.

    deprecated

    Since v1.16.0. Use addProxyConfigurationOnPrem instead.

    Parameters

    • destination: Destination

      The destination to which the proxy configuration should be added.

    • Optional jwt: undefined | string

      The JWT of the current user.

    Returns Promise<Destination>

    A promise resolving to the destiation with the added proxy configuration.

addProxyConfigurationInternet

  • addProxyConfigurationInternet(destination: any): Destination

addProxyConfigurationOnPrem

alwaysProvider

  • alwaysProvider(allDestinations: AllDestinations, destinationName: string): Destination | null
  • Constraints the selection to provider destinations.

    Parameters

    • allDestinations: AllDestinations

      Retrieved destinations

    • destinationName: string

      Name of the destination to retrieve

    Returns Destination | null

    the destination to retrieve, returns null if no matched provider destination is found

alwaysSubscriber

  • alwaysSubscriber(allDestinations: AllDestinations, destinationName: string): Destination | null
  • Constraints the selection to subscriber destinations.

    Parameters

    • allDestinations: AllDestinations

      Retrieved destinations

    • destinationName: string

      Name of the destination to retrieve

    Returns Destination | null

    the destination to retrieve, returns null if no matched subscriber destination is found

and

  • Create a FilterList by combining Filterables with logical and.

    Example:

    Entity.requestBuilder()
     .getAll()
     .filter(and(filterExp1, filterExp2));

    Note that the GetAllRequestBuilder.filter method takes a rest parameter and thereby an array of filter expressions that are then combined conjunctively. As a consequence following is equivalent to the example above:

    Entity.requestBuilder()
     .getAll()
     .filter(filterExp1, filterExp2);

    Type parameters

    • EntityT: EntityBase

      Type of the entity to be filtered on

    Parameters

    • Rest ...expressions: Filterable<EntityT>[]

      Filterables to be combined with logical and

    Returns FilterList<EntityT>

    The newly created FilterList

asc

audiences

  • audiences(decodedToken: DecodedJWT): Set<string>
  • Retrieve the audiences of a decoded JWT based on the audiences and scopes in the token.

    Parameters

    • decodedToken: DecodedJWT

      Token to retrieve the audiences from.

    Returns Set<string>

    A set of audiences.

basicHeader

  • basicHeader(username: string, password: string): string

buildAndAddAuthorizationHeader

  • buildAndAddAuthorizationHeader(destination: Destination): (Anonymous function)

buildAuthorizationHeaders

  • buildAuthorizationHeaders(destination: Destination): Promise<MapType<string>>

buildCsrfHeaders

  • Get CSRF token and cookies for a destination and request configuration. The CSRF token and cookies will be retrieved based on the url of the destination and the custom configuration given by the requestConfig. If there is a relative url in the requestConfig it will be appended to the destination's url, an absolute url overwrites the destination related url.

    Type parameters

    Parameters

    • destination: Destination | DestinationNameAndJwt

      The destination to get the headers from

    • requestConfig: Partial<T>

      An http request configuration containing additional information about the request, like url or headers

    Returns Promise<MapType<string>>

    A promise to an object containing the CSRF related headers

buildHeaders

  • buildHeaders<RequestT>(request: ODataRequest<RequestT>): Promise<MapType<string>>
  • Create object containing all headers, including custom headers for a given OData request configuration and destination. Custom headers override duplicate headers.

    Type parameters

    • RequestT: ODataRequestConfig

      Type of the request the headers are built for

    Parameters

    • request: ODataRequest<RequestT>

      OData request configuration to create headers for

    Returns Promise<MapType<string>>

    Key-value pairs where the key is the name of a header property and the value is the respective value

buildHeadersForDestination

  • buildHeadersForDestination(destination: Destination, customHeaders?: MapType<any>): Promise<MapType<string>>

buildHttpRequest

ceiling

checkMandatoryValue

  • checkMandatoryValue<TypeScriptKeys, JwtKeys>(key: keyof TypeScriptKeys, mapping: JwtKeyMapping<TypeScriptKeys, JwtKeys>, decodedJWT: DecodedJWT): void
  • Checks if a given key is in the decoded JWT. If not an error is raised

    exception

    Error is thrown if the key is not present.

    Type parameters

    • TypeScriptKeys

    • JwtKeys

    Parameters

    • key: keyof TypeScriptKeys

      The key of the representation in typescript

    • mapping: JwtKeyMapping<TypeScriptKeys, JwtKeys>

      The mapping between the typescript keys and the JWT key

    • decodedJWT: DecodedJWT

      Decoded token on which the check is done

    Returns void

clientCredentialsGrant

  • Executes a client credentials grant request. If the first parameter is an instance of XsuaaServiceCredentials, the response's access_token will be verified. If the first parameter is an URI, the response will not be verified.

    Parameters

    • xsuaaUriOrCredentials: string | XsuaaServiceCredentials

      The URI or the credentials of a XSUAA service instance.

    • clientCredentials: ClientCredentials

      Client credentials for which to request a token

    • Optional options: ResilienceOptions

      Options to use by retrieving access token

    • Default value customBody: MapType<any> = {}

      Object containing value required for the body request

    Returns Promise<ClientCredentialsResponse>

    A promise resolving to the response

concat

createComplexType

  • createComplexType<ComplexT>(json: any, converters: any): ComplexT
  • deprecated

    Since v1.25.0. use deserializeComplexType instead.

    Type parameters

    • ComplexT

    Parameters

    • json: any

      A raw json object to deserialize a complex type from.

    • converters: any

      A list of rules on how to convert json to the respective type in JavaScript or TypeScript.

    Returns ComplexT

    A deserialized complex type representation.

createGetFilter

createGetResourcePathForKeys

  • createGetResourcePathForKeys(uriConverter: UriConverter): GetResourcePathForKeys
  • Creates a getResourcePathForKeys function using the OData v2 or OData v4 URI converter. The concrete instances for v2 or v4 are initiated in odata/v2/uri-conversion/odata-uri.ts and odata/v4/uri-conversion/odata-uri.ts.

    Parameters

    Returns GetResourcePathForKeys

    The filter getter. See GetFilter

customAttributes

  • customAttributes(decodedToken: DecodedJWT): Map<string, string[]>
  • Extracts the custom attributes in the JWT

    Parameters

    • decodedToken: DecodedJWT

      Token to read the custom attributes

    Returns Map<string, string[]>

    custom attributes added by the xsuaa to the issued JWT.

day

decodeJwt

decodeJwtComplete

  • Decode JWT and return the complete decoded token.

    Parameters

    • token: string

      JWT to be decoded

    Returns CompleteDecodedJWT

    Decoded token containing payload, header and signature.

desc

destinationForServiceBinding

  • Tries to build a destination from a service binding with the given name. Throws an error if no services are bound at all, no service with the given name can be found, or the service type is not supported. The last error can be circumvent by using the second parameter to provide a custom function that transforms a service binding to a destination.

    Parameters

    Returns Destination

    A destination.

endsWith

entityDeserializer

  • entityDeserializer<EdmT, EntityT, JsonT>(edmToTs: EdmToTsType<EdmT>, extractODataETag: ExtractODataETagType, extractDataFromOneToManyLink: ExtractDataFromOneToManyLinkType): EntityDeserializer
  • Constructs an entityDeserializer given the OData v2 or v4 specific methods. The concrete deserializers are created in odata/v2/entity-deserializer.ts and odata/v4/entity-deserializer.ts

    Type parameters

    Parameters

    • edmToTs: EdmToTsType<EdmT>

      Converters emd input to ts values.

    • extractODataETag: ExtractODataETagType

      Extractor for the Etag.

    • extractDataFromOneToManyLink: ExtractDataFromOneToManyLinkType

      Extractor for data related to one to many links.

    Returns EntityDeserializer

    a entity deserializer as defined by EntityDeserializer

entitySerializer

  • Constructs an entitySerializer given the OData v2 or v4 specific tsToEdm method. The concrete serializers are created in odata/v2/entity-serializer.ts and odata/v4/entity-serializer.ts

    Parameters

    • tsToEdm: TsToEdmType

      Converters ts input to edm values

    Returns EntitySerializer

    a entity serializer as defined by EntitySerializer

execute

extractClientCredentials

extractCustomFields

  • extractCustomFields<EntityT, JsonT>(json: Partial<JsonT>, entityConstructor: Constructable<EntityT>): MapType<any>
  • Extracts all custom fields from the JSON payload for a single entity. In this context, a custom fields is every property that is not known in the corresponding entity class.

    Type parameters

    Parameters

    • json: Partial<JsonT>

      The JSON payload.

    • entityConstructor: Constructable<EntityT>

      The constructor function of the entity class.

    Returns MapType<any>

    An object containing the custom fields as key-value pairs.

extractDataFromOneToManyLink

  • extractDataFromOneToManyLink(data: any): any[] | undefined

extractEtagFromHeader

  • extractEtagFromHeader(headers: any): string | undefined

extractODataETag

  • extractODataETag(json: MapType<any>): string | undefined

fetchDestination

  • Fetches a specific destination by name from the given URI, including authorization tokens. For destinations with authenticationType OAuth2SAMLBearerAssertion, this call will trigger the OAuth2SAMLBearerFlow against the target destination.

    Parameters

    • destinationServiceUri: string

      The URI of the destination service

    • jwt: string

      The access token

    • destinationName: string

      The name of the desired destination

    • Optional options: ResilienceOptions

      Options to use by retrieving destinations

    Returns Promise<Destination>

    A Promise resolving to the destination

fetchInstanceDestinations

  • Fetches all instance destinations from the given URI.

    Parameters

    • destinationServiceUri: string

      The URI of the destination service

    • jwt: string

      The access token

    • Optional options: ResilienceOptions

      Options to use by retrieving destinations

    Returns Promise<Destination[]>

    A promise resolving to a list of instance destinations

fetchSubaccountDestinations

  • Fetches all subaccount destinations from the given URI.

    Parameters

    • destinationServiceUri: string

      The URI of the destination service

    • jwt: string

      The access token

    • Optional options: ResilienceOptions

      Options to use by retrieving destinations

    Returns Promise<Destination[]>

    A promise resolving to a list of subaccount destinations

fetchVerificationKeys

  • fetchVerificationKeys(xsuaaCredentials: XsuaaServiceCredentials, jku?: undefined | string): Promise<TokenKey[]>
  • fetchVerificationKeys(url: string, clientId: string, clientSecret: string): Promise<TokenKey[]>
  • Fetches verification keys from the XSUAA service for the given credentials.

    Parameters

    • xsuaaCredentials: XsuaaServiceCredentials

      Credentials of the XSUAA service instance.

    • Optional jku: undefined | string

      Value of the jku property in the JWT header. If not provided the old legacy URL xsuaaCredentials.url/token_keys is used as a fallback which will not work for subscriber accounts created after 14th of April 2020.

    Returns Promise<TokenKey[]>

    An array of TokenKeys.

  • Fetches verification keys from the XSUAA service for the given URL, with the given pair of credentials.

    Parameters

    • url: string

      URL of the XSUAA service instance.

    • clientId: string

      Client ID of the XSUAA service instance.

    • clientSecret: string

      Client secret of the XSUAA service instance.

    Returns Promise<TokenKey[]>

    An array of TokenKeys.

filterFunction

filterNullishValues

  • filterNullishValues(headers?: MapType<any>): MapType<any>
  • Filter headers that have nullish values.

    Parameters

    • Default value headers: MapType<any> = {}

      A header object to be filtered.

    Returns MapType<any>

    • A filtered header object containing only headers with non-nullish values.

floor

getAgentConfig

  • Returns the http or https-agent config depending on the destination URL. If the destination contains a proxy configuration, the agent will be a proxy-agent. If not it will be the default http-agent coming from node.

    Parameters

    • destination: Destination

      determining which kind of configuration is returned

    Returns HttpAgentConfig | HttpsAgentConfig

    The http or http-agent configuration.

getAuthHeaders

  • getAuthHeaders(destination: Destination, customHeaders?: MapType<any>): Promise<MapType<string>>

getAxiosConfigWithDefaults

getCollectionResult

  • getCollectionResult(data: any): any[]

getDestination

  • Builds a destination from one of three sources (in the given order):

    • from the environment variable "destinations"
    • from service bindings
    • from the destination service

    If you want to get a destination only from a specific source, use the corresponding function directly (getDestinationFromEnvByName, destinationForServiceBinding, getDestinationFromDestinationService).

    Parameters

    • name: string

      The name of the destination to be retrieved.

    • Default value options: DestinationOptions = {}

      Configuration for how to retrieve destinations from the destination service.

    Returns Promise<Destination | null>

    A promise returning the requested destination on success.

getDestinationBasicCredentials

  • getDestinationBasicCredentials(): BasicCredentials

getDestinationByName

  • getDestinationByName(name: string): Destination | null
  • deprecated

    Since v1.4.2. Use getDestinationFromEnvByName instead.

    Get a destination from the environment variables by name. Throws an error if there are multiple destinations with the same name. This is discouraged for productive use! Use destination-accessor/useOrFetchDestination for fetching destinations from the Cloud Foundry destination service.

    Parameters

    • name: string

      Name of the destination

    Returns Destination | null

    The requested destination if existent, otherwise null

getDestinationFromDestinationService

  • Retrieves a destination with the given name from the Cloud Foundry destination service. Returns null if no destination can be found. Requires the following service bindings: destination, XSUAA By default, selects subscriber over provider and instance over subaccount destinations.

    If the destinations are read from the environment, the jwt will be ignored.

    Parameters

    • name: string

      The name of the destination to be retrieved.

    • options: DestinationOptions & { iss?: undefined | string }

      Configuration for how to retrieve destinations from the destination service.

    Returns Promise<Destination | null>

    A promise returning the requested destination on success.

getDestinationFromEnvByName

  • getDestinationFromEnvByName(name: string): Destination | null
  • Get a destination from the environment variables by name. Throws an error if there are multiple destinations with the same name. This is discouraged for productive use! Use destination-accessor/useOrFetchDestination for fetching destinations from the Cloud Foundry destination service.

    Parameters

    • name: string

      Name of the destination

    Returns Destination | null

    The requested destination if existent, otherwise null

getDestinationOptions

  • deprecated

    Since v1.0.1. Use getDestination instead.

    Retrieves a destination with the given name from the Cloud Foundry destination service. Returns null if no destination can be found. Requires the following service bindings: destination, XSUAA By default, selects subscriber over provider and instance over subaccount destinations.

    If the destinations are read from the environment, the jwt will be ignored.

    Parameters

    • name: string

      The name of the destination to be retrieved.

    • Default value options: DestinationOptions = {}

      The options of the fetching query of the destination that include the JWT of the current request and the strategy for selecting a destination.

    Returns Promise<Destination | null>

    A promise returning the requested destination on success.

getDestinationServiceCredentials

  • getDestinationServiceCredentials(): any

getDestinationServiceCredentialsList

getDestinationServiceUri

  • getDestinationServiceUri(): string | null
  • Destination URI getter NOTICE: If there exist more than one destination/uri, the function returns the first entry.

    Returns string | null

    The first existing uri in destination or null if not found.

getDestinations

getDestinationsFromEnv

getEdmType

getEntityConstructor

  • getEntityConstructor<EntityT, ComplexT>(fieldOf: ConstructorOrField<EntityT, ComplexT>): Constructable<EntityT>

getEntityKeys

  • getEntityKeys<EntityT>(entity: EntityT, entityConstructor: Constructable<EntityT>): MapType<any>
  • Helper function that maps an entity to its keys map with their original names.

    Type parameters

    Parameters

    • entity: EntityT

      Entity to map

    • entityConstructor: Constructable<EntityT>

      The constructor of the entity

    Returns MapType<any>

    object that includes all keys that represent given entity

getEnvironmentVariable

  • getEnvironmentVariable(name: string): string | undefined | null
  • Environment variables accessor.

    Parameters

    • name: string

      Environment variable name.

    Returns string | undefined | null

    Env variable value if defined. null: If not defined.

getExpand

  • getExpand<EntityT>(selects?: Selectable<EntityT>[]): Partial<{ expand: string }>
  • Get an object containing the given expand as a query parameter, or an empty object if none was given. In this OData v2 expand, selected properties are automatically added to the expand.

    Type parameters

    • EntityT: Entity

      Type of the entity to expand on

    Parameters

    • Default value selects: Selectable<EntityT>[] = []

      The selects which are expanded if necessary

    Returns Partial<{ expand: string }>

    An object containing the query parameter or an empty object

getGrantTokenCacheKey

getHeader

  • getHeader(key: string, headers?: MapType<any>): MapType<any>
  • Find a header in a given header object, if available, idepdendent of the case (lower / upper).

    Parameters

    • key: string

      Name of the header to be found.

    • Default value headers: MapType<any> = {}

      Header object to be searched for given key.

    Returns MapType<any>

    • An object containing the given key (and value) in its original case, as found in headers or an empty object if not found.

getHeaderValue

  • getHeaderValue(key: string, headers?: MapType<any>): any | undefined
  • Get the value of a header based on the given key, independent of the case (lower / upper).

    Parameters

    • key: string

      Name of the header to be found.

    • Default value headers: MapType<any> = {}

      Header object to be searched for given key.

    Returns any | undefined

    The value of the header with the given key or undefined.

getOAuth2ClientCredentialsToken

  • getOAuth2ClientCredentialsToken(destination: Destination): Promise<ClientCredentialsResponse>
  • Retrieves an access token required for "OAuth2ClientCredentials" destination authentication type.

    Parameters

    • destination: Destination

      A destination having OAuth2ClientCredentials authentication type

    Returns Promise<ClientCredentialsResponse>

    A promise returning the requested access token on success.

getOrderBy

  • getOrderBy<EntityT>(orderBy: Orderable<EntityT>[]): Partial<{ orderby: string }>
  • Get an object containing the given order bys as query parameter, or an empty object if none was given.

    Type parameters

    Parameters

    • orderBy: Orderable<EntityT>[]

      A list of orderables to get the query parameters for

    Returns Partial<{ orderby: string }>

    An object containing the query parameter or an empty object

getProtocolOrDefault

  • Extracts the http protocol from the destination url. The default value is http if no protocol is given.

    throws

    Error in case a unsupported protocol is given in the destination URL like rfc://example.com.

    Parameters

    • destination: Destination

      URL of this destination is parsed

    Returns Protocol

    The protocol, either https or http.

getQueryParametersForFilter

  • getQueryParametersForFilter<EntityT>(filter: Filterable<EntityT>, entityConstructor: Constructable<EntityT>): Partial<{ filter: string }>
  • deprecated

    Since v1.21.0. Use oDataUri.getFilter instead. Get an object containing the given filter as query parameter, or an empty object if none was given.

    Type parameters

    • EntityT: Entity

      Type of the entity to filter on

    Parameters

    • filter: Filterable<EntityT>

      The filter to transform to a query parameter

    • entityConstructor: Constructable<EntityT>

      Constructor type of the entity to filter on

    Returns Partial<{ filter: string }>

    An object containing the query parameter or an empty object

getQueryParametersForOrderBy

  • getQueryParametersForOrderBy<EntityT>(orderBy: Orderable<EntityT>[]): Partial<{ orderby: string }>
  • deprecated

    Since v1.21.0. Use oDataUri.getOrderBy instead. Get an object containing the given order bys as query parameter, or an empty object if none was given.

    Type parameters

    • EntityT: Entity

      Type of the entity to order

    Parameters

    • orderBy: Orderable<EntityT>[]

      A list of orderables to get the query parameters for

    Returns Partial<{ orderby: string }>

    An object containing the query parameter or an empty object

getQueryParametersForSelection

  • getQueryParametersForSelection<EntityT>(selects?: Selectable<EntityT>[]): Partial<{ expand: string; select: string }>
  • deprecated

    Since v1.21.0. Use oDataUri.getSelect and oDataUri.getExpand instead.

    Get an object containing the given Selectables as query parameter, or an empty object if none were given. This retrieves where in addition to the selection (select) there is also an expansion (expand) needed.

    Type parameters

    • EntityT: Entity

      Type of the entity to get the selection for

    Parameters

    • Default value selects: Selectable<EntityT>[] = []

      The list of selectables to be transformed to query parameters

    Returns Partial<{ expand: string; select: string }>

    An object containing the query parameters or an empty object

getRequestLine

  • Generate the request line, containing method, url and http version from the request builder, e.g.: GET /sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartnerAddress?$format=json&$top=1 HTTP/1.1

    Parameters

    Returns string

    the generated request line.

getResourcePathForKeys

  • getResourcePathForKeys<EntityT>(keys?: MapType<FieldType>, entityConstructor: Constructable<EntityT>): string
  • deprecated

    Since v1.21.0. Use oDataUri.getResourcePathForKeys instead. Get the resource path of an entity specified by key-value pairs.

    Type parameters

    • EntityT: EntityBase

      Type of the entity to get the resource path for

    Parameters

    • Default value keys: MapType<FieldType> = {}

      Key-value pairs where the key is the name of a key property of the given entity and the value is the respective value

    • entityConstructor: Constructable<EntityT>

      Constructor type of the entity to get the resource path for

    Returns string

    The path to the resource

getSelect

  • getSelect<EntityT>(selects?: Selectable<EntityT>[]): Partial<{ select: string }>
  • Get an object containing the given Selectables as query parameter, or an empty object if none were given. This retrieves where in addition to the selection (select) there is also an expansion (expand) needed.

    Type parameters

    • EntityT: Entity

      Type of the entity to get the selection for

    Parameters

    • Default value selects: Selectable<EntityT>[] = []

      The list of selectables to be transformed to query parameters

    Returns Partial<{ select: string }>

    An object containing the query parameters or an empty object

getService

  • getService(service: string): Service | undefined

getServiceCredentialsList

  • getServiceCredentialsList(service: string): any[]
  • Credentials list getter for a given service.

    Parameters

    • service: string

      Service name

    Returns any[]

    Fetched credentials objects of existing service in 'VCAP_SERVICES'.

getServiceList

  • getServiceList(service: string): Service[]
  • Services getter for a given service.

    Parameters

    • service: string

      Service name.

    Returns Service[]

    List of service bindings of the given type. Returns an empty array if no service binding exists for the given type.

getSingleResult

  • getSingleResult(data: any): Record<string, any>

getUrlProtocol

  • deprecated

    Since v1.5.1. use getProtocolOrDefault instead Takes the destination URL and return everything before the '://'.

    Parameters

    • destination: Destination

      URL of this destination is parsed

    Returns Protocol | undefined

    The protocol either undefined if no :// is found or anything before the delimiter.

getVcapService

  • getVcapService(): MapType<any> | null
  • 'VCAP_SERVICES' Getter from environment variables. This function returns the VCAP_SERVICES as object or null if it is not defined (i.e. no services are bound to the application).

    Returns MapType<any> | null

    'VCAP_SERVICES' found in environment variables or null if not defined. The key denotes the name ov the service and the value is the definition.

getXsuaaServiceCredentials

  • Takes a decoded JWT and uses the client_id and audience claims to determine the XSUAA service instance that issued the JWT. Returns the credentials if a match is found, otherwise throws an error. If no decoded JWT is specified, then returns the first existing XSUAA credential service plan "application".

    Parameters

    • Optional token: DecodedJWT | string

      Either an encoded or decoded JWT.

    Returns XsuaaServiceCredentials

    The credentials for a match, otherwise null.

headerForClientCredentials

hour

indexOf

isCollectionResult

  • isCollectionResult(data: any): boolean

isComplexTypeNameSpace

  • isComplexTypeNameSpace(val: any): val is ComplexTypeNamespace<any>

isDestination

  • isDestination(destination: any): destination is Destination

isDestinationNameAndJwt

  • isDestinationNameAndJwt(destination: any): destination is DestinationNameAndJwt

isEdmType

  • isEdmType(val: any): val is EdmTypeShared<"any">
  • Check whether a value is an EdmType. This will yield positive results for every string starting with Edm..

    Parameters

    • val: any

      Value to test.

    Returns val is EdmTypeShared<"any">

    Whether the given value is of type EdmTypeShared

isFilter

  • isFilter<T, FieldT>(filterable: Filterable<T>): filterable is Filter<T, FieldT>

isFilterLambdaExpression

  • isFilterLambdaExpression<EntityT, FieldT>(filterable: Filterable<EntityT>): filterable is FilterLambdaExpression<EntityT, FieldT>

isFilterLink

  • isFilterLink<EntityT, LinkedT>(filterable: Filterable<EntityT>): filterable is FilterLink<EntityT, LinkedT>

isFilterList

  • isFilterList<T>(filterable: Filterable<T>): filterable is FilterList<T>

isIdenticalTenant

  • Compare two decoded JWTs based on their tenantIds.

    Parameters

    Returns boolean

    Whether the tenant is identical.

isOf

isWithETag

  • isWithETag(config: any): config is WithETag

issuerUrl

  • issuerUrl(decodedToken: DecodedJWT): string | undefined
  • Get the issuer url of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the issuer url from.

    Returns string | undefined

    The issuer url if available.

length

minute

month

Const nonEnumerable

  • nonEnumerable(target: any, propertyKey: string): void

or

parseDestination

  • Takes a JSON object returned by any of the calls to the destination service and returns an SDK compatible destination object. This function only accepts destination configurations of type 'HTTP' and will error if no 'URL' is given.

    Parameters

    Returns Destination

    An SDK compatible destination object.

parseProxyEnv

  • Parses the environment variable for the web proxy and extracts the values considering defaults like http for the protocol and 80 or 443 for the port. The general pattern to be parsed is protocol://user:password@host:port, where everything besides the host is optional. Special characters in the user and password need to be percent encoded.

    Parameters

    • proxyEnvValue: string

      Environment variable which is parsed

    Returns ProxyConfiguration | undefined

    Configuration with default values or undefined if the parsing failed.

prependDollar

  • prependDollar(param: string): string

proxyAgent

  • Builds the http(s)-agent config. Note that the proxy agent type like http or https is determined by the destination RUL protocol. The protocol from the proxy is unrelated to this and in most cases http.

    Parameters

    • destination: Destination

      Destination containing the proxy configurations

    Returns HttpAgentConfig | HttpsAgentConfig

    The http(s)-agent containing the proxy configuration

proxyStrategy

  • Determines the proxy strategy. If noProxy is set the ProxyConfiguration in the destination is omitted. For onPremProxy or internetProxy the connectivy service or enviroment variables are checked to fill the ProxyConfiguration.

    Parameters

    • destination: Destination

      from which the proxy strategy is derived.

    Returns ProxyStrategy

    ProxyStrategy possible values are noProxy, internetProxy or onPremProxy.

refreshTokenGrant

  • Executes a refresh token grant request against the given URI. If the first parameter is an instance of XsuaaServiceCredentials, the response's access_token will be verified. If the first parameter is an URI, the response will not be verified.

    Parameters

    • xsuaaUriOrCredentials: string | XsuaaServiceCredentials

      The URI or the credentials of a XSUAA service instance.

    • clientCredentials: ClientCredentials

      The credentials (client_id, client_secret) if the target XSUAA service instance.

    • refreshToken: string

      The refresh token that should be used to generate a new access token.

    • Optional options: ResilienceOptions

      Options to use by retrieving access token.

    Returns Promise<UserTokenResponse>

    A promise resolving to the response of the XSUAA service.

replace

  • Build a filter function to replace the occurence of a search string with another string. Evaluates to string.

    Type parameters

    Parameters

    • str: string | Field<EntityT> | StringFilterFunction<EntityT>

      The string to get the index from. This can either be a string, a reference to a field or another filter function.

    • searchStr: string | Field<EntityT> | StringFilterFunction<EntityT>

      The substring to get the index for. This can either be a string, a reference to a field or another filter function.

    • replaceStr: string | Field<EntityT> | StringFilterFunction<EntityT>

      The substring to get the index for. This can either be a string, a reference to a field or another filter function.

    Returns StringFilterFunction<EntityT>

    The newly created filter function

replaceDuplicateKeys

  • replaceDuplicateKeys(headers?: MapType<any>, customHeaders?: MapType<any>): MapType<any>
  • Create a header object by replacing headers that are set as custom headers.

    Parameters

    • Default value headers: MapType<any> = {}

      A base header object that contains the headers that will be compared with customHeaders.

    • Default value customHeaders: MapType<any> = {}

      A header object to be compared with headers. Only headers present in headers will be compared.

    Returns MapType<any>

    • An object containing all keys from the original headers object, where headers present in the customHeaders are replaced. Note that the case (upper / lower) used by customHeaders will be used.

resolveService

retrieveJwt

  • retrieveJwt(req: IncomingMessage): string | undefined
  • Retrieve JWT from a request that is based on the node IncomingMessage. Fails if no authorization header is given or has the wrong format. Expected format is 'Bearer '.

    Parameters

    • req: IncomingMessage

      Request to retrieve the JWT from

    Returns string | undefined

    JWT found in header

round

sanitizeDestination

  • sanitizeDestination(destination: MapType<any>): Destination
  • Takes an existing or a parsed destination and returns an SDK compatible destination object.

    Parameters

    • destination: MapType<any>

      An object that adheres to the Destination interface.

    Returns Destination

    An SDK compatible destination object.

second

secondsToTime

  • secondsToTime(n: number): Time
  • Converts from seconds to time as Time.

    Parameters

    • n: number

      Number of seconds to convert (should be positive).

    Returns Time

    Time The converted time from the given number of seconds

serviceToken

  • Returns an access token that can be used to call the given service. The token is fetched via a client credentials grant with the credentials of the given service. If multiple instances of the provided service exist, the first instance will be selected. When a JWT is passed, the tenant of the JWT will be used when performing the grant. When no JWT is passed, the grant will be performed using the provider tenant.

    Throws an error if there is no instance of the given service type or the XSUAA service, or if the request to the XSUAA service fails.

    Parameters

    Returns Promise<string>

    Access token.

startsWith

subscriberFirst

  • subscriberFirst(allDestinations: AllDestinations, destinationName: string): Destination | null
  • Prioritizes the selection of subscriber destinations.

    Parameters

    • allDestinations: AllDestinations

      Retrieved destinations

    • destinationName: string

      Name of the destination to retrieve

    Returns Destination | null

    the destination to retrieve, returns null if no matched destination is found

substring

  • Build a filter function to get a substring starting from a designated position. Evaluates to string.

    Type parameters

    Parameters

    • str: string | Field<EntityT> | StringFilterFunction<EntityT>

      The string to get a substring from. This can either be a string, a reference to a field or another filter function.

    • pos: number | Field<EntityT> | NumberFilterFunction<EntityT>

      The starting position of the substring. This can be either a number, a reference to a field or another filter function.

    • Optional len: number | Field<EntityT> | NumberFilterFunction<EntityT>

      The length of the substring. This can be either a number, a reference to a field or another filter function.

    Returns StringFilterFunction<EntityT>

    The newly created filter function

substringOf

  • Build a filter function to test whether a string is a substring of the other. Evaluates to boolean.

    Type parameters

    Parameters

    • substr: string | Field<EntityT> | StringFilterFunction<EntityT>

      The substring to test for. This can either be a string, a reference to a field or another filter function.

    • str: string | Field<EntityT> | StringFilterFunction<EntityT>

      The string to test. This can either be a string, a reference to a field or another filter function.

    Returns BooleanFilterFunction<EntityT>

    The newly created filter function

tenantFromJwt

  • Creates a tenant object from the decoded JWT.

    exception

    Error Raised if no id is found in the decoded JWT.

    Parameters

    Returns Tenant

    Representation of the tenant.

tenantId

  • tenantId(decodedToken: DecodedJWT): string | undefined
  • Get the tenant id of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the tenant id from.

    Returns string | undefined

    The tenant id if available.

tenantName

  • tenantName(decodedToken: DecodedJWT): string | undefined
  • Get the tenant name of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the tenant id from.

    Returns string | undefined

    The tenant id if available.

timeToSeconds

  • timeToSeconds(time: Time): number
  • Converts the given time to seconds in positive numerical format.

    Parameters

    • time: Time

      Time to convert.

    Returns number

    number Time in seconds.

toBatchChangeSet

toBatchRetrieveBody

  • Build a string as the request body of the retrieve request. Below is an example of the generated body, where the two empty line are mandatory to make the request valid. * example starts * Content-Type: application/http Content-Transfer-Encoding: binary

    GET /SomeUrl/API_BUSINESS_PARTNER/A_BusinessPartnerBank?$format=json&$top=1 HTTP/1.1

    * example ends *

    Parameters

    Returns string

    The request body.

Const toGuid

  • toGuid(value: string): string

toLower

toPascalCase

  • toPascalCase(str: string): string
  • Converts a string to PascalCase format e.g. "MyNameInPascalCase".

    Parameters

    • str: string

      The string to be transformed.

    Returns string

    The transformed string.

toPropertyFormat

  • toPropertyFormat(str: string): string
  • Converts a string to the format used by properties. Use this for serialization.

    Parameters

    • str: string

      The string to be transformed.

    Returns string

    The transformed string.

toSanitizedHeaderObject

  • toSanitizedHeaderObject(key: string, value: any): MapType<any>
  • Create a header object based on the given key and value if neither key nor value are nullish.

    Parameters

    • key: string

      Name of the header.

    • value: any

      Value of the header.

    Returns MapType<any>

    • An object containing the given key and value of an empty object.

toStaticPropertyFormat

  • toStaticPropertyFormat(str: string): string
  • Converts a string to the case used by static methods on entity classes. Use this for serialization.

    Parameters

    • str: string

      The string to be transformed.

    Returns string

    The input string in the case used by static methods on entity-classes.

toTitleFormat

  • toTitleFormat(str: string): string
  • Converts a string to a human readable format, e.g. it transforms to_BusinessPartner to To Business Partner. Use this for serialization.

    Parameters

    • str: string

      The string to be transformed.

    Returns string

    The transformed string.

toTypeNameFormat

  • toTypeNameFormat(str: string): string
  • Converts a string to the format used by properties. Use this for serialization.

    Parameters

    • str: string

      The string to be transformed.

    Returns string

    The transformed string.

toUpper

trim

useOrFetchDestination

  • Returns the parameter if it is a destination, calls getDestination otherwise (which will try to fetch the destination from the Cloud Foundry destination service).

    Fetching a destination requires:

    • a binding to exactly one XSUAA service instance with service plan "application"
    • a binding to a destination service instance

    If either of the prerequisites is not met or one of the services returns an error, this function will either throw an error or return a promise that rejects.

    Parameters

    Returns Promise<Destination | null>

    A promise resolving to the requested destination on success.

userApprovedServiceToken

  • Returns a user approved access token that can be used to call the given service on behalf of the given user. The token is fetched via user token + refresh token grant. This can be necessary for scenarios in which a token for a service is required, but the service needs to know about the user on whose behalf the request is performed (for example to let the destination service perform principal propagation with SAP S/4HANA Cloud).

    Throws an error if there is no instance of the given service type or the XSUAA service, or if the request to the XSUAA service fails.

    Parameters

    • userJwt: string

      The JWT of the user for whom the access token should be fetched.

    • service: string | Service

      The type of the service or an instance of Service.

    • Optional options: ResilienceOptions

      Options to influence resilience behavior (see ResilienceOptions). By default, usage of a circuit breaker is enabled.

    Returns Promise<string>

    A user approved access token.

userEmail

  • userEmail(decodedToken: DecodedJWT): string | undefined
  • Get the user's email of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the user id from.

    Returns string | undefined

    The user id if available.

userFamilyName

  • userFamilyName(decodedToken: DecodedJWT): string | undefined
  • Get the user's family name of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the user id from.

    Returns string | undefined

    The user id if available.

userFromJwt

  • Creates a user object from the decoded JWT.

    exception

    Error Raised if no id is found in the decoded JWT.

    Parameters

    Returns User

    Representation of the user

userGivenName

  • userGivenName(decodedToken: DecodedJWT): string | undefined
  • Get the user's given name of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the user id from.

    Returns string | undefined

    The user id if available.

userId

  • userId(decodedToken: DecodedJWT): string | undefined
  • Get the user id of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the user id from.

    Returns string | undefined

    The user id if available.

userName

  • userName(decodedToken: DecodedJWT): string | undefined
  • Get the user name of a decoded JWT.

    Parameters

    • decodedToken: DecodedJWT

      Token to read the user id from.

    Returns string | undefined

    The user id if available.

userScopes

userTokenGrant

  • userTokenGrant(xsuaaUri: string, userJwt: string, clientId: string, options?: ResilienceOptions): Promise<UserTokenResponse>
  • Executes a user token grant request against the given URI.

    Parameters

    • xsuaaUri: string

      The URI of the target XSUAA service instance.

    • userJwt: string

      The JWT of the user on whose behalf the request is executed.

    • clientId: string

      The client_id of the target XSUAA service instance.

    • Optional options: ResilienceOptions

      Options to use by retrieving access token

    Returns Promise<UserTokenResponse>

    A promise resolving to the response of the XSUAA service.

verifyJwt

  • Verifies the given JWT and returns the decoded payload.

    Parameters

    • token: string

      JWT to be verified

    • Optional options: VerifyJwtOptions

      Options to control certain aspects of JWT verification behavior.

    Returns Promise<DecodedJWT>

    A Promise to the decoded and verified JWT.

verifyJwtWithKey

  • verifyJwtWithKey(token: string, key: string): Promise<DecodedJWT>
  • Verifies the given JWT with the given key and returns the decoded payload.

    Parameters

    • token: string

      JWT to be verified

    • key: string

      Key to use for verification

    Returns Promise<DecodedJWT>

    A Promise to the decoded and verified JWT.

wrapJwtInHeader

  • wrapJwtInHeader(token: string): AxiosRequestConfig
  • Wraps the access token in header's authorization.

    Parameters

    • token: string

      Token to attach in request header

    Returns AxiosRequestConfig

    The request header that holds the access token

year

Object literals

Const DestinationSelectionStrategies

DestinationSelectionStrategies: object

Selector of destination selection strategies. See alwaysProvider, alwaysSubscriber and subscriberFirst for more information available selection strategies.

alwaysProvider

alwaysProvider: alwaysProvider

alwaysSubscriber

alwaysSubscriber: alwaysSubscriber

subscriberFirst

subscriberFirst: subscriberFirst

Const EnvironmentAccessor

EnvironmentAccessor: object
deprecated

Since v1.5.0. Use directly exported functions instead

getDestinationBasicCredentials

getDestinationBasicCredentials: getDestinationBasicCredentials

getDestinationServiceCredentials

getDestinationServiceCredentials: getDestinationServiceCredentials

getDestinationServiceCredentialsList

getDestinationServiceCredentialsList: getDestinationServiceCredentialsList

getDestinationServiceUri

getDestinationServiceUri: getDestinationServiceUri

getEnvironmentVariable

getEnvironmentVariable: getEnvironmentVariable

getServiceCredentialsList

getServiceCredentialsList: getServiceCredentialsList

getServiceList

getServiceList: getServiceList

getVcapService

getVcapService: getVcapService

getXsuaaServiceCredentials

getXsuaaServiceCredentials: getXsuaaServiceCredentials

Const circuitBreakerDefaultOptions

circuitBreakerDefaultOptions: object

errorThresholdPercentage

errorThresholdPercentage: number = 50

resetTimeout

resetTimeout: number = 30000

timeout

timeout: number = 10000

Const deserializersCommon

deserializersCommon: object

Edm.Any

Edm.Any: identity = identity

Edm.Binary

Edm.Binary: identity = identity

Edm.Boolean

Edm.Boolean: identity = identity

Edm.Byte

Edm.Byte: toNumber = toNumber

Edm.Decimal

Edm.Decimal: toBigNumber = toBigNumber

Edm.Double

Edm.Double: fromEdmToNumber = fromEdmToNumber

Edm.Float

Edm.Float: fromEdmToNumber = fromEdmToNumber

Edm.Guid

Edm.Guid: toGuid = toGuid

Edm.Int16

Edm.Int16: toNumber = toNumber

Edm.Int32

Edm.Int32: toNumber = toNumber

Edm.Int64

Edm.Int64: toBigNumber = toBigNumber

Edm.SByte

Edm.SByte: toNumber = toNumber

Edm.Single

Edm.Single: fromEdmToNumber = fromEdmToNumber

Edm.String

Edm.String: identity = identity

Const filterFunctions

filterFunctions: object

Filter functions common to both OData v2 and OData v4. See below for version specific filter functions.

Filter functions are used to create more complex filtering expresions, e. g. when filtering by the first letter of a property:

 .filter(startsWith(BusinessPartner.FIRST_NAME, 'A').equals(true))

ceiling

ceiling: ceiling

concat

concat: concat

day

day: day

endsWith

endsWith: endsWith

floor

floor: floor

hour

hour: hour

indexOf

indexOf: indexOf

isOf

isOf: isOf

length

length: length

minute

minute: minute

month

month: month

round

round: round

second

second: second

startsWith

startsWith: startsWith

substring

substring: substring

toLower

toLower: toLower

toUpper

toUpper: toUpper

trim

trim: trim

year

year: year

Const filterFunctions

filterFunctions: object

OData v2 specific filter functions

replace

replace: replace

substringOf

substringOf: substringOf

Const mapping

mapping: object

Mapping between key name in the Tenant and key name in decoded JWT and the

id

id: object

extractorFunction

extractorFunction: tenantId = tenantId

keyInJwt

keyInJwt: "zid" = "zid"

name

name: object

extractorFunction

extractorFunction: tenantName = tenantName

keyInJwt

keyInJwt: "zdn" = "zdn"

Const mapping

mapping: object

Mapping between key name in the User and key name in decoded JWT and the

customAttributes

customAttributes: object

extractorFunction

extractorFunction: customAttributes = customAttributes

keyInJwt

keyInJwt: "xs.user.attributes" = "xs.user.attributes"

email

email: object

extractorFunction

extractorFunction: userEmail = userEmail

keyInJwt

keyInJwt: "email" = "email"

familyName

familyName: object

extractorFunction

extractorFunction: userFamilyName = userFamilyName

keyInJwt

keyInJwt: "family_name" = "family_name"

givenName

givenName: object

extractorFunction

extractorFunction: userGivenName = userGivenName

keyInJwt

keyInJwt: "given_name" = "given_name"

id

id: object

extractorFunction

extractorFunction: userId = userId

keyInJwt

keyInJwt: "user_id" = "user_id"

scopes

scopes: object

extractorFunction

extractorFunction: userScopes = userScopes

keyInJwt

keyInJwt: "scope" = "scope"

userName

userName: object

extractorFunction

extractorFunction: userName = userName

keyInJwt

keyInJwt: "user_name" = "user_name"

Const numberReturnTypeMapping

numberReturnTypeMapping: object

decimal

decimal: "Edm.Decimal" = "Edm.Decimal"

double

double: "Edm.Double" = "Edm.Double"

int

int: "Edm.Int32" = "Edm.Int32"

Const oDataUri

oDataUri: object

Instance of the ODataUri conversion interface for OData v2.

convertToUriFormat

convertToUriFormat: convertToUriFormat

getEntityKeys

getEntityKeys: getEntityKeys

getExpand

getExpand: getExpand

getFilter

getFilter: GetFilterType<any>

getOrderBy

getOrderBy: getOrderBy

getResourcePathForKeys

getResourcePathForKeys: GetResourcePathForKeysType<any>

getSelect

getSelect: getSelect

Const serializersCommom

serializersCommom: object

Edm.Any

Edm.Any: identity = identity

Edm.Binary

Edm.Binary: identity = identity

Edm.Boolean

Edm.Boolean: identity = identity

Edm.Byte

Edm.Byte: toNumber = toNumber

Edm.Decimal

Edm.Decimal: fromBigNumber = fromBigNumber

Edm.Double

Edm.Double: fromNumberToEdm = fromNumberToEdm

Edm.Float

Edm.Float: fromNumberToEdm = fromNumberToEdm

Edm.Guid

Edm.Guid: identity = identity

Edm.Int16

Edm.Int16: toNumber = toNumber

Edm.Int32

Edm.Int32: toNumber = toNumber

Edm.Int64

Edm.Int64: fromBigNumber = fromBigNumber

Edm.SByte

Edm.SByte: toNumber = toNumber

Edm.Single

Edm.Single: fromNumberToEdm = fromNumberToEdm

Edm.String

Edm.String: identity = identity