diff options
Diffstat (limited to 'src/data/things')
-rw-r--r-- | src/data/things/track.js | 5 | ||||
-rw-r--r-- | src/data/things/validators.js | 25 |
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) { |