From 6d0ad85bc718c2429d8dc124bba1329cc9615d12 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Mon, 4 Mar 2024 20:31:12 -0400 Subject: data: contribution: matchingPresets --- src/data/composite/wiki-properties/thing.js | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/data/composite/wiki-properties/thing.js (limited to 'src/data/composite/wiki-properties/thing.js') diff --git a/src/data/composite/wiki-properties/thing.js b/src/data/composite/wiki-properties/thing.js new file mode 100644 index 00000000..5b5d77dd --- /dev/null +++ b/src/data/composite/wiki-properties/thing.js @@ -0,0 +1,31 @@ +// An individual Thing, provided directly rather than by reference. + +import {input, templateCompositeFrom} from '#composite'; +import {isThingClass, validateThing} from '#validators'; + +export default templateCompositeFrom({ + annotation: `wikiData`, + + compose: false, + + inputs: { + class: input.staticValue({ + validate: isThingClass, + defaultValue: null, + }), + }, + + update: ({ + [input.staticValue('class')]: thingClass, + }) => ({ + validate: + validateThing({ + referenceType: + (thingClass + ? thingClass[Symbol.for('Thing.referenceType')] + : ''), + }), + }), + + steps: () => [], +}); -- cgit 1.3.0-6-gf8a5