@ospin/fct-graph
Advanced tools
Comparing version 2.19.0 to 2.20.0
{ | ||
"name": "@ospin/fct-graph", | ||
"author": "danielseehausen", | ||
"version": "2.19.0", | ||
"version": "2.20.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,3 +71,3 @@ [![codecov](https://codecov.io/gh/ospin-web-dev/FCTGraph/branch/main/graph/badge.svg?token=RXXLX0HDAR)](https://codecov.io/gh/ospin-web-dev/FCTGraph) | ||
functionalities: [ tempSensorData, pidControllerData ], | ||
dataStreams: [ ...dataStreamData ], | ||
dataStreams: [ dataStreamData, ... ], | ||
..., /* see FCTGraph.SCHEMA */ | ||
@@ -74,0 +74,0 @@ }) |
const Joi = require('joi') | ||
const ArrayUtils = require('@choux/array-utils') | ||
const { v4: uuidv4 } = require('uuid') | ||
@@ -28,7 +29,7 @@ const JOIous = require('../mixins/instanceMixins/JOIous') | ||
static _collectUniqueDataStreamsData(functionalitiesData) { | ||
static _collectUniqueDataStreamsDataFromFctData(functionalitiesData) { | ||
const uniqueDataStreamsDataById = {} | ||
functionalitiesData.forEach(({ slots }) => { | ||
slots.forEach(({ dataStreams }) => { | ||
slots.forEach(({ dataStreams = [] }) => { | ||
dataStreams.forEach(dataStream => { | ||
@@ -64,4 +65,4 @@ uniqueDataStreamsDataById[dataStream.id] = dataStream | ||
_populateConnections(functionalitiesData) { | ||
const dataStreamsData = FCTGraph._collectUniqueDataStreamsData(functionalitiesData) | ||
_populateConnectionsFromFctData(functionalitiesData) { | ||
const dataStreamsData = FCTGraph._collectUniqueDataStreamsDataFromFctData(functionalitiesData) | ||
@@ -72,3 +73,3 @@ this._addManyConnectionsViaDataStreamsData(dataStreamsData) | ||
constructor({ | ||
id, | ||
id = uuidv4(), | ||
deviceId, | ||
@@ -85,3 +86,3 @@ functionalities: functionalitiesData = [], | ||
functionalitiesData.map(fctData => this._addFunctionalityByData(fctData)) | ||
this._populateConnections(functionalitiesData) | ||
this._populateConnectionsFromFctData(functionalitiesData) | ||
} | ||
@@ -88,0 +89,0 @@ |
@@ -16,2 +16,9 @@ const Joi = require('joi') | ||
static get PORT_SCHEMA() { | ||
return Joi.object({ | ||
name: Joi.string().required(), | ||
purpose: Joi.string().required(), | ||
}) | ||
} | ||
static get SCHEMA() { | ||
@@ -27,2 +34,4 @@ return Joi.object({ | ||
isVirtual: Joi.boolean().required(), | ||
ports: Joi.array().items(this.PORT_SCHEMA), | ||
firmwareBlackBox: Joi.object(), | ||
}) | ||
@@ -29,0 +38,0 @@ } |
@@ -13,5 +13,6 @@ const Joi = require('joi') | ||
static get SCHEMA() { | ||
return Joi.object({ | ||
return super.SCHEMA.concat(Joi.object({ | ||
type: Joi.string().allow(InSlot.TYPE).required(), | ||
}).concat(super.SCHEMA) | ||
dataStreams: super.SCHEMA.extract('dataStreams').max(1), | ||
})) | ||
} | ||
@@ -18,0 +19,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137207
2741