@snowtop/ent 0.1.0-alpha113 → 0.1.0-alpha115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action/orchestrator.js +12 -0
- package/package.json +1 -1
package/action/orchestrator.js
CHANGED
|
@@ -290,6 +290,18 @@ class Orchestrator {
|
|
|
290
290
|
if (!val) {
|
|
291
291
|
continue;
|
|
292
292
|
}
|
|
293
|
+
if (field.valid) {
|
|
294
|
+
let valid = field.valid(val);
|
|
295
|
+
if (util_1.types.isPromise(valid)) {
|
|
296
|
+
valid = await valid;
|
|
297
|
+
}
|
|
298
|
+
// if not valid, don't format and don't pass to ent?
|
|
299
|
+
// or just early throw here
|
|
300
|
+
if (!valid) {
|
|
301
|
+
continue;
|
|
302
|
+
// throw new Error(`invalid field ${fieldName} with value ${val}`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
293
305
|
// nested so it's not JSON stringified or anything like that
|
|
294
306
|
val = field.format(formatted[dbKey], true);
|
|
295
307
|
if (util_1.types.isPromise(val)) {
|