The path in the sub request should be serialized as an absolute or relative url.
Union type to represent the parent of a field. This can either be an entity constructor or a complex type field.
The type of a constructor.
Type of an instance created by the constructor.
Options to use while fetching destinations. Encompasses both DestinationCachingOptions and ResilienceOptions interfaces.
Allowed Edm types for OData v2.
Allowed Edm types for OData v4.
Represents all expandables, i.e. everything that can be used in an .expand
statement. Only relevant for OData v4 requests.
Type of the entity to be selected on
Union type to represent all possible types of a field.
Type of a parameter of a filter function. This can either be a primitive type, a reference to a field or another filter function.
Primitive type of a parameter of a filter function.
hidden
A union of all types that can be used for filtering.
Type of the entity to be filtered on
Internal representation of all parameters of a function import as a map
External represenation of all parameters
Unwrap return type of the given function type ApiT[FnT]
.
E. g. for someFunction() => AxiosResponse<SomeReturnType>
this gives you SomeReturnType
.
It is never
when the given type is not a function type
Interface of the api.
Name of the function, that is part of the api.
A union of all types that can be used for ordering.
Type of the entity to be ordered
A union of all types that can be used as input for ordering.
Type of the entity to be ordered
Type of the parameters of a given function
Interface of the api.
Name of the function, that is part of the api.
Interface to represent the registered claims of a JWT.
Represents all selectables, i.e. everything that can be used in a .select
statement.
Type of the entity to be selected on
Get the type of the promised response, e. g. for Promise<SomeType>
this gives you SomeType
.
Type of the promised content.
Unwrap the Axios response type.
Entity deserializer instance for v2 entities. See EntityDeserializer for the provided methods.
Entity deserializer instance for v4 entities. See EntityDeserializer for the provided methods.
Entity serializer instance for v2 entities. See EntitySerializer for the provided methods.
Entity serializer instance for v4 entities. See EntitySerializer for the provided methods.
Builds a DestinationHttpRequestConfig for the given destination, merges it into the given requestConfig and executes it (using Axios).
an ODataRequest.
The headers that should be added to.
The provided headers with the new authorization headers.
The request to get CSRF headers for.
Destination related headers to include in the request.
A promise to an object containing the CSRF related headers
Builds a DestinationHttpRequestConfig for the given destination and then merges it into the given request configuration. Setting of the given request configuration take precedence over any destination related configuration.
A destination or a destination name and a JWT.
Any object representing an HTTP request.
The given request config merged with the config built for the given destination.
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.
The destination to which the proxy configuration should be added.
The JWT of the current user.
A promise resolving to the destiation with the added proxy configuration.
Adds the proxy configuration to a destination based on web proxies defined in environment variables. See ProxyConfiguration and proxyStrategy for details.
to which the proxy configuration is added.
Destination containing the configuration for web proxy.
Will return the entity if all elements of the multilink relation fulfill the condition.
A filter condition like MyEntity.someMultiLink.someProperty.eq('value')
The lambda filter function to be considered in the query
Constraints the selection to provider destinations.
Retrieved destinations
Name of the destination to retrieve
the destination to retrieve, returns null if no matched provider destination is found
Constraints the selection to subscriber destinations.
Retrieved destinations
Name of the destination to retrieve
the destination to retrieve, returns null if no matched subscriber destination is found
Create a FilterList by combining Filterables with logical and
.
Example:
Entity.requestBuilder()
.getAll()
.filter(and(filterExp1, filterExp2));
Note that the GetAllRequestBuilderV2.filter and GetAllRequestBuilderV4.filter method take 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 of the entity to be filtered on
Filterables to be combined with logical and
The newly created FilterList
Will return the entity if at least one element of the multilink relation fulfills the condition.
A filter condition like MyEntity.someMultiLink.someProperty.eq('value')
The lambda filter function to be considered in the query
Create new Order by orderBy._fieldName
in ascending order.
Type of the entity to be ordered
Field or link to be ordered by
New order
Retrieve the audiences of a decoded JWT based on the audiences and scopes in the token.
Token to retrieve the audiences from.
A set of audiences.
A destination.
The provided headers with the new authorization headers.
A destination or a destination name and a JWT.
Any object representing an HTTP request.
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.
The destination to get the headers from
An http request configuration containing additional information about the request, like url or headers
A promise to an object containing the CSRF related headers
Create object containing all headers, including custom headers for a given OData request configuration and destination. Custom headers override duplicate headers.
Type of the request the headers are built for
OData request configuration to create headers for
Key-value pairs where the key is the name of a header property and the value is the respective value
Builds a DestinationHttpRequestConfig for the given destination. If a destination name (and a JWT) are provided, it will try to resolve the destination.
A destination or a destination name and a JWT.
Custom default headers for the resulting HTTP request.
Build a filter function to ceil a number. Evaluates to double or decimal, defaults to double.
The number to ceil. This can either be a number, a reference to a field or another filter function.
The return type to use.
The newly created filter function
Checks if a given key is in the decoded JWT. If not an error is raised
The key of the representation in typescript
The mapping between the typescript keys and the JWT key
Decoded token on which the check is done
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.
The URL of the token service or the credentials of a XSUAA service instance.
Client credentials for which to request a token
Options to use by retrieving access token
Object containing value required for the body request
A promise resolving to the response
Build a filter function to concatenate two strings. Evaluates to string.
The first string to concatenate. This can either be a string, a reference to a field or another filter function.
The second string to concatenate. This can either be a string, a reference to a field or another filter function.
The newly created filter function
Build a filter function to test whether a string is a substring of the other. Evaluates to boolean.
The substring to test for. This can either be a string, a reference to a field or another filter function.
The string to test. This can either be a string, a reference to a field or another filter function.
The newly created filter function
A raw json object to deserialize a complex type from.
A list of rules on how to convert json to the respective type in JavaScript or TypeScript.
A deserialized complex type representation.
Creates a getFilter function using the OData v2 or OData v4 URI converter. The concrete filter getters are initiated in odata/v2/uri-conversion/odata-uri.ts and odata/v4/uri-conversion/odata-uri.ts.
Uri converter for v2 or v4.
The filter getter. See interface GetFilter
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.
Uri converter for v2 or v4.
The filter getter. See GetFilter
Extracts the custom attributes in the JWT
Token to read the custom attributes
custom attributes added by the xsuaa to the issued JWT.
Build a filter function to get the day of a date. Evaluates to int.
The date to get the day for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
Decode JWT.
JWT to be decoded
Decoded payload.
Decode JWT and return the complete decoded token.
JWT to be decoded
Decoded token containing payload, header and signature.
Create new Order by orderBy._fieldName
in descending order.
Type of the entity to be ordered
Field or link to be ordered by
New order
Deserialize the parsed batch response.
Two dimensional list of parsed batch sub responses.
A map that holds the entity type to constructor mapping.
Response data access module.
Entity deserializer.
An array of parsed sub responses of the batch response.
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.
The name of the service.
Options to customize the behavior of this function.
A destination.
Detects the system dependent line break in a string.
The string to check for line breaks. Should have at least two lines, otherwise an error will be thrown.
The system dependent line break
Build a filter function to test whether a string ends with another. Evaluates to boolean.
The string to test. This can either be a string, a reference to a field or another filter function.
The suffix to test for. This can either be a string, a reference to a field or another filter function.
The newly created filter function
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
Converters emd input to ts values.
Extractor for the Etag.
Extractor for data related to one to many links.
a entity deserializer as defined by EntityDeserializer
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
Converters ts input to edm values
a entity serializer as defined by EntitySerializer
Takes as paramter a function that expects an HttpRequest and returns a Promise of HttpResponse. Returns a function that takes a destination and a request-config (extends HttpRequestConfig), builds an HttpRequest from them, and calls the provided execute function.
NOTE: If you simply want to execute a request without passing your own execute function, use executeHttpRequest instead!
A function that can execute an HttpRequestConfig.
A function expecting destination and a request.
Extracts the credentials of a service into an instance of ClientCredentials.
The credentials of a service as read from VCAP_SERVICES.
A ClientCredentials instance.
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.
The JSON payload.
The constructor function of the entity class.
An object containing the custom fields as key-value pairs.
One to many link response data
The content of the one to many link
One to many link response data
The content of the one to many link
Extractor for the etag for OData v2 responses used in entityDeserializer.
Response data from which the etag is extracted
The etag
Extractor for the etag for OData v4 responses used in entityDeserializer.
Reponse data from which the etag is extracted
The etag
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. In this pass the access token as string. Fetches a specific destination with authenticationType OAuth2UserTokenExchange by name from the given URI, including authorization tokens.
The URI of the destination service
The access token or AuthAndExchangeTokens if you want to include the X-user-token for OAuth2UserTokenExchange.
The name of the desired destination
Options to use by retrieving destinations
A Promise resolving to the destination
Fetches all instance destinations from the given URI.
The URI of the destination service
The access token
Options to use by retrieving destinations
A promise resolving to a list of instance destinations
Fetches all subaccount destinations from the given URI.
The URI of the destination service
The access token
Options to use by retrieving destinations
A promise resolving to a list of subaccount destinations
Fetches verification keys from the XSUAA service for the given credentials.
Credentials of the XSUAA service instance.
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.
An array of TokenKeys.
Fetches verification keys from the XSUAA service for the given URL, with the given pair of credentials.
URL of the XSUAA service instance.
Client ID of the XSUAA service instance.
Client secret of the XSUAA service instance.
An array of TokenKeys.
Build a custom filter function.
the name of the function, e.g., substring
the return type of the filter function
the parameter(s) used in the function
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
the name of the function, e.g., substring
the return type of the filter function
the parameter(s) used in the function
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
Build a custom filter function.
An instance of filter function suited for the given return type
A header object to be filtered.
Build a filter function to floor a number. Evaluates to double or decimal, defaults to double.
The number to floor. This can either be a number, a reference to a field or another filter function.
The return type to use.
The newly created filter function
Build a filter function to get the fractional seconds of a date. Evaluates to decimal.
The date to get the fractional seconds for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
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.
determining which kind of configuration is returned
The http or http-agent configuration.
Builds an Axios config with default configuration i.e. no_proxy, default http and https agent and GET as request method.
AxiosRequestConfig with default parameters
Extract the collection data from the response. If the data does not contain a collection an empty array is returned.
Response of the OData v2 service
any[] - Collection extracted from the response
Extract the collection data from the response. If the data does not contain a collection an empty array is returned.
Response of the OData v4 service
any[] - Collection extracted from the response
Builds a destination from one of three sources (in the given order):
If you want to get a destination only from a specific source, use the corresponding function directly
(getDestinationFromEnvByName
, destinationForServiceBinding
, getDestinationFromDestinationService
).
The name of the destination to be retrieved.
Configuration for how to retrieve destinations from the destination service.
A promise returning the requested destination on success.
Basic Credentials Getter from Destination service credentials needed for JWT generator.
Basic credentials.
Name of the destination
The requested destination if existent, otherwise null
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.
The name of the destination to be retrieved.
Configuration for how to retrieve destinations from the destination service.
A promise returning the requested destination on success.
Get a destination from the environment variables by name. If there are multiple destinations with the same name the first one will be used. This is discouraged for productive use! Use destination-accessor/useOrFetchDestination for fetching destinations from the Cloud Foundry destination service.
Name of the destination
The requested destination if existent, otherwise null
The name of the destination to be retrieved.
The options of the fetching query of the destination that include the JWT of the current request and the strategy for selecting a destination.
A promise returning the requested destination on success.
Get destination service if one is present.
Destination service
First 'destination' credentials getter.
The 'destination' credentials object or null if it does not exist.
Destination credentials getter.
A list of 'credentials' objects in 'destination' service.
Destination URI getter NOTICE: If there exist more than one destination/uri, the function returns the first entry.
The first existing uri in destination or null if not found.
A list of destinations
Get all destinations from the environment variable "destinations". This is discouraged for productive use! Use useOrFetchDestination for fetching destinations from the Cloud Foundry destination service.
A list of destinations
Convenience method to get the EdmTypeShared from the overloaded constructor. The two scenarios are complexTypeNameOrEdmType = EdmTypeShared and edmTypeOrUndefined = undefined or complexTypeNameOrEdmType = string of complextype and edmTypeOrUndefined = EdmTypeShared.
Either the name of the complex type or the EdmType
Either the EdmType or undefined.
The EdmType resolved for the two arguments.
Convenience method to get the entity constructor of the parent of a complex type.
Either an entity constructor or another complex type field.
The constructor of the transitive parent entity;
Helper function that maps an entity to its keys map with their original names.
Entity to map
The constructor of the entity
object that includes all keys that represent given entity
Environment variables accessor.
Environment variable name.
Env variable value if defined. null: If not defined.
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 of the entity to expand on
The selects which are expanded if necessary
An object containing the query parameter or an empty object
Get an object containing the given expand as a query parameter, or an empty object if none was given.
Type of the entity to expand on
The expands to transform to a query parameter
Constructor type of the entity to expand on
An object containing the query parameter or an empty object
Name of the header to be found.
Header object to be searched for given key.
headers
or an empty object if not found.Name of the header to be found.
Header object to be searched for given key.
The value of the header with the given key or undefined.
Name of the header to be found.
Header object to be searched for given key.
headers
or an empty object if not found.The seralized request as
Extract the collection data from the one to many link response. If the data does not contain a collection an empty array is returned.
Response of the one to many link
any[] - Collection extracted from the response
Extract the collection data from the one to many link response. If the data does not contain a collection an empty array is returned.
Response of the one to many link
any[] - Collection extracted from the response
Retrieves an access token required for "OAuth2ClientCredentials" destination authentication type.
A destination having OAuth2ClientCredentials
authentication type
A promise returning the requested access token on success.
Get an object containing the given order bys as query parameter, or an empty object if none was given.
Type of the entity to order
A list of orderables to get the query parameters for
An object containing the query parameter or an empty object
Extracts the http protocol from the destination url. The default value is http if no protocol is given.
URL of this destination is parsed
The protocol, either https or http.
Type of the entity to filter on
The filter to transform to a query parameter
Constructor type of the entity to filter on
An object containing the query parameter or an empty object
Type of the entity to get the selection for
The list of selectables to be transformed to query parameters
An object containing the query parameters or an empty object
Type of the entity to get the resource path for
Key-value pairs where the key is the name of a key property of the given entity and the value is the respective value
Constructor type of the entity to get the resource path for
The path to the resource
Get the response body from the string representation of a response.
String representation of a response.
The response body as a one line 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 of the entity to get the selection for
The list of selectables to be transformed to query parameters
An object containing the query parameters or an empty object
Get an object containing the given Selectables as query parameter, or an empty object if none were given. In OData v4 selected properties are not automatically expanded anymore and a manual expand needs to be performed.
Type of the entity to get the selection for
The list of selectables to be transformed to query parameters
An object containing the query parameters or an empty object
Returns the first found instance for the given service type.
The service type.
The first found service.
Credentials list getter for a given service.
Service name
Fetched credentials objects of existing service in 'VCAP_SERVICES'.
Services getter for a given service.
Service name.
List of service bindings of the given type. Returns an empty array if no service binding exists for the given type.
Parses the data of a single result.
Response of the OData service.
The single result object if existent, an empty object otherwise.
Extract the single entry data from the response. If the data does not contain a single object an empty object is returned.
Response of the OData v4 service
Record<string, any> - single object extracted from the response
URL of this destination is parsed
The protocol either undefined if no :// is found or anything before the delimiter.
'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).
'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.
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".
Either an encoded or decoded JWT.
The credentials for a match, otherwise null.
Build a filter function to test whether a set is a subsequence of the other, i. e. wheter the second parameter can be transformed into the first by removing items. Evaluates to boolean.
The subsequence to test for. This can either be an array, a reference to a field or another filter function.
The sequence to test. This can either be an array, a reference to a field or another filter function.
The newly created filter function
Build a filter function to test whether a set is a subset of the other, i. e. wheter the second parameter can be transformed into the first by reordering and / or removing items. Evaluates to boolean.
The subset to test for. This can either be an array, a reference to a field or another filter function.
The set to test. This can either be an array, a reference to a field or another filter function.
The newly created filter function
Build a filter function to get the hour of a date. Evaluates to int.
The date to get the hour for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
Build a filter function to get the start index of a substring. Evaluates to int.
The string to get the index from. This can either be a string, a reference to a field or another filter function.
The substring to get the index for. This can either be a string, a reference to a field or another filter function.
The newly created filter function
Checks if the data contains a collection result.
Response of the OData service.
True if the data is a collection result.
Checks if the data contains a collection result.
Response of the OData v4 service
boolean - true if the data is a collection result
Check whether a value is an EdmType. This will yield positive results for every string starting with Edm.
.
Value to test.
Whether the given value is of type EdmTypeShared
hidden
Compare two decoded JWTs based on their tenantIds.
User JWT
Provider JWT
Whether the tenant is identical.
Checks if the property with name key of the entity is a navigation property.
Name of the property.
Constructor of the entity.
A boolean denoting whether an entity is a navigation property or not.
Build a filter function to test whether a selection is of a given type. Evaluates to boolean.
The type to test for, e. g. API_BUSINESS_PARTNER.A_BusinessPartner
.
The newly created filter function
Build a filter function to test whether a field is of a given type. Evaluates to boolean.
A reference to a field to test for type.
The type to test for, e. g. API_BUSINESS_PARTNER.A_BusinessPartner
.
The newly created filter function
Get the issuer url of a decoded JWT.
Token to read the issuer url from.
The issuer url if available.
Build a filter function to get the length of a string. Evaluates to int.
The string to compute the length for. This can either be a string, a reference to a field or another filter function.
The newly created filter function
Build a filter function to test whether a string matches a pattern. Evaluates to boolean.
The string to get the index from. This can either be a string, a reference to a field or another filter function.
The pattern to test against. This should be a regular expression as a string.
The newly created filter function
Build a filter function to get the latest possible point in time. Evaluates to DateTimeOffset.
The newly created filter function
A base header object that contains the headers that will be compared with customHeaders
.
A header object to be compared with headers. Only headers present in headers
will be compared.
customHeaders
are replaced. Note that the case (upper / lower) used by customHeaders
will be used.Build a filter function to get the earliest possible point in time. Evaluates to DateTimeOffset.
The newly created filter function
Build a filter function to get the minute of a date. Evaluates to int.
The date to get the minute for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
Build a filter function to get the month of a date. Evaluates to int.
The date to get the month for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
Build a filter function to get the current point in time. Evaluates to DateTimeOffset.
The newly created filter function
Create a FilterList by combining Filterables with logical or
.
Example:
Entity.requestBuilder()
.getAll()
.filter(or(filterExp1, filterExp2));
Type of the entity to be filtered on
Filterables to be combined with logical or
The newly created FilterList
Parse the complete batch HTTP response.
HTTP response of a batch request.
An array of parsed sub responses of the batch response.
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.
A JSON object returned by the destination service.
An SDK compatible destination object.
Parse the entity name from the metadata uri. This should be the __metadata
property of a single entity in the response.
The URI to parse the entity name from
The entity name.
Parse the HTTP code of response.
String representation of the response.
The HTTP code.
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.
Environment variable which is parsed
Configuration with default values or undefined if the parsing failed.
Parse the body and http code of a batch sub response.
A batch sub response.
The parsed response.s
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.
Destination containing the proxy configurations
The http(s)-agent containing the proxy configuration
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.
from which the proxy strategy is derived.
ProxyStrategy possible values are noProxy, internetProxy or onPremProxy.
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.
The URL of the token service or the credentials of a XSUAA service instance.
The credentials (client_id, client_secret) if the target XSUAA service instance.
The refresh token that should be used to generate a new access token.
Options to use by retrieving access token.
A promise resolving to the response of the XSUAA service.
Build a filter function to replace the occurence of a search string with another string. Evaluates to string.
The string to get the index from. This can either be a string, a reference to a field or another filter function.
The substring to get the index for. This can either be a string, a reference to a field or another filter function.
The substring to get the index for. This can either be a string, a reference to a field or another filter function.
The newly created filter function
A base header object that contains the headers that will be compared with customHeaders
.
A header object to be compared with headers. Only headers present in headers
will be compared.
headers
object, where headers present in the customHeaders
are replaced. Note that the case (upper / lower) used by customHeaders
will be used.Takes a string that represents the service type and resolves it by calling getService. If the parameter is already an instance of Service, it is returned directly.
Throws an error when no service can be found for the given type.
A Service instance.
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
Request to retrieve the JWT from
JWT found in header
Build a filter function to round a number. Evaluates to double or decimal, defaults to double.
The number to round. This can either be a number, a reference to a field or another filter function.
The return type to use.
The newly created filter function
Takes an existing or a parsed destination and returns an SDK compatible destination object.
An object that adheres to the Destination interface.
An SDK compatible destination object.
Build a filter function to get the second of a date. Evaluates to int.
The date to get the second for. This can either be a date (moment.Moment) or a reference to a field.
The newly created filter function
Serialize a batch request to string. This is used for the batch request payload when executing the request.
Batch request to serialize.
Request serialization options.
String representation of the batch request.
Serialize change set to string.
Change set containing a collection of write operations.
Request serialization options.
The serialized string representation of a change set.
Serialize a multipart request to string.
Request serialization options.
The serialized string representation of a multipart request, including the multipart headers.
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.
The type of the service or an instance of Service.
Options to influence caching and resilience behavior (see CachingOptions and ResilienceOptions, respectively) and a JWT. By default, caching and usage of a circuit breaker are enabled.
Access token.
Split a batch response into an array of sub responses for the retrieve requests and changesets.
The raw HTTP response.
A list of sub responses represented as strings.
Split a changeset (sub) response into an array of sub responses.
The string representation of a change set response.
A list of sub responses represented as strings.
Split a string representation of a response into sub responses given its boundary.
The string representation of the response to split.
The boundary to split by.
A list of sub responses represented as strings.
Build a filter function to test whether a string starts with another. Evaluates to boolean.
The string to test. This can either be a string, a reference to a field or another filter function.
The prefix to test for. This can either be a string, a reference to a field or another filter function.
The newly created filter function
Prioritizes the selection of subscriber destinations.
Retrieved destinations
Name of the destination to retrieve
the destination to retrieve, returns null if no matched destination is found
Build a filter function to get a substring starting from a designated position. Evaluates to string.
The string to get a substring from. This can either be a string, a reference to a field or another filter function.
The starting position of the substring. This can be either a number, a reference to a field or another filter function.
The length of the substring. This can be either a number, a reference to a field or another filter function.
The newly created filter function
Build a filter function to test whether a string is a substring of the other. Evaluates to boolean.
The substring to test for. This can either be a string, a reference to a field or another filter function.
The string to test. This can either be a string, a reference to a field or another filter function.
The newly created filter function
Creates a tenant object from the decoded JWT.
Decoded JWT token
Representation of the tenant.
Get the tenant id of a decoded JWT.
Token to read the tenant id from.
The tenant id if available.
Get the tenant name of a decoded JWT.
Token to read the tenant id from.
The tenant id if available.
Converts the given time to seconds in positive numerical format.
Time to convert.
number Time in seconds.
Change set containing a collection of write operations.
The serialized string representation of a change set.
Change set containing a collection of write operations.
The serialized string representation of a change set.
The request builder of the retrieve request.
The request body.
The request builder of the retrieve request.
The request body.
Build a filter function to transform a string to lower case. Evaluates to string.
The string to transform. This can either be a string, a reference to a field or another filter function.
The newly created filter function
The string to be transformed.
The transformed string.
The string to be transformed.
The transformed string.
Name of the header.
Value of the header.
The string to be transformed.
The transformed string.
The string to be transformed.
The transformed string.
Build a filter function to transform a string to upper case. Evaluates to string.
The string to transform. This can either be a string, a reference to a field or another filter function.
The newly created filter function
Build a filter function to get the signed number of minutes in the time zone offset. Evaluates to int.
The date to get the offset minutes for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
Build a filter function to trim whitespace from a string. Evaluates to string.
The string to trim whitespace from. This can either be a string, a reference to a field or another filter function.
The newly created filter function
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:
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.
A destination or the necessary parameters to fetch one.
Caching options by fetching destination.
A promise resolving to the requested destination on success.
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.
The JWT of the user for whom the access token should be fetched.
The type of the service or an instance of Service.
Options to influence resilience behavior (see ResilienceOptions). By default, usage of a circuit breaker is enabled.
A user approved access token.
Get the user's email of a decoded JWT.
Token to read the user id from.
The user id if available.
Get the user's family name of a decoded JWT.
Token to read the user id from.
The user id if available.
Creates a user object from the decoded JWT.
Decoded JWT toeken
Representation of the user
Get the user's given name of a decoded JWT.
Token to read the user id from.
The user id if available.
Get the user id of a decoded JWT.
Token to read the user id from.
The user id if available.
Get the user name of a decoded JWT.
Token to read the user id from.
The user id if available.
Get the user's scopes of a decoded JWT.
Token to read the user id from.
The user id if available.
Executes a user token grant request against the given URI.
The URL of the token service or the credentials of a XSUAA service instance.
The JWT of the user on whose behalf the request is executed.
The client_id of the target XSUAA service instance.
Options to use by retrieving access token
A promise resolving to the response of the XSUAA service.
Verifies the given JWT and returns the decoded payload.
JWT to be verified
Options to control certain aspects of JWT verification behavior.
A Promise to the decoded and verified JWT.
Verifies the given JWT with the given key and returns the decoded payload.
JWT to be verified
Key to use for verification
A Promise to the decoded and verified JWT.
Wraps the access token in header's authorization.
Token to attach in request header
The request header that holds the access token
Build a filter function to get the year of a date. Evaluates to int.
The date to get the year for. This can either be a date (Moment) or a reference to a field.
The newly created filter function
Selector of destination selection strategies. See alwaysProvider, alwaysSubscriber and subscriberFirst for more information available selection strategies.
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))
OData v2 specific filter functions
OData v4 specific filter functions
Mapping between key name in the Tenant and key name in decoded JWT and the
Mapping between key name in the User and key name in decoded JWT and the
Instance of the ODataUri conversion interface for OData v2.
Instance of the ODataUri conversion interface for OData v4.
@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