(map, cls, doState)
| 609 | } |
| 610 | |
| 611 | function validateMap(map, cls, doState) { |
| 612 | for (const id in map) { |
| 613 | const idProps = map[id]; |
| 614 | const fcb = flatten(values(idProps)); |
| 615 | const optional = fcb.reduce((acc, cb) => { |
| 616 | if (acc === false || cb.optional) { |
| 617 | return acc; |
| 618 | } |
| 619 | const deps = concat(cb.outputs, cb.inputs, cb.states).filter( |
| 620 | dep => dep.id === id |
| 621 | ); |
| 622 | return ( |
| 623 | !deps.length || |
| 624 | all(({allow_optional}) => allow_optional, deps) |
| 625 | ); |
| 626 | }, true); |
| 627 | if (optional) { |
| 628 | continue; |
| 629 | } |
| 630 | const idPath = getPath(paths, id); |
| 631 | if (!idPath) { |
| 632 | if (validateIds) { |
| 633 | missingId(id, cls, fcb); |
| 634 | } |
| 635 | } else { |
| 636 | for (const property in idProps) { |
| 637 | const callbacks = idProps[property]; |
| 638 | validateProp(id, idPath, property, cls, callbacks); |
| 639 | if (doState) { |
| 640 | // It would be redundant to check state on both inputs |
| 641 | // and outputs - so only set doState for outputs. |
| 642 | callbacks.forEach(validateState); |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | validateMap(outputMap, 'Output', true); |
| 650 | validateMap(inputMap, 'Input'); |
no test coverage detected
searching dependent graphs…