@tsed/json-mapper 8.33.0 → 8.35.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.
- package/lib/esm/components/DateMapper.js +1 -1
- package/lib/esm/components/PrimitiveMapper.js +1 -1
- package/lib/esm/components/TemporalMapper.js +1 -1
- package/lib/esm/domain/JsonDeserializer.js +5 -5
- package/lib/esm/domain/JsonSerializer.js +5 -5
- package/lib/types/domain/JsonDeserializer.d.ts +1 -1
- package/lib/types/domain/JsonDeserializerOptions.d.ts +2 -2
- package/lib/types/domain/JsonMapperTypesContainer.d.ts +1 -1
- package/lib/types/domain/JsonSerializerOptions.d.ts +1 -1
- package/package.json +19 -20
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { JsonMapperCompiler } from "./JsonMapperCompiler.js";
|
|
2
|
+
import { JsonParameterStore, JsonSchema, VendorKeys, getPropertiesStores, s } from "@tsed/schema";
|
|
1
3
|
import { classOf, isArray, isBoolean, isEmpty, isNil, nameOf, objectKeys } from "@tsed/core";
|
|
2
|
-
import {
|
|
4
|
+
import { JsonMapperSettings } from "./JsonMapperSettings.js";
|
|
5
|
+
import { Writer } from "./Writer.js";
|
|
3
6
|
import { alterAfterDeserialize } from "../hooks/alterAfterDeserialize.js";
|
|
4
7
|
import { alterBeforeDeserialize } from "../hooks/alterBeforeDeserialize.js";
|
|
5
8
|
import { alterOnDeserialize } from "../hooks/alterOnDeserialize.js";
|
|
6
|
-
import { JsonMapperCompiler } from "./JsonMapperCompiler.js";
|
|
7
|
-
import { JsonMapperSettings } from "./JsonMapperSettings.js";
|
|
8
9
|
import { getJsonMapperTypes } from "./JsonMapperTypesContainer.js";
|
|
9
|
-
import { Writer } from "./Writer.js";
|
|
10
10
|
function isDeserializable(obj, options) {
|
|
11
11
|
if ((!!options.collectionType && isNil(obj)) || obj === undefined) {
|
|
12
12
|
return false;
|
|
@@ -85,7 +85,7 @@ export class JsonDeserializer extends JsonMapperCompiler {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
createMapper(model, id, groups) {
|
|
88
|
-
const entity =
|
|
88
|
+
const entity = s.store(model);
|
|
89
89
|
const properties = new Set();
|
|
90
90
|
const schemaProperties = [...getPropertiesStores(entity).values()];
|
|
91
91
|
const writer = new Writer().arrow("input", "options");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { getPropertiesStores, s } from "@tsed/schema";
|
|
1
2
|
import { classOf, hasJsonMethod, isArray, isBoolean, isClassObject, isCollection, isDate, isMomentObject, isMongooseObject, isNil, isObject, isPrimitive, nameOf } from "@tsed/core";
|
|
2
|
-
import { getPropertiesStores, JsonEntityStore } from "@tsed/schema";
|
|
3
|
-
import { alterOnSerialize } from "../hooks/alterOnSerialize.js";
|
|
4
|
-
import { getObjectProperties } from "../utils/getObjectProperties.js";
|
|
5
3
|
import { JsonMapperCompiler } from "./JsonMapperCompiler.js";
|
|
6
4
|
import { JsonMapperSettings } from "./JsonMapperSettings.js";
|
|
7
|
-
import { getJsonMapperTypes } from "./JsonMapperTypesContainer.js";
|
|
8
5
|
import { Writer } from "./Writer.js";
|
|
6
|
+
import { alterOnSerialize } from "../hooks/alterOnSerialize.js";
|
|
7
|
+
import { getJsonMapperTypes } from "./JsonMapperTypesContainer.js";
|
|
8
|
+
import { getObjectProperties } from "../utils/getObjectProperties.js";
|
|
9
9
|
const getCollectionType = (input) => {
|
|
10
10
|
return isArray(input) ? "Array" : input instanceof Set ? "Set" : input instanceof Map ? "Map" : undefined;
|
|
11
11
|
};
|
|
@@ -48,7 +48,7 @@ export class JsonSerializer extends JsonMapperCompiler {
|
|
|
48
48
|
return alterOnSerialize(this.schemes[schemaId], value, options);
|
|
49
49
|
}
|
|
50
50
|
createMapper(model, id, groups) {
|
|
51
|
-
const entity =
|
|
51
|
+
const entity = s.store(model);
|
|
52
52
|
const properties = new Set();
|
|
53
53
|
const schemaProperties = [...getPropertiesStores(entity).values()];
|
|
54
54
|
const writer = new Writer().arrow("input", "options");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { CachedGroupsJsonMapper, CachedJsonMapper, JsonMapperCompiler } from "./JsonMapperCompiler.js";
|
|
1
2
|
import { Type } from "@tsed/core";
|
|
2
3
|
import { JsonDeserializerOptions } from "./JsonDeserializerOptions.js";
|
|
3
|
-
import { CachedGroupsJsonMapper, CachedJsonMapper, JsonMapperCompiler } from "./JsonMapperCompiler.js";
|
|
4
4
|
/**
|
|
5
5
|
* Deserializes raw JSON data into class instances based on schema metadata,
|
|
6
6
|
* handling collections, discriminators, hooks, and registered type mappers.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MetadataTypes, Type } from "@tsed/core";
|
|
2
1
|
import { type GenericsMap, JsonEntityStore } from "@tsed/schema";
|
|
3
|
-
import {
|
|
2
|
+
import { MetadataTypes, Type } from "@tsed/core";
|
|
4
3
|
import { JsonMapperGlobalOptions } from "./JsonMapperGlobalOptions.js";
|
|
4
|
+
import { JsonMapperMethods } from "../interfaces/JsonMapperMethods.js";
|
|
5
5
|
/**
|
|
6
6
|
* Options accepted by the `JsonDeserializer`. They describe the target type,
|
|
7
7
|
* collection strategy, additional mapper types, and hook configuration used while materializing data.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MetadataTypes, Type } from "@tsed/core";
|
|
2
|
-
import { JsonMapperMethods } from "../interfaces/JsonMapperMethods.js";
|
|
3
2
|
import { JsonMapperGlobalOptions } from "./JsonMapperGlobalOptions.js";
|
|
3
|
+
import { JsonMapperMethods } from "../interfaces/JsonMapperMethods.js";
|
|
4
4
|
/**
|
|
5
5
|
* Options accepted by the `JsonSerializer`. They describe the target type, alias strategy,
|
|
6
6
|
* additional type mappers, and group handling.
|
package/package.json
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/json-mapper",
|
|
3
|
+
"version": "8.35.0",
|
|
3
4
|
"description": "Json mapper module for Ts.ED Framework",
|
|
4
|
-
"
|
|
5
|
-
|
|
5
|
+
"keywords": [
|
|
6
|
+
"TypeScript",
|
|
7
|
+
"class",
|
|
8
|
+
"classes",
|
|
9
|
+
"decorators",
|
|
10
|
+
"deserialization",
|
|
11
|
+
"json mapper",
|
|
12
|
+
"mapper",
|
|
13
|
+
"models",
|
|
14
|
+
"serialization",
|
|
15
|
+
"tsed"
|
|
16
|
+
],
|
|
6
17
|
"source": "./src/index.ts",
|
|
18
|
+
"type": "module",
|
|
7
19
|
"main": "./lib/esm/index.js",
|
|
8
20
|
"module": "./lib/esm/index.js",
|
|
9
|
-
"typings": "./lib/types/index.d.ts",
|
|
10
21
|
"browser": "./lib/esm/index.js",
|
|
22
|
+
"typings": "./lib/types/index.d.ts",
|
|
11
23
|
"exports": {
|
|
12
24
|
".": {
|
|
13
25
|
"tsed-source": "./src/index.ts",
|
|
@@ -25,27 +37,14 @@
|
|
|
25
37
|
"build:ts": "tsc --build tsconfig.esm.json",
|
|
26
38
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
27
39
|
},
|
|
28
|
-
"keywords": [
|
|
29
|
-
"TypeScript",
|
|
30
|
-
"decorators",
|
|
31
|
-
"models",
|
|
32
|
-
"json mapper",
|
|
33
|
-
"mapper",
|
|
34
|
-
"serialization",
|
|
35
|
-
"deserialization",
|
|
36
|
-
"class",
|
|
37
|
-
"classes",
|
|
38
|
-
"tsed"
|
|
39
|
-
],
|
|
40
40
|
"dependencies": {
|
|
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.
|
|
48
|
-
"eslint": "9.12.0",
|
|
44
|
+
"@tsed/barrels": "8.35.0",
|
|
45
|
+
"@tsed/core": "8.35.0",
|
|
46
|
+
"@tsed/schema": "8.35.0",
|
|
47
|
+
"@tsed/typescript": "8.35.0",
|
|
49
48
|
"temporal-polyfill": "1.0.1",
|
|
50
49
|
"typescript": "6.0.2",
|
|
51
50
|
"vitest": "4.1.4"
|