From fd102ee597e2ad2ba8f0950ce1a16fd34029963d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 18 Sep 2023 13:26:18 -0300 Subject: data: MORE composite wip --- src/data/things/track.js | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'src/data/things/track.js') diff --git a/src/data/things/track.js b/src/data/things/track.js index 870b9913..b41dbb5b 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -140,9 +140,11 @@ export class Track extends Thing { artistContribs: [ inheritFromOriginalRelease({property: 'artistContribs'}), - withResolvedContribs - .inputs({from: input.updateValue()}) - .outputs({into: '#artistContribs'}), + withResolvedContribs({ + from: input.updateValue(), + }).outputs({ + '#resolvedContribs': '#artistContribs', + }), exposeDependencyOrContinue({dependency: '#artistContribs'}), @@ -164,9 +166,11 @@ export class Track extends Thing { coverArtistContribs: [ exitWithoutUniqueCoverArt(), - withResolvedContribs - .inputs({from: input.updateValue()}) - .outputs({into: '#coverArtistContribs'}), + withResolvedContribs({ + from: input.updateValue(), + }).outputs({ + '#resolvedContribs': '#coverArtistContribs', + }), exposeDependencyOrContinue({dependency: '#coverArtistContribs'}), @@ -400,7 +404,7 @@ export const withPropertyFromAlbum = templateCompositeFrom({ annotation: `withPropertyFromAlbum`, inputs: { - property: input({type: 'string'}), + property: input.staticValue({type: 'string'}), notFoundMode: input({ validate: oneOf('exit', 'null'), @@ -409,12 +413,10 @@ export const withPropertyFromAlbum = templateCompositeFrom({ }, outputs: { - into: { - dependencies: [input.staticValue('property')], - default: ({ - [input.staticValue('property')]: property, - }) => '#album.' + property, - }, + dependencies: [input.staticValue('property')], + compute: ({ + [input.staticValue('property')]: property, + }) => ['#album.' + property], }, steps: () => [ @@ -422,9 +424,20 @@ export const withPropertyFromAlbum = templateCompositeFrom({ notFoundMode: input('notFoundMode'), }), - withPropertyFromObject - .inputs({object: '#album', property: input('property')}) - .outputs({into: 'into'}), + withPropertyFromObject({ + object: '#album', + property: input('property'), + }), + + { + dependencies: ['#value', input.staticValue('property')], + compute: (continuation, { + ['#value']: value, + [input.staticValue('property')]: property, + }) => continuation({ + ['#album.' + property]: value, + }), + }, ], }); -- cgit 1.3.0-6-gf8a5