« 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/sorting-rule.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/things/sorting-rule.js')
-rw-r--r--src/data/things/sorting-rule.js28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/data/things/sorting-rule.js b/src/data/things/sorting-rule.js
index e113955f..71b90277 100644
--- a/src/data/things/sorting-rule.js
+++ b/src/data/things/sorting-rule.js
@@ -3,7 +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 {V} from '#composite';
 import {chunkByProperties, compareArrays, unique} from '#sugar';
 import Thing from '#thing';
 import {isObject, isStringNonEmpty, anyOf, strictArrayOf} from '#validators';
@@ -52,11 +52,7 @@ export class SortingRule extends Thing {
 
     // Expose only
 
-    isSortingRule: [
-      exposeConstant({
-        value: input.value(true),
-      }),
-    ],
+    isSortingRule: exposeConstant(V(true)),
   });
 
   static [Thing.yamlDocumentSpec] = {
@@ -130,18 +126,14 @@ export class ThingSortingRule extends SortingRule {
 
     // Expose only
 
-    isThingSortingRule: [
-      exposeConstant({
-        value: input.value(true),
-      }),
-    ],
+    isThingSortingRule: exposeConstant(V(true)),
   });
 
-  static [Thing.yamlDocumentSpec] = Thing.extendDocumentSpec(SortingRule, {
+  static [Thing.yamlDocumentSpec] = {
     fields: {
       'By Properties': {property: 'properties'},
     },
-  });
+  };
 
   sort(sortable) {
     if (this.properties) {
@@ -237,14 +229,10 @@ export class DocumentSortingRule extends ThingSortingRule {
 
     // Expose only
 
-    isDocumentSortingRule: [
-      exposeConstant({
-        value: input.value(true),
-      }),
-    ],
+    isDocumentSortingRule: exposeConstant(V(true)),
   });
 
-  static [Thing.yamlDocumentSpec] = Thing.extendDocumentSpec(ThingSortingRule, {
+  static [Thing.yamlDocumentSpec] = {
     fields: {
       'Sort Documents': {property: 'filename'},
       'Select Documents Following': {property: 'selectDocumentsFollowing'},
@@ -257,7 +245,7 @@ export class DocumentSortingRule extends ThingSortingRule {
         'Select Documents Under',
       ]},
     ],
-  });
+  };
 
   static async apply(rule, {wikiData, dataPath, dry}) {
     const oldLayout = getThingLayoutForFilename(rule.filename, wikiData);