From 9c3f0a79ee38ee5a13617ed0406d42e579ed49f3 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Tue, 25 Nov 2025 16:08:30 -0400 Subject: data: Track: chop withMainReleaseTrack probably contains normative changes re: dropping notFoundValue behavior in properties which inherit from main release, but has no effect on good wiki data and maybe those compositions resolve the same anyway... --- .../composite/things/track/withMainReleaseTrack.js | 244 --------------------- 1 file changed, 244 deletions(-) delete mode 100644 src/data/composite/things/track/withMainReleaseTrack.js (limited to 'src/data/composite/things/track/withMainReleaseTrack.js') diff --git a/src/data/composite/things/track/withMainReleaseTrack.js b/src/data/composite/things/track/withMainReleaseTrack.js deleted file mode 100644 index c92c2246..00000000 --- a/src/data/composite/things/track/withMainReleaseTrack.js +++ /dev/null @@ -1,244 +0,0 @@ -// Just provides the main release of this track as a dependency. -// If this track isn't a secondary release, then it'll provide null, unless -// the {selfIfMain} option is set, in which case it'll provide this track -// itself. This will early exit (with notFoundValue) if the main release -// is specified by reference and that reference doesn't resolve to anything. - -import {input, templateCompositeFrom} from '#composite'; -import {onlyItem} from '#sugar'; -import {getKebabCase} from '#wiki-data'; - -import { - exitWithoutDependency, - withAvailabilityFilter, - withResultOfAvailabilityCheck, -} from '#composite/control-flow'; - -import { - withFilteredList, - withMappedList, - withPropertyFromList, - withPropertyFromObject, -} from '#composite/data'; - -export default templateCompositeFrom({ - annotation: `withMainReleaseTrack`, - - inputs: { - selfIfMain: input({type: 'boolean', defaultValue: false}), - notFoundValue: input({defaultValue: null}), - }, - - outputs: ['#mainReleaseTrack'], - - steps: () => [ - withResultOfAvailabilityCheck({ - from: '_mainRelease', - }), - - { - dependencies: [ - input.myself(), - input('selfIfMain'), - '#availability', - ], - - compute: (continuation, { - [input.myself()]: track, - [input('selfIfMain')]: selfIfMain, - '#availability': availability, - }) => - (availability - ? continuation() - : continuation.raiseOutput({ - ['#mainReleaseTrack']: - (selfIfMain ? track : null), - })), - }, - - exitWithoutDependency({ - dependency: 'mainRelease', - value: input('notFoundValue'), - }), - - withPropertyFromObject({ - object: 'mainRelease', - property: input.value('isTrack'), - }), - - { - dependencies: ['mainRelease', '#mainRelease.isTrack'], - - compute: (continuation, { - ['mainRelease']: mainRelease, - ['#mainRelease.isTrack']: mainReleaseIsTrack, - }) => - (mainReleaseIsTrack - ? continuation.raiseOutput({ - ['#mainReleaseTrack']: mainRelease, - }) - : continuation()), - }, - - { - dependencies: ['name', '_directory'], - compute: (continuation, { - ['name']: ownName, - ['_directory']: ownDirectory, - }) => { - const ownNameKebabed = getKebabCase(ownName); - - return continuation({ - ['#mapItsNameLikeName']: - name => getKebabCase(name) === ownNameKebabed, - - ['#mapItsDirectoryLikeDirectory']: - (ownDirectory - ? directory => directory === ownDirectory - : () => false), - - ['#mapItsNameLikeDirectory']: - (ownDirectory - ? name => getKebabCase(name) === ownDirectory - : () => false), - - ['#mapItsDirectoryLikeName']: - directory => directory === ownNameKebabed, - }); - }, - }, - - withPropertyFromObject({ - object: 'mainRelease', - property: input.value('tracks'), - }), - - withPropertyFromList({ - list: '#mainRelease.tracks', - property: input.value('mainRelease'), - internal: input.value(true), - }), - - withAvailabilityFilter({ - from: '#mainRelease.tracks.mainRelease', - }), - - withMappedList({ - list: '#availabilityFilter', - map: input.value(item => !item), - }).outputs({ - '#mappedList': '#availabilityFilter', - }), - - withFilteredList({ - list: '#mainRelease.tracks', - filter: '#availabilityFilter', - }).outputs({ - '#filteredList': '#mainRelease.tracks', - }), - - withPropertyFromList({ - list: '#mainRelease.tracks', - property: input.value('name'), - }), - - withPropertyFromList({ - list: '#mainRelease.tracks', - property: input.value('directory'), - internal: input.value(true), - }), - - withMappedList({ - list: '#mainRelease.tracks.name', - map: '#mapItsNameLikeName', - }).outputs({ - '#mappedList': '#filterItsNameLikeName', - }), - - withMappedList({ - list: '#mainRelease.tracks.directory', - map: '#mapItsDirectoryLikeDirectory', - }).outputs({ - '#mappedList': '#filterItsDirectoryLikeDirectory', - }), - - withMappedList({ - list: '#mainRelease.tracks.name', - map: '#mapItsNameLikeDirectory', - }).outputs({ - '#mappedList': '#filterItsNameLikeDirectory', - }), - - withMappedList({ - list: '#mainRelease.tracks.directory', - map: '#mapItsDirectoryLikeName', - }).outputs({ - '#mappedList': '#filterItsDirectoryLikeName', - }), - - withFilteredList({ - list: '#mainRelease.tracks', - filter: '#filterItsNameLikeName', - }).outputs({ - '#filteredList': '#matchingItsNameLikeName', - }), - - withFilteredList({ - list: '#mainRelease.tracks', - filter: '#filterItsDirectoryLikeDirectory', - }).outputs({ - '#filteredList': '#matchingItsDirectoryLikeDirectory', - }), - - withFilteredList({ - list: '#mainRelease.tracks', - filter: '#filterItsNameLikeDirectory', - }).outputs({ - '#filteredList': '#matchingItsNameLikeDirectory', - }), - - withFilteredList({ - list: '#mainRelease.tracks', - filter: '#filterItsDirectoryLikeName', - }).outputs({ - '#filteredList': '#matchingItsDirectoryLikeName', - }), - - { - dependencies: [ - '#matchingItsNameLikeName', - '#matchingItsDirectoryLikeDirectory', - '#matchingItsNameLikeDirectory', - '#matchingItsDirectoryLikeName', - ], - - compute: (continuation, { - ['#matchingItsNameLikeName']: NLN, - ['#matchingItsDirectoryLikeDirectory']: DLD, - ['#matchingItsNameLikeDirectory']: NLD, - ['#matchingItsDirectoryLikeName']: DLN, - }) => continuation({ - ['#mainReleaseTrack']: - onlyItem(DLD) ?? - onlyItem(NLN) ?? - onlyItem(DLN) ?? - onlyItem(NLD) ?? - null, - }), - }, - - { - dependencies: ['#mainReleaseTrack', input.myself()], - - compute: (continuation, { - ['#mainReleaseTrack']: mainReleaseTrack, - [input.myself()]: thisTrack, - }) => continuation({ - ['#mainReleaseTrack']: - (mainReleaseTrack === thisTrack - ? null - : mainReleaseTrack), - }), - }, - ], -}); -- cgit 1.3.0-6-gf8a5