diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-04 20:25:05 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-12 17:26:32 -0300 |
commit | be402bfcad9a8ab5287ed15f942f5d4730d7490e (patch) | |
tree | 192b87ebba2f90ba383bb5e1b547d8b236643594 /src/data/composite/things | |
parent | ef84fb80de0a26fcb959fa6e6799cd01388d236f (diff) |
data: contribution: context
Diffstat (limited to 'src/data/composite/things')
-rw-r--r-- | src/data/composite/things/contribution/index.js | 1 | ||||
-rw-r--r-- | src/data/composite/things/contribution/withContributionContext.js | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/data/composite/things/contribution/index.js b/src/data/composite/things/contribution/index.js index c0506a2b..b06e8677 100644 --- a/src/data/composite/things/contribution/index.js +++ b/src/data/composite/things/contribution/index.js @@ -1 +1,2 @@ export {default as withContributionArtist} from './withContributionArtist.js'; +export {default as withContributionContext} from './withContributionContext.js'; diff --git a/src/data/composite/things/contribution/withContributionContext.js b/src/data/composite/things/contribution/withContributionContext.js new file mode 100644 index 00000000..83ad5b73 --- /dev/null +++ b/src/data/composite/things/contribution/withContributionContext.js @@ -0,0 +1,29 @@ +import {input, templateCompositeFrom} from '#composite'; + +import {withPropertiesFromObject} from '#composite/data'; + +export default templateCompositeFrom({ + annotation: `withContributionContext`, + + outputs: [ + '#contributionTarget', + '#contributionProperty', + ], + + steps: () => [ + { + dependencies: ['thing', 'thingProperty'], + + compute: (continuation, { + ['thing']: thing, + ['thingProperty']: thingProperty, + }) => continuation({ + ['#contributionTarget']: + thing.constructor[Symbol.for('Thing.referenceType')], + + ['#contributionProperty']: + thingProperty, + }), + }, + ], +}); |