feat(actualV1): Actual Launch! Symbolic v1! Let's GOOOO!#19
Conversation
* moves seeder from test to src directory * exports the seeders and the datastream from the package index.js Co-authored-by: Viktor Diezel <viktor.diezel@ospin.de>
31ad621 to
fbb7997
Compare
| } | ||
| } | ||
|
|
||
| static get UNITLESS_UNIT() { return Slot.UNIT_TYPE_UNIT_OPTIONS.unitless[0] } |
There was a problem hiding this comment.
Here you are implicitly using the "magic string" unitless. A safer options would be
Slot.UNIT_TYPE_UNIT_OPTIONS[Slot.UNIT_TYPES.UNITLESS][0]Or write a helper method if that is too ugly:
static getUnitOptionsFromUnitType(type) {
return Slot.UNIT_TYPE_UNIT_OPTIONS[type]
}
const unitLessUnit = Slot.getUnitOptionsFromUnitType(Slot.UNIT_TYPES.UNITLESS)[0]There was a problem hiding this comment.
v good 👁️ ! updated
| if ( | ||
| this.unit !== otherSlot.unit | ||
| && !this.isUnitless() | ||
| && !otherSlot.isUnitless() | ||
| ) { | ||
| throw new SlotConnectionError(this, otherSlot, 'units must match between slots') | ||
| } | ||
| } |
There was a problem hiding this comment.
if I have one slot that is unitless and another one that is not, should they be compatible? If I'm not mistaken, this code says yes. Do we want that behaviour or should we treat unitless just as any other "unit" by saying: only unitless slots can be connected.
I see that we might be be missing the difference between: Allow any unit which might be required for certain customer made functionalities, like an "averager" functionality, and functionalities that allow only unitless input, like PID parameters.
Your solution covers the "averager" case: We don't know which units are going in, so we can't create the slots accordingly with the correct unit. It would also allow putting in non-sense values e.g. to the PID slots.
Maybe we should make a difference between unitless as - and null ? Or introduce a new string identifier, like any.
There was a problem hiding this comment.
screw that, total freedom!
vdiezel
left a comment
There was a problem hiding this comment.
very professional - very easy to read and the tests show how easy the interface is to use.
I have nothing to complain about - I think my only chance to contribute would be only after actually using it for a while.
4abed6d to
b6fbb8f
Compare
Codecov Report
@@ Coverage Diff @@
## main #19 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 27 +2
Lines 458 489 +31
Branches 32 30 -2
=========================================
+ Hits 458 489 +31
|
e7db921 to
02bb9c8
Compare
| this.slots = Array.isArray(slots) | ||
| ? slots.map(SlotFactory.new) | ||
| : [] | ||
| this.slots = [] |
There was a problem hiding this comment.
I recall a best practice when initializing objects is to always provide everything the object will need in its lifecycle in the constructor (e.g., avoid doing things like adding a new this.property in some helper method because that makes the instance a lot less transparent). For this reason are empty slots added here, then immediately populated in the add slots call.
|
|
||
| static deepEquals(objA, objB) { | ||
| const objDiff = this.diff(objA, objB) | ||
| const objDiff = this.diff(objA.serialize(), objB.serialize()) |
There was a problem hiding this comment.
only the serialized results count as equality. Anything not communicated in serialization is internal to the fctgraph workings, and not persisted when it is sent/stored as JSON
| static generateSlots(functionalityId) { | ||
| if (!Array.isArray(this.SLOT_SEEDS)) { | ||
| throw new Error(`${this.name} must have .SLOT_SEEDS to use .generateSlots`) | ||
| } | ||
|
|
||
| return this.SLOT_SEEDS.map(slotData => ({ | ||
| ...slotData, | ||
| functionalityId, | ||
| })) | ||
| } | ||
|
|
There was a problem hiding this comment.
this is used now in all children of FunctionalitySeeder (e.g. TemperatureSensor) because they must send their functionality id to their slots!
02bb9c8 to
fa13444
Compare
| const fctData = { | ||
| ...super.generate(overrideData), | ||
| subType: HeaterActuator.SUB_TYPE, | ||
| slots: [ ...this.SLOT_SEEDS ], | ||
| ...data, | ||
| } |
There was a problem hiding this comment.
first, do what is required to generate an id
| ...fctData, | ||
| slots: [ ...this.generateSlots(overrideData.id || fctData.id) ], | ||
| ...overrideData, |
There was a problem hiding this comment.
then use the id when making the slots (or use the provided id)
(the changes to this FCT seeder is recreated in all of the usable FCT seeders)
| } | ||
|
|
||
| static get UNITLESS_UNIT() { return Slot.UNIT_TYPE_UNIT_OPTIONS.unitless[0] } | ||
| static get UNITLESS_UNIT() { return Slot.UNIT_TYPE_UNIT_OPTIONS[Slot.UNIT_TYPES.UNITLESS][0] } |
There was a problem hiding this comment.
requested change
|
ready for review! |
….com/ospin-web-dev/FCTGraph into finishing-touches-for-initial-deploy
FelixMZ2018
left a comment
There was a problem hiding this comment.
Looks great! The tests make it really easy to understand usage and concepts!
I left a few comments but nothing is blocking from my side
| [](https://codecov.io/gh/ospin-web-dev/FCTGraph) | ||
| [](https://codeclimate.com/repos/60ae147b04beeb018b015a77/maintainability) | ||
| [](https://codecov.io/gh/ospin-web-dev/FCTGraph) | ||
| [](https://codeclimate.com/github/ospin-web-dev/FCTGraph/maintainability) |
There was a problem hiding this comment.
Should codeclimate be removed here ?
There was a problem hiding this comment.
good question - no because this is public (which codeclimate works on)
| "test-release": "npx semantic-release --dry-run", | ||
| "test": "jest", | ||
| "test-with-coverage": "jest -i --coverage", | ||
| "test-with-coverage": "jest --coverage", |
There was a problem hiding this comment.
Probably worth changing the script title in hambda so all 3 projects use the same syntax
| @@ -24,7 +24,7 @@ | |||
| "start": "node index.js", | |||
| "test-release": "npx semantic-release --dry-run", | |||
There was a problem hiding this comment.
I dont think that would work because it can only be called from the master branch
| return util.inspect(this, { compact: false, depth: 4 }) | ||
| } | ||
|
|
||
| // deeper print outs while running on Node |
There was a problem hiding this comment.
Should the deeper printout have a higher depth than 4 ?
There was a problem hiding this comment.
good question and 👁️ ! - I actually chose 4 off the cuff assuming it would get us all the way down to data streams from an FCTGraph printout and no further. Turns out it doesn't (but 6 does!).
{ fctGraph: { fcts: { slots: { dataStreams } }
I have updated it (and also fixed unfound mistake in which datastreams weren't being serialized).
dfa83ad to
b714781
Compare
Co-authored-by: Felix Menzel <36296555+FelixMZ2018@users.noreply.github.com>
5945b3b to
d284171
Compare
|
🎉 This PR is included in version 2.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

BREAKING CHANGE: breaks the fake major version!
Ignore the diff! please review the code from /src.
I can best recommend reading the README since that attempts to outline the major architecture and will make looking at the code a lot more straight forward I believe.
My goal while writing this was EXtenSIbiliTy so I would particularly appreciate any feedback regarding that. I wanted it to be open for UNCLE extension and closed for BOB modification. E.g.
closes ospin-web-dev/REACTor#1329