diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-03 13:26:52 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-12-03 13:26:52 -0400 |
commit | 4ba84964a90ec93d6d30d577e9e00c3e5b4fca83 (patch) | |
tree | b9d603370471360f62e43e9dfecf9c64c07b3d99 /src/data/things | |
parent | 5c1d9fb97b8ecc61c0343d6eee63a735c34e53c9 (diff) |
data: individual custom additional name list props
Diffstat (limited to 'src/data/things')
-rw-r--r-- | src/data/things/track.js | 9 | ||||
-rw-r--r-- | src/data/things/validators.js | 25 |
2 files changed, 25 insertions, 9 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js index 1f99ef53..08891719 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -24,6 +24,7 @@ import { import { additionalFiles, + additionalNameList, commentary, commentatorArtists, contributionList, @@ -42,8 +43,9 @@ import { import { exitWithoutUniqueCoverArt, + inferredAdditionalNameList, inheritFromOriginalRelease, - trackAdditionalNameList, + sharedAdditionalNameList, trackReverseReferenceList, withAlbum, withAlwaysReferenceByDirectory, @@ -64,7 +66,10 @@ export class Track extends Thing { name: name('Unnamed Track'), directory: directory(), - additionalNames: trackAdditionalNameList(), + + 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) { |