diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-05-19 21:44:18 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-05-19 21:47:31 -0300 |
commit | 048e79a1ea83a942579ce89f797795e34cc4199e (patch) | |
tree | c810109a93bc5fe1dbae611bb6efb212846df00f /src/data/composite/things/album/withTracks.js | |
parent | 471de6e5ac73bd6c769a58392e3e49aff6d8f2cb (diff) |
data: TrackSection thing objects
Sorry this commit is kind of monolithic! It's difficult to separate out any of the changes since they're all related to track sections' basic functionality.
Diffstat (limited to 'src/data/composite/things/album/withTracks.js')
-rw-r--r-- | src/data/composite/things/album/withTracks.js | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/src/data/composite/things/album/withTracks.js b/src/data/composite/things/album/withTracks.js index fff3d5ae..05f5b24d 100644 --- a/src/data/composite/things/album/withTracks.js +++ b/src/data/composite/things/album/withTracks.js @@ -1,9 +1,8 @@ import {input, templateCompositeFrom} from '#composite'; -import find from '#find'; import {exitWithoutDependency, raiseOutputWithoutDependency} from '#composite/control-flow'; -import {withResolvedReferenceList} from '#composite/wiki-data'; +import {withFlattenedList, withPropertyFromList} from '#composite/data'; export default templateCompositeFrom({ annotation: `withTracks`, @@ -11,41 +10,22 @@ export default templateCompositeFrom({ outputs: ['#tracks'], steps: () => [ - exitWithoutDependency({ - dependency: 'ownTrackData', - value: input.value([]), - }), - raiseOutputWithoutDependency({ dependency: 'trackSections', - mode: input.value('empty'), output: input.value({ - ['#tracks']: [], + '#tracks': [], }), }), - { - dependencies: ['trackSections'], - compute: (continuation, {trackSections}) => - continuation({ - '#trackRefs': trackSections - .flatMap(section => section.tracks ?? []), - }), - }, - - withResolvedReferenceList({ - list: '#trackRefs', - data: 'ownTrackData', - find: input.value(find.track), + withPropertyFromList({ + list: 'trackSections', + property: input.value('tracks'), }), - { - dependencies: ['#resolvedReferenceList'], - compute: (continuation, { - ['#resolvedReferenceList']: resolvedReferenceList, - }) => continuation({ - ['#tracks']: resolvedReferenceList, - }) - }, + withFlattenedList({ + list: '#trackSections.tracks', + }).outputs({ + ['#flattenedList']: '#tracks', + }), ], }); |