« get me outta code hell

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:
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/album.js6
-rw-r--r--src/data/things/art-tag.js6
-rw-r--r--src/data/things/artist.js4
-rw-r--r--src/data/things/cacheable-object.js4
-rw-r--r--src/data/things/flash.js4
-rw-r--r--src/data/things/group.js4
-rw-r--r--src/data/things/homepage-layout.js4
-rw-r--r--src/data/things/index.js15
-rw-r--r--src/data/things/thing.js16
-rw-r--r--src/data/things/track.js20
-rw-r--r--src/data/things/validators.js7
-rw-r--r--src/data/things/wiki-info.js4
12 files changed, 51 insertions, 43 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 0c87b7c1..c012c243 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -1,7 +1,7 @@
-import Thing from './thing.js';
+import {empty} from '#sugar';
+import find from '#find';
 
-import {empty} from '../../util/sugar.js';
-import find from '../../util/find.js';
+import Thing from './thing.js';
 
 export class Album extends Thing {
   static [Thing.referenceType] = 'album';
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index 75fb0f7b..c103c4d5 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -1,8 +1,6 @@
-import Thing from './thing.js';
+import {sortAlbumsTracksChronologically} from '#wiki-data';
 
-import {
-  sortAlbumsTracksChronologically,
-} from '../../util/wiki-data.js';
+import Thing from './thing.js';
 
 export class ArtTag extends Thing {
   static [Thing.referenceType] = 'tag';
diff --git a/src/data/things/artist.js b/src/data/things/artist.js
index f144b21f..522ca5f9 100644
--- a/src/data/things/artist.js
+++ b/src/data/things/artist.js
@@ -1,6 +1,6 @@
-import Thing from './thing.js';
+import find from '#find';
 
-import find from '../../util/find.js';
+import Thing from './thing.js';
 
 export class Artist extends Thing {
   static [Thing.referenceType] = 'artist';
diff --git a/src/data/things/cacheable-object.js b/src/data/things/cacheable-object.js
index 6a210cc1..ea705a61 100644
--- a/src/data/things/cacheable-object.js
+++ b/src/data/things/cacheable-object.js
@@ -74,9 +74,9 @@
 //      function, which provides a mapping of exposed property names to whether
 //      or not their dependencies are yet met.
 
-import {color, ENABLE_COLOR} from '../../util/cli.js';
+import {inspect as nodeInspect} from 'node:util';
 
-import {inspect as nodeInspect} from 'util';
+import {color, ENABLE_COLOR} from '#cli';
 
 function inspect(value) {
   return nodeInspect(value, {colors: ENABLE_COLOR});
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 1383fa83..6eb5234f 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -1,6 +1,6 @@
-import Thing from './thing.js';
+import find from '#find';
 
-import find from '../../util/find.js';
+import Thing from './thing.js';
 
 export class Flash extends Thing {
   static [Thing.referenceType] = 'flash';
diff --git a/src/data/things/group.js b/src/data/things/group.js
index 111d6715..ba339b3e 100644
--- a/src/data/things/group.js
+++ b/src/data/things/group.js
@@ -1,6 +1,6 @@
-import Thing from './thing.js';
+import find from '#find';
 
-import find from '../../util/find.js';
+import Thing from './thing.js';
 
 export class Group extends Thing {
   static [Thing.referenceType] = 'group';
diff --git a/src/data/things/homepage-layout.js b/src/data/things/homepage-layout.js
index a79dd77a..ec9e9556 100644
--- a/src/data/things/homepage-layout.js
+++ b/src/data/things/homepage-layout.js
@@ -1,6 +1,6 @@
-import Thing from './thing.js';
+import find from '#find';
 
-import find from '../../util/find.js';
+import Thing from './thing.js';
 
 export class HomepageLayout extends Thing {
   static [Thing.getPropertyDescriptors] = ({
diff --git a/src/data/things/index.js b/src/data/things/index.js
index 11b6b1a9..591cdc3b 100644
--- a/src/data/things/index.js
+++ b/src/data/things/index.js
@@ -1,12 +1,12 @@
-import {logError} from '../../util/cli.js';
-import {openAggregate, showAggregate} from '../../util/sugar.js';
+import * as path from 'node:path';
+import {fileURLToPath} from 'node:url';
 
-import * as path from 'path';
-import {fileURLToPath} from 'url';
+import {logError} from '#cli';
+import * as serialize from '#serialize';
+import {openAggregate, showAggregate} from '#sugar';
+import * as validators from '#validators';
 
 import Thing from './thing.js';
-import * as validators from './validators.js';
-import * as serialize from '../serialize.js';
 
 import * as albumClasses from './album.js';
 import * as artTagClasses from './art-tag.js';
@@ -20,6 +20,9 @@ import * as staticPageClasses from './static-page.js';
 import * as trackClasses from './track.js';
 import * as wikiInfoClasses from './wiki-info.js';
 
+export {default as Thing} from './thing.js';
+export {default as CacheableObject} from './cacheable-object.js';
+
 const allClassLists = {
   'album.js': albumClasses,
   'art-tag.js': artTagClasses,
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 5004f4e6..c2876f56 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -1,7 +1,12 @@
 // Thing: base class for wiki data types, providing wiki-specific utility
 // functions on top of essential CacheableObject behavior.
 
-import CacheableObject from './cacheable-object.js';
+import {inspect} from 'node:util';
+
+import {color} from '#cli';
+import find from '#find';
+import {empty} from '#sugar';
+import {getKebabCase} from '#wiki-data';
 
 import {
   isAdditionalFileList,
@@ -19,14 +24,9 @@ import {
   validateInstanceOf,
   validateReference,
   validateReferenceList,
-} from './validators.js';
+} from '#validators';
 
-import {inspect} from 'util';
-import {color} from '../../util/cli.js';
-import {empty} from '../../util/sugar.js';
-import {getKebabCase} from '../../util/wiki-data.js';
-
-import find from '../../util/find.js';
+import CacheableObject from './cacheable-object.js';
 
 export default class Thing extends CacheableObject {
   static referenceType = Symbol('Thing.referenceType');
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 36e3adbe..e176acb4 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -1,10 +1,10 @@
-import Thing from './thing.js';
+import {inspect} from 'node:util';
 
-import {inspect} from 'util';
+import {color} from '#cli';
+import find from '#find';
+import {empty} from '#sugar';
 
-import {color} from '../../util/cli.js';
-import find from '../../util/find.js';
-import {empty} from '../../util/sugar.js';
+import Thing from './thing.js';
 
 export class Track extends Thing {
   static [Thing.referenceType] = 'track';
@@ -47,7 +47,15 @@ export class Track extends Thing {
     hasCoverArt: {
       flags: {update: true, expose: true},
 
-      update: {validate: isBoolean},
+      update: {
+        validate(value) {
+          if (value !== false) {
+            throw new TypeError(`Expected false or null`);
+          }
+
+          return true;
+        },
+      },
 
       expose: {
         dependencies: ['albumData', 'coverArtistContribsByRef'],
diff --git a/src/data/things/validators.js b/src/data/things/validators.js
index 1754adf3..fc953c2a 100644
--- a/src/data/things/validators.js
+++ b/src/data/things/validators.js
@@ -1,8 +1,7 @@
-import {withAggregate} from '../../util/sugar.js';
+import {inspect as nodeInspect} from 'node:util';
 
-import {color, ENABLE_COLOR} from '../../util/cli.js';
-
-import {inspect as nodeInspect} from 'util';
+import {color, ENABLE_COLOR} from '#cli';
+import {withAggregate} from '#sugar';
 
 function inspect(value) {
   return nodeInspect(value, {colors: ENABLE_COLOR});
diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js
index adf085e5..e906cab1 100644
--- a/src/data/things/wiki-info.js
+++ b/src/data/things/wiki-info.js
@@ -1,6 +1,6 @@
-import Thing from './thing.js';
+import find from '#find';
 
-import find from '../../util/find.js';
+import Thing from './thing.js';
 
 export class WikiInfo extends Thing {
   static [Thing.getPropertyDescriptors] = ({