« get me outta code hell

data: dynamicThingFromSingleReference -> resolvedReference - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-06 15:42:47 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-06 15:42:47 -0300
commit2437ac322a4c44f2fd9f6a77ac7a65bbb3afc2c0 (patch)
tree3df201d124ccb5cc561017b9c1f4f09090ad3910 /src/data/things/thing.js
parent007c70642a60ed83bd840f550aa06563d4ba6a99 (diff)
data: dynamicThingFromSingleReference -> resolvedReference
Diffstat (limited to 'src/data/things/thing.js')
-rw-r--r--src/data/things/thing.js40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 915474d4..36a1f58a 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -193,40 +193,23 @@ export default class Thing extends CacheableObject {
     // Corresponding dynamic property to referenceList, which takes the values
     // in the provided property and searches the specified wiki data for
     // matching actual Thing-subclass objects.
-    resolvedReferenceList({
-      list,
-      data,
-      find: findFunction,
-    }) {
+    resolvedReferenceList({list, data, find}) {
       return Thing.composite.from(`Thing.common.resolvedReferenceList`, [
         Thing.composite.withResolvedReferenceList({
-          list,
-          data,
-          to: '#things',
-          find: findFunction,
+          list, data, find,
           notFoundMode: 'filter',
         }),
-
-        Thing.composite.exposeDependency('#things'),
+        Thing.composite.exposeDependency('#resolvedReferenceList'),
       ]);
     },
 
     // Corresponding function for a single reference.
-    dynamicThingFromSingleReference: (
-      singleReferenceProperty,
-      thingDataProperty,
-      findFn
-    ) => ({
-      flags: {expose: true},
-
-      expose: {
-        dependencies: [singleReferenceProperty, thingDataProperty],
-        compute: ({
-          [singleReferenceProperty]: ref,
-          [thingDataProperty]: thingData,
-        }) => (ref && thingData ? findFn(ref, thingData, {mode: 'quiet'}) : null),
-      },
-    }),
+    resolvedReference({ref, data, find}) {
+      return Thing.composite.from(`Thing.common.resolvedReference`, [
+        Thing.composite.withResolvedReference({ref, data, find}),
+        Thing.composite.exposeDependency('#resolvedReference'),
+      ]);
+    },
 
     // Corresponding dynamic property to contribsByRef, which takes the values
     // in the provided property and searches the object's artistData for
@@ -273,10 +256,7 @@ export default class Thing extends CacheableObject {
     // you would use this to compute a corresponding "referenced *by* tracks"
     // property. Naturally, the passed ref list property is of the things in the
     // wiki data provided, not the requesting Thing itself.
-    reverseReferenceList({
-      data,
-      list,
-    }) {
+    reverseReferenceList({data, list}) {
       return Thing.composite.from(`Thing.common.reverseReferenceList`, [
         Thing.composite.withReverseReferenceList({data, list}),
         Thing.composite.exposeDependency('#reverseReferenceList'),