diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 07:37:14 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-11-14 07:37:14 -0400 |
commit | 913f418eadb0b085c805ff1c83b749a0ce620741 (patch) | |
tree | 6d369056d724552ac5191930ae87c05b93ee64fc /src/data/composite/wiki-properties | |
parent | db0fd78ca60fc695f87d1f3adf53967bdae2796f (diff) |
data: annotated artwork references
Not used on-site, but this is all coded internally.
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'}), + ], +}); |