@travetto/model 3.1.9 → 3.1.11

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/README.md CHANGED
@@ -216,10 +216,6 @@ export interface ModelType {
216
216
  * If not provided, will be computed on create
217
217
  */
218
218
  id: string;
219
- /**
220
- * Type of model to save
221
- */
222
- type?: string;
223
219
  /**
224
220
  * Run before saving
225
221
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model",
3
- "version": "3.1.9",
3
+ "version": "3.1.11",
4
4
  "description": "Datastore abstraction for core operations.",
5
5
  "keywords": [
6
6
  "datastore",
@@ -26,14 +26,14 @@
26
26
  "directory": "module/model"
27
27
  },
28
28
  "dependencies": {
29
- "@travetto/config": "^3.1.3",
30
- "@travetto/di": "^3.1.1",
31
- "@travetto/registry": "^3.1.1",
32
- "@travetto/schema": "^3.1.3"
29
+ "@travetto/config": "^3.1.5",
30
+ "@travetto/di": "^3.1.2",
31
+ "@travetto/registry": "^3.1.2",
32
+ "@travetto/schema": "^3.1.5"
33
33
  },
34
34
  "peerDependencies": {
35
- "@travetto/cli": "^3.1.3",
36
- "@travetto/test": "^3.1.1"
35
+ "@travetto/cli": "^3.1.5",
36
+ "@travetto/test": "^3.1.2"
37
37
  },
38
38
  "peerDependenciesMeta": {
39
39
  "@travetto/cli": {
@@ -63,7 +63,7 @@ class $ModelRegistry extends MetadataRegistry<ModelOptions<ModelType>> {
63
63
  const view = schema.views[AllViewⲐ].schema;
64
64
  delete view.id.required; // Allow ids to be optional
65
65
 
66
- if ('type' in view && this.getBaseModel(cls) !== cls) {
66
+ if (schema.subTypeField in view && this.getBaseModel(cls) !== cls) {
67
67
  config.subType = !!schema.subTypeName; // Copy from schema
68
68
  delete view[schema.subTypeField].required; // Allow type to be optional
69
69
  }
@@ -134,8 +134,9 @@ class $ModelRegistry extends MetadataRegistry<ModelOptions<ModelType>> {
134
134
  getStore(cls: Class): string {
135
135
  if (!this.stores.has(cls)) {
136
136
  const config = this.get(cls) ?? this.getOrCreatePending(cls);
137
- if (config.subType) {
138
- return this.getStore(this.getBaseModel(cls));
137
+ const base = this.getBaseModel(cls);
138
+ if (base !== cls) {
139
+ return this.getStore(base);
139
140
  }
140
141
 
141
142
  const name = config.store ?? cls.name.toLowerCase();
@@ -13,10 +13,6 @@ export interface ModelType {
13
13
  * If not provided, will be computed on create
14
14
  */
15
15
  id: string;
16
- /**
17
- * Type of model to save
18
- */
19
- type?: string;
20
16
  /**
21
17
  * Run before saving
22
18
  */