« get me outta code hell

Merge branch 'fast-link-wiki-data' into preview - 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>2023-11-04 21:22:53 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-11-04 21:22:53 -0300
commit0175df41994ed44d2dded79ac21badf463140e14 (patch)
tree950f92e8ee963fced5b16d4e5052e6d9d38950b4 /src/data/composite
parent8e174abde6a6b9b46e2cf885115c58bedcfd0802 (diff)
parent527e4618fdc57d80ac79ca9ceb3eed60fca90d6b (diff)
Merge branch 'fast-link-wiki-data' into preview
Diffstat (limited to 'src/data/composite')
-rw-r--r--src/data/composite/wiki-properties/wikiData.js34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/data/composite/wiki-properties/wikiData.js b/src/data/composite/wiki-properties/wikiData.js
index 4ea47785..5cea49a0 100644
--- a/src/data/composite/wiki-properties/wikiData.js
+++ b/src/data/composite/wiki-properties/wikiData.js
@@ -1,17 +1,29 @@
 // General purpose wiki data constructor, for properties like artistData,
 // trackData, etc.
 
-import {validateArrayItems, validateInstanceOf} from '#validators';
+import {input, templateCompositeFrom} from '#composite';
+import {validateWikiData} from '#validators';
 
-// TODO: Not templateCompositeFrom.
+import {inputThingClass} from '#composite/wiki-data';
 
-// TODO: This should validate with validateWikiData.
+// TODO: Kludge.
+import Thing from '../../things/thing.js';
 
-export default function(thingClass) {
-  return {
-    flags: {update: true},
-    update: {
-      validate: validateArrayItems(validateInstanceOf(thingClass)),
-    },
-  };
-}
+export default templateCompositeFrom({
+  annotation: `wikiData`,
+
+  compose: false,
+
+  inputs: {
+    class: inputThingClass(),
+  },
+
+  update: ({
+    [input.staticValue('class')]: thingClass,
+  }) => {
+    const referenceType = thingClass[Thing.referenceType];
+    return {validate: validateWikiData({referenceType})};
+  },
+
+  steps: () => [],
+});