diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 20:11:42 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-11-15 20:40:14 -0400 |
commit | 18849547f4bed29da0b0ad8b69a74b4c2e83ef43 (patch) | |
tree | b66e4bd95b2f19aa08b080bfd29c498aa7702ab2 /src/data/composite | |
parent | 4f6e0bc351831abedca9dcb9667987b2907e0a61 (diff) |
data: Referenced Artworks
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'}), |