« 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/composite/wiki-data
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/wiki-data')
-rw-r--r--src/data/composite/wiki-data/withResolvedSeriesList.js28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/data/composite/wiki-data/withResolvedSeriesList.js b/src/data/composite/wiki-data/withResolvedSeriesList.js
index 8a4a4f99..bd2b0ecf 100644
--- a/src/data/composite/wiki-data/withResolvedSeriesList.js
+++ b/src/data/composite/wiki-data/withResolvedSeriesList.js
@@ -1,7 +1,7 @@
 import {input, templateCompositeFrom} from '#composite';
 import find from '#find';
 import {stitchArrays} from '#sugar';
-import {isSeriesList} from '#validators';
+import {isSeriesList, validateThing} from '#validators';
 
 import {raiseOutputWithoutDependency} from '#composite/control-flow';
 
@@ -18,6 +18,10 @@ export default templateCompositeFrom({
   annotation: `withResolvedSeriesList`,
 
   inputs: {
+    group: input({
+      validate: validateThing({referenceType: 'group'}),
+    }),
+
     list: input({
       validate: isSeriesList,
       acceptsNull: true,
@@ -84,12 +88,30 @@ export default templateCompositeFrom({
         ['#serieses.description']: description,
         ['#serieses.albums']: albums,
       }) => continuation({
-        ['#resolvedSeriesList']:
+        ['#seriesProperties']:
           stitchArrays({
             name,
             description,
             albums,
-          }),
+          }).map(properties => ({
+              ...properties,
+              group: input
+            }))
+      }),
+    },
+
+    {
+      dependencies: ['#seriesProperties', input('group')],
+      compute: (continuation, {
+        ['#seriesProperties']: seriesProperties,
+        [input('group')]: group,
+      }) => continuation({
+        ['#resolvedSeriesList']:
+          seriesProperties
+            .map(properties => ({
+              ...properties,
+              group,
+            })),
       }),
     },
   ],