diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-12-06 13:25:28 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-12-06 13:25:28 -0400 |
| commit | c7cc130f97c2a0f390ba0e07e3aa048395636817 (patch) | |
| tree | 91e4e4b5b1d5c70b364dc7e530b424ea3e422b09 /src/data/things/sorting-rule.js | |
| parent | f2161a3fe8ff9b574f53156d08ca7853427be8e4 (diff) | |
data: concise-retouch remaining toplevel property descriptors
Diffstat (limited to 'src/data/things/sorting-rule.js')
| -rw-r--r-- | src/data/things/sorting-rule.js | 28 |
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); |