« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/referenceList.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/wiki-properties/referenceList.js')
-rw-r--r--src/data/composite/wiki-properties/referenceList.js39
1 files changed, 13 insertions, 26 deletions
diff --git a/src/data/composite/wiki-properties/referenceList.js b/src/data/composite/wiki-properties/referenceList.js
index ebd5947c..4f8207b5 100644
--- a/src/data/composite/wiki-properties/referenceList.js
+++ b/src/data/composite/wiki-properties/referenceList.js
@@ -8,10 +8,14 @@
 //
 
 import {input, templateCompositeFrom} from '#composite';
-import {isThingClass, validateReferenceList} from '#validators';
+import {validateReferenceList} from '#validators';
 
 import {exposeDependency} from '#composite/control-flow';
-import {inputWikiData, withResolvedReferenceList} from '#composite/wiki-data';
+import {inputSoupyFind, inputWikiData, withResolvedReferenceList}
+  from '#composite/wiki-data';
+
+import {referenceListInputDescriptions, referenceListUpdateDescription}
+  from './helpers/reference-list-helpers.js';
 
 export default templateCompositeFrom({
   annotation: `referenceList`,
@@ -19,33 +23,16 @@ export default templateCompositeFrom({
   compose: false,
 
   inputs: {
-    class: input.staticValue({
-      validate: isThingClass,
-      acceptsNull: true,
-      defaultValue: null,
-    }),
-
-    referenceType: input.staticValue({
-      type: 'string',
-      acceptsNull: true,
-      defaultValue: null,
-    }),
-
-    data: inputWikiData({allowMixedTypes: false}),
+    ...referenceListInputDescriptions(),
 
-    find: input({type: 'function'}),
+    data: inputWikiData({allowMixedTypes: true}),
+    find: inputSoupyFind(),
   },
 
-  update: ({
-    [input.staticValue('class')]: thingClass,
-    [input.staticValue('referenceType')]: referenceType,
-  }) => ({
-    validate:
-      validateReferenceList(
-        (thingClass
-          ? thingClass[Symbol.for('Thing.referenceType')]
-          : referenceType)),
-  }),
+  update:
+    referenceListUpdateDescription({
+      validateReferenceList: validateReferenceList,
+    }),
 
   steps: () => [
     withResolvedReferenceList({