« get me outta code hell

find, data, checks: dummy 'from' option in find() - 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:
author(quasar) nebula <qznebula@protonmail.com>2026-01-23 20:48:02 -0400
committer(quasar) nebula <qznebula@protonmail.com>2026-01-23 21:25:54 -0400
commit9bdcf0476f4b222cb806755510b1dc3d4d545e1e (patch)
treeeebfe47b2b50f26ac372fb3b3b8fe200e5262a59 /src/data
parent723a8b9e79601f445fd83517ba93c75e93368b47 (diff)
find, data, checks: dummy 'from' option in find()
Diffstat (limited to 'src/data')
-rw-r--r--src/data/checks.js11
-rw-r--r--src/data/composite/wiki-data/withResolvedReference.js7
-rw-r--r--src/data/composite/wiki-data/withResolvedReferenceList.js7
3 files changed, 19 insertions, 6 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index ebf6aad4..2b660421 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -229,6 +229,16 @@ function decoSuppressFindErrors(findFn, {property}) {
   }, findFn);
 }
 
+function decoFindThing(findFn, thing) {
+  return (ref, opts) => {
+    if (opts) {
+      return findFn(ref, {...opts, from: thing});
+    } else {
+      return findFn(ref, {from: thing});
+    }
+  };
+}
+
 // Warn about references across data which don't match anything.  This involves
 // using the find() functions on all references, setting it to 'error' mode, and
 // collecting everything in a structured logged (which gets logged if there are
@@ -549,6 +559,7 @@ export function filterReferenceErrors(wikiData, {
 
             findFn = decoSuppressFindErrors(findFn, {property});
             findFn = decoAnnotateFindErrors(findFn);
+            findFn = decoFindThing(findFn, thing);
 
             const fieldPropertyMessage =
               getFieldPropertyMessage(
diff --git a/src/data/composite/wiki-data/withResolvedReference.js b/src/data/composite/wiki-data/withResolvedReference.js
index d9a05367..58523a65 100644
--- a/src/data/composite/wiki-data/withResolvedReference.js
+++ b/src/data/composite/wiki-data/withResolvedReference.js
@@ -38,14 +38,15 @@ export default templateCompositeFrom({
     }),
 
     {
-      dependencies: [input('findOptions')],
+      dependencies: [input('findOptions'), input.myself()],
       compute: (continuation, {
         [input('findOptions')]: findOptions,
+        [input.myself()]: myself,
       }) => continuation({
         ['#findOptions']:
           (findOptions
-            ? {...findOptions, mode: 'quiet'}
-            : {mode: 'quiet'}),
+            ? {...findOptions, mode: 'quiet', from: myself}
+            : {mode: 'quiet', from: myself}),
       }),
     },
 
diff --git a/src/data/composite/wiki-data/withResolvedReferenceList.js b/src/data/composite/wiki-data/withResolvedReferenceList.js
index 14ce6919..23f3c365 100644
--- a/src/data/composite/wiki-data/withResolvedReferenceList.js
+++ b/src/data/composite/wiki-data/withResolvedReferenceList.js
@@ -49,14 +49,15 @@ export default templateCompositeFrom({
     }),
 
     {
-      dependencies: [input('findOptions')],
+      dependencies: [input('findOptions'), input.myself()],
       compute: (continuation, {
         [input('findOptions')]: findOptions,
+        [input.myself()]: myself,
       }) => continuation({
         ['#findOptions']:
           (findOptions
-            ? {...findOptions, mode: 'quiet'}
-            : {mode: 'quiet'}),
+            ? {...findOptions, mode: 'quiet', from: myself}
+            : {mode: 'quiet', from: myself}),
       }),
     },