@travetto/model 3.1.9 → 3.1.10
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 +0 -4
- package/package.json +4 -4
- package/src/registry/model.ts +4 -3
- package/src/types/model.ts +0 -4
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
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.
|
|
29
|
+
"@travetto/config": "^3.1.4",
|
|
30
30
|
"@travetto/di": "^3.1.1",
|
|
31
31
|
"@travetto/registry": "^3.1.1",
|
|
32
|
-
"@travetto/schema": "^3.1.
|
|
32
|
+
"@travetto/schema": "^3.1.4"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@travetto/cli": "^3.1.
|
|
35
|
+
"@travetto/cli": "^3.1.4",
|
|
36
36
|
"@travetto/test": "^3.1.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
package/src/registry/model.ts
CHANGED
|
@@ -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 (
|
|
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
|
-
|
|
138
|
-
|
|
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();
|