@eclipse-emfcloud/model-service-theia
Version:
Model service Theia
62 lines • 2.87 kB
TypeScript
export declare const ModelAccessorBusProtocolServicePath = "/services/eclipse-emfcloud/model-service-theia/model-accessor-bus";
/**
* Inversify injection key for the frontend model accessor bus.
*/
export declare const ModelAccessorBusProtocol: unique symbol;
/**
* Remote protocol over the RPC bridge to the {@link _ModelAccessorBus ModelAccessorBus} in the backend.
*/
export interface ModelAccessorBusProtocol {
/**
* Create a subscription for notifications from one or several accessors, from one provider in a specific ModelHub context.
* The resulting token represents a subscription in the backend {@link _ModelAccessorBus | ModelAccessorBus}
* that sends notifications back over the RPC channel to the {@link ModelAccessorBusClient}.
*
* @param {string} context A string identifying a single ModelHub context.
* @param {string} id A string identifying a single or a set of accessors.
* If '*' is provided, the subscription applies to all accessors from all providers.
* If 'xxx' is provided, the subscription applies to all accessors the id of which starts with "xxx"
* @returns {Promise<ProviderChangeSubscriptionToken>}
*/
subscribe(context: string, id: string): Promise<ProviderChangeSubscriptionToken>;
/**
* Close a subscription.
*
* @param token The token containing the subscription to close
*/
closeSubscription(token: ProviderChangeSubscriptionToken): void;
/**
* Calls an accessor.
* @param {string} accessorId The sting uniquely identifying the accessor.
* @param {array} parameters An optional list of parameters. The expected list of parameters depends on the accessor.
* @returns undefined if the accessor has not been found. Depending on its implementation, an accessor may return undefined as well.
* @throws if the list of provided arguments does not match the accessor requirements.
*/
get<T>(accessorId: string, ...parameters: unknown[]): Promise<T | undefined>;
}
export interface ModelAccessorBusClient {
/**
* RPC method triggered on accessor changed.
*/
onAccessorChanged(subscriptionId: number): void;
/**
* RPC analogue of the {@link _ProviderChangeSubscription.close | ProviderChangeSubscription.close}
* method.
*/
closeSubscription(id: number): void;
}
/**
* A serializable token representing a subscription in the backend {@link _ModelAccessorBus | ModelAccessorBus}
* that sends notifications back over the RPC channel to the {@link ModelAccessorBusClient}.
*/
export interface ProviderChangeSubscriptionToken {
/**
* The unique identifier of the subscription.
*/
id: number;
/**
* The accessor Id to which the subscription is restricted.
*/
accessorId: string;
}
//# sourceMappingURL=model-accessor-bus-protocol.d.ts.map