1 | /**
|
2 | * Options to be passed during transformation.
|
3 | *
|
4 | * @see https://github.com/typestack/class-transformer
|
5 | *
|
6 | * @publicApi
|
7 | */
|
8 | export interface ClassTransformOptions {
|
9 | /**
|
10 | * Exclusion strategy. By default exposeAll is used, which means that it will expose all properties that
|
11 | * are transformed by default.
|
12 | */
|
13 | strategy?: 'excludeAll' | 'exposeAll';
|
14 | /**
|
15 | * Only properties with given groups will be transformed.
|
16 | */
|
17 | groups?: string[];
|
18 | /**
|
19 | * Only properties with "since" > version < "until" will be transformed.
|
20 | */
|
21 | version?: number;
|
22 | /**
|
23 | * Excludes properties with the given prefixes. For example, if you mark your private properties with "_" and "__"
|
24 | * you can set this option's value to ["_", "__"] and all private properties will be skipped.
|
25 | * This works only for "exposeAll" strategy.
|
26 | */
|
27 | excludePrefixes?: string[];
|
28 | /**
|
29 | * If set to true then class transformer will ignore all @Expose and @Exclude decorators and what's inside them.
|
30 | * This option is useful if you want to "clone" your object but not apply decorators affects.
|
31 | */
|
32 | ignoreDecorators?: boolean;
|
33 | /**
|
34 | * Target maps allows to set a Types of the transforming object without using @Type decorator.
|
35 | * This is useful when you are transforming external classes, or if you already have type metadata for
|
36 | * objects and you don't want to set it up again.
|
37 | */
|
38 | targetMaps?: any[];
|
39 | /**
|
40 | * If set to true then class transformer will perform a circular check. (Circular check is turned off by default)
|
41 | * This option is useful when you know for sure that your types might have a circular dependency.
|
42 | */
|
43 | enableCircularCheck?: boolean;
|
44 | /**
|
45 | * If set to true class-transformer will attempt conversion based on TS reflected type
|
46 | */
|
47 | enableImplicitConversion?: boolean;
|
48 | /**
|
49 | * If set to true class-transformer will exclude properties which are not part of the original class
|
50 | * and exposing all class properties (with undefined, if nothing else is given)
|
51 | */
|
52 | excludeExtraneousValues?: boolean;
|
53 | /**
|
54 | * If set to true then class transformer will take default values for unprovided fields.
|
55 | * This is useful when you convert a plain object to a class and have an optional field with a default value.
|
56 | */
|
57 | exposeDefaultValues?: boolean;
|
58 | /**
|
59 | * When set to true, fields with `undefined` as value will be included in class to plain transformation. Otherwise
|
60 | * those fields will be omitted from the result.
|
61 | *
|
62 | * DEFAULT: `true`
|
63 | */
|
64 | exposeUnsetFields?: boolean;
|
65 | }
|