« 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
diff options
context:
space:
mode:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/composite/things/content/contentArtists.js40
-rw-r--r--src/data/composite/things/content/index.js2
-rw-r--r--src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js (renamed from src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js)0
-rw-r--r--src/data/things/content.js27
4 files changed, 25 insertions, 44 deletions
diff --git a/src/data/composite/things/content/contentArtists.js b/src/data/composite/things/content/contentArtists.js
deleted file mode 100644
index 8d5db5a5..00000000
--- a/src/data/composite/things/content/contentArtists.js
+++ /dev/null
@@ -1,40 +0,0 @@
-import {input, templateCompositeFrom} from '#composite';
-import {validateReferenceList} from '#validators';
-
-import {exitWithoutDependency, exposeDependency}
-  from '#composite/control-flow';
-import {withResolvedReferenceList} from '#composite/wiki-data';
-import {soupyFind} from '#composite/wiki-properties';
-
-import withExpressedOrImplicitArtistReferences
-  from './helpers/withExpressedOrImplicitArtistReferences.js';
-
-export default templateCompositeFrom({
-  annotation: `contentArtists`,
-
-  compose: false,
-
-  update: {
-    validate: validateReferenceList('artist'),
-  },
-
-  steps: () => [
-    withExpressedOrImplicitArtistReferences({
-      from: input.updateValue(),
-    }),
-
-    exitWithoutDependency({
-      dependency: '#artistReferences',
-      value: input.value([]),
-    }),
-
-    withResolvedReferenceList({
-      list: '#artistReferences',
-      find: soupyFind.input('artist'),
-    }),
-
-    exposeDependency({
-      dependency: '#resolvedReferenceList',
-    }),
-  ],
-});
diff --git a/src/data/composite/things/content/index.js b/src/data/composite/things/content/index.js
index 37d6fdc5..27bf7c53 100644
--- a/src/data/composite/things/content/index.js
+++ b/src/data/composite/things/content/index.js
@@ -1,4 +1,4 @@
-export {default as contentArtists} from './contentArtists.js';
 export {default as hasAnnotationPart} from './hasAnnotationPart.js';
 export {default as withAnnotationPartNodeLists} from './withAnnotationPartNodeLists.js';
+export {default as withExpressedOrImplicitArtistReferences} from './withExpressedOrImplicitArtistReferences.js';
 export {default as withWebArchiveDate} from './withWebArchiveDate.js';
diff --git a/src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js b/src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js
index 69da8c75..69da8c75 100644
--- a/src/data/composite/things/content/helpers/withExpressedOrImplicitArtistReferences.js
+++ b/src/data/composite/things/content/withExpressedOrImplicitArtistReferences.js
diff --git a/src/data/things/content.js b/src/data/things/content.js
index 49a9a0d9..8a255ac3 100644
--- a/src/data/things/content.js
+++ b/src/data/things/content.js
@@ -1,11 +1,12 @@
 import {input} from '#composite';
 import {transposeArrays} from '#sugar';
 import Thing from '#thing';
-import {is, isDate} from '#validators';
+import {is, isDate, validateReferenceList} from '#validators';
 import {parseDate} from '#yaml';
 
 import {withFilteredList, withMappedList, withPropertyFromList}
   from '#composite/data';
+import {withResolvedReferenceList} from '#composite/wiki-data';
 import {contentString, simpleDate, soupyFind, thing}
   from '#composite/wiki-properties';
 
@@ -19,9 +20,9 @@ import {
 } from '#composite/control-flow';
 
 import {
-  contentArtists,
   hasAnnotationPart,
   withAnnotationPartNodeLists,
+  withExpressedOrImplicitArtistReferences,
   withWebArchiveDate,
 } from '#composite/things/content';
 
@@ -31,7 +32,27 @@ export class ContentEntry extends Thing {
 
     thing: thing(),
 
-    artists: contentArtists(),
+    artists: [
+      withExpressedOrImplicitArtistReferences({
+        from: input.updateValue({
+          validate: validateReferenceList('artist'),
+        }),
+      }),
+
+      exitWithoutDependency({
+        dependency: '#artistReferences',
+        value: input.value([]),
+      }),
+
+      withResolvedReferenceList({
+        list: '#artistReferences',
+        find: soupyFind.input('artist'),
+      }),
+
+      exposeDependency({
+        dependency: '#resolvedReferenceList',
+      }),
+    ],
 
     artistText: contentString(),