« get me outta code hell

data: declare {update} in higher-context locations - 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:
author(quasar) nebula <qznebula@protonmail.com>2023-09-19 10:16:52 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-19 10:16:52 -0300
commit33558828e70e4dd942bec1fbdb8aea3819ed8a19 (patch)
tree137bb45eb742c321fd4c221f15fd9412c1679ec9 /src/data/things/track.js
parentc6c1a6be4ee817c65ccc994cd6ae68a835aa406e (diff)
data: declare {update} in higher-context locations
Diffstat (limited to 'src/data/things/track.js')
-rw-r--r--src/data/things/track.js33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 28caf1d..135e6d1 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -121,15 +121,13 @@ export class Track extends Thing {
     coverArtFileExtension: [
       exitWithoutUniqueCoverArt(),
 
-      exposeUpdateValueOrContinue(),
+      exposeUpdateValueOrContinue({
+        validate: input.value(isFileExtension),
+      }),
 
       withPropertyFromAlbum({property: 'trackCoverArtFileExtension'}),
       exposeDependencyOrContinue({dependency: '#album.trackCoverArtFileExtension'}),
-
-      exposeConstant({
-        value: 'jpg',
-        update: {validate: isFileExtension},
-      }),
+      exposeConstant({value: 'jpg'}),
     ],
 
     // Date of cover art release. Like coverArtFileExtension, this represents
@@ -140,13 +138,12 @@ export class Track extends Thing {
       withHasUniqueCoverArt(),
       exitWithoutDependency({dependency: '#hasUniqueCoverArt', mode: 'falsy'}),
 
-      exposeUpdateValueOrContinue(),
+      exposeUpdateValueOrContinue({
+        validate: input.value(isDate),
+      }),
 
       withPropertyFromAlbum({property: 'trackArtDate'}),
-      exposeDependency({
-        dependency: '#album.trackArtDate',
-        update: {validate: isDate},
-      }),
+      exposeDependency({dependency: '#album.trackArtDate'}),
     ],
 
     commentary: commentary(),
@@ -175,7 +172,7 @@ export class Track extends Thing {
       inheritFromOriginalRelease({property: 'artistContribs'}),
 
       withResolvedContribs({
-        from: input.updateValue(),
+        from: input.updateValue({validate: isContributionList}),
       }).outputs({
         '#resolvedContribs': '#artistContribs',
       }),
@@ -183,10 +180,7 @@ export class Track extends Thing {
       exposeDependencyOrContinue({dependency: '#artistContribs'}),
 
       withPropertyFromAlbum({property: 'artistContribs'}),
-      exposeDependency({
-        dependency: '#album.artistContribs',
-        update: {validate: isContributionList},
-      }),
+      exposeDependency({dependency: '#album.artistContribs'}),
     ],
 
     contributorContribs: [
@@ -201,7 +195,7 @@ export class Track extends Thing {
       exitWithoutUniqueCoverArt(),
 
       withResolvedContribs({
-        from: input.updateValue(),
+        from: input.updateValue({validate: isContributionList}),
       }).outputs({
         '#resolvedContribs': '#coverArtistContribs',
       }),
@@ -209,10 +203,7 @@ export class Track extends Thing {
       exposeDependencyOrContinue({dependency: '#coverArtistContribs'}),
 
       withPropertyFromAlbum({property: 'trackCoverArtistContribs'}),
-      exposeDependency({
-        dependency: '#album.trackCoverArtistContribs',
-        update: {validate: isContributionList},
-      }),
+      exposeDependency({dependency: '#album.trackCoverArtistContribs'}),
     ],
 
     referencedTracks: [