UNPKG

@getanthill/datastore

Version:

Event-Sourced Datastore

18 lines (17 loc) 1.16 kB
import type { NextFunction, Request, Response } from 'express'; import type { Services } from '../../typings'; import type { ChangeStreamDocument } from 'mongodb'; export declare function writeJSON(_req: Request, res: Response, data: any): void; export declare function serverSentEventKeepAlive(services: Services, res: Response): void; export declare function initChangeStream(services: Services, req: Request, onChange: (change: ChangeStreamDocument<Document>) => void, maxWaitInMilliseconds: number): Promise<import("mongodb").ChangeStream<import("bson").Document, ChangeStreamDocument<import("bson").Document>>>; export declare function serverSentEvents(services: Services): (req: Request, res: Response, next: NextFunction) => Promise<void>; /** * @alpha * * Horizontal Scaling of the stream reader (async process to publish in * a queue-like system such as RabbitMQ or Kafka) * @see https://stackoverflow.com/questions/54295043/what-is-a-good-horizontal-scaling-strategy-for-a-mongodb-change-stream-reader * * @param services */ export declare function stream(services: Services): (req: Request, res: Response, next: NextFunction) => Promise<void>;