2020-11-07 00:45:20 +00:00
|
|
|
/**
|
|
|
|
* @author Martin Karkowski
|
|
|
|
* @email m.karkowski@zema.de
|
|
|
|
* @create date 2020-11-07 17:24:34
|
2020-11-15 19:11:25 +00:00
|
|
|
* @modify date 2020-11-14 17:32:43
|
2020-11-07 00:45:20 +00:00
|
|
|
* @desc [description]
|
|
|
|
*/
|
|
|
|
|
2020-11-15 19:11:25 +00:00
|
|
|
import { nopeDispatcher } from "../dispatcher/nopeDispatcher";
|
2020-11-07 00:45:20 +00:00
|
|
|
import { NopeObservable } from "../observables/nopeObservable";
|
2020-11-15 19:11:25 +00:00
|
|
|
import { COMMUNICATION_LAYER, DISPATCHER_INSTANCE, DISPATCHER_OPTIONS, OBSERVABLE_FACTORY, OBSERVABLE_INSTANCE } from '../symbols/identifiers';
|
|
|
|
import { ICommunicationInterface, INopeDispatcherOptions } from "../types/nope/nopeCommunication.interface";
|
2020-11-07 00:45:20 +00:00
|
|
|
import { IPackageDescription } from "../types/nope/nopePackage.interface";
|
|
|
|
|
2020-11-15 19:11:25 +00:00
|
|
|
/**
|
|
|
|
* Generates the Default Package, containing all relevant elements of the
|
|
|
|
* nope-package. Provide the utilized communication layer.
|
|
|
|
*
|
|
|
|
* @export
|
|
|
|
* @param {ICommunicationInterface} communicationLayer The Layer, which should be used.
|
|
|
|
* @return {*}
|
|
|
|
*/
|
|
|
|
export function generateNopeBasicPackage(options: INopeDispatcherOptions) {
|
2020-11-07 00:45:20 +00:00
|
|
|
const TYPES = {
|
|
|
|
dispatcher: DISPATCHER_INSTANCE,
|
|
|
|
observableFactory: OBSERVABLE_FACTORY,
|
|
|
|
observable: OBSERVABLE_INSTANCE,
|
2020-11-15 19:11:25 +00:00
|
|
|
communicationLayer: COMMUNICATION_LAYER,
|
|
|
|
dispatcherOptions: DISPATCHER_OPTIONS,
|
2020-11-07 00:45:20 +00:00
|
|
|
}
|
2020-11-15 19:11:25 +00:00
|
|
|
|
2020-11-07 00:45:20 +00:00
|
|
|
const definedPackage: IPackageDescription<typeof TYPES> = {
|
2020-11-15 19:11:25 +00:00
|
|
|
activationHandlers: [],
|
|
|
|
autostart: {},
|
|
|
|
defaultInstances: [],
|
|
|
|
nameOfPackage: 'nopeBasicPackage',
|
|
|
|
providedClasses: [
|
|
|
|
{
|
|
|
|
description: {
|
|
|
|
name: 'nopeDispatcher',
|
|
|
|
selector: TYPES.dispatcher,
|
|
|
|
type: nopeDispatcher
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
allowInstanceGeneration: false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
description: {
|
|
|
|
name: 'communicationLayer',
|
|
|
|
selector: TYPES.dispatcherOptions,
|
|
|
|
type: options,
|
|
|
|
options: {
|
|
|
|
toConstant: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
allowInstanceGeneration: false,
|
|
|
|
}
|
2020-11-07 00:45:20 +00:00
|
|
|
},
|
2020-11-15 19:11:25 +00:00
|
|
|
{
|
|
|
|
description: {
|
|
|
|
name: 'nopeObservable',
|
|
|
|
selector: TYPES.observable,
|
|
|
|
factorySelector: TYPES.observableFactory,
|
|
|
|
type: NopeObservable
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
allowInstanceGeneration: false,
|
|
|
|
}
|
2020-11-07 00:45:20 +00:00
|
|
|
}
|
2020-11-15 19:11:25 +00:00
|
|
|
],
|
|
|
|
providedFunctions: [],
|
|
|
|
requiredPackages: [],
|
|
|
|
types: TYPES
|
2020-11-07 00:45:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return definedPackage;
|
|
|
|
}
|