« get me outta code hell

data: {Album, Track}.referencedByArtworks - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-11-19 09:03:20 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-11-19 09:22:22 -0400
commitd2bc9d725c83ab8d6131598b7763c7e711f9697a (patch)
tree052674ab1f6499d5dbc1af8b972118ad2ef90baa /src/data/composite
parent3baf0c1c8cf9989d4b6e50baa90fc24f1b99b8b5 (diff)
data: {Album, Track}.referencedByArtworks
Diffstat (limited to 'src/data/composite')
-rw-r--r--src/data/composite/wiki-properties/index.js1
-rw-r--r--src/data/composite/wiki-properties/reverseReferencedArtworkList.js39
2 files changed, 40 insertions, 0 deletions
diff --git a/src/data/composite/wiki-properties/index.js b/src/data/composite/wiki-properties/index.js
index e98c89fc..2de76912 100644
--- a/src/data/composite/wiki-properties/index.js
+++ b/src/data/composite/wiki-properties/index.js
@@ -24,6 +24,7 @@ export {default as referencedArtworkList} from './referencedArtworkList.js';
 export {default as reverseAnnotatedReferenceList} from './reverseAnnotatedReferenceList.js';
 export {default as reverseContributionList} from './reverseContributionList.js';
 export {default as reverseReferenceList} from './reverseReferenceList.js';
+export {default as reverseReferencedArtworkList} from './reverseReferencedArtworkList.js';
 export {default as reverseSingleReferenceList} from './reverseSingleReferenceList.js';
 export {default as seriesList} from './seriesList.js';
 export {default as simpleDate} from './simpleDate.js';
diff --git a/src/data/composite/wiki-properties/reverseReferencedArtworkList.js b/src/data/composite/wiki-properties/reverseReferencedArtworkList.js
new file mode 100644
index 00000000..2950bdb9
--- /dev/null
+++ b/src/data/composite/wiki-properties/reverseReferencedArtworkList.js
@@ -0,0 +1,39 @@
+import {input, templateCompositeFrom} from '#composite';
+import {combineWikiDataArrays} from '#wiki-data';
+
+import {exposeDependency} from '#composite/control-flow';
+import {inputWikiData, withReverseAnnotatedReferenceList}
+  from '#composite/wiki-data';
+
+export default templateCompositeFrom({
+  annotation: `reverseReferencedArtworkList`,
+
+  compose: false,
+
+  steps: () => [
+    {
+      dependencies: [
+        'albumData',
+        'trackData',
+      ],
+
+      compute: (continuation, {
+        albumData,
+        trackData,
+      }) => continuation({
+        ['#data']:
+          combineWikiDataArrays([
+            albumData,
+            trackData,
+          ]),
+      }),
+    },
+
+    withReverseAnnotatedReferenceList({
+      data: '#data',
+      list: input.value('referencedArtworks'),
+    }),
+
+    exposeDependency({dependency: '#reverseAnnotatedReferenceList'}),
+  ],
+});