From 65ff74446f22976613caf352d42253c8c17e172d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 16 Nov 2024 13:29:52 -0400 Subject: data: raiseResolvedReferenceList This commit also implements raiseResolvedReferenceList across the compositions which have a notFoundMode input. This causes no semantic changes at all, except that notFoundMode is no longer ignored(!!) in withResolvedContribs. --- .../wiki-data/withResolvedArtworkReferenceList.js | 63 ++++------------------ 1 file changed, 10 insertions(+), 53 deletions(-) (limited to 'src/data/composite/wiki-data/withResolvedArtworkReferenceList.js') diff --git a/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js b/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js index ae1952be..38c65a8d 100644 --- a/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js +++ b/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js @@ -3,11 +3,12 @@ import {stitchArrays} from '#sugar'; import {isString, optional, validateArrayItems, validateProperties} from '#validators'; -import {withFilteredList, withMappedList, withPropertiesFromList} - from '#composite/data'; +import {withAvailabilityFilter} from '#composite/control-flow'; +import {withPropertiesFromList} from '#composite/data'; import inputNotFoundMode from './inputNotFoundMode.js'; import inputWikiData from './inputWikiData.js'; +import raiseResolvedReferenceList from './raiseResolvedReferenceList.js'; import withResolvedReferenceList from './withResolvedReferenceList.js'; export default templateCompositeFrom({ @@ -67,59 +68,15 @@ export default templateCompositeFrom({ }), }, - { - dependencies: ['#matches'], - compute: (continuation, {'#matches': matches}) => - (matches.every(match => match) - ? continuation.raiseOutput({ - ['#resolvedArtworkReferenceList']: - matches, - }) - : continuation()), - }, - - { - dependencies: [input('notFoundMode')], - compute: (continuation, { - [input('notFoundMode')]: notFoundMode, - }) => - (notFoundMode === 'exit' - ? continuation.exit([]) - : continuation()), - }, - - { - dependencies: ['#matches', input('notFoundMode')], - compute: (continuation, { - ['#matches']: matches, - [input('notFoundMode')]: notFoundMode, - }) => - (notFoundMode === 'null' - ? continuation.raiseOutput({ - ['#resolvedArtworkReferenceList']: - matches, - }) - : continuation()), - }, - - withMappedList({ - list: '#resolvedReferenceList', - map: input.value(thing => thing !== null), + withAvailabilityFilter({ + from: '#resolvedReferenceList', }), - withFilteredList({ - list: '#matches', - filter: '#mappedList', + raiseResolvedReferenceList({ + notFoundMode: input('notFoundMode'), + results: '#matches', + filter: '#availabilityFilter', + outputs: input.value('#resolvedArtworkReferenceList'), }), - - { - dependencies: ['#filteredList'], - compute: (continuation, { - ['#filteredList']: filteredList, - }) => continuation({ - ['#resolvedArtworkReferenceList']: - filteredList, - }), - }, ], }) -- cgit 1.3.0-6-gf8a5