« get me outta code hell

data: contribution: matchingPresets - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-properties/thing.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-04 20:31:12 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-06-12 17:26:33 -0300
commit6a33ef641ee51772fa64cf09595c73ee058f28f8 (patch)
tree49ab513b82597fe9f102eef7f1785928dfa4b81e /src/data/composite/wiki-properties/thing.js
parent5826cb1f9a21825f4998013a67ae7c9aa6bcb102 (diff)
data: contribution: matchingPresets
Diffstat (limited to 'src/data/composite/wiki-properties/thing.js')
-rw-r--r--src/data/composite/wiki-properties/thing.js31
1 files changed, 31 insertions, 0 deletions
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: () => [],
+});