« get me outta code hell

Merge branch 'preview' into time-tooltips - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-03 17:53:51 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-03 17:53:51 -0400
commit7039d7fa471318df40c1905cd5ac52688dc6adcf (patch)
tree6c859ab2b0ee7bf86089475952ec529f40b95b83 /src/data/things
parent168efd0f2685fa00259fffc9f26c7f6a30a61991 (diff)
parent2d054508f58147f5968a10f39c2f87ba62dd91f7 (diff)
Merge branch 'preview' into time-tooltips
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/track.js5
-rw-r--r--src/data/things/validators.js25
2 files changed, 23 insertions, 7 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index d25213c2..e3fe0804 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -43,7 +43,9 @@ import {
 
 import {
   exitWithoutUniqueCoverArt,
+  inferredAdditionalNameList,
   inheritFromOriginalRelease,
+  sharedAdditionalNameList,
   trackReverseReferenceList,
   withAlbum,
   withAlwaysReferenceByDirectory,
@@ -64,7 +66,10 @@ export class Track extends Thing {
 
     name: name('Unnamed Track'),
     directory: directory(),
+
     additionalNames: additionalNameList(),
+    sharedAdditionalNames: sharedAdditionalNameList(),
+    inferredAdditionalNames: inferredAdditionalNameList(),
 
     duration: duration(),
     urls: urls(),
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index 55eedbcf..ac91b456 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -429,13 +429,6 @@ export function isURL(string) {
   return true;
 }
 
-export const isAdditionalName = validateProperties({
-  name: isName,
-  annotation: optional(isStringNonEmpty),
-});
-
-export const isAdditionalNameList = validateArrayItems(isAdditionalName);
-
 export function validateReference(type = 'track') {
   return (ref) => {
     isStringNonEmpty(ref);
@@ -557,6 +550,24 @@ export function validateWikiData({
   };
 }
 
+export const isAdditionalName = validateProperties({
+  name: isName,
+  annotation: optional(isStringNonEmpty),
+
+  // TODO: This only allows indicating sourcing from a track.
+  // That's okay for the current limited use of "from", but
+  // could be expanded later.
+  from:
+    // Double TODO: Explicitly allowing both references and
+    // live objects to co-exist is definitely weird, and
+    // altogether questions the way we define validators...
+    optional(oneOf(
+      validateReferenceList('track'),
+      validateWikiData({referenceType: 'track'}))),
+});
+
+export const isAdditionalNameList = validateArrayItems(isAdditionalName);
+
 // Compositional utilities
 
 export function oneOf(...checks) {