@travetto/model 3.1.0-rc.7 → 3.1.0-rc.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model",
3
- "version": "3.1.0-rc.7",
3
+ "version": "3.1.0-rc.9",
4
4
  "description": "Datastore abstraction for core operations.",
5
5
  "keywords": [
6
6
  "datastore",
@@ -26,13 +26,13 @@
26
26
  "directory": "module/model"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^3.1.0-rc.6",
30
- "@travetto/di": "^3.1.0-rc.3",
29
+ "@travetto/config": "^3.1.0-rc.7",
30
+ "@travetto/di": "^3.1.0-rc.4",
31
31
  "@travetto/registry": "^3.1.0-rc.3",
32
- "@travetto/schema": "^3.1.0-rc.5"
32
+ "@travetto/schema": "^3.1.0-rc.6"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/cli": "^3.1.0-rc.8",
35
+ "@travetto/cli": "^3.1.0-rc.9",
36
36
  "@travetto/test": "^3.1.0-rc.4"
37
37
  },
38
38
  "peerDependenciesMeta": {
@@ -96,6 +96,10 @@ export class ModelCrudUtil {
96
96
  SchemaRegistry.ensureInstanceTypeField(cls, item);
97
97
  }
98
98
 
99
+ if (item.prePersist) {
100
+ await item.prePersist();
101
+ }
102
+
99
103
  let errors: ValidationError[] = [];
100
104
  try {
101
105
  await SchemaValidator.validate(cls, item);
@@ -112,11 +116,6 @@ export class ModelCrudUtil {
112
116
  if (errors.length) {
113
117
  throw new ValidationResultError(errors);
114
118
  }
115
-
116
- if (item.prePersist) {
117
- await item.prePersist();
118
- }
119
-
120
119
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
121
120
  return item as T;
122
121
  }