diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-04 21:22:53 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-04 21:22:53 -0300 |
commit | 0175df41994ed44d2dded79ac21badf463140e14 (patch) | |
tree | 950f92e8ee963fced5b16d4e5052e6d9d38950b4 /src/data/composite/wiki-properties | |
parent | 8e174abde6a6b9b46e2cf885115c58bedcfd0802 (diff) | |
parent | 527e4618fdc57d80ac79ca9ceb3eed60fca90d6b (diff) |
Merge branch 'fast-link-wiki-data' into preview
Diffstat (limited to 'src/data/composite/wiki-properties')
-rw-r--r-- | src/data/composite/wiki-properties/wikiData.js | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/data/composite/wiki-properties/wikiData.js b/src/data/composite/wiki-properties/wikiData.js index 4ea47785..5cea49a0 100644 --- a/src/data/composite/wiki-properties/wikiData.js +++ b/src/data/composite/wiki-properties/wikiData.js @@ -1,17 +1,29 @@ // General purpose wiki data constructor, for properties like artistData, // trackData, etc. -import {validateArrayItems, validateInstanceOf} from '#validators'; +import {input, templateCompositeFrom} from '#composite'; +import {validateWikiData} from '#validators'; -// TODO: Not templateCompositeFrom. +import {inputThingClass} from '#composite/wiki-data'; -// TODO: This should validate with validateWikiData. +// TODO: Kludge. +import Thing from '../../things/thing.js'; -export default function(thingClass) { - return { - flags: {update: true}, - update: { - validate: validateArrayItems(validateInstanceOf(thingClass)), - }, - }; -} +export default templateCompositeFrom({ + annotation: `wikiData`, + + compose: false, + + inputs: { + class: inputThingClass(), + }, + + update: ({ + [input.staticValue('class')]: thingClass, + }) => { + const referenceType = thingClass[Thing.referenceType]; + return {validate: validateWikiData({referenceType})}; + }, + + steps: () => [], +}); |