@ospin/fct-graph
Advanced tools
Comparing version 6.1.0 to 6.2.0
const FCTGraph = require('./src/fctGraph/FCTGraph') | ||
const DataStream = require('./src/dataStreams/DataStream') | ||
const Functionality = require('./src/functionalities/Functionality') | ||
const Ports = require('./src/functionalities/Ports') | ||
const Slot = require('./src/slots/Slot') | ||
@@ -13,2 +14,3 @@ const FCTGraphSeeder = require('./src/seeders/fctGraph/FCTGraphSeeder') | ||
Functionality, | ||
Ports, | ||
Slot, | ||
@@ -15,0 +17,0 @@ DataStream, |
{ | ||
"name": "@ospin/fct-graph", | ||
"author": "OSPIN webapp team", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"description": "Graph data structure with conditional edges via 'slots' on nodes. Intended to represent physical and virtual functionalities on a device.", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -71,2 +71,10 @@ const Joi = require('joi') | ||
const getPhysicalFcts = fctGraph => ( | ||
getFctsByQuery(fctGraph, { isVirtual: false }) | ||
) | ||
const getVirtualFcts = fctGraph => ( | ||
getFctsByQuery(fctGraph, { isVirtual: true }) | ||
) | ||
const getAllDataStreams = fctGraph => ( | ||
@@ -372,2 +380,4 @@ Array.from( | ||
getIntervalOutFcts, | ||
getPhysicalFcts, | ||
getVirtualFcts, | ||
getAllDataStreams, | ||
@@ -374,0 +384,0 @@ getAllUniqueDataStreams, |
@@ -6,2 +6,3 @@ const Joi = require('joi') | ||
const Slot = require('../slots/Slot') | ||
const Ports = require('./Ports') | ||
const ObjUtils = require('../utils/ObjUtils') | ||
@@ -19,9 +20,2 @@ | ||
const PORT_SCHEMA = Joi.object({ | ||
name: Joi.string().required(), | ||
purpose: Joi.string().required(), | ||
// some devices share a port, so they have to be internally distinguished within the port | ||
unitId: Joi.string(), | ||
}) | ||
const SCHEMA = Joi.object({ | ||
@@ -46,3 +40,3 @@ id: Joi.string().pattern(RegexUtils.UUIDV4).required(), | ||
is: false, | ||
then: Joi.array().items(PORT_SCHEMA).default([]), | ||
then: Ports.SCHEMA, | ||
otherwise: Joi.forbidden(), | ||
@@ -89,2 +83,4 @@ }, | ||
const isVirtual = fct => fct.isVirtual | ||
const getSlotNames = fct => fct.slots.map(({ name }) => name) | ||
@@ -98,8 +94,3 @@ | ||
const getPortId = fct => { | ||
const [ port ] = fct.ports | ||
const { name, unitId } = port | ||
if (unitId) return `${name}-${unitId}` | ||
return name | ||
} | ||
const getPortId = fct => Ports.getId(fct.ports) | ||
@@ -191,3 +182,2 @@ const getAllDataStreams = fct => ( | ||
FIXED_SUB_TYPES, | ||
PORT_SCHEMA, | ||
SCHEMA, | ||
@@ -202,2 +192,3 @@ create, | ||
isPhysical, | ||
isVirtual, | ||
getSlotNames, | ||
@@ -204,0 +195,0 @@ getInSlots, |
74246
18
1135