« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/track.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/track.js')
-rw-r--r--src/data/things/track.js45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 870b991..b41dbb5 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,
+      }),
+    },
   ],
 });