diff options
Diffstat (limited to 'src/data/composite/things/album/withTracks.js')
-rw-r--r-- | src/data/composite/things/album/withTracks.js | 46 |
1 files changed, 11 insertions, 35 deletions
diff --git a/src/data/composite/things/album/withTracks.js b/src/data/composite/things/album/withTracks.js index fff3d5ae..c8d27c4c 100644 --- a/src/data/composite/things/album/withTracks.js +++ b/src/data/composite/things/album/withTracks.js @@ -1,51 +1,27 @@ import {input, templateCompositeFrom} from '#composite'; -import find from '#find'; -import {exitWithoutDependency, raiseOutputWithoutDependency} - from '#composite/control-flow'; +import {withFlattenedList, withPropertyFromList} from '#composite/data'; import {withResolvedReferenceList} from '#composite/wiki-data'; +import withTrackSections from './withTrackSections.js'; + export default templateCompositeFrom({ annotation: `withTracks`, outputs: ['#tracks'], steps: () => [ - exitWithoutDependency({ - dependency: 'ownTrackData', - value: input.value([]), - }), + withTrackSections(), - raiseOutputWithoutDependency({ - dependency: 'trackSections', - mode: input.value('empty'), - output: input.value({ - ['#tracks']: [], - }), + withPropertyFromList({ + list: '#trackSections', + property: input.value('tracks'), }), - { - dependencies: ['trackSections'], - compute: (continuation, {trackSections}) => - continuation({ - '#trackRefs': trackSections - .flatMap(section => section.tracks ?? []), - }), - }, - - withResolvedReferenceList({ - list: '#trackRefs', - data: 'ownTrackData', - find: input.value(find.track), + withFlattenedList({ + list: '#trackSections.tracks', + }).outputs({ + ['#flattenedList']: '#tracks', }), - - { - dependencies: ['#resolvedReferenceList'], - compute: (continuation, { - ['#resolvedReferenceList']: resolvedReferenceList, - }) => continuation({ - ['#tracks']: resolvedReferenceList, - }) - }, ], }); |