« get me outta code hell

data: Artwork, constitutibleArtwork, etc - 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:
author(quasar) nebula <qznebula@protonmail.com>2025-03-31 15:04:20 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:35 -0300
commite8964d7a9f9dc787d4d84c0554d22149bb2daa0c (patch)
tree460944e7a5417ee8a998e37d7cbd05364398fd4f /src/data/composite/wiki-data
parent964273f8cb26c6d9df8ec827126167dc5b58ae27 (diff)
data: Artwork, constitutibleArtwork, etc
Not used in content yet.
Diffstat (limited to 'src/data/composite/wiki-data')
-rw-r--r--src/data/composite/wiki-data/index.js1
-rw-r--r--src/data/composite/wiki-data/withConstitutedArtwork.js44
2 files changed, 45 insertions, 0 deletions
diff --git a/src/data/composite/wiki-data/index.js b/src/data/composite/wiki-data/index.js
index be83e4c9..ee7411f2 100644
--- a/src/data/composite/wiki-data/index.js
+++ b/src/data/composite/wiki-data/index.js
@@ -12,6 +12,7 @@ export {default as inputSoupyFind} from './inputSoupyFind.js';
 export {default as inputSoupyReverse} from './inputSoupyReverse.js';
 export {default as inputWikiData} from './inputWikiData.js';
 export {default as withClonedThings} from './withClonedThings.js';
+export {default as withConstitutedArtwork} from './withConstitutedArtwork.js';
 export {default as withContributionListSums} from './withContributionListSums.js';
 export {default as withCoverArtDate} from './withCoverArtDate.js';
 export {default as withDirectory} from './withDirectory.js';
diff --git a/src/data/composite/wiki-data/withConstitutedArtwork.js b/src/data/composite/wiki-data/withConstitutedArtwork.js
new file mode 100644
index 00000000..9843588a
--- /dev/null
+++ b/src/data/composite/wiki-data/withConstitutedArtwork.js
@@ -0,0 +1,44 @@
+import {input, templateCompositeFrom} from '#composite';
+import thingConstructors from '#things';
+import {isContributionList} from '#validators';
+
+export default templateCompositeFrom({
+  annotation: `withConstitutedArtwork`,
+
+  inputs: {
+    contribsProperty: input({type: 'string'}),
+    artistProperty: input({type: 'string'}),
+    dateProperty: input({type: 'string'}),
+  },
+
+  outputs: ['#constitutedArtwork'],
+
+  steps: () => [
+    {
+      dependencies: [
+        input.myself(),
+        'find',
+
+        input('contribsProperty'),
+        input('dateProperty'),
+      ],
+
+      compute: (continuation, {
+        [input.myself()]: myself,
+        ['find']: find,
+
+        [input('contribsProperty')]: contribsProperty,
+        [input('dateProperty')]: dateProperty,
+      }) => continuation({
+        ['#constitutedArtwork']:
+          Object.assign(new thingConstructors.Artwork, {
+            thing: myself,
+            find: find,
+
+            artistContribsFromThingProperty: contribsProperty,
+            dateFromThingProperty: dateProperty,
+          }),
+      }),
+    },
+  ],
+});