UNPKG

event-driven

Version:

makes building event-driven-architecture easy

32 lines (31 loc) 949 B
/// <reference types="mongoose/types/pipelinestage" /> /// <reference types="mongoose/types/error" /> /// <reference types="mongoose/types/connection" /> import { Document, Types } from 'mongoose'; export interface EventDoc extends Document { _id: Types.ObjectId; parentIds: Types.ObjectId[]; durableName?: string; clientGroup: string; subject: string; data: any; republish: { targetClientGroup: string; createdAt: Date; }[]; createdAt: Date; } export declare const Event: import("mongoose").Model<EventDoc, {}, {}, {}>; export interface Event<Subjects> { subject: Subjects; data: any; } export declare const createEvent: <PublishingEvent extends Event<string>>(data: { parentIds: Types.ObjectId[]; durableName?: string | undefined; clientGroup: string; subject: PublishingEvent["subject"]; data: PublishingEvent["data"]; }) => EventDoc & { _id: Types.ObjectId; };