diff options
Diffstat (limited to 'src/data/composite/things/track/withAlbum.js')
-rw-r--r-- | src/data/composite/things/track/withAlbum.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/data/composite/things/track/withAlbum.js b/src/data/composite/things/track/withAlbum.js new file mode 100644 index 0000000..03b840d --- /dev/null +++ b/src/data/composite/things/track/withAlbum.js @@ -0,0 +1,22 @@ +// Gets the track's album. This will early exit if albumData is missing. +// If there's no album whose list of tracks includes this track, the output +// dependency will be null. + +import {input, templateCompositeFrom} from '#composite'; + +import {withUniqueReferencingThing} from '#composite/wiki-data'; + +export default templateCompositeFrom({ + annotation: `withAlbum`, + + outputs: ['#album'], + + steps: () => [ + withUniqueReferencingThing({ + data: 'albumData', + list: input.value('tracks'), + }).outputs({ + ['#uniqueReferencingThing']: '#album', + }), + ], +}); |