« get me outta code hell

withAlbum.js « track « things « composite « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/things/track/withAlbum.js
blob: 4c55e1f42eac635892a8af428560d31bab438375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 {templateCompositeFrom} from '#composite';

import {withUniqueReferencingThing} from '#composite/wiki-data';
import {soupyReverse} from '#composite/wiki-properties';

export default templateCompositeFrom({
  annotation: `withAlbum`,

  outputs: ['#album'],

  steps: () => [
    withUniqueReferencingThing({
      reverse: soupyReverse.input('albumsWhoseTracksInclude'),
    }).outputs({
      ['#uniqueReferencingThing']: '#album',
    }),
  ],
});