diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-23 14:40:15 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-23 14:40:24 -0300 |
commit | 0df2ba538cfced993ec6794a589512302a62373d (patch) | |
tree | 342d6cce5acd37555940a483b3c1aefb3222394a /src/data/composite/things/artwork/withPropertyFromMainArtwork.js | |
parent | ca8121c2225fe7dfa97c604ca08ae241e5fe84d7 (diff) |
data: Artwork: withAttachedArtwork & friends
Diffstat (limited to 'src/data/composite/things/artwork/withPropertyFromMainArtwork.js')
-rw-r--r-- | src/data/composite/things/artwork/withPropertyFromMainArtwork.js | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/src/data/composite/things/artwork/withPropertyFromMainArtwork.js b/src/data/composite/things/artwork/withPropertyFromMainArtwork.js deleted file mode 100644 index a0233119..00000000 --- a/src/data/composite/things/artwork/withPropertyFromMainArtwork.js +++ /dev/null @@ -1,100 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; - -import {withResultOfAvailabilityCheck} from '#composite/control-flow'; -import {withPropertyFromObject} from '#composite/data'; - -import withContainingArtworkList from './withContainingArtworkList.js'; - -function getOutputName({ - [input.staticValue('property')]: property, -}) { - if (property) { - return `#mainArtwork.${property}`; - } else { - return '#value'; - } -} - -export default templateCompositeFrom({ - annotation: `withPropertyFromMainArtwork`, - - inputs: { - property: input({type: 'string'}), - onlyIfAttached: input({type: 'boolean', defaultValue: false}), - }, - - outputs: inputs => [getOutputName(inputs)], - - steps: () => [ - { - dependencies: [input.staticValue('property')], - compute: (continuation, inputs) => - continuation({'#output': getOutputName(inputs)}), - }, - - { - dependencies: [input('onlyIfAttached'), 'attachAbove', '#output'], - compute: (continuation, { - [input('onlyIfAttached')]: onlyIfAttached, - ['attachAbove']: attachAbove, - ['#output']: output, - }) => - (onlyIfAttached && attachAbove - ? continuation() - : onlyIfAttached - ? continuation.raiseOutput({[output]: null}) - : continuation()), - }, - - withContainingArtworkList(), - - withResultOfAvailabilityCheck({ - from: '#containingArtworkList', - }), - - { - dependencies: ['#availability', '#output'], - compute: (continuation, { - ['#availability']: availability, - ['#output']: output, - }) => - (availability - ? continuation() - : continuation.raiseOutput({[output]: null})), - }, - - { - dependencies: ['#containingArtworkList'], - compute: (continuation, { - ['#containingArtworkList']: list, - }) => - continuation({'#mainArtwork': list[0]}), - }, - - { - dependencies: [input.myself(), '#mainArtwork', '#output'], - compute: (continuation, { - [input.myself()]: myself, - ['#mainArtwork']: mainArtwork, - ['#output']: output, - }) => - (myself === mainArtwork - ? continuation.raiseOutput({[output]: null}) - : continuation()), - }, - - withPropertyFromObject({ - object: '#mainArtwork', - property: input('property'), - }), - - { - dependencies: ['#value', '#output'], - compute: (continuation, { - ['#value']: value, - ['#output']: output, - }) => - continuation.raiseOutput({[output]: value}), - }, - ], -}); |