in src/model/Action.js [76:114]
constructor(name, desc = {}) {
super();
if (_.isUndefined(name)) {
throw new Error('Action must have a name');
}
/**
* Action name.
* @type {string}
*/
this.name = name;
/**
* Flag that allow or prohibit the port addition to the action
* Note if it set to true, trying to create or add any port lead to the exception
* @type {boolean}
*/
this.canHavePorts = _.isUndefined(desc.canHavePorts) ? true : Boolean(desc.canHavePorts);
if (!this.canHavePorts && (!_.isUndefined(desc.i) || !_.isUndefined(desc.o))) {
throw new Error(PORT_PROHIBITION_ERROR);
}
/**
* Dictionary of input ports descriptions.
* @type {Object.<string, PortDesc>}
*/
this.i = _.mapValues(desc.i || {}, createPort);
/**
* Dictionary of output ports descriptions.
* @type {Object.<string, PortDesc>}
*/
this.o = _.mapValues(desc.o || {}, createPort);
/**
* Metadata associated with the action (i.e. arbitrary user-defined action details).
* @type {Object.<string, *>}
*/
this.data = _.assign({}, desc.data);
}