import { Observable } from 'rxjs'; import { GatewayConnection } from '../data/gateway-connection'; import { NodeConnection } from '../data/node-connection'; import { Rpc } from '../rpc/rpc'; import { NotificationConnection } from './notification-connection'; import { WorkItemManager } from './work-item-manager'; import { WorkItemFindResult, WorkItemResult, WorkItemSubmitRequest } from './work-item-request'; /** * Work item connection to submit a powershell work item, and to query its state. */ export declare class WorkItemConnection { private rpc; workItemManager: WorkItemManager; /** * Initializes a new instance of the WorkItemConnection class. * * @param rpc the RPC. * @param gatewayConnection the gateway connection. * @param notificationConnection the notification connection. */ constructor(rpc: Rpc, gatewayConnection: GatewayConnection, nodeConnection: NodeConnection, notificationConnection: NotificationConnection); /** * Submit a work item either directly to NotificationManager or through RPC. * * @param nodeName the name of the node to submit the item against. * @param request the work item request. * @return Observable the observable of WorkItemResult object. */ submit(nodeName: string, request: WorkItemSubmitRequest): Observable; /** * Query a work item either directly to NotificationManager or through RPC. * * @param id the ID of the work item. * @return Observable the observable of WorkItemResult object. */ query(id: string): Observable; /** * Find existing work item with state. * * @param nodeName the node name. * @param moduleName the module name. * @param typeId the type ID. * @return Observable the observable of WorkItemFindResult. */ find(nodeName: string, moduleName: string, typeId: string): Observable; /** * Submit a work item either directly to NotificationManager or through RPC, and wait for completion. * * @param nodeName the name of the node to submit the work item against * @param request the work item request. * @param timeout the timeout milliseconds. (optional, default forever until unsubscribe) * @param interval the interval period milliseconds. (optional, default 1 sec) * @return Observable the observable of WorkItemResult object. */ submitAndWait(nodeName: string, request: WorkItemSubmitRequest, timeout?: number, interval?: number): Observable; /** * Wait for existing work item with state. * * @param workItemResult the work item result to wait for the final result. * @param timeout the timeout milliseconds. (optional, default forever until unsubscribe) * @param interval the interval period milliseconds. (optional, default 1 sec) * @return Observable the observable of WorkItemFindResult. */ wait(workItemResult: WorkItemResult, timeout?: number, interval?: number): Observable; /** * Check if work item result was finished. * * @param result the work item result. * @return boolean true if work item was completed with success or error. */ isFinished(result: WorkItemResult): boolean; /** * Wait for existing work item with state. * * @param workItemResult the work item result to wait for the final result. * @param timeout the timeout milliseconds. (optional, default forever until unsubscribe) * @param interval the interval period milliseconds. (optional, default 1 sec) * @return Observable the observable of WorkItemFindResult. */ private waitObservable; }