diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-11-25 16:08:30 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-11-25 16:08:48 -0400 |
| commit | 9c3f0a79ee38ee5a13617ed0406d42e579ed49f3 (patch) | |
| tree | 716f3f64418ecd5df3725e437640fd7f62cb9bfa /src/data/composite/things/track/withPropertyFromMainRelease.js | |
| parent | e0ed41638ac5f76968499a16628f7054eae11158 (diff) | |
data: Track: chop withMainReleaseTrack
probably contains normative changes re: dropping notFoundValue behavior in properties which inherit from main release, but has no effect on good wiki data and maybe those compositions resolve the same anyway...
Diffstat (limited to 'src/data/composite/things/track/withPropertyFromMainRelease.js')
| -rw-r--r-- | src/data/composite/things/track/withPropertyFromMainRelease.js | 68 |
1 files changed, 18 insertions, 50 deletions
diff --git a/src/data/composite/things/track/withPropertyFromMainRelease.js b/src/data/composite/things/track/withPropertyFromMainRelease.js index c6f65653..cd24da4a 100644 --- a/src/data/composite/things/track/withPropertyFromMainRelease.js +++ b/src/data/composite/things/track/withPropertyFromMainRelease.js @@ -1,86 +1,54 @@ -// Provides a value inherited from the main release, if applicable, and a -// flag indicating if this track is a secondary release or not. -// -// Like withMainRelease, this will early exit (with notFoundValue) if the -// main release is specified by reference and that reference doesn't -// resolve to anything. +// Provides a value inherited from the main release, or null, +// if this track is not a secondary release. import {input, templateCompositeFrom} from '#composite'; import {withResultOfAvailabilityCheck} from '#composite/control-flow'; import {withPropertyFromObject} from '#composite/data'; -import withMainReleaseTrack from './withMainReleaseTrack.js'; - export default templateCompositeFrom({ annotation: `withPropertyFromMainRelease`, inputs: { property: input({type: 'string'}), - - notFoundValue: input({ - defaultValue: null, - }), }, outputs: ({ [input.staticValue('property')]: property, - }) => - ['#isSecondaryRelease'].concat( - (property - ? ['#mainRelease.' + property] - : ['#mainReleaseValue'])), + }) => [ + (property + ? '#mainRelease.' + property + : '#mainReleaseValue'), + ], steps: () => [ - withMainReleaseTrack({ - notFoundValue: input('notFoundValue'), - }), - - withResultOfAvailabilityCheck({ - from: '#mainReleaseTrack', - }), - { - dependencies: [ - '#availability', - input.staticValue('property'), - ], - + dependencies: ['isSecondaryRelease', input.staticValue('property')], compute: (continuation, { - ['#availability']: availability, + ['isSecondaryRelease']: isSecondaryRelease, [input.staticValue('property')]: property, }) => - (availability + (isSecondaryRelease ? continuation() - : continuation.raiseOutput( - Object.assign( - {'#isSecondaryRelease': false}, - (property - ? {['#mainRelease.' + property]: null} - : {'#mainReleaseValue': null})))), + : property + ? continuation.raiseOutput({['#mainRelease.' + property]: null}) + : continuation.raiseOutput({'#mainReleaseValue': null})), }, withPropertyFromObject({ - object: '#mainReleaseTrack', + object: 'mainReleaseTrack', property: input('property'), }), { - dependencies: [ - '#value', - input.staticValue('property'), - ], - + dependencies: ['#value', input.staticValue('property')], compute: (continuation, { ['#value']: value, [input.staticValue('property')]: property, }) => - continuation.raiseOutput( - Object.assign( - {'#isSecondaryRelease': true}, - (property - ? {['#mainRelease.' + property]: value} - : {'#mainReleaseValue': value}))), + (property + ? continuation.raiseOutput({['#mainRelease.' + property]: value}) + : continuation.raiseOutput({'#mainReleaseValue': value})), }, ], }); |