import type { DestinationFetchOptions } from './destination-accessor-types'; import type { Destination } from './destination-service-types'; import type { CachingOptions } from '../cache'; import type { Service } from '../environment-accessor'; import type { JwtPayload } from '../jsonwebtoken-type'; import type { IasOptions } from './ias-types'; /** * 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. * @param options - Options to customize the behavior of this function. * @returns A destination. */ export declare function getDestinationFromServiceBinding(options: Pick & DestinationFromServiceBindingOptions & { iasOptions?: IasOptions; }): Promise; /** * Options to customize the behavior of {@link getDestinationFromServiceBinding}. */ export type DestinationFromServiceBindingOptions = { /** * Custom transformation function to control how a {@link Destination} is built from the given {@link Service}. */ serviceBindingTransformFn?: ServiceBindingTransformFunction; } & ({ /** * A service binding to use directly instead of looking it up by name. Mandatory if no destination name is provided. */ service: Service; destinationName?: never; } | { /** * The name of the destination to retrieve from service bindings. */ destinationName: string; service?: never; }); /** * Represents options passed to the service binding transform function. */ export type ServiceBindingTransformOptions = { /** * The JWT payload used to fetch destinations. */ jwt?: JwtPayload; /** * The options for IAS token retrieval. */ iasOptions?: IasOptions; } & CachingOptions; /** * Type of the function to transform the service binding. */ export type ServiceBindingTransformFunction = (service: Service, options?: ServiceBindingTransformOptions) => Promise; /** * @internal */ export declare function searchServiceBindingForDestination(options: DestinationFetchOptions & DestinationFromServiceBindingOptions): Promise;