git backup current version
This commit is contained in:
parent
b6c20d69c3
commit
7a537d8382
@ -25,6 +25,7 @@ import {
|
|||||||
IEmitter,
|
IEmitter,
|
||||||
IExecutingTaskMsg,
|
IExecutingTaskMsg,
|
||||||
IExternalEventMsg,
|
IExternalEventMsg,
|
||||||
|
IExternalPropertyChangedMsg,
|
||||||
IRequestTaskMsg,
|
IRequestTaskMsg,
|
||||||
IResponseTaskMsg,
|
IResponseTaskMsg,
|
||||||
IRpcUnregisterMsg,
|
IRpcUnregisterMsg,
|
||||||
@ -173,7 +174,7 @@ export class Bridge implements ICommunicationBridge {
|
|||||||
public connected: INopeObservable<boolean>;
|
public connected: INopeObservable<boolean>;
|
||||||
|
|
||||||
public considerConnection = true;
|
public considerConnection = true;
|
||||||
public allowServiceRedundancy = false;
|
public allowsServiceRedundancy = false;
|
||||||
public ownDispatcherId: string;
|
public ownDispatcherId: string;
|
||||||
public id: string;
|
public id: string;
|
||||||
|
|
||||||
@ -806,4 +807,13 @@ export class Bridge implements ICommunicationBridge {
|
|||||||
emitNewInstancesAvailable(instances: IAvailableInstancesMsg): Promise<void> {
|
emitNewInstancesAvailable(instances: IAvailableInstancesMsg): Promise<void> {
|
||||||
throw new Error("Method should be overwritten.");
|
throw new Error("Method should be overwritten.");
|
||||||
}
|
}
|
||||||
|
onPropertyChange(name: string, cb: (data: IExternalPropertyChangedMsg) => void): Promise<void> {
|
||||||
|
throw new Error("Method should be overwritten.");
|
||||||
|
}
|
||||||
|
emitPropertyChange(name: string, data: IExternalPropertyChangedMsg): Promise<void> {
|
||||||
|
throw new Error("Method should be overwritten.");
|
||||||
|
}
|
||||||
|
offPropertyChange(name: string, cb: (data: IExternalPropertyChangedMsg) => void): Promise<void> {
|
||||||
|
throw new Error("Method should be overwritten.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,6 @@ import { INopePromise } from "../types/nope/nopePromise.interface";
|
|||||||
* @export
|
* @export
|
||||||
* @class nopeDispatcher
|
* @class nopeDispatcher
|
||||||
*/
|
*/
|
||||||
// @injectable()
|
|
||||||
export class nopeDispatcher implements INopeDispatcher {
|
export class nopeDispatcher implements INopeDispatcher {
|
||||||
public readonly id: string;
|
public readonly id: string;
|
||||||
|
|
||||||
@ -232,10 +231,17 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
|
|
||||||
protected _lastPublishedEvent: Map<string, IExternalEventMsg>;
|
protected _lastPublishedEvent: Map<string, IExternalEventMsg>;
|
||||||
|
|
||||||
|
public readonly externallySubscribedProperties: INopeObservable<string[]>;
|
||||||
|
public readonly externallyPublishedProperties: INopeObservable<string[]>;
|
||||||
|
public readonly subscribedProperties: INopeObservable<string[]>;
|
||||||
|
public readonly publishedProperties: INopeObservable<string[]>;
|
||||||
|
|
||||||
|
|
||||||
public readonly externallySubscribedEvents: INopeObservable<string[]>;
|
public readonly externallySubscribedEvents: INopeObservable<string[]>;
|
||||||
public readonly externallyPublishedEvents: INopeObservable<string[]>;
|
public readonly externallyPublishedEvents: INopeObservable<string[]>;
|
||||||
public readonly subscribedEvents: INopeObservable<string[]>;
|
public readonly subscribedEvents: INopeObservable<string[]>;
|
||||||
public readonly publishedEvents: INopeObservable<string[]>;
|
public readonly publishedEvents: INopeObservable<string[]>;
|
||||||
|
|
||||||
public readonly externalProvidedServices: INopeObservable<string[]>;
|
public readonly externalProvidedServices: INopeObservable<string[]>;
|
||||||
public readonly canceledTask: INopeObservable<ITaskCancelationMsg>;
|
public readonly canceledTask: INopeObservable<ITaskCancelationMsg>;
|
||||||
public readonly ready: INopeObservable<boolean>;
|
public readonly ready: INopeObservable<boolean>;
|
||||||
@ -373,14 +379,14 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
this.methodInterface = new Proxy({}, _handlerWithoutOptions);
|
this.methodInterface = new Proxy({}, _handlerWithoutOptions);
|
||||||
|
|
||||||
// Define the Observables provided by the dispatcher.
|
// Define the Observables provided by the dispatcher.
|
||||||
this.externallySubscribedEvents = this._generateObservable();
|
this.externallySubscribedProperties = this._generateObservable();
|
||||||
this.externallySubscribedEvents.setContent([]);
|
this.externallySubscribedProperties.setContent([]);
|
||||||
this.externallyPublishedEvents = this._generateObservable();
|
this.externallyPublishedProperties = this._generateObservable();
|
||||||
this.externallyPublishedEvents.setContent([]);
|
this.externallyPublishedProperties.setContent([]);
|
||||||
this.publishedEvents = this._generateObservable();
|
this.publishedProperties = this._generateObservable();
|
||||||
this.publishedEvents.setContent([]);
|
this.publishedProperties.setContent([]);
|
||||||
this.subscribedEvents = this._generateObservable();
|
this.subscribedProperties = this._generateObservable();
|
||||||
this.subscribedEvents.setContent([]);
|
this.subscribedProperties.setContent([]);
|
||||||
this.externalProvidedServices = this._generateObservable();
|
this.externalProvidedServices = this._generateObservable();
|
||||||
this.externalProvidedServices.setContent([]);
|
this.externalProvidedServices.setContent([]);
|
||||||
this.canceledTask = this._generateObservable();
|
this.canceledTask = this._generateObservable();
|
||||||
@ -587,7 +593,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerInternalInstanceGenerator<I extends INopeModule>(
|
public registerInternalWrapperGenerator<I extends INopeModule>(
|
||||||
identifier: string,
|
identifier: string,
|
||||||
cb: IGenerateRemoteInstanceCallback<I>
|
cb: IGenerateRemoteInstanceCallback<I>
|
||||||
): void {
|
): void {
|
||||||
@ -602,7 +608,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
this._internalGenerators.set(identifier, cb);
|
this._internalGenerators.set(identifier, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unregisterInternalInstanceGenerator(identifier: string): void {
|
public unregisterInternalWrapperGenerator(identifier: string): void {
|
||||||
if (this._logger?.enabledFor((Logger as any).DEBUG)) {
|
if (this._logger?.enabledFor((Logger as any).DEBUG)) {
|
||||||
this._logger.debug(
|
this._logger.debug(
|
||||||
"Rmoving instance generator for \"" +
|
"Rmoving instance generator for \"" +
|
||||||
@ -1611,7 +1617,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.registerInternalInstanceGenerator(
|
this.registerInternalWrapperGenerator(
|
||||||
"*",
|
"*",
|
||||||
async (dispather, description) => {
|
async (dispather, description) => {
|
||||||
const mod = new NopeGenericModule(dispather, _this._generateObservable);
|
const mod = new NopeGenericModule(dispather, _this._generateObservable);
|
||||||
@ -1672,12 +1678,12 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update the all internal subscribed / published events.
|
// Update the all internal subscribed / published events.
|
||||||
this.subscribedEvents.setContent(
|
this.subscribedProperties.setContent(
|
||||||
Array.from(
|
Array.from(
|
||||||
new Set([..._this._externalSubscribed, ...this._internalSubscribed])
|
new Set([..._this._externalSubscribed, ...this._internalSubscribed])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.publishedEvents.setContent(
|
this.publishedProperties.setContent(
|
||||||
Array.from(
|
Array.from(
|
||||||
new Set([..._this._externalPublished, ...this._internalPublished])
|
new Set([..._this._externalPublished, ...this._internalPublished])
|
||||||
)
|
)
|
||||||
@ -2285,10 +2291,10 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
this._externalPublished = _published;
|
this._externalPublished = _published;
|
||||||
|
|
||||||
// Update the Elements.
|
// Update the Elements.
|
||||||
this.externallySubscribedEvents.setContent(
|
this.externallySubscribedProperties.setContent(
|
||||||
Array.from(this._externalSubscribed)
|
Array.from(this._externalSubscribed)
|
||||||
);
|
);
|
||||||
this.externallyPublishedEvents.setContent(
|
this.externallyPublishedProperties.setContent(
|
||||||
Array.from(this._externalPublished)
|
Array.from(this._externalPublished)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2358,7 +2364,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
* @return {boolean} The result of the test. True if an external subscription exsits
|
* @return {boolean} The result of the test. True if an external subscription exsits
|
||||||
* @memberof nopeDispatcher
|
* @memberof nopeDispatcher
|
||||||
*/
|
*/
|
||||||
public subscriptionExists(topic: string, externalOnly = true): boolean {
|
public subscriptionForPropertyExists(topic: string, externalOnly = true): boolean {
|
||||||
if (externalOnly) {
|
if (externalOnly) {
|
||||||
return this._externalSubscribed.has(topic);
|
return this._externalSubscribed.has(topic);
|
||||||
} else {
|
} else {
|
||||||
@ -2367,7 +2373,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public publisherExists(topic: string, externalOnly = true): boolean {
|
public publisherForPropertyExists(topic: string, externalOnly = true): boolean {
|
||||||
if (externalOnly) {
|
if (externalOnly) {
|
||||||
return this._externalPublished.has(topic);
|
return this._externalPublished.has(topic);
|
||||||
} else {
|
} else {
|
||||||
@ -2494,12 +2500,17 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
* @return {nopeObservable<IExternalEventMsg>} An Listener on the Communication Channel.
|
* @return {nopeObservable<IExternalEventMsg>} An Listener on the Communication Channel.
|
||||||
* @memberof nopeDispatcher
|
* @memberof nopeDispatcher
|
||||||
*/
|
*/
|
||||||
protected _subscribeToEvent(event: string) {
|
protected _subscribeToEvent(event: string): {
|
||||||
|
newSubscription: boolean,
|
||||||
|
observable: INopeObservable<IExternalEventMsg>
|
||||||
|
} {
|
||||||
const item = this._externalTopicLinkedWithObservable.get(event) || {
|
const item = this._externalTopicLinkedWithObservable.get(event) || {
|
||||||
observable: this._generateObservable<IExternalEventMsg>(),
|
observable: this._generateObservable<IExternalEventMsg>(),
|
||||||
cb: () => {
|
cb: () => {
|
||||||
// Default callback
|
// Default callback
|
||||||
}
|
},
|
||||||
|
// we must know, whether this element is new or not.
|
||||||
|
newSubscription: this._externalTopicLinkedWithObservable.has(event)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!item.observable.hasSubscriptions) {
|
if (!item.observable.hasSubscriptions) {
|
||||||
@ -2515,7 +2526,12 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
// Set the Items.
|
// Set the Items.
|
||||||
this._externalTopicLinkedWithObservable.set(event, item);
|
this._externalTopicLinkedWithObservable.set(event, item);
|
||||||
|
|
||||||
return item.observable;
|
const { cb, ...ret } = item;
|
||||||
|
|
||||||
|
return ret as {
|
||||||
|
newSubscription: boolean,
|
||||||
|
observable: INopeObservable<IExternalEventMsg>
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2797,7 +2813,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
// Updates is enabled: if so, use the socket to send the data
|
// Updates is enabled: if so, use the socket to send the data
|
||||||
// to other dispatchers.
|
// to other dispatchers.
|
||||||
if (
|
if (
|
||||||
_this.subscriptionExists(_pubTopic) ||
|
_this.subscriptionForPropertyExists(_pubTopic) ||
|
||||||
_this._forceEmittingUpdates ||
|
_this._forceEmittingUpdates ||
|
||||||
// If the Update is forced
|
// If the Update is forced
|
||||||
options.forced
|
options.forced
|
||||||
@ -3144,7 +3160,7 @@ export class nopeDispatcher implements INopeDispatcher {
|
|||||||
...args
|
...args
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Only Publish data, if there exists a Subscription.
|
// Only Publish data, if there exists a Subscription.
|
||||||
if (forced || (this.subscriptionExists(_eventName) && this.id !== sender)) {
|
if (forced || (this.subscriptionForPropertyExists(_eventName) && this.id !== sender)) {
|
||||||
// Use the Communicator to emit the Event or its forced
|
// Use the Communicator to emit the Event or its forced
|
||||||
await this.communicator.emitEvent(_eventName, {
|
await this.communicator.emitEvent(_eventName, {
|
||||||
forced,
|
forced,
|
||||||
|
@ -200,6 +200,33 @@ export interface ICommunicationInterface {
|
|||||||
*/
|
*/
|
||||||
offEvent(event: string, cb: (data: IExternalEventMsg) => void): Promise<void>;
|
offEvent(event: string, cb: (data: IExternalEventMsg) => void): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to subscribe to an event
|
||||||
|
*
|
||||||
|
* @param {string} name The Event name (Usually the Topic.)
|
||||||
|
* @param {(data: IExternalPropertyChangedMsg) => void} cb The Callback which should be used to call if there are new Events.
|
||||||
|
* @memberof ICommunicationInterface
|
||||||
|
*/
|
||||||
|
onPropertyChange(name: string, cb: (data: IExternalPropertyChangedMsg) => void): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to emit an event on the given event channel
|
||||||
|
*
|
||||||
|
* @param {string} name The Name of the Event
|
||||||
|
* @param {IExternalPropertyChangedMsg} data A datapacket describing the Property Change
|
||||||
|
* @memberof ICommunicationInterface
|
||||||
|
*/
|
||||||
|
emitPropertyChange(name: string, data: IExternalPropertyChangedMsg): Promise<void>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to unregister an event listener
|
||||||
|
*
|
||||||
|
* @param {string} name The Name of the Event
|
||||||
|
* @param {(data: IExternalPropertyChangedMsg) => void} cb The desired Callback
|
||||||
|
* @memberof ICommunicationInterface
|
||||||
|
*/
|
||||||
|
offPropertyChange(name: string, cb: (data: IExternalPropertyChangedMsg) => void): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function, to subscribe to "Bonjour"-Messages of the Dispatcher Dispatchers.
|
* Function, to subscribe to "Bonjour"-Messages of the Dispatcher Dispatchers.
|
||||||
*
|
*
|
||||||
@ -308,15 +335,22 @@ export interface ICommunicationInterface {
|
|||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @memberof ICommunicationInterface
|
* @memberof ICommunicationInterface
|
||||||
*/
|
*/
|
||||||
allowServiceRedundancy: boolean;
|
allowsServiceRedundancy: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to show, whether the the layer receives its own messages
|
* Used to show, whether the the layer receives its own messages
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
* @memberof ICommunicationInterface
|
* @memberof ICommunicationInterface
|
||||||
*/
|
*/
|
||||||
receivesOwnMessages?: boolean;
|
receivesOwnMessages: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID of the Layer.
|
||||||
|
*
|
||||||
|
* @author M.Karkowski
|
||||||
|
* @type {string}
|
||||||
|
* @memberof ICommunicationInterface
|
||||||
|
*/
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -598,6 +632,52 @@ export type IExternalEventMsg = {
|
|||||||
forced?: boolean;
|
forced?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type IExternalPropertyChangedMsg<T = unknown> = {
|
||||||
|
/**
|
||||||
|
* Type of the Message
|
||||||
|
*
|
||||||
|
* @type {'property'}
|
||||||
|
*/
|
||||||
|
type: "property";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data of the Message.
|
||||||
|
* Holding the Data of the Event
|
||||||
|
*
|
||||||
|
* @type {*}
|
||||||
|
*/
|
||||||
|
data: T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Topic, on which it was hosted
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
propertyName: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information about the Sender.
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
sender: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Timestamp, when the message was created.
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
timestamp?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag, indicating that the update is forced.
|
||||||
|
*
|
||||||
|
* @author M.Karkowski
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
forced?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type IRequestOfService = {
|
export type IRequestOfService = {
|
||||||
type: "requestOfService";
|
type: "requestOfService";
|
||||||
taskId: string;
|
taskId: string;
|
||||||
|
@ -252,7 +252,22 @@ export type INopeDispatcherOptions = {
|
|||||||
* @interface INopeDispatcher
|
* @interface INopeDispatcher
|
||||||
*/
|
*/
|
||||||
export interface INopeDispatcher {
|
export interface INopeDispatcher {
|
||||||
|
/**
|
||||||
|
* Flag showing, that the system is ready.
|
||||||
|
*
|
||||||
|
* @author M.Karkowski
|
||||||
|
* @type {INopeObservable<boolean>}
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
readonly ready: INopeObservable<boolean>;
|
readonly ready: INopeObservable<boolean>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Communicator which is used
|
||||||
|
*
|
||||||
|
* @author M.Karkowski
|
||||||
|
* @type {ICommunicationBridge}
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
readonly communicator: ICommunicationBridge;
|
readonly communicator: ICommunicationBridge;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,9 +278,27 @@ export interface INopeDispatcher {
|
|||||||
*/
|
*/
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just a proxy to call functions the easy way.
|
||||||
|
*
|
||||||
|
* @example For example after registering a function "test":
|
||||||
|
* await dispatcher.methodInterfaceWithOptions.test({},"hello")
|
||||||
|
*
|
||||||
|
* @author M.Karkowski
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
methodInterfaceWithOptions: {
|
methodInterfaceWithOptions: {
|
||||||
[index: string]: <T>(optins: ICallOptions, ...args) => INopePromise<T>;
|
[index: string]: <T>(options: ICallOptions, ...args) => INopePromise<T>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Just a proxy to call functions the easy way.
|
||||||
|
*
|
||||||
|
* @example For example after registering a function "test":
|
||||||
|
* await dispatcher.methodInterface.test("hello")
|
||||||
|
* @author M.Karkowski
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
methodInterface: { [index: string]: <T>(...args) => INopePromise<T> };
|
methodInterface: { [index: string]: <T>(...args) => INopePromise<T> };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -274,7 +307,7 @@ export interface INopeDispatcher {
|
|||||||
* @type {INopeObservable<string[]>}
|
* @type {INopeObservable<string[]>}
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
readonly externallySubscribedEvents: INopeObservable<string[]>;
|
readonly externallySubscribedProperties: INopeObservable<string[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Observable holding the newest published elements
|
* An Observable holding the newest published elements
|
||||||
@ -282,7 +315,23 @@ export interface INopeDispatcher {
|
|||||||
* @type {INopeObservable<string[]>}
|
* @type {INopeObservable<string[]>}
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
readonly externallyPublishedEvents: INopeObservable<string[]>;
|
readonly externallyPublishedProperties: INopeObservable<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Observable holding the newest External Subscription
|
||||||
|
*
|
||||||
|
* @type {INopeObservable<string[]>}
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
|
readonly subscribedProperties: INopeObservable<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Observable holding the newest published elements
|
||||||
|
*
|
||||||
|
* @type {INopeObservable<string[]>}
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
|
readonly publishedProperties: INopeObservable<string[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Observable holding the newest External Subscription
|
* An Observable holding the newest External Subscription
|
||||||
@ -300,6 +349,22 @@ export interface INopeDispatcher {
|
|||||||
*/
|
*/
|
||||||
readonly publishedEvents: INopeObservable<string[]>;
|
readonly publishedEvents: INopeObservable<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Observable holding the newest External Subscription
|
||||||
|
*
|
||||||
|
* @type {INopeObservable<string[]>}
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
|
readonly externallySubscribedEvents: INopeObservable<string[]>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An Observable holding the newest published elements
|
||||||
|
*
|
||||||
|
* @type {INopeObservable<string[]>}
|
||||||
|
* @memberof INopeDispatcher
|
||||||
|
*/
|
||||||
|
readonly externallyPublishedEvents: INopeObservable<string[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observable holding all available Dispatchers.
|
* Observable holding all available Dispatchers.
|
||||||
*
|
*
|
||||||
@ -343,7 +408,7 @@ export interface INopeDispatcher {
|
|||||||
* @return {*} {boolean}
|
* @return {*} {boolean}
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
subscriptionExists(topic: string, externalOnly?: boolean): boolean;
|
subscriptionForPropertyExists(topic: string, externalOnly?: boolean): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Element to test, if a publisher for a specific topic exists or not.
|
* Element to test, if a publisher for a specific topic exists or not.
|
||||||
@ -353,7 +418,7 @@ export interface INopeDispatcher {
|
|||||||
* @return {*} {boolean}
|
* @return {*} {boolean}
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
publisherExists(topic: string, externalOnly?: boolean): boolean;
|
publisherForPropertyExists(topic: string, externalOnly?: boolean): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to register a Function in the Dispatcher
|
* Function to register a Function in the Dispatcher
|
||||||
@ -363,10 +428,10 @@ export interface INopeDispatcher {
|
|||||||
* @return {*} {(...args) => Promise<any>}
|
* @return {*} {(...args) => Promise<any>}
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
registerFunction(
|
registerFunction<T = unknown>(
|
||||||
func: (...args) => IValidPromise<any>,
|
func: (...args) => IValidPromise<T> | T,
|
||||||
options?: IFunctionOptions
|
options?: IFunctionOptions
|
||||||
): (...args) => Promise<any>;
|
): (...args) => Promise<T> | T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to unregister a Function from the Dispatcher
|
* Function to unregister a Function from the Dispatcher
|
||||||
@ -394,7 +459,7 @@ export interface INopeDispatcher {
|
|||||||
* @return {*} {INopeObservable<T, S, G>}
|
* @return {*} {INopeObservable<T, S, G>}
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
registerObservable<T, K, S = T, G = T>(
|
registerObservable<T, S = T, G = T>(
|
||||||
observable: INopeObservable<T, S, G>,
|
observable: INopeObservable<T, S, G>,
|
||||||
options: IPropertyOptions
|
options: IPropertyOptions
|
||||||
): INopeObservable<T, S, G>;
|
): INopeObservable<T, S, G>;
|
||||||
@ -493,12 +558,12 @@ export interface INopeDispatcher {
|
|||||||
* @return {*} {(Promise<I & INopeModule>)} The Element
|
* @return {*} {(Promise<I & INopeModule>)} The Element
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
generateInstance<I>(
|
generateInstance<I, T extends INopeModule = INopeModule>(
|
||||||
description: Partial<IInstanceCreationMsg>,
|
description: Partial<IInstanceCreationMsg>,
|
||||||
options?: {
|
options?: {
|
||||||
selector?: ValidDefaultSelectors | ValidSelectorFunction
|
selector?: ValidDefaultSelectors | ValidSelectorFunction
|
||||||
}
|
}
|
||||||
): Promise<I & INopeModule>;
|
): Promise<I & T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function, used to delete a remote instance.
|
* Function, used to delete a remote instance.
|
||||||
@ -547,8 +612,8 @@ export interface INopeDispatcher {
|
|||||||
unprovideInstanceGeneratorForExternalDispatchers(identifier: string): Promise<void>;
|
unprovideInstanceGeneratorForExternalDispatchers(identifier: string): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function, to provide an internal internal generator. This generator
|
* A function, to provide an internal wrapper for instances generator. This generator
|
||||||
* will be used to generate a specific internal accessor for a remote instance.
|
* will be used to generate a specific internal wrapper for a remote instance.
|
||||||
*
|
*
|
||||||
* @author M.Karkowski
|
* @author M.Karkowski
|
||||||
* @template I
|
* @template I
|
||||||
@ -556,21 +621,21 @@ export interface INopeDispatcher {
|
|||||||
* @param {IGenerateRemoteInstanceCallback<I>} cb
|
* @param {IGenerateRemoteInstanceCallback<I>} cb
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
registerInternalInstanceGenerator<I extends INopeModule>(
|
registerInternalWrapperGenerator<I extends INopeModule>(
|
||||||
identifier: string,
|
identifier: string,
|
||||||
cb: IGenerateRemoteInstanceCallback<I>
|
cb: IGenerateRemoteInstanceCallback<I>
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function, that is used to remove an instance generator. This removes the
|
* Function, that is used to remove an wrapper generator. This removes the
|
||||||
* generator from the NoPE-Network. Available instance of that type wont be
|
* generator for the wrapper. Available instance inside of NoPE of that type
|
||||||
* removed.
|
* which is being wrapped wont be removed.
|
||||||
*
|
*
|
||||||
* @author M.Karkowski
|
* @author M.Karkowski
|
||||||
* @param {string} identifier
|
* @param {string} identifier
|
||||||
* @memberof INopeDispatcher
|
* @memberof INopeDispatcher
|
||||||
*/
|
*/
|
||||||
unregisterInternalInstanceGenerator(identifier: string);
|
unregisterInternalWrapperGenerator(identifier: string);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper Function to get a Dispatcer for the desired Instance
|
* Helper Function to get a Dispatcer for the desired Instance
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
* @desc Defintion of a generic Module.
|
* @desc Defintion of a generic Module.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ICallOptions, IExternalEventMsg } from "./nopeCommunication.interface";
|
import { ICallOptions } from "./nopeCommunication.interface";
|
||||||
import { INopeDescriptor } from "./nopeDescriptor.interface";
|
import { INopeDescriptor } from "./nopeDescriptor.interface";
|
||||||
import { INopeObservable, IPipe } from "./nopeObservable.interface";
|
import { INopeObservable } from "./nopeObservable.interface";
|
||||||
import { INopePromise } from "./nopePromise.interface";
|
import { INopePromise } from "./nopePromise.interface";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,14 +255,6 @@ export interface IPropertyOptions<K = any> {
|
|||||||
publish?: string;
|
publish?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* An Advanced Pipe Option.
|
|
||||||
*/
|
|
||||||
pipe?: {
|
|
||||||
pipe?: IPipe<IExternalEventMsg, K>;
|
|
||||||
scope?: { [index: string]: any };
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to disable Registery Updates.
|
* Flag to disable Registery Updates.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user