UNPKG

liveperson-functions-client

Version:

JavaScript client for LivePerson Functions.

87 lines (86 loc) 3.33 kB
import { GetUrlOptions } from '../types/getUrlOptions'; import { Config, DebugConfig, GetAccessToken, GetAuthorizationHeader, GetDpopHeader } from './clientConfig'; import { Tooling } from '../types/tooling'; import { Response } from '../types/response'; import { Invocation, LambdaRequest, IsImplemented, FunctionRequest } from '../types/invocationTypes'; import { DoFetchOptions } from '../types/fetchOptions'; /** * The FaaS BaseClient. */ export declare class BaseClient { readonly version: string; protected readonly config: Required<Config>; protected readonly tooling: Tooling; protected getAuthorizationHeader: GetAuthorizationHeader | undefined; protected getAccessToken: GetAccessToken | undefined; protected getDpopHeader: GetDpopHeader | undefined; /** * Default constructor, creates a FaaS client. * * @param config The client configuration. * @param tooling The tooling used internally in the client. */ constructor(config: Required<Config>, tooling: Tooling); /** * Invokes a function. * * @param invocationData The invocation data. * @returns The function invocation response. */ invoke(invocationData: Invocation): Promise<Response>; /** * Lists functions. compatible with V2 and V1 Functions. * Should be used during transition period to V2. Please be aware than some V2 functions properties may be different than V1. * @param lambdaRequestData filtering data. * @returns A list of functions (V2 or V1). * @deprecated Will be replaced by 'getFunctions' in V2. */ getLambdas(lambdaRequestData: LambdaRequest): Promise<Response>; /** * Lists functions, Only V2. * @param functionRequestData filtering data. * @returns A list of functions. */ getFunctions(functionRequestData: FunctionRequest): Promise<Response>; /** * Checks if an Event(ID) is implemented. */ isImplemented(isImplementedRequestData: IsImplemented): Promise<boolean>; private performInvocationV1; private performInvocationV2; private performGetLambdasRequest; /** * Equivalent to performGetLambdasRequest for V2 */ private performGetFunctionsRequest; private performGetRequestForIsImplemented; private performGetRequestForIsImplementedV2; /** * Base function to perform requests against the FaaS services. */ protected doFetch(options: DoFetchOptions): Promise<Response>; /** * Internal method to retrieve and build the request URL for the FaaS services. */ protected getUrl(options: GetUrlOptions): Promise<string>; /** * Internal method to gather information for logging/debugging purposes. */ protected getDebugConfig(opts?: DebugConfig): { [x: string]: { version: string; }; }; protected isCustomLambdaErrorV1(error: unknown): boolean; protected isCustomLambdaErrorV2(error: unknown): boolean; private isEventInvocation; private isAppJwtCredentials; private isDpopCredentials; private getAppJwtAuthorizationHeader; private resolveDomain; private collectBaseMetricsFrom; private collectBaseMetricsForInvokeFrom; private enhanceBaseMetrics; private isV2Domain; private mapV2ErrorCodeToV1; }