« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/composite/things/track/index.js1
-rw-r--r--src/data/composite/things/track/withPropertyFromAlbum.js48
-rw-r--r--src/data/things/track.js37
3 files changed, 24 insertions, 62 deletions
diff --git a/src/data/composite/things/track/index.js b/src/data/composite/things/track/index.js
index 24b1c01b..88fd3d45 100644
--- a/src/data/composite/things/track/index.js
+++ b/src/data/composite/things/track/index.js
@@ -1,4 +1,3 @@
 export {default as inheritContributionListFromMainRelease} from './inheritContributionListFromMainRelease.js';
 export {default as inheritFromMainRelease} from './inheritFromMainRelease.js';
-export {default as withPropertyFromAlbum} from './withPropertyFromAlbum.js';
 export {default as withPropertyFromMainRelease} from './withPropertyFromMainRelease.js';
diff --git a/src/data/composite/things/track/withPropertyFromAlbum.js b/src/data/composite/things/track/withPropertyFromAlbum.js
deleted file mode 100644
index a203c2e7..00000000
--- a/src/data/composite/things/track/withPropertyFromAlbum.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// Gets a single property from this track's album, providing it as the same
-// property name prefixed with '#album.' (by default).
-
-import {input, templateCompositeFrom} from '#composite';
-
-import {withPropertyFromObject} from '#composite/data';
-
-export default templateCompositeFrom({
-  annotation: `withPropertyFromAlbum`,
-
-  inputs: {
-    property: input.staticValue({type: 'string'}),
-    internal: input({type: 'boolean', defaultValue: false}),
-  },
-
-  outputs: ({
-    [input.staticValue('property')]: property,
-  }) => ['#album.' + property],
-
-  steps: () => [
-    // XXX: This is a ridiculous hack considering `defaultValue` above.
-    // If we were certain what was up, we'd just get around to fixing it LOL
-    {
-      dependencies: [input('internal')],
-      compute: (continuation, {
-        [input('internal')]: internal,
-      }) => continuation({
-        ['#internal']: internal ?? false,
-      }),
-    },
-
-    withPropertyFromObject({
-      object: 'album',
-      property: input('property'),
-      internal: '#internal',
-    }),
-
-    {
-      dependencies: ['#value', input.staticValue('property')],
-      compute: (continuation, {
-        ['#value']: value,
-        [input.staticValue('property')]: property,
-      }) => continuation({
-        ['#album.' + property]: value,
-      }),
-    },
-  ],
-});
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 75ffcfb7..39a1804f 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -89,7 +89,6 @@ import {
 import {
   inheritContributionListFromMainRelease,
   inheritFromMainRelease,
-  withPropertyFromAlbum,
 } from '#composite/things/track';
 
 export class Track extends Thing {
@@ -161,7 +160,8 @@ export class Track extends Thing {
         validate: input.value(isBoolean),
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('alwaysReferenceTracksByDirectory'),
       }),
 
@@ -306,7 +306,8 @@ export class Track extends Thing {
         validate: input.value(isContentString),
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackArtistText'),
       }),
 
@@ -324,7 +325,8 @@ export class Track extends Thing {
         dependency: '_artistText',
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackArtistText'),
       }),
 
@@ -352,7 +354,8 @@ export class Track extends Thing {
       // Secondary releases' artists may differ from the main release.
       inheritContributionListFromMainRelease(),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackArtistContribs'),
       }),
 
@@ -412,7 +415,8 @@ export class Track extends Thing {
 
       exposeDependencyOrContinue({dependency: '#trackSection.color'}),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('color'),
       }),
 
@@ -479,7 +483,8 @@ export class Track extends Thing {
         mode: input.value('empty'),
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackCoverArtistContribs'),
       }),
 
@@ -508,7 +513,8 @@ export class Track extends Thing {
         validate: input.value(isDate),
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackArtDate'),
       }),
 
@@ -531,7 +537,8 @@ export class Track extends Thing {
         validate: input.value(isFileExtension),
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackCoverArtFileExtension'),
       }),
 
@@ -550,7 +557,8 @@ export class Track extends Thing {
 
       exposeUpdateValueOrContinue(),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackDimensions'),
       }),
 
@@ -704,7 +712,8 @@ export class Track extends Thing {
         dependency: 'dateFirstReleased',
       }),
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('date'),
       }),
 
@@ -782,7 +791,8 @@ export class Track extends Thing {
             : continuation()),
       },
 
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('trackCoverArtistContribs'),
         internal: input.value(true),
       }),
@@ -1100,7 +1110,8 @@ export class Track extends Thing {
     ],
 
     groups: [
-      withPropertyFromAlbum({
+      withPropertyFromObject({
+        object: 'album',
         property: input.value('groups'),
       }),