import { Observable, Subject } from 'rxjs'; import { EnvironmentModuleEntryPoint, EnvironmentModuleEntryPointType } from '../../manifest/environment-modules'; import { RpcExtensionBrokerRequest, RpcExtensionBrokerRequestResult } from '../../rpc/extension-broker/rpc-extension-broker-model'; import { Rpc } from '../../rpc/rpc'; import { ExtensionBrokerEmitRequestPayload, ExtensionBrokerRequestPayload } from './model/extension-broker-request-payload'; import { ExtensionBrokerDestroyResponsePayload, ExtensionBrokerMoveResponsePayload, ExtensionBrokerResponsePayload, FulfillmentEntryPoints } from './model/extension-broker-response-payload'; import { ExtensionEntries } from './model/extension-entries'; import { SnapInExtensionInstance, WorkerExtensionInstance } from './model/extension-instance'; import { ExtensionRect } from './model/extension-rect'; import { ExtensionSearchOptions } from './model/extension-search-options'; export declare abstract class ExtensionBrokerQuery { protected rpc: Rpc; constructor(rpc: Rpc); protected watcher: Subject; resultEmitter: Subject; abstract getTargetExtensions(extensionTargetId: string): Observable; abstract createSnapIn(entryPointId: string): Observable; abstract createWorker(entryPointId: string, extensionTarget?: string): Observable; abstract findWorker(searchOptions: ExtensionSearchOptions): Observable; abstract getExtensionEntryPointsByType(types: EnvironmentModuleEntryPointType[]): Observable; abstract runWorker(entryPointId: string, method: string, version: number, ...args: any[]): Observable; abstract startWorker(entryPointId: string, method: string, version: number, ...args: any[]): Observable; abstract createDialog(entryPointId: string): Observable; abstract showDialog(entryPointId: string, version: number, ...args: any[]): Observable; abstract callService(entryPointId: string, method: string, version: number, ...args: any[]): Observable; abstract request(payload: ExtensionBrokerRequestPayload): Observable; /** * Handles rpc response messages from the extension host. * @param data the result of the extension host request */ onRpcResponse(data: RpcExtensionBrokerRequestResult): Promise; /** * Calls a method on a extension instance and returns its result. * @param instanceId The instance id of the extension to call * @param method The method to call * @param version The version of the method to call * @param args The arguments to pass to the method * @returns an observable for the result of the call (may be null if method call is void) */ protected call(instanceId: string, method: string, version: number, ...args: any[]): Observable; /** * Destroys a extension instance * @param instanceId The instance id of the extension to destroy * @returns an observable for when the extension is destroyed */ protected destroy(instanceId: string): Observable; /** * Moves a extension instance * @param instanceId The instance id of the extension to destroy * @param rect The rectangular position to move the extension to (relative to the iframe) * @param zIndex the z index to move to, default is 1 * @returns an observable for when the extension is destroyed */ protected move(instanceId: string, rect: ExtensionRect, zIndex?: number): Observable; } /** * Extension broker listener class * Register a listener without needed full extension broker service */ export declare class ExtensionBrokerListener { private static extensionBrokerModuleSubjectServer; private static requestReceivedSubject; static get requestReceived(): Observable; static initialize(rpc: Rpc): void; private static handleRpcRequest; } /** * Extension Broker Module Side Service. * Manages requests designated for other extensions through the shell using RPC */ export declare class ExtensionBroker extends ExtensionBrokerQuery { /** * The source name to use for logging */ protected get logSourceName(): string; /** * Initializes a new instance of the Extension Broker class * @param rpc The rpc to use to communicate with the shell */ constructor(rpc: Rpc); /** * Occurs when an emit request is received from shell */ private onEmitReceived; /** * Gets the entry point ids for all the extensions that fulfill an extension targets contract * In some cases, as specified by the extension target, the shell may ask the user to select a preferred * extension that fulfills the target contract. Returning only the 1 entry point id. * @param extensionTargetId The id of the extension target * @return An observable for the entry point ids of the extensions that fulfill an extension targets contract. */ getTargetExtensions(extensionTargetId: string): Observable; /** * Creates a SnapIn instance given its entry point id. * This instance is tied to the calling extension and will close when destroy is called or the calling extension is destroyed. * @param entryPointId The id of the worker to create */ createSnapIn(entryPointId: string): Observable; /** * Finds a worker given either its entryPointId or instanceId * @param searchOptions The search options for finding a worker instance */ findWorker(searchOptions: ExtensionSearchOptions): Observable; /** * Finds extensions by search condition. * @param searchOptions The search options for finding manifest entry points that meet the condition. */ findEntriesByCondition(searchOptions: ExtensionSearchOptions): Observable; /** * return all registered entry points by type * @param types entry point types to return */ getExtensionEntryPointsByType(types: EnvironmentModuleEntryPointType[]): Observable; /** * Creates a worker instance given its entry point id. * This instance is tied to the calling extension and will close when destroy is called or the calling extension is destroyed. * @param entryPointId The id of the worker to create */ createWorker(entryPointId: string, extensionTarget?: string): Observable; /** * subscribe to results emission for specific action */ listen(eventType: string, instanceId: string): Observable; /** * Runs a worker instance and returns the result of one method. After which the worker is destroyed. * @param entryPointId The id of the worker to create * @param method The method to call * @param version The version of the method to call * @param args The arguments to pass to the method * @returns an observable for the result of the worker. */ runWorker(entryPointId: string, method: string, version: number, ...args: any[]): Observable; /** * Runs a worker instance with no association to the calling extension. * The worker will run its own workflow until it is finished * @param entryPointId The id of the worker to create * @param method The method to call * @param version The version of the method to call * @param args The arguments to pass to the method * @returns an observable fro the creation of the worker. */ startWorker(entryPointId: string, method: string, version: number, ...args: any[]): Observable; /** * Runs a dialog instance and returns its result. After which the dialog is destroyed. * @param entryPointId The id of the dialog to create * @param version The version of the dialog to call * @param args The arguments to pass to the dialog * @returns an observable for the result of the dialog. */ createDialog(entryPointId: string): Observable; /** * Runs a dialog instance and returns its result. After which the dialog is destroyed. * @param entryPointId The id of the dialog to create * @param version The version of the dialog to call * @param args The arguments to pass to the dialog * @returns an observable for the result of the dialog. */ showDialog(entryPointId: string, version: number, ...args: any[]): Observable; /** * Runs a dialog instance and returns its result. After which the dialog is destroyed. * @param instanceId The id of the extension to show * @param version The version of the extension tp show * @param args The arguments to pass to the extension * @returns an observable for the result of the dialog. */ show(instanceId: string, version: number, ...args: any[]): Observable; /** * Emit a result to listeners subscribed to the given eventType and instanceId * @param instanceId The instance Id of the component emitting the result * @param eventType the type of event being emitted, can be any string like "output", "validation", "changes" * so listeners can subscribe to specific event streams. listeners must be aware of chosen eventType * @param result the result to be sent to event listeners */ emitResult(instanceId: string, eventType: string, result: T): Observable; /** * Calls a method on a service extension * @param entryPointId The id of the service to call * @param method The method to call * @param version The version of the method to call * @param args The arguments to pass to the method * @returns an observable for the result of the service method. */ callService(entryPointId: string, method: string, version: number, ...args: any[]): Observable; destroyRequested(entryPointId: string, version: number, args?: any[]): Observable; /** * Makes an extension broker request via the RPC * @param requestType The @see RpcExtensionBrokerRequestType. * @param payload The payload for this message. Depends on requestType. * @returns An observable for the response message from the shell */ request(payload: ExtensionBrokerRequestPayload): Observable; }