@sap-cloud-sdk/connectivity
Version:
SAP Cloud SDK for JavaScript connectivity
66 lines (65 loc) • 3.23 kB
TypeScript
import type { DestinationFetchOptions, DestinationsByType } from './destination-accessor-types';
import type { Destination, DestinationCertificate } from './destination-service-types';
type DestinationsServiceOptions = Pick<DestinationFetchOptions, 'useCache'>;
type DestinationServiceOptions = Pick<DestinationFetchOptions, 'destinationName' | 'retry'>;
/**
* @internal
* Fetch either subaccount or instance destinations (no token retrieval).
* @param destinationServiceUri - The URI of the destination service
* @param serviceToken - The service token for the destination service.
* @param type - Either 'instance' or 'subaccount', depending on what destinations should be fetched.
* @param options - Options to use for retrieving destinations.
* @returns A promise resolving to a list of destinations of the requested type.
*/
export declare function fetchDestinations(destinationServiceUri: string, serviceToken: string, type: 'instance' | 'subaccount', options?: DestinationsServiceOptions): Promise<Destination[]>;
/**
* @internal
*/
export interface AuthAndExchangeTokens {
/**
* @internal
*/
authHeaderJwt: string;
/**
* @internal
*/
exchangeHeaderJwt?: string;
/**
* @internal
*/
exchangeTenant?: string;
/**
* @internal
*/
refreshToken?: string;
}
/**
* @internal
* Fetch a destination from the destination find API (`/destinations`) and skip the automatic token retrieval.
* @param destinationName - Name of the destination.
* @param destinationServiceUri - The URI of the destination service.
* @param serviceToken - The service token for the destination service.
* @returns A promise resolving to the requested destination.
*/
export declare function fetchDestinationWithoutTokenRetrieval(destinationName: string, destinationServiceUri: string, serviceToken: string): Promise<DestinationsByType>;
/**
* Fetches a certificate from the subaccount and destination instance for a given a name.
* Subaccount is tried first.
* @param destinationServiceUri - The URI of the destination service
* @param token - The access token for destination service.
* @param certificateName - Name of the Certificate to be fetched
* @returns A Promise resolving to the destination
* @internal
*/
export declare function fetchCertificate(destinationServiceUri: string, token: string, certificateName: string): Promise<DestinationCertificate | undefined>;
/**
* @internal
* Fetches a specific destination including authorization tokens from the given URI.
* For destinations with authenticationType `OAuth2SAMLBearerAssertion`, this call will trigger the `OAuth2SAMLBearer` flow against the target destination.
* @param destinationServiceUri - The URI of the destination service
* @param token - The access token or `AuthAndExchangeTokens` if you want to include other token headers for e.g. `OAuth2UserTokenExchange`.
* @param options - Options to use for retrieving destinations.
* @returns A promise resolving to the destination.
*/
export declare function fetchDestinationWithTokenRetrieval(destinationServiceUri: string, token: string | AuthAndExchangeTokens, options: DestinationServiceOptions): Promise<Destination>;
export {};