@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.
@@ -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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.0-alpha113",
3
+ "version": "0.1.0-alpha115",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",