diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/data/things/album.js | 2 | ||||
-rw-r--r-- | src/data/things/art-tag.js | 11 | ||||
-rw-r--r-- | src/data/things/composite.js | 10 | ||||
-rw-r--r-- | src/data/things/thing.js | 20 |
4 files changed, 21 insertions, 22 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js index 44af5cbf..20a1a5b3 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -233,7 +233,7 @@ export class Album extends Thing { { dependencies: ['trackSections'], - compute: ({trackSections}, continuation) => + compute: (continuation, {trackSections}) => continuation({ '#trackRefs': trackSections .flatMap(section => section.tracks ?? []), diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js index 7e466555..ba3cbd0d 100644 --- a/src/data/things/art-tag.js +++ b/src/data/things/art-tag.js @@ -1,4 +1,4 @@ -import {exposeUpdateValueOrContinue} from '#composite'; +import {exposeUpdateValueOrContinue, input} from '#composite'; import {sortAlbumsTracksChronologically} from '#wiki-data'; import {isName} from '#validators'; @@ -22,18 +22,15 @@ export class ArtTag extends Thing { isContentWarning: flag(false), nameShort: [ - exposeUpdateValueOrContinue(), + exposeUpdateValueOrContinue({ + validate: input.value(isName), + }), { dependencies: ['name'], compute: ({name}) => name.replace(/ \([^)]*?\)$/, ''), }, - - { - flags: {update: true, expose: true}, - validate: {isName}, - }, ], // Update only diff --git a/src/data/things/composite.js b/src/data/things/composite.js index 83879c54..e2dbc70b 100644 --- a/src/data/things/composite.js +++ b/src/data/things/composite.js @@ -1693,7 +1693,7 @@ export function withPropertiesFromObject({ mapDependencies: {object}, options: {prefix, properties}, - compute: ({object, '#options': {prefix, properties}}, continuation) => + compute: (continuation, {object, '#options': {prefix, properties}}) => continuation( Object.fromEntries( properties.map(property => [ @@ -1729,7 +1729,7 @@ export function withPropertyFromList({ mapContinuation: {into}, options: {property}, - compute({list, '#options': {property}}, continuation) { + compute(continuation, {list, '#options': {property}}) { if (list === undefined || empty(list)) { return continuation({into: []}); } @@ -1765,7 +1765,7 @@ export function withPropertiesFromList({ mapDependencies: {list}, options: {prefix, properties}, - compute({list, '#options': {prefix, properties}}, continuation) { + compute(continuation, {list, '#options': {prefix, properties}}) { const lists = Object.fromEntries( properties.map(property => [`${prefix}.${property}`, []])); @@ -1811,7 +1811,7 @@ export function fillMissingListItems({ mapDependencies: {list, dependency}, mapContinuation: {into}, - compute: ({list, dependency}, continuation) => + compute: (continuation, {list, dependency}) => continuation({ into: list.map(item => item ?? dependency), }), @@ -1827,7 +1827,7 @@ export function fillMissingListItems({ mapContinuation: {into}, options: {value}, - compute: ({list, '#options': {value}}, continuation) => + compute: (continuation, {list, '#options': {value}}) => continuation({ into: list.map(item => item ?? value), }), diff --git a/src/data/things/thing.js b/src/data/things/thing.js index a75ff3e1..265cfe18 100644 --- a/src/data/things/thing.js +++ b/src/data/things/thing.js @@ -209,6 +209,8 @@ export function contributionList() { return compositeFrom({ annotation: `contributionList`, + compose: false, + update: {validate: isContributionList}, steps: [ @@ -598,12 +600,12 @@ export const withResolvedReference = templateCompositeFrom({ input('notFoundMode'), ], - compute({ + compute(continuation, { [input('ref')]: ref, [input('data')]: data, [input('find')]: findFunction, [input('notFoundMode')]: notFoundMode, - }, continuation) { + }) { const match = findFunction(ref, data, {mode: 'quiet'}); if (match === null && notFoundMode === 'exit') { @@ -659,11 +661,11 @@ export const withResolvedReferenceList = templateCompositeFrom({ { dependencies: [input('list'), input('data'), input('find')], - compute: ({ + compute: (continuation, { [input('list')]: list, [input('data')]: data, [input('find')]: findFunction, - }, continuation) => + }) => continuation({ '#matches': list.map(ref => findFunction(ref, data, {mode: 'quiet'})), }), @@ -671,7 +673,7 @@ export const withResolvedReferenceList = templateCompositeFrom({ { dependencies: ['#matches'], - compute: ({'#matches': matches}, continuation) => + compute: (continuation, {'#matches': matches}) => (matches.every(match => match) ? continuation.raiseOutput({ ['#resolvedReferenceList']: matches, @@ -681,10 +683,10 @@ export const withResolvedReferenceList = templateCompositeFrom({ { dependencies: ['#matches', input('notFoundMode')], - compute({ + compute(continuation, { ['#matches']: matches, [input('notFoundMode')]: notFoundMode, - }, continuation) { + }) { switch (notFoundMode) { case 'exit': return continuation.exit([]); @@ -732,11 +734,11 @@ export const withReverseReferenceList = templateCompositeFrom({ { dependencies: [input.myself(), input('data'), input('list')], - compute: ({ + compute: (continuation, { [input.myself()]: thisThing, [input('data')]: data, [input('list')]: refListProperty, - }, continuation) => + }) => continuation({ ['#reverseReferenceList']: data.filter(thing => thing[refListProperty].includes(thisThing)), |