« get me outta code hell

data, content: stub multiple artworks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-02 15:10:58 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:38 -0300
commit58fba5a7a859c5398e0e58f31d7e8e5a649db63b (patch)
tree39f4ac7ed8292d2af453263f63ecdfaf93cba42d /src/data/composite/wiki-properties
parent4030a62fc518627071dc792e2754d9d99fa46546 (diff)
data, content: stub multiple artworks
Only for tracks as of this commit, most anything else is in a
severely broken state aye
Diffstat (limited to 'src/data/composite/wiki-properties')
-rw-r--r--src/data/composite/wiki-properties/constitutibleArtworkList.js (renamed from src/data/composite/wiki-properties/constitutibleArtwork.js)17
-rw-r--r--src/data/composite/wiki-properties/index.js2
-rw-r--r--src/data/composite/wiki-properties/soupyReverse.js5
3 files changed, 13 insertions, 11 deletions
diff --git a/src/data/composite/wiki-properties/constitutibleArtwork.js b/src/data/composite/wiki-properties/constitutibleArtworkList.js
index e0f0f521..01429f03 100644
--- a/src/data/composite/wiki-properties/constitutibleArtwork.js
+++ b/src/data/composite/wiki-properties/constitutibleArtworkList.js
@@ -1,7 +1,7 @@
 import {input, templateCompositeFrom} from '#composite';
-import {isContributionList, isDate, validateThing} from '#validators';
+import {isContributionList, isDate, validateWikiData} from '#validators';
 
-import {exitWithoutDependency, exposeDependency, exposeUpdateValueOrContinue}
+import {exitWithoutDependency, exposeUpdateValueOrContinue}
   from '#composite/control-flow';
 import {withConstitutedArtwork} from '#composite/wiki-data';
 
@@ -29,14 +29,14 @@ export default templateCompositeFrom({
   steps: () => [
     exposeUpdateValueOrContinue({
       validate: input.value(
-        validateThing({
+        validateWikiData({
           referenceType: 'artwork',
         })),
     }),
 
     exitWithoutDependency({
       dependency: input('contribs'),
-      value: input.value(null),
+      value: input.value([]),
     }),
 
     {
@@ -60,8 +60,11 @@ export default templateCompositeFrom({
       dateProperty: '#dateProperty',
     }),
 
-    exposeDependency({
-      dependency: '#constitutedArtwork',
-    }),
+    {
+      dependencies: ['#constitutedArtwork'],
+      compute: ({
+        ['#constitutedArtwork']: constitutedArtwork,
+      }) => [constitutedArtwork],
+    },
   ],
 });
diff --git a/src/data/composite/wiki-properties/index.js b/src/data/composite/wiki-properties/index.js
index 7583630d..d346c7e5 100644
--- a/src/data/composite/wiki-properties/index.js
+++ b/src/data/composite/wiki-properties/index.js
@@ -9,7 +9,7 @@ export {default as annotatedReferenceList} from './annotatedReferenceList.js';
 export {default as color} from './color.js';
 export {default as commentary} from './commentary.js';
 export {default as commentatorArtists} from './commentatorArtists.js';
-export {default as constitutibleArtwork} from './constitutibleArtwork.js';
+export {default as constitutibleArtworkList} from './constitutibleArtworkList.js';
 export {default as contentString} from './contentString.js';
 export {default as contribsPresent} from './contribsPresent.js';
 export {default as contributionList} from './contributionList.js';
diff --git a/src/data/composite/wiki-properties/soupyReverse.js b/src/data/composite/wiki-properties/soupyReverse.js
index a3171738..b99c45da 100644
--- a/src/data/composite/wiki-properties/soupyReverse.js
+++ b/src/data/composite/wiki-properties/soupyReverse.js
@@ -24,9 +24,8 @@ soupyReverse.artworkContributionsBy =
     bindTo,
 
     referencing: thing =>
-      (thing[artworkProperty]
-        ? thing[artworkProperty].artistContribs
-        : []),
+      thing[artworkProperty]
+        .flatMap(artwork => artwork.artistContribs),
 
     referenced: contrib => [contrib.artist],
   });