import { Observable, ReplaySubject } from 'rxjs'; import { RpcNotification } from '../rpc/notification/rpc-notification-model'; import { Rpc } from '../rpc/rpc'; import { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model'; import { RpcWorkItemFind, RpcWorkItemFindResult } from '../rpc/work-item-find/rpc-work-item-find-model'; import { Notification, NotificationEvent } from './notification'; import { NotificationMessage } from './notification-message'; import { NotificationState } from './notification-state'; import { PowerShellWorkItemMessage } from './powershell-notification'; import { SocketMessage } from './socket-signalr'; import { RecoveredWorkItem } from './work-item-request'; /** * Mock the IFrameService class in app folder */ export declare class IFrameService { getActiveToolIFrameData: () => { entryPoint: { name: string; parentModule: { name: string; }; }; }; } /** * Notification manager class. */ export declare class NotificationManager { private rpc; private collection; private psSessionIdToNotificationIdMap; private notificationIdToPsSessionIdMap; private rpcNotifySubscription; private rpcQuerySubscription; private changedEventSubject; private rpcWorkItemFindSubjectServer; private rpcNotificationSubjectServer; private iFrameService; /** * Initializes a new instance of the NotificationManager class. * * @param rpc the RPC object. */ constructor(rpc: Rpc); /** * register iframe service from shell * @param iFrameService the iframe service from shell */ registerIFrameService(iFrameService: any): void; /** * Gets the items from current notification collection including dismissed. */ get items(): Notification[]; /** * Gets the subject of notification changed event. */ get changed(): ReplaySubject; /** * Initializes the rpc notification call. */ initialize(): void; /** * Stop the notification manager. */ uninitialize(): void; /** * Find a notification. * * @param id the notification id. */ find(id: string): Notification; /** * Remove a notification. * There is no dismiss API on the gateway, this just remove from the list. * Don't remove active notification. Use dismiss api instead, so it doesn't displays to .items property. * * @param id the session id (notification id). * @return boolean true if removed. */ remove(id: string): boolean; /** * Dismiss a notification to mark dismiss property. * * @param id the session id (notification id). * @return boolean true if dismissed. */ dismiss(id: string): boolean; /** * Set dismissed to false for notification updated that was previously dismissed * * @param id the session id (notification id). * @return boolean true if undismissed. */ undismiss(id: string): boolean; /** * Add notification from WorkItem. * * @param psSessionId the psSession ID. * @param workItem the RPC work item. * @param state the initial state. * @param object the object from query result. * @return notification the notification object. */ addFromWorkItem(notificationId: string, workItem: RpcWorkItem, state: NotificationState): void; /** * Update an existing work item with psSession Id information. * * @param notificationId the id of the notification. * @param psSessionId the psSession ID. * @param workItem the work item. * @param state the state of the work item. * @param object the object from query result. */ updateWorkItemWithPsSession(notificationId: string, psSessionId: string, workItem: RpcWorkItem, state: NotificationState, object: any): boolean; /** * Add notification from Recover. * * @param id the notification ID. * @param workItem the RPC work item. * @param state the initial state. * @param object the object from query result. * @return notification the notification object. */ addFromRecover(recover: RecoveredWorkItem): void; /** * Add initial notification for Message Notification. * * @param id the notification ID. * @param workItem the RPC work item. * @param state the initial state. * @param object the object from query result. * @return notification the notification object. */ addForNotificationMessage(state: NotificationState, message: NotificationMessage): boolean; /** * Update notification from socket message. * * @param psSessionId the psSession ID. * @param message the socket message. */ updateFromMessage(psSessionId: string, message: SocketMessage): boolean; /** * Update notification from socket message. * * @param psSessionId the psSession ID. * @param message the socket message. */ updateFromNotificationMessage(state: NotificationState, item: NotificationMessage): boolean; /** * Add or update client notification. * * @param clientNotification the client notification object. * @param Observable the observable of void. */ notify(clientNotification: RpcNotification): Observable; /** * Find current work item by the typeId/sourceName/nodeName. * * @param workItemFind the query notification object. * @param RpcWorkItemFindResult the result of query. */ workItemFind(workItemFind: RpcWorkItemFind): RpcWorkItemFindResult; /** * Add an event to report the change of notification data or collection. * * @param changeEvent the changed event. * @param notification the notification object. (optional) */ private addEvent; }