@tsed/json-mapper 8.26.1 → 8.27.0
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.
|
@@ -70,11 +70,11 @@ export class JsonDeserializer extends JsonMapperCompiler {
|
|
|
70
70
|
}
|
|
71
71
|
return super.compile(model, groups);
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
compileMapper(mapper, { id, groupsId, model, storeGroups }) {
|
|
74
74
|
if (typeof model === "function") {
|
|
75
75
|
this.constructors[id] = model;
|
|
76
76
|
}
|
|
77
|
-
return super.
|
|
77
|
+
return super.compileMapper(mapper, { id, groupsId, model, storeGroups });
|
|
78
78
|
}
|
|
79
79
|
newInstanceOf(id, obj, options) {
|
|
80
80
|
try {
|
|
@@ -69,7 +69,7 @@ export class JsonMapperCompiler {
|
|
|
69
69
|
this.globals[key] = value;
|
|
70
70
|
return this;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
compileMapper(mapper, { id, groupsId, storeGroups }) {
|
|
73
73
|
const { globals, schemes } = this;
|
|
74
74
|
const injectGlobals = Object.keys(globals)
|
|
75
75
|
.map((name) => {
|
|
@@ -110,7 +110,7 @@ export class JsonMapperCompiler {
|
|
|
110
110
|
});
|
|
111
111
|
const mapper = opts.mapper ? opts.mapper(id, groups) : this.createMapper(token, id, groups);
|
|
112
112
|
try {
|
|
113
|
-
return this.
|
|
113
|
+
return this.compileMapper(mapper, { id, groupsId, model: token, storeGroups });
|
|
114
114
|
}
|
|
115
115
|
catch (err) {
|
|
116
116
|
throw new Error(`Fail to compile mapper for ${nameOf(model)}. See the error above: ${err.message}.\n${mapper}`);
|
|
@@ -14,7 +14,7 @@ export declare class JsonDeserializer extends JsonMapperCompiler<JsonDeserialize
|
|
|
14
14
|
constructor();
|
|
15
15
|
map<Model = any>(input: any, options?: JsonDeserializerOptions): Model;
|
|
16
16
|
compile(model: Type<any>, groups: false | string[]): CachedJsonMapper<JsonDeserializerOptions>;
|
|
17
|
-
|
|
17
|
+
compileMapper(mapper: string, { id, groupsId, model, storeGroups }: {
|
|
18
18
|
id: string;
|
|
19
19
|
model: Type<any> | string;
|
|
20
20
|
groupsId: string;
|
|
@@ -51,7 +51,7 @@ export declare abstract class JsonMapperCompiler<Options extends Record<string,
|
|
|
51
51
|
addTypeMapper(model: Type<any> | string, fn: any): this;
|
|
52
52
|
removeTypeMapper(model: Type<any> | string): void;
|
|
53
53
|
addGlobal(key: string, value: any): this;
|
|
54
|
-
|
|
54
|
+
compileMapper(mapper: string, { id, groupsId, storeGroups }: {
|
|
55
55
|
id: string;
|
|
56
56
|
groupsId: string;
|
|
57
57
|
model: Type<any> | string;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/json-mapper",
|
|
3
3
|
"description": "Json mapper module for Ts.ED Framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.
|
|
5
|
+
"version": "8.27.0",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"tslib": ">=2.7.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@tsed/barrels": "8.
|
|
45
|
-
"@tsed/core": "8.
|
|
46
|
-
"@tsed/schema": "8.
|
|
47
|
-
"@tsed/typescript": "8.
|
|
44
|
+
"@tsed/barrels": "8.27.0",
|
|
45
|
+
"@tsed/core": "8.27.0",
|
|
46
|
+
"@tsed/schema": "8.27.0",
|
|
47
|
+
"@tsed/typescript": "8.27.0",
|
|
48
48
|
"eslint": "9.12.0",
|
|
49
49
|
"typescript": "6.0.2",
|
|
50
|
-
"vitest": "
|
|
50
|
+
"vitest": "4.1.4"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@tsed/core": ">=8.0.0",
|