UNPKG

n8n

Version:

n8n Workflow Automation Tool

25 lines (24 loc) 1.27 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import type { IPushDataType } from '../Interfaces'; import type { Logger } from '../Logger'; import type { User } from '../databases/entities/User'; import type { OrchestrationService } from '../services/orchestration.service'; export declare abstract class AbstractPush<T> extends EventEmitter { protected readonly logger: Logger; private readonly orchestrationService; protected connections: Record<string, T>; protected userIdByPushRef: Record<string, string>; protected abstract close(connection: T): void; protected abstract sendToOneConnection(connection: T, data: string): void; constructor(logger: Logger, orchestrationService: OrchestrationService); protected add(pushRef: string, userId: User['id'], connection: T): void; protected onMessageReceived(pushRef: string, msg: unknown): void; protected remove(pushRef?: string): void; private sendTo; sendToAll(type: IPushDataType, data?: unknown): void; sendToOneSession(type: IPushDataType, data: unknown, pushRef: string): void; sendToUsers(type: IPushDataType, data: unknown, userIds: Array<User['id']>): void; closeAllConnections(): void; hasPushRef(pushRef: string): boolean; }