UNPKG

integreat

Version:
23 lines (22 loc) 1.32 kB
import type { TransformDefinition } from 'map-transform/types.js'; import type Auth from './Auth.js'; import type { Action, Response, Adapter, MapOptions, MapTransform } from '../types.js'; import type { EndpointDef, ServiceOptions, MatchObject, PreparedOptions } from './types.js'; export type PrepareOptions = (options: ServiceOptions, serviceId: string) => ServiceOptions; export default class Endpoint { #private; id?: string; match?: MatchObject; options: PreparedOptions; allowRawRequest?: boolean; allowRawResponse?: boolean; castWithoutDefaults?: boolean; outgoingAuth?: Auth; incomingAuth?: Auth[]; constructor(endpointDef: EndpointDef, serviceId: string, options: PreparedOptions, mapTransform: MapTransform, mapOptions: MapOptions, serviceMutation?: TransformDefinition, serviceAdapters?: Adapter[], endpointAdapters?: Adapter[], outgoingAuth?: Auth, incomingAuth?: Auth[]); validateAction(action: Action): Promise<Response | null>; mutate(action: Action, isRev: boolean): Promise<Action>; isMatch(action: Action, isIncoming?: boolean): Promise<boolean>; static sortAndPrepare(endpointDefs: EndpointDef[]): EndpointDef[]; static findMatchingEndpoint(endpoints: Endpoint[], action: Action, isIncoming?: boolean): Promise<Endpoint | undefined>; }