« get me outta code hell

infra, data: cut unneeded boilerplate from top-level compositions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/index.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-09 09:16:50 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-09 09:16:50 -0300
commit7b32066dd9629bbb220c2e2425b5294070b5a0db (patch)
treed545d0a9a1e61ddb11c41f37631ae186420a253f /src/data/things/index.js
parentceaed5fef3ce2c5d59a6606a6318164b93294f2b (diff)
infra, data: cut unneeded boilerplate from top-level compositions
Diffstat (limited to 'src/data/things/index.js')
-rw-r--r--src/data/things/index.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/data/things/index.js b/src/data/things/index.js
index 3b73a77..4d8d9d1 100644
--- a/src/data/things/index.js
+++ b/src/data/things/index.js
@@ -2,6 +2,7 @@ import * as path from 'node:path';
 import {fileURLToPath} from 'node:url';
 
 import {logError} from '#cli';
+import {compositeFrom} from '#composite';
 import * as serialize from '#serialize';
 import {openAggregate, showAggregate} from '#sugar';
 
@@ -130,8 +131,16 @@ function evaluatePropertyDescriptors() {
         throw new Error(`Missing [Thing.getPropertyDescriptors] function`);
       }
 
-      constructor.propertyDescriptors =
-        constructor[Thing.getPropertyDescriptors](opts);
+      const results = constructor[Thing.getPropertyDescriptors](opts);
+
+      for (const [key, value] of Object.entries(results)) {
+        if (Array.isArray(value)) {
+          results[key] = compositeFrom(`${constructor.name}.${key}`, value);
+          continue;
+        }
+      }
+
+      constructor.propertyDescriptors = results;
     },
 
     showFailedClasses(failedClasses) {