diff options
Diffstat (limited to 'src/data/composite')
3 files changed, 39 insertions, 27 deletions
diff --git a/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js b/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js index e9c6a590..08c45ec8 100644 --- a/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js +++ b/src/data/composite/wiki-data/withResolvedArtworkReferenceList.js @@ -24,7 +24,7 @@ export default templateCompositeFrom({ acceptsNull: true, }), - data: inputWikiData({allowMixedTypes: false}), + data: inputWikiData({allowMixedTypes: true}), find: input({type: 'function'}), notFoundMode: input({ @@ -33,6 +33,8 @@ export default templateCompositeFrom({ }), }, + outputs: ['#resolvedArtworkReferenceList'], + steps: () => [ withPropertiesFromList({ list: input('list'), diff --git a/src/data/composite/wiki-data/withResolvedReferenceList.js b/src/data/composite/wiki-data/withResolvedReferenceList.js index 1d39e5b2..42f0e175 100644 --- a/src/data/composite/wiki-data/withResolvedReferenceList.js +++ b/src/data/composite/wiki-data/withResolvedReferenceList.js @@ -23,7 +23,7 @@ export default templateCompositeFrom({ acceptsNull: true, }), - data: inputWikiData({allowMixedTypes: false}), + data: inputWikiData({allowMixedTypes: true}), find: input({type: 'function'}), notFoundMode: input({ 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'}), |