« get me outta code hell

data: wikiData: port to templateCompositeFrom syntax - 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>2023-11-04 20:43:29 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-11-04 20:43:29 -0300
commitc4eba52cd5023e3b503937b47e2bc6f77527d5c3 (patch)
tree606efb43ac331e45073890ff6bfff4546458f778 /src/data/composite/wiki-properties
parente4974b2af9419acd644497274bd49f39880b2282 (diff)
data: wikiData: port to templateCompositeFrom syntax
Diffstat (limited to 'src/data/composite/wiki-properties')
-rw-r--r--src/data/composite/wiki-properties/wikiData.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/data/composite/wiki-properties/wikiData.js b/src/data/composite/wiki-properties/wikiData.js
index 5965b949..5cea49a0 100644
--- a/src/data/composite/wiki-properties/wikiData.js
+++ b/src/data/composite/wiki-properties/wikiData.js
@@ -1,20 +1,29 @@
 // General purpose wiki data constructor, for properties like artistData,
 // trackData, etc.
 
+import {input, templateCompositeFrom} from '#composite';
 import {validateWikiData} from '#validators';
 
+import {inputThingClass} from '#composite/wiki-data';
+
 // TODO: Kludge.
 import Thing from '../../things/thing.js';
 
-// TODO: Not templateCompositeFrom.
+export default templateCompositeFrom({
+  annotation: `wikiData`,
+
+  compose: false,
+
+  inputs: {
+    class: inputThingClass(),
+  },
 
-export default function(thingClass) {
-  const referenceType = thingClass[Thing.referenceType];
+  update: ({
+    [input.staticValue('class')]: thingClass,
+  }) => {
+    const referenceType = thingClass[Thing.referenceType];
+    return {validate: validateWikiData({referenceType})};
+  },
 
-  return {
-    flags: {update: true},
-    update: {
-      validate: validateWikiData({referenceType}),
-    },
-  };
-}
+  steps: () => [],
+});