From 112cf48c3877e35a6fd41fc613c33cc46eaf719d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 27 Nov 2025 17:25:50 -0400 Subject: data: ContentEntry: chop contentArtists --- .../composite/things/content/contentArtists.js | 40 -------------- .../withExpressedOrImplicitArtistReferences.js | 61 ---------------------- src/data/composite/things/content/index.js | 2 +- .../withExpressedOrImplicitArtistReferences.js | 61 ++++++++++++++++++++++ 4 files changed, 62 insertions(+), 102 deletions(-) delete mode 100644 src/data/composite/things/content/contentArtists.js delete mode 100644 src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js create mode 100644 src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js (limited to 'src/data/composite/things/content') diff --git a/src/data/composite/things/content/contentArtists.js b/src/data/composite/things/content/contentArtists.js deleted file mode 100644 index 8d5db5a5..00000000 --- a/src/data/composite/things/content/contentArtists.js +++ /dev/null @@ -1,40 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; -import {validateReferenceList} from '#validators'; - -import {exitWithoutDependency, exposeDependency} - from '#composite/control-flow'; -import {withResolvedReferenceList} from '#composite/wiki-data'; -import {soupyFind} from '#composite/wiki-properties'; - -import withExpressedOrImplicitArtistReferences - from './helpers/withExpressedOrImplicitArtistReferences.js'; - -export default templateCompositeFrom({ - annotation: `contentArtists`, - - compose: false, - - update: { - validate: validateReferenceList('artist'), - }, - - steps: () => [ - withExpressedOrImplicitArtistReferences({ - from: input.updateValue(), - }), - - exitWithoutDependency({ - dependency: '#artistReferences', - value: input.value([]), - }), - - withResolvedReferenceList({ - list: '#artistReferences', - find: soupyFind.input('artist'), - }), - - exposeDependency({ - dependency: '#resolvedReferenceList', - }), - ], -}); diff --git a/src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js b/src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js deleted file mode 100644 index 69da8c75..00000000 --- a/src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js +++ /dev/null @@ -1,61 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; - -import {raiseOutputWithoutDependency} from '#composite/control-flow'; -import {withFilteredList, withMappedList} from '#composite/data'; -import {withContentNodes} from '#composite/wiki-data'; - -export default templateCompositeFrom({ - annotation: `withExpressedOrImplicitArtistReferences`, - - inputs: { - from: input({type: 'array', acceptsNull: true}), - }, - - outputs: ['#artistReferences'], - - steps: () => [ - { - dependencies: [input('from')], - compute: (continuation, { - [input('from')]: expressedArtistReferences, - }) => - (expressedArtistReferences - ? continuation.raiseOutput({'#artistReferences': expressedArtistReferences}) - : continuation()), - }, - - raiseOutputWithoutDependency({ - dependency: 'artistText', - output: input.value({'#artistReferences': null}), - }), - - withContentNodes({ - from: 'artistText', - }), - - withMappedList({ - list: '#contentNodes', - map: input.value(node => - node.type === 'tag' && - node.data.replacerKey?.data === 'artist'), - }).outputs({ - '#mappedList': '#artistTagFilter', - }), - - withFilteredList({ - list: '#contentNodes', - filter: '#artistTagFilter', - }).outputs({ - '#filteredList': '#artistTags', - }), - - withMappedList({ - list: '#artistTags', - map: input.value(node => - 'artist:' + - node.data.replacerValue[0].data), - }).outputs({ - '#mappedList': '#artistReferences', - }), - ], -}); diff --git a/src/data/composite/things/content/index.js b/src/data/composite/things/content/index.js index 37d6fdc5..27bf7c53 100644 --- a/src/data/composite/things/content/index.js +++ b/src/data/composite/things/content/index.js @@ -1,4 +1,4 @@ -export {default as contentArtists} from './contentArtists.js'; export {default as hasAnnotationPart} from './hasAnnotationPart.js'; export {default as withAnnotationPartNodeLists} from './withAnnotationPartNodeLists.js'; +export {default as withExpressedOrImplicitArtistReferences} from './withExpressedOrImplicitArtistReferences.js'; export {default as withWebArchiveDate} from './withWebArchiveDate.js'; diff --git a/src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js b/src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js new file mode 100644 index 00000000..69da8c75 --- /dev/null +++ b/src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js @@ -0,0 +1,61 @@ +import {input, templateCompositeFrom} from '#composite'; + +import {raiseOutputWithoutDependency} from '#composite/control-flow'; +import {withFilteredList, withMappedList} from '#composite/data'; +import {withContentNodes} from '#composite/wiki-data'; + +export default templateCompositeFrom({ + annotation: `withExpressedOrImplicitArtistReferences`, + + inputs: { + from: input({type: 'array', acceptsNull: true}), + }, + + outputs: ['#artistReferences'], + + steps: () => [ + { + dependencies: [input('from')], + compute: (continuation, { + [input('from')]: expressedArtistReferences, + }) => + (expressedArtistReferences + ? continuation.raiseOutput({'#artistReferences': expressedArtistReferences}) + : continuation()), + }, + + raiseOutputWithoutDependency({ + dependency: 'artistText', + output: input.value({'#artistReferences': null}), + }), + + withContentNodes({ + from: 'artistText', + }), + + withMappedList({ + list: '#contentNodes', + map: input.value(node => + node.type === 'tag' && + node.data.replacerKey?.data === 'artist'), + }).outputs({ + '#mappedList': '#artistTagFilter', + }), + + withFilteredList({ + list: '#contentNodes', + filter: '#artistTagFilter', + }).outputs({ + '#filteredList': '#artistTags', + }), + + withMappedList({ + list: '#artistTags', + map: input.value(node => + 'artist:' + + node.data.replacerValue[0].data), + }).outputs({ + '#mappedList': '#artistReferences', + }), + ], +}); -- cgit 1.3.0-6-gf8a5