« get me outta code hell

data: inputThingClass -> isThingClass, use global Thing symbols - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/singleReference.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-01-20 16:32:56 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-30 07:59:39 -0400
commit4739ac5fae824c6c985fca9ae34f6335f5c9c13e (patch)
tree571de29898c4702c2ddcf7661bd6f86f17bc650c /src/data/composite/wiki-properties/singleReference.js
parente57e540bd57ea9b25cf785327054f344347c40b1 (diff)
data: inputThingClass -> isThingClass, use global Thing symbols
Diffstat (limited to 'src/data/composite/wiki-properties/singleReference.js')
-rw-r--r--src/data/composite/wiki-properties/singleReference.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/data/composite/wiki-properties/singleReference.js b/src/data/composite/wiki-properties/singleReference.js
index 34bd2e6..db4fc9f 100644
--- a/src/data/composite/wiki-properties/singleReference.js
+++ b/src/data/composite/wiki-properties/singleReference.js
@@ -8,14 +8,10 @@
 //
 
 import {input, templateCompositeFrom} from '#composite';
-import {validateReference} from '#validators';
+import {isThingClass, validateReference} from '#validators';
 
 import {exposeDependency} from '#composite/control-flow';
-import {inputThingClass, inputWikiData, withResolvedReference}
-  from '#composite/wiki-data';
-
-// TODO: Kludge.
-import Thing from '../../things/thing.js';
+import {inputWikiData, withResolvedReference} from '#composite/wiki-data';
 
 export default templateCompositeFrom({
   annotation: `singleReference`,
@@ -23,17 +19,20 @@ export default templateCompositeFrom({
   compose: false,
 
   inputs: {
-    class: inputThingClass(),
+    class: input.staticValue({validate: isThingClass}),
+
     find: input({type: 'function'}),
+
     data: inputWikiData({allowMixedTypes: false}),
   },
 
   update: ({
     [input.staticValue('class')]: thingClass,
-  }) => {
-    const {[Thing.referenceType]: referenceType} = thingClass;
-    return {validate: validateReference(referenceType)};
-  },
+  }) => ({
+    validate:
+      validateReference(
+        thingClass[Symbol.for('Thing.referenceType')]),
+  }),
 
   steps: () => [
     withResolvedReference({