@dipscope/type-manager 4.0.4 → 5.0.0-beta.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/CHANGELOG.md +38 -0
- package/{LICENSE.txt → LICENSE.md} +0 -0
- package/README.md +143 -321
- package/alias.d.ts +3 -7
- package/custom-data.d.ts +3 -8
- package/default-value-resolver.d.ts +7 -0
- package/default-value.d.ts +4 -7
- package/discriminant.d.ts +5 -8
- package/discriminator.d.ts +3 -8
- package/factories/type-factory.d.ts +3 -3
- package/factory.d.ts +15 -8
- package/functions/get-own-reflect-metadata.d.ts +9 -0
- package/functions/get-reflect-metadata.d.ts +10 -0
- package/functions/get-words.d.ts +8 -0
- package/functions/index.d.ts +16 -0
- package/functions/is-arrow-function.d.ts +8 -0
- package/functions/is-ctor-function.d.ts +8 -0
- package/functions/is-data-view.d.ts +8 -0
- package/functions/is-float-32-array.d.ts +8 -0
- package/functions/is-float-64-array.d.ts +8 -0
- package/functions/is-int-16-array.d.ts +8 -0
- package/functions/is-int-32-array.d.ts +8 -0
- package/functions/is-int-8-array.d.ts +8 -0
- package/functions/is-uint-16-array.d.ts +8 -0
- package/functions/is-uint-32-array.d.ts +8 -0
- package/functions/is-uint-8-array.d.ts +8 -0
- package/functions/is-uint-8-clamped-array.d.ts +8 -0
- package/functions/name-of.d.ts +8 -0
- package/{core/generic-argument.d.ts → generic-argument.d.ts} +0 -0
- package/{core/generic-metadata.d.ts → generic-metadata.d.ts} +0 -0
- package/index.d.ts +39 -7
- package/index.js +1 -2
- package/{core/inject-index.d.ts → inject-index.d.ts} +0 -0
- package/{core/inject-metadata.d.ts → inject-metadata.d.ts} +0 -0
- package/{core/inject-options.d.ts → inject-options.d.ts} +0 -0
- package/inject.d.ts +2 -2
- package/injector.d.ts +13 -8
- package/injectors/singleton-injector.d.ts +2 -2
- package/{core/log-level.d.ts → log-level.d.ts} +0 -0
- package/{core/log.d.ts → log.d.ts} +41 -11
- package/{core/metadata.d.ts → metadata.d.ts} +0 -0
- package/naming-convention.d.ts +12 -8
- package/naming-conventions/camel-case-naming-convention.d.ts +1 -1
- package/naming-conventions/flat-case-naming-convention.d.ts +1 -1
- package/naming-conventions/flat-upper-case-naming-convention.d.ts +1 -1
- package/naming-conventions/kebab-case-naming-convention.d.ts +1 -1
- package/naming-conventions/kebab-upper-case-naming-convention.d.ts +1 -1
- package/naming-conventions/pascal-case-naming-convention.d.ts +1 -1
- package/naming-conventions/snake-case-naming-convention.d.ts +1 -1
- package/naming-conventions/snake-upper-case-naming-convention.d.ts +1 -1
- package/package.json +6 -3
- package/{core/property-metadata.d.ts → property-metadata.d.ts} +18 -12
- package/{core/property-name.d.ts → property-name.d.ts} +0 -0
- package/{core/property-options.d.ts → property-options.d.ts} +21 -4
- package/property.d.ts +3 -2
- package/{core/reference-callback.d.ts → reference-callback.d.ts} +0 -0
- package/reference-handler.d.ts +29 -8
- package/reference-handlers/direct-reference-handler.d.ts +6 -6
- package/reference-handlers/lead-reference-handler.d.ts +6 -6
- package/reference-handlers/path-reference-handler.d.ts +6 -6
- package/{core/reference-key.d.ts → reference-key.d.ts} +0 -0
- package/{core/reference-value-initializer.d.ts → reference-value-initializer.d.ts} +0 -0
- package/{core/reference-value-resolver.d.ts → reference-value-resolver.d.ts} +0 -0
- package/{core/reference-value.d.ts → reference-value.d.ts} +0 -0
- package/{core/serializer-context-options.d.ts → serializer-context-options.d.ts} +0 -0
- package/{core/serializer-context.d.ts → serializer-context.d.ts} +9 -3
- package/serializer.d.ts +24 -8
- package/serializers/array-buffer-serializer.d.ts +3 -3
- package/serializers/array-serializer.d.ts +3 -3
- package/serializers/boolean-serializer.d.ts +3 -3
- package/serializers/data-view-serializer.d.ts +3 -3
- package/serializers/date-serializer.d.ts +3 -3
- package/serializers/float-32-array-serializer.d.ts +3 -3
- package/serializers/float-64-array-serializer.d.ts +3 -3
- package/serializers/int-16-array-serializer.d.ts +3 -3
- package/serializers/int-32-array-serializer.d.ts +3 -3
- package/serializers/int-8-array-serializer.d.ts +3 -3
- package/serializers/map-serializer.d.ts +3 -3
- package/serializers/number-serializer.d.ts +3 -3
- package/serializers/set-serializer.d.ts +3 -3
- package/serializers/string-serializer.d.ts +3 -3
- package/serializers/type-serializer.d.ts +3 -3
- package/serializers/uint-16-array-serializer.d.ts +3 -3
- package/serializers/uint-32-array-serializer.d.ts +3 -3
- package/serializers/uint-8-array-serializer.d.ts +3 -3
- package/serializers/uint-8-clamped-array-serializer.d.ts +3 -3
- package/{core/type-abstraction.d.ts → type-abstraction.d.ts} +0 -0
- package/{core/type-argument.d.ts → type-argument.d.ts} +0 -0
- package/{core/type-context-entry.d.ts → type-context-entry.d.ts} +0 -0
- package/{core/type-context.d.ts → type-context.d.ts} +0 -0
- package/{core/type-ctor.d.ts → type-ctor.d.ts} +0 -0
- package/{core/type-fn.d.ts → type-fn.d.ts} +0 -0
- package/{core/type-like.d.ts → type-like.d.ts} +0 -0
- package/type-manager-options.d.ts +3 -3
- package/type-manager.d.ts +10 -10
- package/{core/type-metadata-resolver.d.ts → type-metadata-resolver.d.ts} +0 -0
- package/{core/type-metadata-symbol.d.ts → type-metadata-symbol.d.ts} +0 -0
- package/{core/type-metadata.d.ts → type-metadata.d.ts} +9 -3
- package/{core/type-name.d.ts → type-name.d.ts} +0 -0
- package/{core/type-options-base.d.ts → type-options-base.d.ts} +0 -9
- package/{core/type-options.d.ts → type-options.d.ts} +26 -0
- package/{core/type-resolver.d.ts → type-resolver.d.ts} +0 -0
- package/type.d.ts +1 -1
- package/core/alias.d.ts +0 -6
- package/core/custom-data.d.ts +0 -6
- package/core/discriminant.d.ts +0 -8
- package/core/discriminator.d.ts +0 -6
- package/core/factory.d.ts +0 -18
- package/core/fn.d.ts +0 -316
- package/core/index.d.ts +0 -42
- package/core/index.js +0 -2
- package/core/injector.d.ts +0 -16
- package/core/naming-convention.d.ts +0 -15
- package/core/reference-handler.d.ts +0 -32
- package/core/serializer.d.ts +0 -27
- package/deserializable.d.ts +0 -11
- package/factories/index.js +0 -2
- package/injectable.d.ts +0 -10
- package/injectors/index.js +0 -2
- package/naming-conventions/index.js +0 -2
- package/preserve-discriminator.d.ts +0 -10
- package/reference-handlers/index.js +0 -2
- package/serializable.d.ts +0 -11
- package/serializers/index.js +0 -2
- package/type-and-property.d.ts +0 -12
- package/use-default-value.d.ts +0 -10
- package/use-implicit-conversion.d.ts +0 -10
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/inject.d.ts
CHANGED
package/injector.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeMetadata } from './type-metadata';
|
|
2
2
|
/**
|
|
3
|
-
* Injector
|
|
3
|
+
* Injector used to resolve dependent types.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param {Injector} injector Injector.
|
|
8
|
-
*
|
|
9
|
-
* @returns {ClassDecorator} Class decorator.
|
|
5
|
+
* @type {Injector}
|
|
10
6
|
*/
|
|
11
|
-
export
|
|
7
|
+
export interface Injector {
|
|
8
|
+
/**
|
|
9
|
+
* Method to get instance described by type metadata.
|
|
10
|
+
*
|
|
11
|
+
* @param {TypeMetadata<TType>} typeMetadata Type metadata.
|
|
12
|
+
*
|
|
13
|
+
* @returns {TType|undefined} Instance of type described by type metadata or undefined.
|
|
14
|
+
*/
|
|
15
|
+
get<TType>(typeMetadata: TypeMetadata<TType>): TType | undefined;
|
|
16
|
+
}
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogLevel } from './log-level';
|
|
2
2
|
/**
|
|
3
|
-
* Main logger class.
|
|
3
|
+
* Main logger class used by serializers for displaying messages.
|
|
4
4
|
*
|
|
5
5
|
* @type {Log}
|
|
6
6
|
*/
|
|
@@ -10,31 +10,61 @@ export declare class Log {
|
|
|
10
10
|
*
|
|
11
11
|
* @type {LogLevel}
|
|
12
12
|
*/
|
|
13
|
-
logLevel: LogLevel;
|
|
13
|
+
readonly logLevel: LogLevel;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Info enabled?
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @type {boolean}
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
readonly infoEnabled: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Warn enabled?
|
|
22
|
+
*
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
readonly warnEnabled: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Error enabled?
|
|
28
|
+
*
|
|
29
|
+
* @type {boolean}
|
|
30
|
+
*/
|
|
31
|
+
readonly errorEnabled: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Supports console?
|
|
34
|
+
*
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
*/
|
|
37
|
+
readonly supportsConsole: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Supports console log?
|
|
40
|
+
*
|
|
41
|
+
* @type {boolean}
|
|
42
|
+
*/
|
|
43
|
+
readonly supportsConsoleLog: boolean;
|
|
20
44
|
/**
|
|
21
|
-
*
|
|
45
|
+
* Supports console info?
|
|
22
46
|
*
|
|
23
47
|
* @type {boolean}
|
|
24
48
|
*/
|
|
25
|
-
|
|
49
|
+
readonly supportsConsoleInfo: boolean;
|
|
26
50
|
/**
|
|
27
|
-
*
|
|
51
|
+
* Supports console warn?
|
|
28
52
|
*
|
|
29
53
|
* @type {boolean}
|
|
30
54
|
*/
|
|
31
|
-
|
|
55
|
+
readonly supportsConsoleWarn: boolean;
|
|
32
56
|
/**
|
|
33
|
-
*
|
|
57
|
+
* Supports console error?
|
|
34
58
|
*
|
|
35
59
|
* @type {boolean}
|
|
36
60
|
*/
|
|
37
|
-
|
|
61
|
+
readonly supportsConsoleError: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Constructor.
|
|
64
|
+
*
|
|
65
|
+
* @param {LogLevel} logLevel Log level.
|
|
66
|
+
*/
|
|
67
|
+
constructor(logLevel: LogLevel);
|
|
38
68
|
/**
|
|
39
69
|
* Displays info message.
|
|
40
70
|
*
|
|
File without changes
|
package/naming-convention.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { NamingConvention } from './core/naming-convention';
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* Represents naming convention.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param {NamingConvention} namingConvention Naming convention.
|
|
8
|
-
*
|
|
9
|
-
* @returns {ClassDecorator&PropertyDecorator} Class and property decorator.
|
|
4
|
+
* @type {NamingConvention}
|
|
10
5
|
*/
|
|
11
|
-
export
|
|
6
|
+
export interface NamingConvention {
|
|
7
|
+
/**
|
|
8
|
+
* Converts name from provided to target one.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} name Name.
|
|
11
|
+
*
|
|
12
|
+
* @returns {string} Converted name.
|
|
13
|
+
*/
|
|
14
|
+
convert(name: string): string;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "DipScope authors and contributors",
|
|
3
|
-
"dependencies": {
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"lodash": "^4.17.21"
|
|
5
|
+
},
|
|
4
6
|
"description": "A package which will help you to transform your JSON strings or plain objects into JS object instances.",
|
|
5
7
|
"devDependencies": {
|
|
8
|
+
"@types/lodash": "^4.14.182",
|
|
6
9
|
"@types/jasmine": "^3.6.3",
|
|
7
10
|
"@typescript-eslint/eslint-plugin": "^4.14.2",
|
|
8
11
|
"@typescript-eslint/parser": "^4.14.2",
|
|
@@ -39,10 +42,10 @@
|
|
|
39
42
|
"scripts": {
|
|
40
43
|
"build": "npm run clean && npx webpack --config=webpack.config.js && npm run copy",
|
|
41
44
|
"clean": "shx rm -rf dist",
|
|
42
|
-
"copy": "shx cp CHANGELOG.md dist && shx cp LICENSE.
|
|
45
|
+
"copy": "shx cp CHANGELOG.md dist && shx cp LICENSE.md dist && shx cp package.json dist && shx cp README.md dist",
|
|
43
46
|
"test": "jasmine-ts --config=jasmine.json",
|
|
44
47
|
"lint": "eslint . --ext .ts"
|
|
45
48
|
},
|
|
46
49
|
"types": "index.d.ts",
|
|
47
|
-
"version": "
|
|
50
|
+
"version": "5.0.0-beta.0"
|
|
48
51
|
}
|
|
@@ -64,23 +64,35 @@ export declare class PropertyMetadata<TDeclaringType, TType> extends Metadata {
|
|
|
64
64
|
*/
|
|
65
65
|
get customData(): CustomData;
|
|
66
66
|
/**
|
|
67
|
-
* Gets default value.
|
|
67
|
+
* Gets serialized default value.
|
|
68
68
|
*
|
|
69
|
-
* @returns {any|undefined} Resolved default value or undefined.
|
|
69
|
+
* @returns {any|undefined} Resolved serialized default value or undefined.
|
|
70
70
|
*/
|
|
71
|
-
get
|
|
71
|
+
get serializedDefaultValue(): any | undefined;
|
|
72
72
|
/**
|
|
73
|
-
* Gets
|
|
73
|
+
* Gets deserialized default value.
|
|
74
74
|
*
|
|
75
|
-
* @returns {
|
|
75
|
+
* @returns {any|undefined} Resolved deserialized default value or undefined.
|
|
76
76
|
*/
|
|
77
|
-
get
|
|
77
|
+
get deserializedDefaultValue(): any | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Gets serialized property name.
|
|
80
|
+
*
|
|
81
|
+
* @returns {string} Serialized property name.
|
|
82
|
+
*/
|
|
83
|
+
get serializedPropertyName(): string;
|
|
78
84
|
/**
|
|
79
85
|
* Gets deserialized property name.
|
|
80
86
|
*
|
|
81
87
|
* @returns {string} Deserialized property name.
|
|
82
88
|
*/
|
|
83
89
|
get deserializedPropertyName(): string;
|
|
90
|
+
/**
|
|
91
|
+
* Gets deserializable value.
|
|
92
|
+
*
|
|
93
|
+
* @returns {boolean|undefined} Deserializable indicator or undefined.
|
|
94
|
+
*/
|
|
95
|
+
get deserializable(): boolean | undefined;
|
|
84
96
|
/**
|
|
85
97
|
* Gets generic arguments.
|
|
86
98
|
*
|
|
@@ -111,12 +123,6 @@ export declare class PropertyMetadata<TDeclaringType, TType> extends Metadata {
|
|
|
111
123
|
* @returns {boolean|undefined} Serializable indicator or undefined.
|
|
112
124
|
*/
|
|
113
125
|
get serializable(): boolean | undefined;
|
|
114
|
-
/**
|
|
115
|
-
* Gets serialized property name.
|
|
116
|
-
*
|
|
117
|
-
* @returns {string} Serialized property name.
|
|
118
|
-
*/
|
|
119
|
-
get serializedPropertyName(): string;
|
|
120
126
|
/**
|
|
121
127
|
* Checks if serialization configured.
|
|
122
128
|
*
|
|
File without changes
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Alias } from './alias';
|
|
2
2
|
import { CustomData } from './custom-data';
|
|
3
|
+
import { DefaultValue } from './default-value';
|
|
3
4
|
import { GenericArgument } from './generic-argument';
|
|
4
5
|
import { NamingConvention } from './naming-convention';
|
|
5
6
|
import { ReferenceHandler } from './reference-handler';
|
|
@@ -28,12 +29,28 @@ export interface PropertyOptions<TType> {
|
|
|
28
29
|
/**
|
|
29
30
|
* Default value for undefined ones.
|
|
30
31
|
*
|
|
31
|
-
*
|
|
32
|
-
* use default value option is true.
|
|
32
|
+
* Used to set both serialized and deserialized default values and
|
|
33
|
+
* only when use default value option is true.
|
|
33
34
|
*
|
|
34
|
-
* @type {
|
|
35
|
+
* @type {DefaultValue}
|
|
35
36
|
*/
|
|
36
|
-
defaultValue?:
|
|
37
|
+
defaultValue?: DefaultValue;
|
|
38
|
+
/**
|
|
39
|
+
* Serialized default value for undefined ones.
|
|
40
|
+
*
|
|
41
|
+
* Used only when use default value option is true.
|
|
42
|
+
*
|
|
43
|
+
* @type {DefaultValue}
|
|
44
|
+
*/
|
|
45
|
+
serializedDefaultValue?: DefaultValue;
|
|
46
|
+
/**
|
|
47
|
+
* Deserialized default value for undefined ones.
|
|
48
|
+
*
|
|
49
|
+
* Used only when use default value option is true.
|
|
50
|
+
*
|
|
51
|
+
* @type {DefaultValue}
|
|
52
|
+
*/
|
|
53
|
+
deserializedDefaultValue?: DefaultValue;
|
|
37
54
|
/**
|
|
38
55
|
* Deserializable from object?
|
|
39
56
|
*
|
package/property.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { GenericArgument
|
|
2
|
-
import { PropertyOptions } from './
|
|
1
|
+
import { GenericArgument } from './generic-argument';
|
|
2
|
+
import { PropertyOptions } from './property-options';
|
|
3
|
+
import { TypeArgument } from './type-argument';
|
|
3
4
|
/**
|
|
4
5
|
* Property decorator.
|
|
5
6
|
*
|
|
File without changes
|
package/reference-handler.d.ts
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReferenceKey } from './reference-key';
|
|
2
|
+
import { ReferenceValue } from './reference-value';
|
|
3
|
+
import { ReferenceValueInitializer } from './reference-value-initializer';
|
|
4
|
+
import { ReferenceValueResolver } from './reference-value-resolver';
|
|
5
|
+
import { SerializerContext } from './serializer-context';
|
|
2
6
|
/**
|
|
3
|
-
* Reference handler
|
|
7
|
+
* Reference handler to resolve object references.
|
|
4
8
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param {ReferenceHandler} referenceHandler Reference handler.
|
|
8
|
-
*
|
|
9
|
-
* @returns {ClassDecorator&PropertyDecorator} Class and property decorator.
|
|
9
|
+
* @type {ReferenceHandler}
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export interface ReferenceHandler {
|
|
12
|
+
/**
|
|
13
|
+
* Defines reference. Called during serialization.
|
|
14
|
+
*
|
|
15
|
+
* @param {SerializerContext<any>} serializerContext Serializer context.
|
|
16
|
+
* @param {ReferenceKey} referenceKey Reference which acts as a key. This is basically a serializing object.
|
|
17
|
+
* @param {ReferenceValueInitializer} referenceValueInitializer Function to initialize a reference value when one is not yet present for a key.
|
|
18
|
+
*
|
|
19
|
+
* @returns {ReferenceValue|ReferenceValueResolver} Resolved reference value or reference resolver when circular dependency is detected.
|
|
20
|
+
*/
|
|
21
|
+
define(serializerContext: SerializerContext<any>, referenceKey: ReferenceKey, referenceValueInitializer: ReferenceValueInitializer): ReferenceValue | ReferenceValueResolver;
|
|
22
|
+
/**
|
|
23
|
+
* Restores reference. Called during deserialization.
|
|
24
|
+
*
|
|
25
|
+
* @param {SerializerContext<any>} serializerContext Serializer context.
|
|
26
|
+
* @param {ReferenceKey} referenceKey Reference which acts as a key. This is basically a deserializing object.
|
|
27
|
+
* @param {ReferenceValueInitializer} referenceValueInitializer Function to initialize a reference value when one is not yet present for a key.
|
|
28
|
+
*
|
|
29
|
+
* @returns {ReferenceValue|ReferenceValueResolver} Resolved reference value or reference resolver when circular dependency is detected.
|
|
30
|
+
*/
|
|
31
|
+
restore(serializerContext: SerializerContext<any>, referenceKey: ReferenceKey, referenceValueInitializer: ReferenceValueInitializer): ReferenceValue | ReferenceValueResolver;
|
|
32
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReferenceHandler } from '../
|
|
2
|
-
import { ReferenceKey } from '../
|
|
3
|
-
import { ReferenceValue } from '../
|
|
4
|
-
import { ReferenceValueInitializer } from '../
|
|
5
|
-
import { ReferenceValueResolver } from '../
|
|
6
|
-
import { SerializerContext } from '../
|
|
1
|
+
import { ReferenceHandler } from '../reference-handler';
|
|
2
|
+
import { ReferenceKey } from '../reference-key';
|
|
3
|
+
import { ReferenceValue } from '../reference-value';
|
|
4
|
+
import { ReferenceValueInitializer } from '../reference-value-initializer';
|
|
5
|
+
import { ReferenceValueResolver } from '../reference-value-resolver';
|
|
6
|
+
import { SerializerContext } from '../serializer-context';
|
|
7
7
|
/**
|
|
8
8
|
* Direct reference handler which preserves references as is.
|
|
9
9
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReferenceHandler } from '../
|
|
2
|
-
import { ReferenceKey } from '../
|
|
3
|
-
import { ReferenceValue } from '../
|
|
4
|
-
import { ReferenceValueInitializer } from '../
|
|
5
|
-
import { ReferenceValueResolver } from '../
|
|
6
|
-
import { SerializerContext } from '../
|
|
1
|
+
import { ReferenceHandler } from '../reference-handler';
|
|
2
|
+
import { ReferenceKey } from '../reference-key';
|
|
3
|
+
import { ReferenceValue } from '../reference-value';
|
|
4
|
+
import { ReferenceValueInitializer } from '../reference-value-initializer';
|
|
5
|
+
import { ReferenceValueResolver } from '../reference-value-resolver';
|
|
6
|
+
import { SerializerContext } from '../serializer-context';
|
|
7
7
|
/**
|
|
8
8
|
* Lead reference handler preserves references except circular. If circular reference is detected the it will
|
|
9
9
|
* be setted to undefined so only first occurance is handled.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReferenceHandler } from '../
|
|
2
|
-
import { ReferenceKey } from '../
|
|
3
|
-
import { ReferenceValue } from '../
|
|
4
|
-
import { ReferenceValueInitializer } from '../
|
|
5
|
-
import { ReferenceValueResolver } from '../
|
|
6
|
-
import { SerializerContext } from '../
|
|
1
|
+
import { ReferenceHandler } from '../reference-handler';
|
|
2
|
+
import { ReferenceKey } from '../reference-key';
|
|
3
|
+
import { ReferenceValue } from '../reference-value';
|
|
4
|
+
import { ReferenceValueInitializer } from '../reference-value-initializer';
|
|
5
|
+
import { ReferenceValueResolver } from '../reference-value-resolver';
|
|
6
|
+
import { SerializerContext } from '../serializer-context';
|
|
7
7
|
/**
|
|
8
8
|
* Path reference handler preserves references using JSONPath.
|
|
9
9
|
*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -51,11 +51,17 @@ export declare class SerializerContext<TType> extends Metadata {
|
|
|
51
51
|
*/
|
|
52
52
|
get customData(): CustomData;
|
|
53
53
|
/**
|
|
54
|
-
* Gets default value.
|
|
54
|
+
* Gets serialized default value.
|
|
55
55
|
*
|
|
56
|
-
* @returns {any|undefined} Resolved default value or undefined.
|
|
56
|
+
* @returns {any|undefined} Resolved serialized default value or undefined.
|
|
57
57
|
*/
|
|
58
|
-
get
|
|
58
|
+
get serializedDefaultValue(): any | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Gets deserialized default value.
|
|
61
|
+
*
|
|
62
|
+
* @returns {any|undefined} Resolved deserialized default value or undefined.
|
|
63
|
+
*/
|
|
64
|
+
get deserializedDefaultValue(): any | undefined;
|
|
59
65
|
/**
|
|
60
66
|
* Gets discriminant.
|
|
61
67
|
*
|
package/serializer.d.ts
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SerializerContext } from './serializer-context';
|
|
2
|
+
import { TypeLike } from './type-like';
|
|
2
3
|
/**
|
|
3
|
-
* Serializer
|
|
4
|
+
* Serializer.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param {Serializer<TType>} serializer Serializer.
|
|
8
|
-
*
|
|
9
|
-
* @returns {ClassDecorator&PropertyDecorator} Class and property decorator.
|
|
6
|
+
* @type {Serializer<TType>}
|
|
10
7
|
*/
|
|
11
|
-
export
|
|
8
|
+
export interface Serializer<TType> {
|
|
9
|
+
/**
|
|
10
|
+
* Serializes provided value.
|
|
11
|
+
*
|
|
12
|
+
* @param {TypeLike<TType>} x Some value.
|
|
13
|
+
* @param {SerializerContext<TType>} serializerContext Serializer context.
|
|
14
|
+
*
|
|
15
|
+
* @returns {TypeLike<any>} Serialized value.
|
|
16
|
+
*/
|
|
17
|
+
serialize(x: TypeLike<TType>, serializerContext: SerializerContext<TType>): TypeLike<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Deserializes provided value.
|
|
20
|
+
*
|
|
21
|
+
* @param {TypeLike<any>} x Some value.
|
|
22
|
+
* @param {SerializerContext<TType>} serializerContext Serializer context.
|
|
23
|
+
*
|
|
24
|
+
* @returns {TypeLike<TType>} Deserialized value.
|
|
25
|
+
*/
|
|
26
|
+
deserialize(x: TypeLike<any>, serializerContext: SerializerContext<TType>): TypeLike<TType>;
|
|
27
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Array buffer serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Array serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Boolean serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Data view serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Date serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Float 32 array serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Float 64 array serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Int 16 array serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Int 32 array serializer.
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Serializer } from '../
|
|
2
|
-
import { SerializerContext } from '../
|
|
3
|
-
import { TypeLike } from '../
|
|
1
|
+
import { Serializer } from '../serializer';
|
|
2
|
+
import { SerializerContext } from '../serializer-context';
|
|
3
|
+
import { TypeLike } from '../type-like';
|
|
4
4
|
/**
|
|
5
5
|
* Int 8 array serializer.
|
|
6
6
|
*
|