« get me outta code hell

data: isAlbum, isTrack, isArtist, isCommentaryEntry, etc - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-07-10 08:28:41 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-07-10 08:28:41 -0300
commit0674d61d13ebaafe3b36dd84b7ab90db7f99ceb4 (patch)
treefa081814a1e44f003fb44b8cdbf6ed782c879c9b
parentb9afcbf668f52d55550eddcc9ff164ee66aadeae (diff)
data: isAlbum, isTrack, isArtist, isCommentaryEntry, etc
-rw-r--r--src/data/things/additional-file.js11
-rw-r--r--src/data/things/additional-name.js10
-rw-r--r--src/data/things/album.js18
-rw-r--r--src/data/things/art-tag.js14
-rw-r--r--src/data/things/artist.js8
-rw-r--r--src/data/things/artwork.js6
-rw-r--r--src/data/things/content.js42
-rw-r--r--src/data/things/contribution.js6
-rw-r--r--src/data/things/flash.js20
-rw-r--r--src/data/things/group.js16
-rw-r--r--src/data/things/homepage-layout.js42
-rw-r--r--src/data/things/language.js10
-rw-r--r--src/data/things/news-entry.js8
-rw-r--r--src/data/things/sorting-rule.js26
-rw-r--r--src/data/things/static-page.js10
-rw-r--r--src/data/things/track.js6
-rw-r--r--src/data/things/wiki-info.js10
17 files changed, 250 insertions, 13 deletions
diff --git a/src/data/things/additional-file.js b/src/data/things/additional-file.js
index 398d0af5..b15f62e0 100644
--- a/src/data/things/additional-file.js
+++ b/src/data/things/additional-file.js
@@ -2,10 +2,9 @@ import {input} from '#composite';
 import Thing from '#thing';
 import {isString, validateArrayItems} from '#validators';
 
-import {contentString, simpleString, thing} from '#composite/wiki-properties';
-
 import {exposeConstant, exposeUpdateValueOrContinue}
   from '#composite/control-flow';
+import {contentString, simpleString, thing} from '#composite/wiki-properties';
 
 export class AdditionalFile extends Thing {
   static [Thing.getPropertyDescriptors] = () => ({
@@ -26,6 +25,14 @@ export class AdditionalFile extends Thing {
         value: input.value([]),
       }),
     ],
+
+    // Expose only
+
+    isAdditionalFile: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {
diff --git a/src/data/things/additional-name.js b/src/data/things/additional-name.js
index 4c23f291..99f3ee46 100644
--- a/src/data/things/additional-name.js
+++ b/src/data/things/additional-name.js
@@ -1,5 +1,7 @@
+import {input} from '#composite';
 import Thing from '#thing';
 
+import {exposeConstant} from '#composite/control-flow';
 import {contentString, thing} from '#composite/wiki-properties';
 
 export class AdditionalName extends Thing {
@@ -10,6 +12,14 @@ export class AdditionalName extends Thing {
 
     name: contentString(),
     annotation: contentString(),
+
+    // Expose only
+
+    isAdditionalName: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {
diff --git a/src/data/things/album.js b/src/data/things/album.js
index a922e565..36b3c272 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -357,13 +357,13 @@ export class Album extends Thing {
       class: input.value(CreditingSourcesEntry),
     }),
 
-    // Additional files
+    // > Update & expose - Additional files
 
     additionalFiles: thingList({
       class: input.value(AdditionalFile),
     }),
 
-    // Update only
+    // > Update only
 
     find: soupyFind(),
     reverse: soupyReverse(),
@@ -378,7 +378,13 @@ export class Album extends Thing {
       class: input.value(WikiInfo),
     }),
 
-    // Expose only
+    // > Expose only
+
+    isAlbum: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
 
     commentatorArtists: commentatorArtists(),
 
@@ -992,6 +998,12 @@ export class TrackSection extends Thing {
 
     // Expose only
 
+    isTrackSection: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     directory: [
       withAlbum(),
 
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index 518f616b..e5c394be 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -7,8 +7,12 @@ import {unique} from '#sugar';
 import {isName} from '#validators';
 import {parseAdditionalNames, parseAnnotatedReferences} from '#yaml';
 
-import {exitWithoutDependency, exposeDependency, exposeUpdateValueOrContinue}
-  from '#composite/control-flow';
+import {
+  exitWithoutDependency,
+  exposeConstant,
+  exposeDependency,
+  exposeUpdateValueOrContinue,
+} from '#composite/control-flow';
 
 import {
   annotatedReferenceList,
@@ -79,6 +83,12 @@ export class ArtTag extends Thing {
 
     // Expose only
 
+    isArtTag: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     descriptionShort: [
       exitWithoutDependency({
         dependency: 'description',
diff --git a/src/data/things/artist.js b/src/data/things/artist.js
index 5b67051c..12abc4c3 100644
--- a/src/data/things/artist.js
+++ b/src/data/things/artist.js
@@ -12,7 +12,7 @@ import {isName, validateArrayItems} from '#validators';
 import {getKebabCase} from '#wiki-data';
 import {parseArtwork} from '#yaml';
 
-import {exitWithoutDependency} from '#composite/control-flow';
+import {exitWithoutDependency, exposeConstant} from '#composite/control-flow';
 
 import {
   constitutibleArtwork,
@@ -76,6 +76,12 @@ export class Artist extends Thing {
 
     // Expose only
 
+    isArtist: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     trackArtistContributions: reverseReferenceList({
       reverse: soupyReverse.input('trackArtistContributionsBy'),
     }),
diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js
index 57c293ca..4aced874 100644
--- a/src/data/things/artwork.js
+++ b/src/data/things/artwork.js
@@ -323,6 +323,12 @@ export class Artwork extends Thing {
 
     // Expose only
 
+    isArtwork: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     referencedByArtworks: reverseReferenceList({
       reverse: soupyReverse.input('artworksWhichReference'),
     }),
diff --git a/src/data/things/content.js b/src/data/things/content.js
index ca41ccaa..d2cf32dc 100644
--- a/src/data/things/content.js
+++ b/src/data/things/content.js
@@ -109,6 +109,12 @@ export class ContentEntry extends Thing {
 
     // Expose only
 
+    isContentEntry: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     annotationParts: [
       withAnnotationParts({
         mode: input.value('strings'),
@@ -151,6 +157,12 @@ export class CommentaryEntry extends ContentEntry {
   static [Thing.getPropertyDescriptors] = () => ({
     // Expose only
 
+    isCommentaryEntry: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     isWikiEditorCommentary: hasAnnotationPart({
       part: input.value('wiki editor'),
     }),
@@ -165,6 +177,12 @@ export class LyricsEntry extends ContentEntry {
 
     // Expose only
 
+    isLyricsEntry: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     isWikiLyrics: hasAnnotationPart({
       part: input.value('wiki lyrics'),
     }),
@@ -200,6 +218,26 @@ export class LyricsEntry extends ContentEntry {
   });
 }
 
-export class CreditingSourcesEntry extends ContentEntry {}
+export class CreditingSourcesEntry extends ContentEntry {
+  static [Thing.getPropertyDescriptors] = () => ({
+    // Expose only
+
+    isCreditingSourcesEntry: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+  });
+}
+
+export class ReferencingSourcesEntry extends ContentEntry {
+  static [Thing.getPropertyDescriptors] = () => ({
+    // Expose only
 
-export class ReferencingSourcesEntry extends ContentEntry {}
+    isReferencingSourceEntry: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+  });
+}
diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js
index 90e8eb79..31d5487e 100644
--- a/src/data/things/contribution.js
+++ b/src/data/things/contribution.js
@@ -144,6 +144,12 @@ export class Contribution extends Thing {
 
     // Expose only
 
+    isContribution: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     context: [
       withContributionContext(),
 
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 160221f0..73b22746 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -149,6 +149,12 @@ export class Flash extends Thing {
 
     // Expose only
 
+    isFlash: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     commentatorArtists: commentatorArtists(),
 
     act: [
@@ -317,6 +323,12 @@ export class FlashAct extends Thing {
 
     // Expose only
 
+    isFlashAct: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     side: [
       withFlashSide(),
       exposeDependency({dependency: '#flashSide'}),
@@ -372,6 +384,14 @@ export class FlashSide extends Thing {
     // Update only
 
     find: soupyFind(),
+
+    // Expose only
+
+    isFlashSide: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {
diff --git a/src/data/things/group.js b/src/data/things/group.js
index 0262a3a5..fc33a9d0 100644
--- a/src/data/things/group.js
+++ b/src/data/things/group.js
@@ -8,6 +8,8 @@ import Thing from '#thing';
 import {is} from '#validators';
 import {parseAnnotatedReferences, parseSerieses} from '#yaml';
 
+import {exposeConstant} from '#composite/control-flow';
+
 import {
   annotatedReferenceList,
   color,
@@ -58,6 +60,12 @@ export class Group extends Thing {
 
     // Expose only
 
+    isGroup: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     descriptionShort: {
       flags: {expose: true},
 
@@ -227,6 +235,14 @@ export class GroupCategory extends Thing {
     // Update only
 
     find: soupyFind(),
+
+    // Expose only
+
+    isGroupCategory: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.reverseSpecs] = {
diff --git a/src/data/things/homepage-layout.js b/src/data/things/homepage-layout.js
index 3a11c287..2456ca95 100644
--- a/src/data/things/homepage-layout.js
+++ b/src/data/things/homepage-layout.js
@@ -17,7 +17,7 @@ import {
   validateReference,
 } from '#validators';
 
-import {exposeDependency} from '#composite/control-flow';
+import {exposeConstant, exposeDependency} from '#composite/control-flow';
 import {withResolvedReference} from '#composite/wiki-data';
 
 import {
@@ -47,6 +47,14 @@ export class HomepageLayout extends Thing {
     sections: thingList({
       class: input.value(HomepageLayoutSection),
     }),
+
+    // Expose only
+
+    isHomepageLayout: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {
@@ -156,6 +164,14 @@ export class HomepageLayoutSection extends Thing {
     rows: thingList({
       class: input.value(HomepageLayoutRow),
     }),
+
+    // Expose only
+
+    isHomepageLayoutSection: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {
@@ -182,6 +198,12 @@ export class HomepageLayoutRow extends Thing {
 
     // Expose only
 
+    isHomepageLayoutRow: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     type: {
       flags: {expose: true},
 
@@ -233,6 +255,12 @@ export class HomepageLayoutActionsRow extends HomepageLayoutRow {
 
     // Expose only
 
+    isHomepageLayoutActionsRow: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     type: {
       flags: {expose: true},
       expose: {compute: () => 'actions'},
@@ -261,6 +289,12 @@ export class HomepageLayoutAlbumCarouselRow extends HomepageLayoutRow {
 
     // Expose only
 
+    isHomepageLayoutAlbumCarouselRow: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     type: {
       flags: {expose: true},
       expose: {compute: () => 'album carousel'},
@@ -321,6 +355,12 @@ export class HomepageLayoutAlbumGridRow extends HomepageLayoutRow {
 
     // Expose only
 
+    isHomepageLayoutAlbumGridRow: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     type: {
       flags: {expose: true},
       expose: {compute: () => 'album grid'},
diff --git a/src/data/things/language.js b/src/data/things/language.js
index e3689643..d9151551 100644
--- a/src/data/things/language.js
+++ b/src/data/things/language.js
@@ -1,8 +1,9 @@
-import { Temporal, toTemporalInstant } from '@js-temporal/polyfill';
+import {Temporal, toTemporalInstant} from '@js-temporal/polyfill';
 
 import {withAggregate} from '#aggregate';
 import CacheableObject from '#cacheable-object';
 import {logWarn} from '#cli';
+import {input} from '#composite';
 import * as html from '#html';
 import {empty} from '#sugar';
 import {isLanguageCode} from '#validators';
@@ -16,6 +17,7 @@ import {
   isExternalLinkStyle,
 } from '#external-links';
 
+import {exposeConstant} from '#composite/control-flow';
 import {externalFunction, flag, name} from '#composite/wiki-properties';
 
 export const languageOptionRegex = /{(?<name>[A-Z0-9_]+)}/g;
@@ -127,6 +129,12 @@ export class Language extends Thing {
 
     // Expose only
 
+    isLanguage: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     onlyIfOptions: {
       flags: {expose: true},
       expose: {
diff --git a/src/data/things/news-entry.js b/src/data/things/news-entry.js
index 43d1638e..28289f53 100644
--- a/src/data/things/news-entry.js
+++ b/src/data/things/news-entry.js
@@ -1,9 +1,11 @@
 export const NEWS_DATA_FILE = 'news.yaml';
 
+import {input} from '#composite';
 import {sortChronologically} from '#sort';
 import Thing from '#thing';
 import {parseDate} from '#yaml';
 
+import {exposeConstant} from '#composite/control-flow';
 import {contentString, directory, name, simpleDate}
   from '#composite/wiki-properties';
 
@@ -22,6 +24,12 @@ export class NewsEntry extends Thing {
 
     // Expose only
 
+    isNewsEntry: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     contentShort: {
       flags: {expose: true},
 
diff --git a/src/data/things/sorting-rule.js b/src/data/things/sorting-rule.js
index ccc4ad89..808a0085 100644
--- a/src/data/things/sorting-rule.js
+++ b/src/data/things/sorting-rule.js
@@ -3,6 +3,7 @@ export const SORTING_RULE_DATA_FILE = 'sorting-rules.yaml';
 import {readFile, writeFile} from 'node:fs/promises';
 import * as path from 'node:path';
 
+import {input} from '#composite';
 import {chunkByProperties, compareArrays, unique} from '#sugar';
 import Thing from '#thing';
 import {isObject, isStringNonEmpty, anyOf, strictArrayOf} from '#validators';
@@ -21,6 +22,7 @@ import {
   reorderDocumentsInYAMLSourceText,
 } from '#yaml';
 
+import {exposeConstant} from '#composite/control-flow';
 import {flag} from '#composite/wiki-properties';
 
 function isSelectFollowingEntry(value) {
@@ -46,6 +48,14 @@ export class SortingRule extends Thing {
       flags: {update: true, expose: true},
       update: {validate: isStringNonEmpty},
     },
+
+    // Expose only
+
+    isSortingRule: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {
@@ -118,6 +128,14 @@ export class ThingSortingRule extends SortingRule {
         validate: strictArrayOf(isStringNonEmpty),
       },
     },
+
+    // Expose only
+
+    isThingSortingRule: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = Thing.extendDocumentSpec(SortingRule, {
@@ -217,6 +235,14 @@ export class DocumentSortingRule extends ThingSortingRule {
       flags: {update: true, expose: true},
       update: {validate: isStringNonEmpty},
     },
+
+    // Expose only
+
+    isDocumentSortingRule: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = Thing.extendDocumentSpec(ThingSortingRule, {
diff --git a/src/data/things/static-page.js b/src/data/things/static-page.js
index 52a09c31..28167df2 100644
--- a/src/data/things/static-page.js
+++ b/src/data/things/static-page.js
@@ -2,11 +2,13 @@ export const DATA_STATIC_PAGE_DIRECTORY = 'static-page';
 
 import * as path from 'node:path';
 
+import {input} from '#composite';
 import {traverse} from '#node-utils';
 import {sortAlphabetically} from '#sort';
 import Thing from '#thing';
 import {isName} from '#validators';
 
+import {exposeConstant} from '#composite/control-flow';
 import {contentString, directory, flag, name, simpleString}
   from '#composite/wiki-properties';
 
@@ -36,6 +38,14 @@ export class StaticPage extends Thing {
     content: contentString(),
 
     absoluteLinks: flag(),
+
+    // Expose only
+
+    isStaticPage: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.findSpecs] = {
diff --git a/src/data/things/track.js b/src/data/things/track.js
index e652de52..3db5e183 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -413,6 +413,12 @@ export class Track extends Thing {
 
     // > Expose only
 
+    isTrack: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
+
     commentatorArtists: commentatorArtists(),
 
     date: [
diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js
index f97f9027..b6057735 100644
--- a/src/data/things/wiki-info.js
+++ b/src/data/things/wiki-info.js
@@ -13,7 +13,7 @@ import {
   isURL,
 } from '#validators';
 
-import {exitWithoutDependency} from '#composite/control-flow';
+import {exitWithoutDependency, exposeConstant} from '#composite/control-flow';
 
 import {
   contentString,
@@ -119,6 +119,14 @@ export class WikiInfo extends Thing {
         default: false,
       },
     },
+
+    // Expose only
+
+    isWikiInfo: [
+      exposeConstant({
+        value: input.value(true),
+      }),
+    ],
   });
 
   static [Thing.yamlDocumentSpec] = {