export = NotifierController; /** * @typedef {Object} DocumentChanges * @property {string} _id of the document * @property {Object} [_source] of the document * @property {Object} [_updatedFields] applied to the document (for updates) * @property {boolean} [created] -- tells if this is a CREATE or REPLACE * (for actionEnum.WRITE) */ /** * @class NotifierController */ declare class NotifierController { constructor(realtimeModule: any); module: any; ttl: number; logger: import("../../kuzzle/Logger").Logger; init(): Promise; /** * Broadcasts a notification about a document change or a * real-time message * * @param {Array} rooms - Subscribed rooms to notify * @param {Request} request - Request at the origin of the notification * @param {string} scope - 'in' or 'out' * @param {object} content - Document or message * * @returns {Promise} */ notifyDocument(rooms: any[], request: Request, scope: string, action: any, content: object): Promise; /** * Broadcast a notification about a user entering or leaving * the provided room * * @param {string} room - Room entered or left * @param {Request} request - User (un)subscription request * @param {string} scope - 'in' or 'out' * @param {object} content - Notification additional informations * * @returns {Promise} */ notifyUser(room: string, request: Request, scope: string, content: object): Promise; /** * Send a "token expired" notification to the target user * * @param {string} connectionId - User's connection identifier * @returns {Promise} */ notifyTokenExpired(connectionId: string): Promise; /** * Publish the content of the provided request to listening subscribers * * @param {Request} request * @returns {Promise.} */ publish(request: Request): Promise; /** * Notify about a created document * * @param {Request} request * @param {DocumentChanges} document created * @returns {Promise.>} list of matched rooms */ notifyDocumentCreate(request: Request, document: DocumentChanges): Promise>; /** * Notify about a replaced document * * @param {Request} request * @param {DocumentChanges} document * @param {string} cache notification content for that document * @returns {Promise.} list of matched rooms */ notifyDocumentReplace(request: Request, document: DocumentChanges, cache?: string): Promise>; /** * Computes document notifications and sends them to subscribed users. * @param {Request} request * @param {notifyActionEnum} action * @param {Array.} documents * @return {Promise} */ notifyDocuments(request: Request, action: notifyActionEnum, documents: Array): Promise; /** * Notify rooms on a document update * @param {Request} request * @param {DocumentChanges} document * @param {string} cache notification content for that document * @returns {Promise.} list of matched rooms */ notifyDocumentUpdate(request: Request, document: DocumentChanges, cache?: string): Promise>; /** * Notify about a document deletion * * @param {Request} request * @param {DocumentChanges} document * @returns {Promise.} returns an empty array ("no room match anymore") */ notifyDocumentDelete(request: Request, document: DocumentChanges): Promise; /** * Trigger a notify global event and, if accepted by plugins, * dispatch the payload to subscribers * * @param {Array} channels - Subscribers channels to notify * @param {Notification.User|Notification.Document|Notification.Server} notification * @param {string} [connectionId] - Notify this connection, or broadcast * if not provided * @param {boolean} [trigger] - If set to true, triggers Kuzzle plugins * * @returns {Promise} */ _dispatch(event: any, channels: any[], notification: Notification.User | Notification.Document | Notification.Server, connectionId?: string): Promise; /** * Broadcasts a notification about a document change or a * real-time message. * * When this method is called from the node who received * the request triggering notification, then every channel is notified * regardless of the "cluster" option. * * When this method is called from the cluster synchronization, * then only the channels having the "cluster: true" option are notified * * @param {Array} rooms - Subscribed rooms to notify * @param {DocumentNotification} notification * @param {object} [options] - fromCluster (true) * * @returns {Promise} */ _notifyDocument(rooms: any[], notification: typeof import("./notification/document"), { fromCluster }?: object): Promise; /** * Broadcast a notification about a user entering or leaving * the provided room * * @param {string} room - Room entered or left * @param {UserNotification} notification * @param {object} content - Notification additional informations * * @returns {Promise} */ _notifyUser(room: string, notification: typeof import("./notification/user"), { fromCluster }?: object): Promise; /** * DRYification for calls to Koncorde's test method from a Request object * @param {Request} request * @param {Object} source - document's source * @param {String} id * * @returns {Array.} */ _test(request: Request, source?: any, id?: string): Array; } declare namespace NotifierController { export { DocumentChanges }; } type DocumentChanges = { /** * of the document */ _id: string; /** * of the document */ _source?: any; /** * applied to the document (for updates) */ _updatedFields?: any; /** * -- tells if this is a CREATE or REPLACE * (for actionEnum.WRITE) */ created?: boolean; };