/// import { LoggerOptions } from "../../../types/logger/LoggerOptions"; import { PubSubSubscriptionOptionsType } from "../../../types/pubsub/PubSubSubscriptionOptions.type"; import { IServerType } from "./HTTPServer"; import { TypeDaprPubSubCallback } from "../../../types/DaprPubSubCallback.type"; import { BulkSubscribeResponse } from "../../../types/pubsub/BulkSubscribeResponse.type"; import DaprPubSubStatusEnum from "../../../enum/DaprPubSubStatus.enum"; import { IncomingHttpHeaders } from "http"; import { PubSubSubscriptionTopicRouteType } from "../../../types/pubsub/PubSubSubscriptionTopicRoute.type"; import { PubSubSubscriptionsType } from "../../../types/pubsub/PubSubSubscriptions.type"; import { DaprPubSubType } from "../../../types/pubsub/DaprPubSub.type"; export default class HTTPServerImpl { private readonly server; private readonly logger; private readonly subscriptionManager; constructor(server: IServerType, loggerOptions?: LoggerOptions); /** * Extracts data from the subscribe request body. * Data should be present in req.body.data or req.body.data_base64 depending on the rawPayload metadata. * If the data is not found, the request body is returned as-is. * @param req HTTP Request * @returns Data from the request body. */ extractDataFromSubscribeRequest(req: any): any; /** * When we subscribe, we subscribe to a topic * For this topic we can define "routes" which route to a certain callback depending on the event content * Each of these topics are handled by a EventHandler but there can be multiple handlers per pubsubname-topic-route combination * * We don't create the EventHandlers here but we ensure that the routes are registered and can receive POST events * -> we create POST / endpoints for each, but we create them uniquely! * -> to ensure uniqueness, we just check if this.pubsubRouteEventHandlers[route] is set * * @param pubSubName * @param topicName * @param cb * @param options */ registerPubsubSubscription(pubsubName: string, topic: string, options?: PubSubSubscriptionOptionsType): void; processBulkSubscribeMessage(routeObj: PubSubSubscriptionTopicRouteType, req: any): Promise; processPubSubCallbacks(routeObj: PubSubSubscriptionTopicRouteType, data: any, headers: IncomingHttpHeaders): Promise; registerPubSubSubscriptionEventHandler(pubsubName: string, topic: string, route: string | undefined, cb: TypeDaprPubSubCallback): void; generateDaprPubSubSubscriptionList(): DaprPubSubType[]; getSubscriptions(): PubSubSubscriptionsType; }