| 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
39
40
41
42
43
44
45
46
47
48
49
50
 | import {input, templateCompositeFrom} from '#composite';
import {isDate} from '#validators';
import {raiseOutputWithoutDependency} from '#composite/control-flow';
import {withHasArtwork} from '#composite/wiki-data';
export default templateCompositeFrom({
  annotation: `withCoverArtDate`,
  inputs: {
    from: input({
      validate: isDate,
      defaultDependency: 'coverArtDate',
      acceptsNull: true,
    }),
  },
  outputs: ['#coverArtDate'],
  steps: () => [
    withHasArtwork({
      contribs: 'coverArtistContribs',
      artworks: 'coverArtworks',
    }),
    raiseOutputWithoutDependency({
      dependency: '#hasArtwork',
      mode: input.value('falsy'),
      output: input.value({'#coverArtDate': null}),
    }),
    {
      dependencies: [input('from')],
      compute: (continuation, {
        [input('from')]: from,
      }) =>
        (from
          ? continuation.raiseOutput({'#coverArtDate': from})
          : continuation()),
    },
    {
      dependencies: ['date'],
      compute: (continuation, {date}) =>
        (date
          ? continuation({'#coverArtDate': date})
          : continuation({'#coverArtDate': null})),
    },
  ],
});
 |