diff options
Diffstat (limited to 'src/data/composite/wiki-properties')
-rw-r--r-- | src/data/composite/wiki-properties/index.js | 1 | ||||
-rw-r--r-- | src/data/composite/wiki-properties/referencedArtworkList.js | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/data/composite/wiki-properties/index.js b/src/data/composite/wiki-properties/index.js index 32916771..d39bff3a 100644 --- a/src/data/composite/wiki-properties/index.js +++ b/src/data/composite/wiki-properties/index.js @@ -19,6 +19,7 @@ export {default as fileExtension} from './fileExtension.js'; export {default as flag} from './flag.js'; export {default as name} from './name.js'; export {default as referenceList} from './referenceList.js'; +export {default as referencedArtworkList} from './referencedArtworkList.js'; export {default as reverseContributionList} from './reverseContributionList.js'; export {default as reverseReferenceList} from './reverseReferenceList.js'; export {default as reverseSingleReferenceList} from './reverseSingleReferenceList.js'; diff --git a/src/data/composite/wiki-properties/referencedArtworkList.js b/src/data/composite/wiki-properties/referencedArtworkList.js new file mode 100644 index 00000000..bd2962de --- /dev/null +++ b/src/data/composite/wiki-properties/referencedArtworkList.js @@ -0,0 +1,47 @@ +import {input, templateCompositeFrom} from '#composite'; +import {isThingClass, validateAnnotatedReferenceList} from '#validators'; + +import {exposeDependency} from '#composite/control-flow'; +import {inputWikiData, 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)), + }), + + steps: () => [ + withResolvedArtworkReferenceList({ + list: input.updateValue(), + data: input('data'), + find: input('find'), + }), + + exposeDependency({dependency: '#resolvedArtworkReferenceList'}), + ], +}); |