« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-data/constituteOrContinue.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/wiki-data/constituteOrContinue.js')
-rw-r--r--src/data/composite/wiki-data/constituteOrContinue.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/data/composite/wiki-data/constituteOrContinue.js b/src/data/composite/wiki-data/constituteOrContinue.js
new file mode 100644
index 00000000..3527976e
--- /dev/null
+++ b/src/data/composite/wiki-data/constituteOrContinue.js
@@ -0,0 +1,34 @@
+import {input, templateCompositeFrom} from '#composite';
+
+import {withPropertyFromObject} from '#composite/data';
+
+import {
+  exposeDependencyOrContinue,
+  inputAvailabilityCheckMode,
+  raiseOutputWithoutDependency,
+} from '#composite/control-flow';
+
+export default templateCompositeFrom({
+  annotation: `constituteFrom`,
+
+  inputs: {
+    property: input({type: 'string', acceptsNull: true}),
+    from: input({type: 'object', acceptsNull: true}),
+    mode: inputAvailabilityCheckMode(),
+  },
+
+  steps: () => [
+    raiseOutputWithoutDependency({
+      dependency: input('property'),
+    }),
+
+    withPropertyFromObject({
+      property: input('property'),
+      object: input('from'),
+    }),
+
+    exposeDependencyOrContinue({
+      dependency: '#value',
+    }),
+  ],
+});