« 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.js32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/data/composite/wiki-properties/referenceList.js b/src/data/composite/wiki-properties/referenceList.js
index bf718551..4d4cb106 100644
--- a/src/data/composite/wiki-properties/referenceList.js
+++ b/src/data/composite/wiki-properties/referenceList.js
@@ -8,44 +8,30 @@
 //
 
 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 {referenceListInputDescriptions, referenceListUpdateDescription}
+  from './helpers/reference-list-helpers.js';
+
 export default templateCompositeFrom({
   annotation: `referenceList`,
 
   compose: false,
 
   inputs: {
-    class: input.staticValue({
-      validate: isThingClass,
-      acceptsNull: true,
-      defaultValue: null,
-    }),
-
-    referenceType: input.staticValue({
-      type: 'string',
-      acceptsNull: true,
-      defaultValue: null,
-    }),
+    ...referenceListInputDescriptions(),
 
     data: inputWikiData({allowMixedTypes: true}),
-
     find: input({type: 'function'}),
   },
 
-  update: ({
-    [input.staticValue('class')]: thingClass,
-    [input.staticValue('referenceType')]: referenceType,
-  }) => ({
-    validate:
-      validateReferenceList(
-        (thingClass
-          ? thingClass[Symbol.for('Thing.referenceType')]
-          : referenceType)),
-  }),
+  update:
+    referenceListUpdateDescription({
+      validateReferenceList: validateReferenceList,
+    }),
 
   steps: () => [
     withResolvedReferenceList({