« get me outta code hell

trackReverseReferenceList.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/trackReverseReferenceList.js
blob: 44940ae72bbbeb6e65abd6602a008fe78506329d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Like a normal reverse reference list ("objects which reference this object
// under a specified property"), only excluding rereleases from the possible
// outputs. While it's useful to travel from a rerelease to the tracks it
// references, rereleases aren't generally relevant from the perspective of
// the tracks *being* referenced. Apart from hiding rereleases from lists on
// the site, it also excludes keeps them from relational data processing, such
// as on the "Tracks - by Times Referenced" listing page.

import {input, templateCompositeFrom} from '#composite';
import {withReverseReferenceList} from '#composite/wiki-data';

export default templateCompositeFrom({
  annotation: `trackReverseReferenceList`,

  compose: false,

  inputs: {
    list: input({type: 'string'}),
  },

  steps: () => [
    withReverseReferenceList({
      data: 'trackData',
      list: input('list'),
    }),

    {
      flags: {expose: true},
      expose: {
        dependencies: ['#reverseReferenceList'],
        compute: ({
          ['#reverseReferenceList']: reverseReferenceList,
        }) =>
          reverseReferenceList.filter(track => !track.originalReleaseTrack),
      },
    },
  ],
});