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
51
52
53
54
55
56
57
58
|
// Gets the flash's act. This will early exit if flashActData is missing.
// If there's no flash whose list of flashes includes this flash, the output
// dependency will be null.
//
// This step models with Flash.withAlbum.
import {input, templateCompositeFrom} from '#composite';
import {is} from '#validators';
import {exitWithoutDependency, raiseOutputWithoutDependency}
from '#composite/control-flow';
import {withPropertyFromList} from '#composite/data';
export default templateCompositeFrom({
annotation: `withFlashAct`,
outputs: ['#flashAct'],
steps: () => [
exitWithoutDependency({
dependency: 'flashActData',
mode: input.value('null'),
}),
withPropertyFromList({
list: 'flashActData',
property: input.value('flashes'),
}),
{
dependencies: [input.myself(), '#flashActData.flashes'],
compute: (continuation, {
[input.myself()]: track,
['#flashActData.flashes']: flashLists,
}) => continuation({
['#flashActIndex']:
flashLists.findIndex(flashes => flashes.includes(track)),
}),
},
raiseOutputWithoutDependency({
dependency: '#flashActIndex',
mode: input.value('index'),
output: input.value({'#album': null}),
}),
{
dependencies: ['flashActData', '#flashActIndex'],
compute: (continuation, {
['flashActData']: flashActData,
['#flashActIndex']: flashActIndex,
}) => continuation.raiseOutput({
['#flashAct']:
flashActData[flashActIndex],
}),
},
],
});
|