From d28e04697429b607c38042ac09418adfceb06baf Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 16 Nov 2024 13:51:25 -0400 Subject: data: withResolvedArtworkReferenceList -> ...Annotated --- src/data/composite/wiki-data/index.js | 2 +- .../withResolvedAnnotatedReferenceList.js | 82 ++++++++++++++++++++++ .../wiki-data/withResolvedArtworkReferenceList.js | 82 ---------------------- 3 files changed, 83 insertions(+), 83 deletions(-) create mode 100644 src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js delete mode 100644 src/data/composite/wiki-data/withResolvedArtworkReferenceList.js (limited to 'src/data/composite/wiki-data') diff --git a/src/data/composite/wiki-data/index.js b/src/data/composite/wiki-data/index.js index e1589093..581dafc8 100644 --- a/src/data/composite/wiki-data/index.js +++ b/src/data/composite/wiki-data/index.js @@ -14,7 +14,7 @@ export {default as withDirectory} from './withDirectory.js'; export {default as withParsedCommentaryEntries} from './withParsedCommentaryEntries.js'; export {default as withRecontextualizedContributionList} from './withRecontextualizedContributionList.js'; export {default as withRedatedContributionList} from './withRedatedContributionList.js'; -export {default as withResolvedArtworkReferenceList} from './withResolvedArtworkReferenceList.js'; +export {default as withResolvedAnnotatedReferenceList} from './withResolvedAnnotatedReferenceList.js'; export {default as withResolvedContribs} from './withResolvedContribs.js'; export {default as withResolvedReference} from './withResolvedReference.js'; export {default as withResolvedReferenceList} from './withResolvedReferenceList.js'; diff --git a/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js b/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js new file mode 100644 index 00000000..341fdb3d --- /dev/null +++ b/src/data/composite/wiki-data/withResolvedAnnotatedReferenceList.js @@ -0,0 +1,82 @@ +import {input, templateCompositeFrom} from '#composite'; +import {stitchArrays} from '#sugar'; +import {isString, optional, validateArrayItems, validateProperties} + from '#validators'; + +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({ + annotation: `withResolvedAnnotatedReferenceList`, + + inputs: { + list: input({ + validate: + validateArrayItems( + validateProperties({ + reference: isString, + annotation: optional(isString), + })), + + acceptsNull: true, + }), + + data: inputWikiData({allowMixedTypes: true}), + find: input({type: 'function'}), + + notFoundMode: inputNotFoundMode(), + }, + + outputs: ['#resolvedAnnotatedReferenceList'], + + steps: () => [ + withPropertiesFromList({ + list: input('list'), + properties: input.value([ + 'reference', + 'annotation', + ]), + }), + + withResolvedReferenceList({ + list: '#list.reference', + data: input('data'), + find: input('find'), + notFoundMode: input.value('null'), + }), + + { + dependencies: [ + '#resolvedReferenceList', + '#list.annotation', + ], + + compute: (continuation, { + ['#resolvedReferenceList']: thing, + ['#list.annotation']: annotation, + }) => continuation({ + ['#matches']: + stitchArrays({ + thing, + annotation, + }), + }), + }, + + withAvailabilityFilter({ + from: '#resolvedReferenceList', + }), + + raiseResolvedReferenceList({ + notFoundMode: input('notFoundMode'), + results: '#matches', + filter: '#availabilityFilter', + outputs: input.value('#resolvedAnnotatedReferenceList'), + }), + ], +}) diff --git a/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js b/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js deleted file mode 100644 index 38c65a8d..00000000 --- a/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js +++ /dev/null @@ -1,82 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; -import {stitchArrays} from '#sugar'; -import {isString, optional, validateArrayItems, validateProperties} - from '#validators'; - -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({ - annotation: `withResolvedArtworkReferenceList`, - - inputs: { - list: input({ - validate: - validateArrayItems( - validateProperties({ - reference: isString, - annotation: optional(isString), - })), - - acceptsNull: true, - }), - - data: inputWikiData({allowMixedTypes: true}), - find: input({type: 'function'}), - - notFoundMode: inputNotFoundMode(), - }, - - outputs: ['#resolvedArtworkReferenceList'], - - steps: () => [ - withPropertiesFromList({ - list: input('list'), - properties: input.value([ - 'reference', - 'annotation', - ]), - }), - - withResolvedReferenceList({ - list: '#list.reference', - data: input('data'), - find: input('find'), - notFoundMode: input.value('null'), - }), - - { - dependencies: [ - '#resolvedReferenceList', - '#list.annotation', - ], - - compute: (continuation, { - ['#resolvedReferenceList']: thing, - ['#list.annotation']: annotation, - }) => continuation({ - ['#matches']: - stitchArrays({ - thing, - annotation, - }), - }), - }, - - withAvailabilityFilter({ - from: '#resolvedReferenceList', - }), - - raiseResolvedReferenceList({ - notFoundMode: input('notFoundMode'), - results: '#matches', - filter: '#availabilityFilter', - outputs: input.value('#resolvedArtworkReferenceList'), - }), - ], -}) -- cgit 1.3.0-6-gf8a5