diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-04 20:22:42 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-18 22:56:00 -0300 |
commit | 32cafa563c289dc5893565afb4133e2a84ac4fcc (patch) | |
tree | cdd27a6dc377ed4ac8e85775c53e0197ab9ed0f4 /src/data/composite/wiki-data | |
parent | 06cf8a27117cf1b77104b75e1e34375f064134ed (diff) |
data: contribution: thingProperty
Diffstat (limited to 'src/data/composite/wiki-data')
-rw-r--r-- | src/data/composite/wiki-data/withResolvedContribs.js | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/data/composite/wiki-data/withResolvedContribs.js b/src/data/composite/wiki-data/withResolvedContribs.js index 7ff7b1bc..fd51c81e 100644 --- a/src/data/composite/wiki-data/withResolvedContribs.js +++ b/src/data/composite/wiki-data/withResolvedContribs.js @@ -8,7 +8,7 @@ import {input, templateCompositeFrom} from '#composite'; import find from '#find'; import {filterMultipleArrays, stitchArrays} from '#sugar'; import thingConstructors from '#things'; -import {is, isContributionList} from '#validators'; +import {is, isContributionList, isStringNonEmpty} from '#validators'; import {raiseOutputWithoutDependency} from '#composite/control-flow'; import {withPropertiesFromList} from '#composite/data'; @@ -26,6 +26,11 @@ export default templateCompositeFrom({ validate: is('exit', 'filter', 'null'), defaultValue: 'null', }), + + thingProperty: input({ + validate: isStringNonEmpty, + defaultValue: null, + }), }, outputs: ['#resolvedContribs'], @@ -39,6 +44,25 @@ export default templateCompositeFrom({ }), }), + { + dependencies: [ + input('thingProperty'), + input.staticDependency('from'), + ], + + compute: (continuation, { + [input('thingProperty')]: thingProperty, + [input.staticDependency('from')]: fromDependency, + }) => continuation({ + ['#thingProperty']: + (thingProperty + ? thingProperty + : !fromDependency?.startsWith('#') + ? fromDependency + : null), + }), + }, + withPropertiesFromList({ list: input('from'), properties: input.value(['artist', 'annotation']), @@ -62,10 +86,15 @@ export default templateCompositeFrom({ }, { - dependencies: ['#details', input.myself()], + dependencies: [ + '#details', + '#thingProperty', + input.myself(), + ], compute: (continuation, { ['#details']: details, + ['#thingProperty']: thingProperty, [input.myself()]: myself, }) => continuation({ ['#contributions']: @@ -75,6 +104,7 @@ export default templateCompositeFrom({ Object.assign(contrib, { ...details, thing: myself, + thingProperty: thingProperty, }); return contrib; |