diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-06-02 11:04:13 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:06 -0300 |
commit | 163a5aabc963e1817020048b94d7d215ad225a77 (patch) | |
tree | 7552840294b553c25d0d06d1a9d7356b757a6bba /src | |
parent | 1d996da933baf57fb79c32b00b35c5c5e15a36f3 (diff) |
data: withReverseContributionList: drop 'mode' option
Diffstat (limited to 'src')
4 files changed, 2 insertions, 43 deletions
diff --git a/src/data/composite/things/artist/artistTotalDuration.js b/src/data/composite/things/artist/artistTotalDuration.js index 54204918..ff709f28 100644 --- a/src/data/composite/things/artist/artistTotalDuration.js +++ b/src/data/composite/things/artist/artistTotalDuration.js @@ -14,7 +14,6 @@ export default templateCompositeFrom({ withReverseContributionList({ data: 'trackData', list: input.value('artistContribs'), - mode: input.value('contributions'), }).outputs({ '#reverseContributionList': '#contributionsAsArtist', }), @@ -22,7 +21,6 @@ export default templateCompositeFrom({ withReverseContributionList({ data: 'trackData', list: input.value('contributorContribs'), - mode: input.value('contributions'), }).outputs({ '#reverseContributionList': '#contributionsAsContributor', }), diff --git a/src/data/composite/wiki-data/withReverseContributionList.js b/src/data/composite/wiki-data/withReverseContributionList.js index 99d0c73b..b7f7a95b 100644 --- a/src/data/composite/wiki-data/withReverseContributionList.js +++ b/src/data/composite/wiki-data/withReverseContributionList.js @@ -1,9 +1,6 @@ // Analogous implementation for withReverseReferenceList, for contributions. // This is mostly duplicate code and both should be ported to the same -// underlying data form later on. Unique to contributions, the 'mode' option -// controls whether the things themselves, for which the artist is credited, -// are exposed (the default), or the actual contribution objects representing -// the relationship itself, instead. +// underlying data form later on. // // This implementation uses a global cache (via WeakMap) to attempt to speed // up subsequent similar accesses. @@ -13,7 +10,6 @@ // is used, a fresh cache will always be created. import {input, templateCompositeFrom} from '#composite'; -import {is} from '#validators'; import {exitWithoutDependency, raiseOutputWithoutDependency} from '#composite/control-flow'; @@ -32,11 +28,6 @@ export default templateCompositeFrom({ inputs: { data: inputWikiData({allowMixedTypes: false}), list: input({type: 'string'}), - - mode: input({ - validate: is('things', 'contributions'), - defaultValue: 'things', - }), }, outputs: ['#reverseContributionList'], @@ -90,25 +81,10 @@ export default templateCompositeFrom({ } return continuation({ - ['#contributions']: + ['#reverseContributionList']: cache.get(data).get(myself) ?? [], }); }, }, - - { - dependencies: ['#contributions', input('mode')], - compute: (continuation, { - ['#contributions']: contributions, - [input('mode')]: mode, - }) => continuation({ - ['#reverseContributionList']: - (mode === 'contributions' - ? contributions - : mode === 'things' - ? contributions.map(contrib => contrib.thing) - : []), - }), - }, ], }); diff --git a/src/data/composite/wiki-properties/reverseContributionList.js b/src/data/composite/wiki-properties/reverseContributionList.js index ce219377..7f3f9c81 100644 --- a/src/data/composite/wiki-properties/reverseContributionList.js +++ b/src/data/composite/wiki-properties/reverseContributionList.js @@ -1,5 +1,4 @@ import {input, templateCompositeFrom} from '#composite'; -import {is} from '#validators'; import {exposeDependency} from '#composite/control-flow'; import {inputWikiData, withReverseContributionList} from '#composite/wiki-data'; @@ -12,18 +11,12 @@ export default templateCompositeFrom({ inputs: { data: inputWikiData({allowMixedTypes: false}), list: input({type: 'string'}), - - mode: input({ - validate: is('things', 'contributions'), - defaultValue: 'things', - }), }, steps: () => [ withReverseContributionList({ data: input('data'), list: input('list'), - mode: input('mode'), }), exposeDependency({dependency: '#reverseContributionList'}), diff --git a/src/data/things/artist.js b/src/data/things/artist.js index 5d1d04a0..6d5e33c0 100644 --- a/src/data/things/artist.js +++ b/src/data/things/artist.js @@ -83,19 +83,16 @@ export class Artist extends Thing { trackArtistContributions: reverseContributionList({ data: 'trackData', list: input.value('artistContribs'), - mode: input.value('contributions'), }), trackContributorContributions: reverseContributionList({ data: 'trackData', list: input.value('contributorContribs'), - mode: input.value('contributions'), }), trackCoverArtistContributions: reverseContributionList({ data: 'trackData', list: input.value('coverArtistContribs'), - mode: input.value('contributions'), }), tracksAsCommentator: reverseReferenceList({ @@ -106,25 +103,21 @@ export class Artist extends Thing { albumArtistContributions: reverseContributionList({ data: 'albumData', list: input.value('artistContribs'), - mode: input.value('contributions'), }), albumCoverArtistContributions: reverseContributionList({ data: 'albumData', list: input.value('coverArtistContribs'), - mode: input.value('contributions'), }), albumWallpaperArtistContributions: reverseContributionList({ data: 'albumData', list: input.value('wallpaperArtistContribs'), - mode: input.value('contributions'), }), albumBannerArtistContributions: reverseContributionList({ data: 'albumData', list: input.value('bannerArtistContribs'), - mode: input.value('contributions'), }), albumsAsCommentator: reverseReferenceList({ @@ -135,7 +128,6 @@ export class Artist extends Thing { flashContributorContributions: reverseContributionList({ data: 'flashData', list: input.value('contributorContribs'), - mode: input.value('contributions'), }), flashesAsCommentator: reverseReferenceList({ |