From 18849547f4bed29da0b0ad8b69a74b4c2e83ef43 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 14 Nov 2024 20:11:42 -0400 Subject: data: Referenced Artworks --- .../wiki-properties/referencedArtworkList.js | 60 +++++++++++++--------- 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'src/data/composite/wiki-properties') diff --git a/src/data/composite/wiki-properties/referencedArtworkList.js b/src/data/composite/wiki-properties/referencedArtworkList.js index bd2962de..251944e5 100644 --- a/src/data/composite/wiki-properties/referencedArtworkList.js +++ b/src/data/composite/wiki-properties/referencedArtworkList.js @@ -1,45 +1,55 @@ import {input, templateCompositeFrom} from '#composite'; -import {isThingClass, validateAnnotatedReferenceList} from '#validators'; +import find from '#find'; +import {validateAnnotatedReferenceList} from '#validators'; +import {combineWikiDataArrays} from '#wiki-data'; import {exposeDependency} from '#composite/control-flow'; -import {inputWikiData, withResolvedArtworkReferenceList} from '#composite/wiki-data'; +import {withResolvedArtworkReferenceList} from '#composite/wiki-data'; export default templateCompositeFrom({ annotation: `referencedArtworkList`, - inputs: { - class: input.staticValue({ - validate: isThingClass, - acceptsNull: true, - defaultValue: null, - }), - - referenceType: input.staticValue({ - type: 'string', - acceptsNull: true, - defaultValue: null, - }), - - data: inputWikiData({allowMixedTypes: false}), - find: input({type: 'function'}), - }, - update: ({ [input.staticValue('class')]: thingClass, [input.staticValue('referenceType')]: referenceType, }) => ({ validate: - validateAnnotatedReferenceList( - (thingClass - ? thingClass[Symbol.for('Thing.referenceType')] - : referenceType)), + validateAnnotatedReferenceList(['album', 'track']), }), steps: () => [ + { + dependencies: [ + 'albumData', + 'trackData', + ], + + compute: (continuation, { + albumData, + trackData, + }) => continuation({ + ['#data']: + combineWikiDataArrays([ + albumData, + trackData, + ]), + }), + }, + + { + compute: (continuation) => continuation({ + ['#find']: + find.mixed({ + track: find.track, + album: find.album, + }), + }), + }, + withResolvedArtworkReferenceList({ list: input.updateValue(), - data: input('data'), - find: input('find'), + data: '#data', + find: '#find', }), exposeDependency({dependency: '#resolvedArtworkReferenceList'}), -- cgit 1.3.0-6-gf8a5