@tsed/json-mapper 7.0.0-alpha.2 → 7.0.0-beta.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/jest.config.js +14 -0
- package/lib/cjs/components/ArrayMapper.js +23 -0
- package/lib/cjs/components/ArrayMapper.js.map +1 -0
- package/lib/cjs/components/DateMapper.js +30 -0
- package/lib/cjs/components/DateMapper.js.map +1 -0
- package/lib/cjs/components/MapMapper.js +30 -0
- package/lib/cjs/components/MapMapper.js.map +1 -0
- package/lib/cjs/components/PrimitiveMapper.js +45 -0
- package/lib/cjs/components/PrimitiveMapper.js.map +1 -0
- package/lib/cjs/components/SetMapper.js +30 -0
- package/lib/cjs/components/SetMapper.js.map +1 -0
- package/lib/cjs/components/SymbolMapper.js +24 -0
- package/lib/cjs/components/SymbolMapper.js.map +1 -0
- package/lib/cjs/decorators/afterDeserialize.js +39 -0
- package/lib/cjs/decorators/afterDeserialize.js.map +1 -0
- package/lib/cjs/decorators/beforeDeserialize.js +39 -0
- package/lib/cjs/decorators/beforeDeserialize.js.map +1 -0
- package/lib/cjs/decorators/jsonMapper.js +18 -0
- package/lib/cjs/decorators/jsonMapper.js.map +1 -0
- package/lib/cjs/decorators/onDeserialize.js +29 -0
- package/lib/cjs/decorators/onDeserialize.js.map +1 -0
- package/lib/cjs/decorators/onSerialize.js +29 -0
- package/lib/cjs/decorators/onSerialize.js.map +1 -0
- package/lib/cjs/domain/JsonMapperContext.js +23 -0
- package/lib/cjs/domain/JsonMapperContext.js.map +1 -0
- package/lib/cjs/domain/JsonMapperTypesContainer.js +23 -0
- package/lib/cjs/domain/JsonMapperTypesContainer.js.map +1 -0
- package/lib/cjs/hooks/alterAfterDeserialize.js +9 -0
- package/lib/cjs/hooks/alterAfterDeserialize.js.map +1 -0
- package/lib/cjs/hooks/alterBeforeDeserialize.js +9 -0
- package/lib/cjs/hooks/alterBeforeDeserialize.js.map +1 -0
- package/lib/cjs/index.js +25 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/JsonMapperMethods.js +3 -0
- package/lib/cjs/interfaces/JsonMapperMethods.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/utils/deserialize.js +154 -0
- package/lib/cjs/utils/deserialize.js.map +1 -0
- package/lib/cjs/utils/serialize.js +145 -0
- package/lib/cjs/utils/serialize.js.map +1 -0
- package/lib/esm/components/ArrayMapper.js +20 -0
- package/lib/esm/components/ArrayMapper.js.map +1 -0
- package/lib/esm/components/DateMapper.js +27 -0
- package/lib/esm/components/DateMapper.js.map +1 -0
- package/lib/esm/components/MapMapper.js +27 -0
- package/lib/esm/components/MapMapper.js.map +1 -0
- package/lib/esm/components/PrimitiveMapper.js +42 -0
- package/lib/esm/components/PrimitiveMapper.js.map +1 -0
- package/lib/esm/components/SetMapper.js +27 -0
- package/lib/esm/components/SetMapper.js.map +1 -0
- package/lib/esm/components/SymbolMapper.js +21 -0
- package/lib/esm/components/SymbolMapper.js.map +1 -0
- package/lib/esm/decorators/afterDeserialize.js +35 -0
- package/lib/esm/decorators/afterDeserialize.js.map +1 -0
- package/lib/esm/decorators/beforeDeserialize.js +35 -0
- package/lib/esm/decorators/beforeDeserialize.js.map +1 -0
- package/lib/esm/decorators/jsonMapper.js +14 -0
- package/lib/esm/decorators/jsonMapper.js.map +1 -0
- package/lib/esm/decorators/onDeserialize.js +25 -0
- package/lib/esm/decorators/onDeserialize.js.map +1 -0
- package/lib/esm/decorators/onSerialize.js +25 -0
- package/lib/esm/decorators/onSerialize.js.map +1 -0
- package/lib/esm/domain/JsonMapperContext.js +19 -0
- package/lib/esm/domain/JsonMapperContext.js.map +1 -0
- package/lib/esm/domain/JsonMapperTypesContainer.js +18 -0
- package/lib/esm/domain/JsonMapperTypesContainer.js.map +1 -0
- package/lib/esm/hooks/alterAfterDeserialize.js +5 -0
- package/lib/esm/hooks/alterAfterDeserialize.js.map +1 -0
- package/lib/esm/hooks/alterBeforeDeserialize.js +5 -0
- package/lib/esm/hooks/alterBeforeDeserialize.js.map +1 -0
- package/lib/esm/index.js +22 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/JsonMapperMethods.js +2 -0
- package/lib/esm/interfaces/JsonMapperMethods.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/utils/deserialize.js +149 -0
- package/lib/esm/utils/deserialize.js.map +1 -0
- package/lib/esm/utils/serialize.js +140 -0
- package/lib/esm/utils/serialize.js.map +1 -0
- package/lib/{components → types/components}/ArrayMapper.d.ts +0 -0
- package/lib/{components → types/components}/DateMapper.d.ts +0 -0
- package/lib/{components → types/components}/MapMapper.d.ts +0 -0
- package/lib/{components → types/components}/PrimitiveMapper.d.ts +0 -0
- package/lib/{components → types/components}/SetMapper.d.ts +0 -0
- package/lib/{components → types/components}/SymbolMapper.d.ts +0 -0
- package/lib/{decorators → types/decorators}/afterDeserialize.d.ts +0 -0
- package/lib/{decorators → types/decorators}/beforeDeserialize.d.ts +0 -0
- package/lib/{decorators → types/decorators}/jsonMapper.d.ts +0 -0
- package/lib/{decorators → types/decorators}/onDeserialize.d.ts +0 -0
- package/lib/{decorators → types/decorators}/onSerialize.d.ts +0 -0
- package/lib/{domain → types/domain}/JsonMapperContext.d.ts +0 -0
- package/lib/types/domain/JsonMapperTypesContainer.d.ts +10 -0
- package/lib/{hooks → types/hooks}/alterAfterDeserialize.d.ts +0 -0
- package/lib/{hooks → types/hooks}/alterBeforeDeserialize.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +13 -3
- package/lib/{interfaces → types/interfaces}/JsonMapperMethods.d.ts +0 -0
- package/lib/{utils → types/utils}/deserialize.d.ts +6 -1
- package/lib/{utils → types/utils}/serialize.d.ts +7 -2
- package/package.json +34 -20
- package/readme.md +1 -0
- package/tsconfig.compile.esm.json +12 -0
- package/lib/components/index.d.ts +0 -6
- package/lib/domain/JsonMapperTypesContainer.d.ts +0 -10
- package/lib/index.js +0 -715
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -704
- package/lib/index.modern.js.map +0 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { MetadataTypes, Type } from "@tsed/core";
|
|
2
|
-
import "../components";
|
|
2
|
+
import "../components/ArrayMapper";
|
|
3
|
+
import "../components/DateMapper";
|
|
4
|
+
import "../components/MapMapper";
|
|
5
|
+
import "../components/PrimitiveMapper";
|
|
6
|
+
import "../components/SetMapper";
|
|
7
|
+
import "../components/SymbolMapper";
|
|
3
8
|
import { JsonMapperMethods } from "../interfaces/JsonMapperMethods";
|
|
4
9
|
export interface JsonSerializerOptions<T = any, C = any> extends MetadataTypes<T, C> {
|
|
5
10
|
/**
|
|
@@ -12,5 +17,5 @@ export interface JsonSerializerOptions<T = any, C = any> extends MetadataTypes<T
|
|
|
12
17
|
useAlias?: boolean;
|
|
13
18
|
[key: string]: any;
|
|
14
19
|
}
|
|
15
|
-
export declare function classToPlainObject(obj: any, options: JsonSerializerOptions<any, any>):
|
|
20
|
+
export declare function classToPlainObject(obj: any, options: JsonSerializerOptions<any, any>): any;
|
|
16
21
|
export declare function serialize(obj: any, { type, collectionType, groups, ...options }?: JsonSerializerOptions): any;
|
package/package.json
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/json-mapper",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-beta.11",
|
|
4
4
|
"description": "Json mapper module for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
|
-
"
|
|
7
|
+
"main": "./lib/cjs/index.js",
|
|
8
|
+
"module": "./lib/esm/index.js",
|
|
9
|
+
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
11
|
+
"types": "./lib/types/index.d.ts",
|
|
12
|
+
"import": "./lib/esm/index.js",
|
|
13
|
+
"require": "./lib/cjs/index.js",
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
18
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
19
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\""
|
|
12
21
|
},
|
|
13
22
|
"keywords": [
|
|
14
23
|
"TypeScript",
|
|
@@ -22,30 +31,35 @@
|
|
|
22
31
|
"classes",
|
|
23
32
|
"tsed"
|
|
24
33
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "microbundle --target node --no-compress --format modern,cjs --tsconfig ./tsconfig.compile.json"
|
|
27
|
-
},
|
|
28
34
|
"dependencies": {
|
|
29
|
-
"tslib": "2.
|
|
35
|
+
"tslib": "2.3.1"
|
|
30
36
|
},
|
|
31
37
|
"devDependencies": {
|
|
32
|
-
"@tsed/core": "7.0.0-
|
|
33
|
-
"@tsed/exceptions": "7.0.0-
|
|
34
|
-
"@tsed/schema": "7.0.0-
|
|
38
|
+
"@tsed/core": "7.0.0-beta.11",
|
|
39
|
+
"@tsed/exceptions": "7.0.0-beta.11",
|
|
40
|
+
"@tsed/schema": "7.0.0-beta.11"
|
|
35
41
|
},
|
|
36
42
|
"peerDependencies": {
|
|
37
|
-
"@tsed/core": "^7.0.0-
|
|
38
|
-
"@tsed/exceptions": "^7.0.0-
|
|
39
|
-
"@tsed/schema": "^7.0.0-
|
|
43
|
+
"@tsed/core": "^7.0.0-beta.11",
|
|
44
|
+
"@tsed/exceptions": "^7.0.0-beta.11",
|
|
45
|
+
"@tsed/schema": "^7.0.0-beta.11"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@tsed/core": {
|
|
49
|
+
"optional": false
|
|
50
|
+
},
|
|
51
|
+
"@tsed/exceptions": {
|
|
52
|
+
"optional": false
|
|
53
|
+
},
|
|
54
|
+
"@tsed/schema": {
|
|
55
|
+
"optional": false
|
|
56
|
+
}
|
|
40
57
|
},
|
|
41
58
|
"repository": "https://github.com/tsedio/tsed",
|
|
42
59
|
"bugs": {
|
|
43
60
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
44
61
|
},
|
|
45
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
62
|
+
"homepage": "https://github.com/tsedio/tsed/tree/beta/packages/specs/json-mapper",
|
|
46
63
|
"author": "Romain Lenzotti",
|
|
47
|
-
"license": "MIT"
|
|
48
|
-
"publishConfig": {
|
|
49
|
-
"tag": "alpha"
|
|
50
|
-
}
|
|
64
|
+
"license": "MIT"
|
|
51
65
|
}
|
package/readme.md
CHANGED
|
@@ -49,6 +49,7 @@ npm install --save @tsed/schema @tsed/json-mapper
|
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
## Contributors
|
|
52
|
+
|
|
52
53
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
|
|
53
54
|
|
|
54
55
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
12
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { JsonMapperMethods } from "../interfaces/JsonMapperMethods";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export declare function registerJsonTypeMapper(type: Type<any>, token: Type<JsonMapperMethods>): void;
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare function getJsonMapperTypes(): WeakMap<Type<any> | Symbol, JsonMapperMethods>;
|