@travetto/model 3.3.4 → 3.3.6
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 +2 -2
- package/src/registry/model.ts +7 -10
- package/src/service/stream.ts +12 -0
- package/support/test/polymorphism.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.6",
|
|
4
4
|
"description": "Datastore abstraction for core operations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datastore",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@travetto/cli": "^3.3.5",
|
|
36
|
-
"@travetto/test": "^3.3.
|
|
36
|
+
"@travetto/test": "^3.3.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"@travetto/cli": {
|
package/src/registry/model.ts
CHANGED
|
@@ -75,16 +75,13 @@ class $ModelRegistry extends MetadataRegistry<ModelOptions<ModelType>> {
|
|
|
75
75
|
if (schema.subTypeField in view && this.getBaseModel(cls) !== cls) {
|
|
76
76
|
config.subType = !!schema.subTypeName; // Copy from schema
|
|
77
77
|
delete view[schema.subTypeField].required; // Allow type to be optional
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
from = parent;
|
|
86
|
-
parent = this.getParentClass(from);
|
|
87
|
-
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const parent = this.getParentClass(cls);
|
|
81
|
+
if (parent && parent !== cls) {
|
|
82
|
+
const pCfg = this.get(parent) ?? this.pending.get(MetadataRegistry.id(parent));
|
|
83
|
+
config.prePersist = [...pCfg.prePersist ?? [], ...config.prePersist ?? []];
|
|
84
|
+
config.postLoad = [...pCfg.postLoad ?? [], ...config.postLoad ?? []];
|
|
88
85
|
}
|
|
89
86
|
return config;
|
|
90
87
|
}
|
package/src/service/stream.ts
CHANGED
|
@@ -21,6 +21,18 @@ export interface StreamMeta {
|
|
|
21
21
|
* Filenames title, optional for elements like images, audio, videos
|
|
22
22
|
*/
|
|
23
23
|
title?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Content encoding
|
|
26
|
+
*/
|
|
27
|
+
contentEncoding?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Content language
|
|
30
|
+
*/
|
|
31
|
+
contentLanguage?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Cache control
|
|
34
|
+
*/
|
|
35
|
+
cacheControl?: string;
|
|
24
36
|
}
|
|
25
37
|
|
|
26
38
|
export interface PartialStream {
|
|
@@ -91,6 +91,7 @@ export abstract class ModelPolymorphismSuite extends BaseModelSuite<ModelCrudSup
|
|
|
91
91
|
const [doc, fire, eng] = await Promise.all(people.map(p => service.create(Worker, p)));
|
|
92
92
|
|
|
93
93
|
assert(doc instanceof Doctor);
|
|
94
|
+
assert(doc.updatedDate !== undefined);
|
|
94
95
|
|
|
95
96
|
await assert.rejects(
|
|
96
97
|
() => service.get(Engineer, doc.id),
|