@rxap/schematics-ts-morph 16.1.0-dev.5 → 16.1.0-dev.6
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 +16 -0
- package/package.json +2 -2
- package/src/index.d.ts +2 -1
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/lib/angular/coerce-dialog-table-action-component.js +2 -2
- package/src/lib/angular/coerce-dialog-table-action-component.js.map +1 -1
- package/src/lib/angular/coerce-form-definition-control.js +2 -3
- package/src/lib/angular/coerce-form-definition-control.js.map +1 -1
- package/src/lib/angular/coerce-form-definition.js +4 -4
- package/src/lib/angular/coerce-form-definition.js.map +1 -1
- package/src/lib/angular/coerce-proxy-remote-method-class.d.ts +1 -1
- package/src/lib/angular/coerce-proxy-remote-method-class.js +1 -1
- package/src/lib/angular/coerce-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/coerce-table-parameters-from-route.js +4 -4
- package/src/lib/angular/coerce-table-parameters-from-route.js.map +1 -1
- package/src/lib/nest/add-operation-to-controller.d.ts +1 -1
- package/src/lib/nest/add-operation-to-controller.js +59 -55
- package/src/lib/nest/add-operation-to-controller.js.map +1 -1
- package/src/lib/nest/build-nest-controller-name.js +10 -0
- package/src/lib/nest/build-nest-controller-name.js.map +1 -1
- package/src/lib/nest/coerce-dto-class.d.ts +2 -7
- package/src/lib/nest/coerce-dto-class.js +44 -59
- package/src/lib/nest/coerce-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-form-submit-operation.d.ts +2 -4
- package/src/lib/nest/coerce-form-submit-operation.js +10 -15
- package/src/lib/nest/coerce-form-submit-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-by-id-operation.d.ts +9 -7
- package/src/lib/nest/coerce-get-by-id-operation.js +84 -56
- package/src/lib/nest/coerce-get-by-id-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-children-operation.js +8 -40
- package/src/lib/nest/coerce-get-children-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-data-grid-operation.d.ts +5 -4
- package/src/lib/nest/coerce-get-data-grid-operation.js +7 -17
- package/src/lib/nest/coerce-get-data-grid-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-operation.d.ts +5 -0
- package/src/lib/nest/coerce-get-operation.js +11 -0
- package/src/lib/nest/coerce-get-operation.js.map +1 -0
- package/src/lib/nest/coerce-get-page-operation.d.ts +16 -17
- package/src/lib/nest/coerce-get-page-operation.js +106 -112
- package/src/lib/nest/coerce-get-page-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-root-operation.d.ts +2 -5
- package/src/lib/nest/coerce-get-root-operation.js +7 -22
- package/src/lib/nest/coerce-get-root-operation.js.map +1 -1
- package/src/lib/nest/coerce-operation.d.ts +36 -9
- package/src/lib/nest/coerce-operation.js +182 -24
- package/src/lib/nest/coerce-operation.js.map +1 -1
- package/src/lib/nest/coerce-options-operation.js +13 -42
- package/src/lib/nest/coerce-options-operation.js.map +1 -1
- package/src/lib/nest/coerce-page-dto-class.d.ts +1 -0
- package/src/lib/nest/coerce-page-dto-class.js +7 -3
- package/src/lib/nest/coerce-page-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-row-dto-class.d.ts +1 -0
- package/src/lib/nest/coerce-row-dto-class.js +11 -6
- package/src/lib/nest/coerce-row-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-table-select-operation.js +6 -6
- package/src/lib/nest/coerce-table-select-operation.js.map +1 -1
- package/src/lib/nest/coerce-table-select-value-resolve-operation.d.ts +5 -1
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js +23 -32
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js.map +1 -1
- package/src/lib/nest/coerce-tree-operation.js +35 -44
- package/src/lib/nest/coerce-tree-operation.js.map +1 -1
- package/src/lib/nest/dto-class-property.d.ts +19 -0
- package/src/lib/nest/dto-class-property.js +26 -0
- package/src/lib/nest/dto-class-property.js.map +1 -0
- package/src/lib/nest/table-query-list.js +10 -2
- package/src/lib/nest/table-query-list.js.map +1 -1
- package/src/lib/nest/create-dto-class.d.ts +0 -24
- package/src/lib/nest/create-dto-class.js +0 -169
- package/src/lib/nest/create-dto-class.js.map +0 -1
|
@@ -1,56 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceTreeOperationRule = void 0;
|
|
4
|
-
const
|
|
5
|
-
const coerce_dto_class_1 = require("./coerce-dto-class");
|
|
4
|
+
const utilities_1 = require("@rxap/utilities");
|
|
6
5
|
const coerce_operation_1 = require("./coerce-operation");
|
|
7
6
|
function CoerceTreeOperationRule(options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const { operationName = 'tree', fullTree = false, path = 'true', propertyList = [], dtoClassNameSuffix = '-tree-node', isArray = true, } = options;
|
|
8
|
+
(0, utilities_1.CoerceArrayItems)(propertyList, [
|
|
9
|
+
{
|
|
10
|
+
name: 'id',
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'name',
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'type',
|
|
19
|
+
type: 'string',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'icon',
|
|
23
|
+
type: {
|
|
24
|
+
name: 'IconDto',
|
|
25
|
+
moduleSpecifier: '@rxap/nest-dto'
|
|
26
|
+
},
|
|
27
|
+
isType: true,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'children',
|
|
31
|
+
isOptional: true,
|
|
32
|
+
isArray: true,
|
|
33
|
+
isType: true,
|
|
34
|
+
type: '<self>',
|
|
35
|
+
},
|
|
36
|
+
], (a, b) => a.name === b.name);
|
|
13
37
|
if (!fullTree) {
|
|
14
38
|
throw new Error('non full tree not implemented yet');
|
|
15
39
|
}
|
|
16
40
|
return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { path,
|
|
17
|
-
operationName,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
propertyList: [
|
|
22
|
-
{
|
|
23
|
-
name: 'id',
|
|
24
|
-
type: 'string',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'name',
|
|
28
|
-
type: 'string',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
name: 'type',
|
|
32
|
-
type: 'string',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'icon',
|
|
36
|
-
type: 'IconConfigDto',
|
|
37
|
-
isType: true,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'children',
|
|
41
|
-
isOptional: true,
|
|
42
|
-
isArray: true,
|
|
43
|
-
isType: true,
|
|
44
|
-
type: '<self>',
|
|
45
|
-
},
|
|
46
|
-
]
|
|
47
|
-
});
|
|
48
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
49
|
-
namedImports: [className],
|
|
50
|
-
moduleSpecifier: filePath,
|
|
51
|
-
});
|
|
52
|
-
return Object.assign({ returnType: className + '[]' }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, moduleSourceFile));
|
|
53
|
-
} }));
|
|
41
|
+
operationName,
|
|
42
|
+
dtoClassNameSuffix,
|
|
43
|
+
propertyList,
|
|
44
|
+
isArray }));
|
|
54
45
|
}
|
|
55
46
|
exports.CoerceTreeOperationRule = CoerceTreeOperationRule;
|
|
56
47
|
//# sourceMappingURL=coerce-tree-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-tree-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-tree-operation.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"coerce-tree-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-tree-operation.ts"],"names":[],"mappings":";;;AAAA,+CAAmD;AACnD,yDAG4B;AAO5B,SAAgB,uBAAuB,CAAC,OAAmC;IACzE,MAAM,EACJ,aAAa,GAAG,MAAM,EACtB,QAAQ,GAAE,KAAK,EACf,IAAI,GAAE,MAAM,EACZ,YAAY,GAAG,EAAE,EACjB,kBAAkB,GAAG,YAAY,EACjC,OAAO,GAAG,IAAI,GACf,GAAG,OAAO,CAAC;IAEZ,IAAA,4BAAgB,EAAC,YAAY,EAAE;QAC7B;YACE,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,eAAe,EAAE,gBAAgB;aAClC;YACD,MAAM,EAAE,IAAI;SACb;QACD;YACE,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,QAAQ;SACf;KACF,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IAED,OAAO,IAAA,kCAAe,kCACjB,OAAO,KACV,IAAI;QACJ,aAAa;QACb,kBAAkB;QAClB,YAAY;QACZ,OAAO,IACP,CAAC;AACL,CAAC;AApDD,0DAoDC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DataProperty, NormalizedTypeImport, TypeImport } from '@rxap/ts-morph';
|
|
2
|
+
import { Normalized } from '@rxap/utilities';
|
|
3
|
+
export interface DtoClassProperty extends DataProperty {
|
|
4
|
+
/**
|
|
5
|
+
* The type of the property
|
|
6
|
+
*
|
|
7
|
+
* if type = '<self>' the type will be the name of the class
|
|
8
|
+
*/
|
|
9
|
+
type: string | TypeImport | '<self>';
|
|
10
|
+
/**
|
|
11
|
+
* indicates that the @Type decorator should be used as the type of the property is another dto class
|
|
12
|
+
*/
|
|
13
|
+
isType?: boolean;
|
|
14
|
+
isOptional?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface NormalizedDtoClassProperty extends Normalized<Omit<DtoClassProperty, 'type'>> {
|
|
17
|
+
type: NormalizedTypeImport;
|
|
18
|
+
}
|
|
19
|
+
export declare function NormalizeDataClassProperty(property: DtoClassProperty): NormalizedDtoClassProperty;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NormalizeDataClassProperty = void 0;
|
|
4
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
5
|
+
function NormalizeDataClassProperty(property) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const { name, type, isArray } = (0, ts_morph_1.NormalizeDataProperty)(property);
|
|
8
|
+
let isType = (_b = (_a = property.isType) !== null && _a !== void 0 ? _a : type.name === '<self>') !== null && _b !== void 0 ? _b : false;
|
|
9
|
+
const isOptional = (_c = property.isOptional) !== null && _c !== void 0 ? _c : false;
|
|
10
|
+
switch (type.name) {
|
|
11
|
+
case 'IconConfig':
|
|
12
|
+
type.name = 'IconDto';
|
|
13
|
+
type.moduleSpecifier = '@rxap/nest-dto';
|
|
14
|
+
isType = true;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
name,
|
|
19
|
+
type,
|
|
20
|
+
isArray,
|
|
21
|
+
isType,
|
|
22
|
+
isOptional,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.NormalizeDataClassProperty = NormalizeDataClassProperty;
|
|
26
|
+
//# sourceMappingURL=dto-class-property.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto-class-property.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/dto-class-property.ts"],"names":[],"mappings":";;;AAAA,6CAKwB;AAqBxB,SAAgB,0BAA0B,CAAC,QAA0B;;IACnE,MAAM,EAAE,IAAI,EAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAqB,EAAC,QAAQ,CAAC,CAAC;IACjE,IAAI,MAAM,GAAG,MAAA,MAAA,QAAQ,CAAC,MAAM,mCAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,mCAAI,KAAK,CAAC;IAChE,MAAM,UAAU,GAAG,MAAA,QAAQ,CAAC,UAAU,mCAAI,KAAK,CAAC;IAChD,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,YAAY;YACf,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;YACtB,IAAI,CAAC,eAAe,GAAG,gBAAgB,CAAC;YACxC,MAAM,GAAG,IAAI,CAAC;YACd,MAAM;KACT;IACD,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,OAAO;QACP,MAAM;QACN,UAAU;KACX,CAAC;AACJ,CAAC;AAlBD,gEAkBC"}
|
|
@@ -24,8 +24,16 @@ exports.TABLE_QUERY_LIST = [
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
name: 'filter',
|
|
27
|
-
type:
|
|
28
|
-
|
|
27
|
+
type: {
|
|
28
|
+
name: 'FilterQuery',
|
|
29
|
+
moduleSpecifier: '@rxap/nest-utilities',
|
|
30
|
+
},
|
|
31
|
+
isArray: true,
|
|
32
|
+
pipeList: [{
|
|
33
|
+
name: 'new FilterQueryPipe()',
|
|
34
|
+
namedImport: 'FilterQueryPipe',
|
|
35
|
+
moduleSpecifier: '@rxap/nest-utilities',
|
|
36
|
+
}],
|
|
29
37
|
// the FilterQueryPipe will set the default value to an empty array
|
|
30
38
|
hasQuestionToken: false,
|
|
31
39
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-query-list.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/table-query-list.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAyB;IACpD;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,GAAG;KAClB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,GAAG;KAClB;IACD;QACE,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;KACnC;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;KAC1C;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"table-query-list.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/table-query-list.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAAyB;IACpD;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,GAAG;KAClB;IACD;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,GAAG;KAClB;IACD;QACE,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;KACnC;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;KAC1C;IACD;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,aAAa;YACnB,eAAe,EAAE,sBAAsB;SACxC;QACD,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,CAAE;gBACV,IAAI,EAAE,uBAAuB;gBAC7B,WAAW,EAAE,iBAAiB;gBAC9B,eAAe,EAAE,sBAAsB;aACxC,CAAE;QACH,mEAAmE;QACnE,gBAAgB,EAAE,KAAK;KACxB;CACF,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { TypeImport } from '@rxap/ts-morph';
|
|
2
|
-
import { ClassDeclaration, ClassDeclarationStructure, ImportDeclarationStructure, OptionalKind, SourceFile, WriterFunction } from 'ts-morph';
|
|
3
|
-
export interface DtoClassProperty {
|
|
4
|
-
name: string;
|
|
5
|
-
/**
|
|
6
|
-
* The type of the property
|
|
7
|
-
*
|
|
8
|
-
* if type = '<self>' the type will be the name of the class
|
|
9
|
-
*/
|
|
10
|
-
type: string | WriterFunction | TypeImport | '<self>';
|
|
11
|
-
isArray?: boolean | null;
|
|
12
|
-
/**
|
|
13
|
-
* indicates that the @Type decorator should be used as the type of the property is another dto class
|
|
14
|
-
*/
|
|
15
|
-
isType?: boolean | null;
|
|
16
|
-
isOptional?: boolean | null;
|
|
17
|
-
/**
|
|
18
|
-
* Use to import the type
|
|
19
|
-
* @deprecated use the type property with a TypeImport object
|
|
20
|
-
*/
|
|
21
|
-
moduleSpecifier?: string | null;
|
|
22
|
-
}
|
|
23
|
-
export declare function CreateDtoClass(sourceFile: SourceFile, className: string, propertyList: DtoClassProperty[], classStructure?: Omit<OptionalKind<ClassDeclarationStructure>, 'name'>, structures?: Array<OptionalKind<ImportDeclarationStructure>>): ClassDeclaration;
|
|
24
|
-
export declare function CreatePageDtoClass(sourceFile: SourceFile, className: string, rowType: string | WriterFunction, classStructure?: Omit<OptionalKind<ClassDeclarationStructure>, 'name'>, structures?: Array<OptionalKind<ImportDeclarationStructure>>): ClassDeclaration;
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CreatePageDtoClass = exports.CreateDtoClass = void 0;
|
|
4
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
6
|
-
const coerce_class_1 = require("../coerce-class");
|
|
7
|
-
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
8
|
-
const ts_morph_2 = require("@rxap/ts-morph");
|
|
9
|
-
function CreateDtoClass(sourceFile, className, propertyList, classStructure, structures) {
|
|
10
|
-
var _a;
|
|
11
|
-
className = (0, schematics_utilities_1.CoerceSuffix)(className, 'Dto');
|
|
12
|
-
classStructure !== null && classStructure !== void 0 ? classStructure : (classStructure = {});
|
|
13
|
-
(_a = classStructure.properties) !== null && _a !== void 0 ? _a : (classStructure.properties = []);
|
|
14
|
-
classStructure.isExported = true;
|
|
15
|
-
for (const property of propertyList) {
|
|
16
|
-
const decorators = [
|
|
17
|
-
{
|
|
18
|
-
name: 'Expose',
|
|
19
|
-
arguments: [],
|
|
20
|
-
},
|
|
21
|
-
];
|
|
22
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
23
|
-
namedImports: ['Expose'],
|
|
24
|
-
moduleSpecifier: 'class-transformer',
|
|
25
|
-
});
|
|
26
|
-
if (property.isArray) {
|
|
27
|
-
decorators.push({
|
|
28
|
-
name: 'IsArray',
|
|
29
|
-
arguments: [],
|
|
30
|
-
});
|
|
31
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
32
|
-
namedImports: ['IsArray'],
|
|
33
|
-
moduleSpecifier: 'class-validator',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (property.type === '<self>') {
|
|
37
|
-
property.type = className;
|
|
38
|
-
property.isType = true;
|
|
39
|
-
}
|
|
40
|
-
if (property.isType) {
|
|
41
|
-
decorators.push({
|
|
42
|
-
name: 'Type',
|
|
43
|
-
arguments: [
|
|
44
|
-
w => {
|
|
45
|
-
w.write('() => ');
|
|
46
|
-
(0, ts_morph_2.WriteType)({
|
|
47
|
-
type: property.type,
|
|
48
|
-
isArray: false
|
|
49
|
-
}, sourceFile)(w);
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
});
|
|
53
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
54
|
-
namedImports: ['Type'],
|
|
55
|
-
moduleSpecifier: 'class-transformer',
|
|
56
|
-
});
|
|
57
|
-
decorators.push({
|
|
58
|
-
name: 'IsInstance',
|
|
59
|
-
arguments: [
|
|
60
|
-
(0, ts_morph_2.WriteType)({
|
|
61
|
-
type: property.type,
|
|
62
|
-
isArray: false
|
|
63
|
-
}, sourceFile),
|
|
64
|
-
w => {
|
|
65
|
-
if (property.isArray) {
|
|
66
|
-
ts_morph_1.Writers.object({ each: 'true' })(w);
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
});
|
|
71
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
72
|
-
namedImports: ['IsInstance'],
|
|
73
|
-
moduleSpecifier: 'class-validator',
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
if (property.isOptional) {
|
|
77
|
-
decorators.push({
|
|
78
|
-
name: 'IsOptional',
|
|
79
|
-
arguments: [],
|
|
80
|
-
});
|
|
81
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
82
|
-
namedImports: ['IsOptional'],
|
|
83
|
-
moduleSpecifier: 'class-validator',
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (property.type === 'string') {
|
|
87
|
-
if (property.name === 'uuid') {
|
|
88
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
89
|
-
namedImports: ['IsUUID'],
|
|
90
|
-
moduleSpecifier: 'class-validator',
|
|
91
|
-
});
|
|
92
|
-
decorators.push({
|
|
93
|
-
name: 'IsUUID',
|
|
94
|
-
arguments: [],
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
99
|
-
namedImports: ['IsString'],
|
|
100
|
-
moduleSpecifier: 'class-validator',
|
|
101
|
-
});
|
|
102
|
-
decorators.push({
|
|
103
|
-
name: 'IsString',
|
|
104
|
-
arguments: [],
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (property.type === 'boolean') {
|
|
109
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
110
|
-
namedImports: ['IsBoolean'],
|
|
111
|
-
moduleSpecifier: 'class-validator',
|
|
112
|
-
});
|
|
113
|
-
decorators.push({
|
|
114
|
-
name: 'IsBoolean',
|
|
115
|
-
arguments: [],
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
if (property.type === 'number') {
|
|
119
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
120
|
-
namedImports: ['IsBoolean'],
|
|
121
|
-
moduleSpecifier: 'class-validator',
|
|
122
|
-
});
|
|
123
|
-
decorators.push({
|
|
124
|
-
name: 'IsBoolean',
|
|
125
|
-
arguments: [],
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
classStructure.properties.push({
|
|
129
|
-
name: property.name,
|
|
130
|
-
type: (0, ts_morph_2.WriteType)(property, sourceFile),
|
|
131
|
-
hasQuestionToken: !!property.isOptional,
|
|
132
|
-
hasExclamationToken: !property.isOptional,
|
|
133
|
-
decorators,
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, structures !== null && structures !== void 0 ? structures : []);
|
|
137
|
-
return (0, coerce_class_1.CoerceClass)(sourceFile, className, classStructure);
|
|
138
|
-
}
|
|
139
|
-
exports.CreateDtoClass = CreateDtoClass;
|
|
140
|
-
function CreatePageDtoClass(sourceFile, className, rowType, classStructure, structures) {
|
|
141
|
-
className = (0, schematics_utilities_1.CoerceSuffix)(className, 'PageDto');
|
|
142
|
-
const propertyList = [
|
|
143
|
-
{
|
|
144
|
-
name: 'rows',
|
|
145
|
-
type: rowType,
|
|
146
|
-
isArray: true,
|
|
147
|
-
isType: true,
|
|
148
|
-
},
|
|
149
|
-
];
|
|
150
|
-
classStructure !== null && classStructure !== void 0 ? classStructure : (classStructure = {});
|
|
151
|
-
classStructure.extends = w => {
|
|
152
|
-
w.write('PageDto<');
|
|
153
|
-
if (typeof rowType === 'string') {
|
|
154
|
-
w.write(rowType);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
rowType(w);
|
|
158
|
-
}
|
|
159
|
-
w.write('>');
|
|
160
|
-
};
|
|
161
|
-
structures !== null && structures !== void 0 ? structures : (structures = []);
|
|
162
|
-
structures.push({
|
|
163
|
-
namedImports: ['PageDto'],
|
|
164
|
-
moduleSpecifier: '@rxap/nest-dto',
|
|
165
|
-
});
|
|
166
|
-
return CreateDtoClass(sourceFile, className, propertyList, classStructure, structures);
|
|
167
|
-
}
|
|
168
|
-
exports.CreatePageDtoClass = CreatePageDtoClass;
|
|
169
|
-
//# sourceMappingURL=create-dto-class.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-dto-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/create-dto-class.ts"],"names":[],"mappings":";;;AAAA,qEAA0D;AAE1D,uCAUkB;AAClB,kDAA8C;AAC9C,+DAA2D;AAC3D,6CAGwB;AAuBxB,SAAgB,cAAc,CAC5B,UAAsB,EACtB,SAAiB,EACjB,YAAgC,EAChC,cAAsE,EACtE,UAA4D;;IAG5D,SAAS,GAAG,IAAA,mCAAY,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,cAAc,aAAd,cAAc,cAAd,cAAc,IAAd,cAAc,GAAK,EAAE,EAAC;IACtB,MAAA,cAAc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