@rxap/schematics-ts-morph 16.1.0-dev.0 → 16.1.0-dev.10
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 +78 -0
- package/README.md +1 -1
- package/package.json +10 -8
- package/src/index.d.ts +7 -2
- package/src/index.js +7 -2
- package/src/index.js.map +1 -1
- package/src/lib/angular/coerce-component.d.ts +6 -0
- package/src/lib/angular/coerce-component.js +57 -2
- package/src/lib/angular/coerce-component.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-array.d.ts +14 -0
- package/src/lib/angular/coerce-form-definition-array.js +87 -0
- package/src/lib/angular/coerce-form-definition-array.js.map +1 -0
- package/src/lib/angular/coerce-form-definition-control.d.ts +9 -12
- package/src/lib/angular/coerce-form-definition-control.js +68 -125
- package/src/lib/angular/coerce-form-definition-control.js.map +1 -1
- package/src/lib/angular/coerce-form-definition-form-control.d.ts +11 -0
- package/src/lib/angular/coerce-form-definition-form-control.js +66 -0
- package/src/lib/angular/coerce-form-definition-form-control.js.map +1 -0
- package/src/lib/angular/coerce-form-definition-group.d.ts +14 -0
- package/src/lib/angular/coerce-form-definition-group.js +80 -0
- package/src/lib/angular/coerce-form-definition-group.js.map +1 -0
- package/src/lib/angular/coerce-form-definition-type.d.ts +2 -2
- package/src/lib/angular/coerce-form-definition-type.js +16 -2
- package/src/lib/angular/coerce-form-definition-type.js.map +1 -1
- package/src/lib/angular/coerce-form-definition.d.ts +4 -4
- package/src/lib/angular/coerce-form-definition.js +24 -13
- package/src/lib/angular/coerce-form-definition.js.map +1 -1
- package/src/lib/angular/coerce-options-data-source.d.ts +3 -1
- package/src/lib/angular/coerce-options-data-source.js +35 -6
- package/src/lib/angular/coerce-options-data-source.js.map +1 -1
- package/src/lib/angular/coerce-proxy-remote-method-class.d.ts +2 -2
- package/src/lib/angular/coerce-proxy-remote-method-class.js +15 -18
- package/src/lib/angular/coerce-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/coerce-table-data-source.js +1 -1
- package/src/lib/angular/coerce-table-data-source.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/angular/coerce-table-select-resolve-value-method.js +2 -2
- package/src/lib/angular/coerce-table-select-resolve-value-method.js.map +1 -1
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.js +2 -2
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/form-definition-utilities.d.ts +1 -0
- package/src/lib/angular/form-definition-utilities.js +7 -3
- package/src/lib/angular/form-definition-utilities.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 +4 -16
- package/src/lib/nest/coerce-dto-class.js +59 -67
- 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 +13 -18
- 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 +85 -56
- package/src/lib/nest/coerce-get-by-id-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-children-operation.d.ts +2 -2
- package/src/lib/nest/coerce-get-children-operation.js +11 -52
- 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 -22
- 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 +17 -27
- package/src/lib/nest/coerce-get-page-operation.js +157 -145
- package/src/lib/nest/coerce-get-page-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-root-operation.d.ts +3 -2
- package/src/lib/nest/coerce-get-root-operation.js +22 -44
- package/src/lib/nest/coerce-get-root-operation.js.map +1 -1
- package/src/lib/nest/coerce-operation.d.ts +32 -9
- package/src/lib/nest/coerce-operation.js +191 -29
- package/src/lib/nest/coerce-operation.js.map +1 -1
- package/src/lib/nest/coerce-options-operation.d.ts +2 -2
- 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 +3 -8
- package/src/lib/nest/coerce-page-dto-class.js +52 -22
- 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 +12 -10
- package/src/lib/nest/coerce-row-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-submit-data-grid-operation.js +3 -7
- package/src/lib/nest/coerce-submit-data-grid-operation.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 +7 -6
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js +32 -33
- 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 +18 -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.d.ts +2 -0
- package/src/lib/nest/table-query-list.js +41 -0
- package/src/lib/nest/table-query-list.js.map +1 -0
- package/src/lib/ts-morph/coerce-imports.js +1 -1
- package/src/lib/ts-morph/coerce-imports.js.map +1 -1
- package/src/lib/types/abstract-control.d.ts +8 -0
- package/src/lib/types/{form-definition-control.js → abstract-control.js} +1 -1
- package/src/lib/types/abstract-control.js.map +1 -0
- 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
- package/src/lib/types/form-definition-control.d.ts +0 -10
- package/src/lib/types/form-definition-control.js.map +0 -1
|
@@ -1,59 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceGetChildrenOperation = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const coerce_dto_class_1 = require("./coerce-dto-class");
|
|
7
|
-
const coerce_operation_1 = require("./coerce-operation");
|
|
4
|
+
const utilities_1 = require("@rxap/utilities");
|
|
5
|
+
const coerce_get_root_operation_1 = require("./coerce-get-root-operation");
|
|
8
6
|
function CoerceGetChildrenOperation(options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
// TODO : remove after migration to controllerName
|
|
19
|
-
controllerName, operationName: 'get-children', paramList, tsMorphTransform: (project, sourceFile, classDeclaration, controllerName) => {
|
|
20
|
-
const { className, filePath, } = (0, coerce_dto_class_1.CoerceDtoClass)({
|
|
21
|
-
project,
|
|
22
|
-
name: (0, schematics_utilities_1.CoerceSuffix)(controllerName, '-item'),
|
|
23
|
-
propertyList: [
|
|
24
|
-
{
|
|
25
|
-
name: 'uuid',
|
|
26
|
-
type: 'string',
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: 'hasChildren',
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'children',
|
|
34
|
-
type: (0, schematics_utilities_1.classify)((0, schematics_utilities_1.CoerceSuffix)(controllerName, '-item-dto')),
|
|
35
|
-
isArray: true,
|
|
36
|
-
isOptional: true,
|
|
37
|
-
isType: true,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
});
|
|
41
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, [
|
|
42
|
-
{
|
|
43
|
-
namedImports: ['plainToInstance'],
|
|
44
|
-
moduleSpecifier: 'class-transformer',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
namedImports: ['classTransformOptions'],
|
|
48
|
-
moduleSpecifier: '@rxap/nest-utilities',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
namedImports: [className],
|
|
52
|
-
moduleSpecifier: filePath,
|
|
53
|
-
},
|
|
54
|
-
]);
|
|
55
|
-
return Object.assign({ returnType: className + '[]' }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName));
|
|
56
|
-
} }));
|
|
7
|
+
const { paramList = [], operationName = 'get-children', } = options;
|
|
8
|
+
(0, utilities_1.CoerceArrayItems)(paramList, [
|
|
9
|
+
{
|
|
10
|
+
name: 'parentUuid',
|
|
11
|
+
type: 'string',
|
|
12
|
+
}
|
|
13
|
+
], (a, b) => a.name === b.name);
|
|
14
|
+
return (0, coerce_get_root_operation_1.CoerceGetRootOperation)(Object.assign(Object.assign({}, options), { operationName,
|
|
15
|
+
paramList }));
|
|
57
16
|
}
|
|
58
17
|
exports.CoerceGetChildrenOperation = CoerceGetChildrenOperation;
|
|
59
18
|
//# sourceMappingURL=coerce-get-children-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-get-children-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-children-operation.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"coerce-get-children-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-children-operation.ts"],"names":[],"mappings":";;;AAAA,+CAAmD;AACnD,2EAGqC;AAIrC,SAAgB,0BAA0B,CAAC,OAAoD;IAC7F,MAAM,EACJ,SAAS,GAAG,EAAE,EACd,aAAa,GAAG,cAAc,GAC/B,GAAG,OAAO,CAAC;IACZ,IAAA,4BAAgB,EAAC,SAAS,EAAE;QAC1B;YACA,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,QAAQ;SACb;KACF,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,IAAA,kDAAsB,kCACxB,OAAO,KACV,aAAa;QACb,SAAS,IACT,CAAC;AACL,CAAC;AAhBD,gEAgBC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { CoerceGetByIdControllerOptions } from './coerce-get-by-id-operation';
|
|
2
|
+
export interface CoerceGetDataGridOperationOptions extends CoerceGetByIdControllerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated use isArray instead
|
|
5
|
+
*/
|
|
4
6
|
collection?: boolean;
|
|
5
|
-
propertyList?: DtoClassProperty[];
|
|
6
7
|
}
|
|
7
8
|
export declare function CoerceGetDataGridOperation(options: Readonly<CoerceGetDataGridOperationOptions>): import("@angular-devkit/schematics").Rule;
|
|
@@ -1,29 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceGetDataGridOperation = void 0;
|
|
4
|
-
const
|
|
5
|
-
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
6
|
-
const coerce_dto_class_1 = require("./coerce-dto-class");
|
|
7
|
-
const coerce_operation_1 = require("./coerce-operation");
|
|
4
|
+
const coerce_get_by_id_operation_1 = require("./coerce-get-by-id-operation");
|
|
8
5
|
function CoerceGetDataGridOperation(options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { controllerName, operationName: 'get', tsMorphTransform: (project, sourceFile, classDeclaration, controllerName) => {
|
|
16
|
-
const { className: dtoClassName, filePath: dtoFilePath, } = (0, coerce_dto_class_1.CoerceDtoClass)({
|
|
17
|
-
project,
|
|
18
|
-
name: controllerName,
|
|
19
|
-
propertyList,
|
|
20
|
-
});
|
|
21
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
22
|
-
namedImports: [dtoClassName],
|
|
23
|
-
moduleSpecifier: dtoFilePath,
|
|
24
|
-
});
|
|
25
|
-
return Object.assign({ returnType: dtoClassName + (collection ? '[]' : '') }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName));
|
|
26
|
-
} }));
|
|
6
|
+
const { collection = false, isArray = collection !== null && collection !== void 0 ? collection : false,
|
|
7
|
+
// if not explicitly defined the idProperty is set to null, as not each data grid operation has an id
|
|
8
|
+
idProperty = null, operationName = idProperty ? 'getById' : 'get', } = options;
|
|
9
|
+
return (0, coerce_get_by_id_operation_1.CoerceGetByIdOperation)(Object.assign(Object.assign({}, options), { operationName,
|
|
10
|
+
idProperty,
|
|
11
|
+
isArray }));
|
|
27
12
|
}
|
|
28
13
|
exports.CoerceGetDataGridOperation = CoerceGetDataGridOperation;
|
|
29
14
|
//# sourceMappingURL=coerce-get-data-grid-operation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-get-data-grid-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-data-grid-operation.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-get-data-grid-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-data-grid-operation.ts"],"names":[],"mappings":";;;AAAA,6EAGsC;AAStC,SAAgB,0BAA0B,CAAC,OAAoD;IAC7F,MAAM,EACJ,UAAU,GAAE,KAAK,EACjB,OAAO,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,KAAK;IAC7B,qGAAqG;IACrG,UAAU,GAAG,IAAI,EACjB,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAC/C,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAA,mDAAsB,kCACxB,OAAO,KACV,aAAa;QACb,UAAU;QACV,OAAO,IACP,CAAC;AAEL,CAAC;AAhBD,gEAgBC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CoerceOperationOptions } from './coerce-operation';
|
|
2
|
+
export interface CoerceGetControllerOptions extends Omit<CoerceOperationOptions, 'operationName'> {
|
|
3
|
+
operationName?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function CoerceGetOperation<Options = Record<string, any>>(options: CoerceGetControllerOptions): import("@angular-devkit/schematics").Rule;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceGetOperation = void 0;
|
|
4
|
+
const coerce_operation_1 = require("./coerce-operation");
|
|
5
|
+
function CoerceGetOperation(options) {
|
|
6
|
+
const { operationName = 'get', isReturnVoid = false } = options;
|
|
7
|
+
return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { operationName,
|
|
8
|
+
isReturnVoid }));
|
|
9
|
+
}
|
|
10
|
+
exports.CoerceGetOperation = CoerceGetOperation;
|
|
11
|
+
//# sourceMappingURL=coerce-get-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coerce-get-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-operation.ts"],"names":[],"mappings":";;;AAAA,yDAG4B;AAM5B,SAAgB,kBAAkB,CAAgC,OAAmC;IACnG,MAAM,EACJ,aAAa,GAAG,KAAK,EACrB,YAAY,GAAG,KAAK,EACrB,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAA,kCAAe,kCACjB,OAAO,KACV,aAAa;QACb,YAAY,IACZ,CAAC;AAEL,CAAC;AAZD,gDAYC"}
|
|
@@ -1,40 +1,30 @@
|
|
|
1
|
-
import { TypeImport } from '@rxap/ts-morph';
|
|
2
|
-
import { ClassDeclaration, Project, SourceFile } from 'ts-morph';
|
|
1
|
+
import { NormalizedUpstreamOptions, TypeImport } from '@rxap/ts-morph';
|
|
2
|
+
import { ClassDeclaration, Project, SourceFile, WriterFunction } from 'ts-morph';
|
|
3
3
|
import { OperationOptions } from './add-operation-to-controller';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* the property name of the source object. if not defined the name will be used
|
|
11
|
-
*/
|
|
12
|
-
source?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface CoerceGetPageOperationOptions extends Omit<Omit<CoerceOperationOptions, 'operationName'>, 'tsMorphTransform'> {
|
|
15
|
-
propertyList: GetPageOperationProperty[];
|
|
16
|
-
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration, controllerName: string, pageClassName: string, rowClassName: string) => Partial<OperationOptions>;
|
|
4
|
+
import { CoerceDtoClassOutput } from './coerce-dto-class';
|
|
5
|
+
import { CoerceOperationOptions, TransformOperation } from './coerce-operation';
|
|
6
|
+
import { DtoClassProperty } from './dto-class-property';
|
|
7
|
+
export interface CoerceGetPageOperationOptions extends Omit<CoerceOperationOptions, 'operationName' | 'tsMorphTransform' | 'coerceOperationDtoClass'> {
|
|
8
|
+
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, pageClassName: string, rowClassName: string) => Partial<OperationOptions>;
|
|
17
9
|
/**
|
|
18
10
|
* the name of the property used as row id value. defaults to the value 'uuid'. If null the __rowId property will be
|
|
19
11
|
* set to the absolute row index absolute row index = page * pageSize + rowIndex
|
|
20
12
|
*/
|
|
21
13
|
rowIdProperty?: string | null;
|
|
22
14
|
operationName?: string;
|
|
23
|
-
/**
|
|
24
|
-
* true - the suffix '-table' will not be enforced for the controller name
|
|
25
|
-
*/
|
|
26
|
-
skipCoerceTableSuffix?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* The base name of the page and row DTO class name. Defaults to the controller name
|
|
29
|
-
*/
|
|
30
|
-
responseDtoName?: string;
|
|
31
15
|
coerceToRowDtoMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, rowClassName: string, options: CoerceGetPageOperationOptions) => void;
|
|
32
16
|
coerceToPageDtoMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, pageClassName: string, rowClassName: string, options: CoerceGetPageOperationOptions) => void;
|
|
33
|
-
coerceGetPageDataMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, options: CoerceGetPageOperationOptions) => void;
|
|
17
|
+
coerceGetPageDataMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, options: CoerceGetPageOperationOptions) => void;
|
|
18
|
+
coerceOperationDtoClass?: (classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, options: Readonly<CoerceGetPageOperationOptions>) => CoerceDtoClassOutput | null;
|
|
19
|
+
upstream?: NormalizedUpstreamOptions | null;
|
|
34
20
|
}
|
|
35
|
-
export declare function
|
|
36
|
-
export declare function GetPageOperationColumnToCodeText(property: GetPageOperationProperty): string;
|
|
21
|
+
export declare function GetPageOperationColumnToCodeText(property: DtoClassProperty): string;
|
|
37
22
|
export declare function CoerceToRowDtoMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, rowClassName: string, options: CoerceGetPageOperationOptions): void;
|
|
38
23
|
export declare function CoerceToPageDtoMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, pageClassName: string, rowClassName: string, options: CoerceGetPageOperationOptions): void;
|
|
39
|
-
export declare function CoerceGetPageDataMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, options: CoerceGetPageOperationOptions): void;
|
|
24
|
+
export declare function CoerceGetPageDataMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, options: CoerceGetPageOperationOptions): void;
|
|
25
|
+
export declare function GetResponseTypeFromUpstream(upstream: NormalizedUpstreamOptions): TypeImport;
|
|
26
|
+
export declare function GetRawRowDataType(options: Readonly<CoerceGetPageOperationOptions>): TypeImport;
|
|
27
|
+
export declare function BuildGetPageUpstreamGetDataImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation;
|
|
28
|
+
export declare function CoerceGetPageOperationDtoClass(classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, options: Readonly<CoerceGetPageOperationOptions>): CoerceDtoClassOutput | null;
|
|
29
|
+
export declare function BuiltGetPageDtoDataMapperImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation<string | WriterFunction>;
|
|
40
30
|
export declare function CoerceGetPageOperation(options: Readonly<CoerceGetPageOperationOptions>): import("@angular-devkit/schematics").Rule;
|
|
@@ -1,42 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoerceGetPageOperation = exports.
|
|
3
|
+
exports.CoerceGetPageOperation = exports.BuiltGetPageDtoDataMapperImplementation = exports.CoerceGetPageOperationDtoClass = exports.BuildGetPageUpstreamGetDataImplementation = exports.GetRawRowDataType = exports.GetResponseTypeFromUpstream = exports.CoerceGetPageDataMethod = exports.CoerceToPageDtoMethod = exports.CoerceToRowDtoMethod = exports.GetPageOperationColumnToCodeText = void 0;
|
|
4
4
|
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
5
|
const ts_morph_1 = require("@rxap/ts-morph");
|
|
6
6
|
const utilities_1 = require("@rxap/utilities");
|
|
7
7
|
const ts_morph_2 = require("ts-morph");
|
|
8
|
-
const coerce_class_method_1 = require("../coerce-class-method");
|
|
9
|
-
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
10
8
|
const coerce_type_alias_1 = require("../ts-morph/coerce-type-alias");
|
|
9
|
+
const write_type_1 = require("../ts-morph/write-type");
|
|
11
10
|
const coerce_operation_1 = require("./coerce-operation");
|
|
12
11
|
const coerce_page_dto_class_1 = require("./coerce-page-dto-class");
|
|
13
12
|
const coerce_row_dto_class_1 = require("./coerce-row-dto-class");
|
|
14
|
-
|
|
15
|
-
var _a, _b;
|
|
16
|
-
if (!property.type) {
|
|
17
|
-
return { name: 'unknown' };
|
|
18
|
-
}
|
|
19
|
-
switch ((_a = property.type) === null || _a === void 0 ? void 0 : _a.name) {
|
|
20
|
-
case 'IconConfig':
|
|
21
|
-
return {
|
|
22
|
-
name: 'IconDto',
|
|
23
|
-
moduleSpecifier: '@rxap/nest-dto',
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return (_b = property.type) !== null && _b !== void 0 ? _b : { name: 'unknown' };
|
|
27
|
-
}
|
|
28
|
-
function GetPageOperationColumnToDtoClassProperty(property) {
|
|
29
|
-
var _a;
|
|
30
|
-
const type = GetPageOperationColumnTypeToTypeImport(property);
|
|
31
|
-
return {
|
|
32
|
-
name: property.name,
|
|
33
|
-
type: (_a = type.name.replace(/\[]$/, '').replace(/^Array<(.+)>/, '$1')) !== null && _a !== void 0 ? _a : 'unknown',
|
|
34
|
-
isArray: type.name.endsWith('[]') || type.name.startsWith('Array<'),
|
|
35
|
-
isOptional: false,
|
|
36
|
-
isType: false,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
exports.GetPageOperationColumnToDtoClassProperty = GetPageOperationColumnToDtoClassProperty;
|
|
13
|
+
const table_query_list_1 = require("./table-query-list");
|
|
40
14
|
function GetPageOperationColumnToCodeText(property) {
|
|
41
15
|
var _a;
|
|
42
16
|
let propertyName = (0, schematics_utilities_1.camelize)(property.name);
|
|
@@ -49,14 +23,17 @@ function GetPageOperationColumnToCodeText(property) {
|
|
|
49
23
|
}
|
|
50
24
|
exports.GetPageOperationColumnToCodeText = GetPageOperationColumnToCodeText;
|
|
51
25
|
function CoerceToRowDtoMethod(sourceFile, classDeclaration, rowClassName, options) {
|
|
52
|
-
var _a;
|
|
53
|
-
(0,
|
|
26
|
+
var _a, _b, _c;
|
|
27
|
+
(0, ts_morph_1.CoerceClassMethod)(classDeclaration, 'toRowDto', {
|
|
54
28
|
scope: ts_morph_2.Scope.Private,
|
|
55
29
|
returnType: rowClassName,
|
|
56
30
|
parameters: [
|
|
57
31
|
{
|
|
58
32
|
name: 'item',
|
|
59
|
-
type:
|
|
33
|
+
type: (0, write_type_1.WriteType)({
|
|
34
|
+
isArray: false,
|
|
35
|
+
type: GetRawRowDataType(options),
|
|
36
|
+
}, sourceFile),
|
|
60
37
|
},
|
|
61
38
|
{
|
|
62
39
|
name: 'index',
|
|
@@ -72,7 +49,10 @@ function CoerceToRowDtoMethod(sourceFile, classDeclaration, rowClassName, option
|
|
|
72
49
|
},
|
|
73
50
|
{
|
|
74
51
|
name: 'list',
|
|
75
|
-
type:
|
|
52
|
+
type: (0, write_type_1.WriteType)({
|
|
53
|
+
isArray: true,
|
|
54
|
+
type: GetRawRowDataType(options),
|
|
55
|
+
}, sourceFile),
|
|
76
56
|
},
|
|
77
57
|
],
|
|
78
58
|
statements: [
|
|
@@ -81,20 +61,23 @@ function CoerceToRowDtoMethod(sourceFile, classDeclaration, rowClassName, option
|
|
|
81
61
|
(options.rowIdProperty === null ?
|
|
82
62
|
'(pageIndex * pageSize + index).toFixed(0)' :
|
|
83
63
|
`item.${(_a = options.rowIdProperty) !== null && _a !== void 0 ? _a : 'uuid'}`) + ',\n ',
|
|
84
|
-
options.propertyList.map(GetPageOperationColumnToCodeText).join(',\n '),
|
|
64
|
+
(_c = (_b = options.propertyList) === null || _b === void 0 ? void 0 : _b.filter(p => p.name !== '__rowId').map(GetPageOperationColumnToCodeText).join(',\n ')) !== null && _c !== void 0 ? _c : '',
|
|
85
65
|
'};',
|
|
86
66
|
],
|
|
87
67
|
});
|
|
88
68
|
}
|
|
89
69
|
exports.CoerceToRowDtoMethod = CoerceToRowDtoMethod;
|
|
90
70
|
function CoerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowClassName, options) {
|
|
91
|
-
(0,
|
|
71
|
+
(0, ts_morph_1.CoerceClassMethod)(classDeclaration, 'toPageDto', {
|
|
92
72
|
scope: ts_morph_2.Scope.Private,
|
|
93
73
|
returnType: pageClassName,
|
|
94
74
|
parameters: [
|
|
95
75
|
{
|
|
96
76
|
name: 'list',
|
|
97
|
-
type:
|
|
77
|
+
type: (0, write_type_1.WriteType)({
|
|
78
|
+
isArray: true,
|
|
79
|
+
type: GetRawRowDataType(options),
|
|
80
|
+
}, sourceFile),
|
|
98
81
|
},
|
|
99
82
|
{
|
|
100
83
|
name: 'total',
|
|
@@ -130,10 +113,67 @@ function CoerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowC
|
|
|
130
113
|
});
|
|
131
114
|
}
|
|
132
115
|
exports.CoerceToPageDtoMethod = CoerceToPageDtoMethod;
|
|
133
|
-
function CoerceGetPageDataMethod(sourceFile, classDeclaration, options) {
|
|
134
|
-
|
|
116
|
+
function CoerceGetPageDataMethod(sourceFile, classDeclaration, moduleSourceFile, options) {
|
|
117
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
118
|
+
const { upstream } = options;
|
|
119
|
+
const statements = [];
|
|
120
|
+
if (upstream && (0, ts_morph_1.IsNormalizedOpenApiUpstreamOptions)(upstream)) {
|
|
121
|
+
const { memberName, className: commandClassName } = (0, coerce_operation_1.CoerceUpstreamBasicOperationImplementation)(classDeclaration, moduleSourceFile, upstream);
|
|
122
|
+
(0, ts_morph_1.CoercePropertyDeclaration)(classDeclaration, memberName, {
|
|
123
|
+
type: commandClassName,
|
|
124
|
+
scope: ts_morph_2.Scope.Private,
|
|
125
|
+
hasExclamationToken: true,
|
|
126
|
+
decorators: [
|
|
127
|
+
{
|
|
128
|
+
name: 'Inject',
|
|
129
|
+
arguments: [commandClassName],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
});
|
|
133
|
+
(0, ts_morph_1.CoerceImports)(sourceFile, [
|
|
134
|
+
{
|
|
135
|
+
namedImports: [commandClassName],
|
|
136
|
+
moduleSpecifier: (0, ts_morph_1.OperationIdToCommandClassImportPath)(upstream.operationId, upstream.scope, upstream.isService),
|
|
137
|
+
}, {
|
|
138
|
+
namedImports: ['Inject'],
|
|
139
|
+
moduleSpecifier: '@nestjs/common',
|
|
140
|
+
},
|
|
141
|
+
]);
|
|
142
|
+
statements.push(`const response = await this.${memberName}.execute({
|
|
143
|
+
parameters: {
|
|
144
|
+
${(_b = (_a = upstream.mapper) === null || _a === void 0 ? void 0 : _a.pageIndex) !== null && _b !== void 0 ? _b : 'pageIndex'}: pageIndex,
|
|
145
|
+
${(_d = (_c = upstream.mapper) === null || _c === void 0 ? void 0 : _c.pageSize) !== null && _d !== void 0 ? _d : 'pageSize'}: pageSize,
|
|
146
|
+
${(_f = (_e = upstream.mapper) === null || _e === void 0 ? void 0 : _e.sortBy) !== null && _f !== void 0 ? _f : 'sortBy'}: sortBy,
|
|
147
|
+
${(_h = (_g = upstream.mapper) === null || _g === void 0 ? void 0 : _g.sortDirection) !== null && _h !== void 0 ? _h : 'sortDirection'}: sortDirection,
|
|
148
|
+
filter: ${((_j = upstream.mapper) === null || _j === void 0 ? void 0 : _j.filter) ? `filter.map((item) => \`\${ item.column }:\${ item.filter }\`).join(';')` :
|
|
149
|
+
'filter'},
|
|
150
|
+
},
|
|
151
|
+
});`, 'return {', ` list: response.${(_l = (_k = upstream.mapper) === null || _k === void 0 ? void 0 : _k.list) !== null && _l !== void 0 ? _l : 'list'} ?? [],`, ` total: response.${(_o = (_m = upstream.mapper) === null || _m === void 0 ? void 0 : _m.total) !== null && _o !== void 0 ? _o : 'total'} ?? 0,`, '};');
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
statements.push(`const response = await ((() => { throw new NotImplementedException(); })() as any).execute({
|
|
155
|
+
parameters: {
|
|
156
|
+
page: pageIndex,
|
|
157
|
+
size: pageSize,
|
|
158
|
+
sort: sortBy,
|
|
159
|
+
order: sortDirection,
|
|
160
|
+
filter: filter.map((item) => \`\${ item.column }:\${ item.filter }\`).join(';'),
|
|
161
|
+
},
|
|
162
|
+
});`, 'return {', ' list: response.entities ?? [],', ' total: response.maxCount ?? 0,', '};');
|
|
163
|
+
}
|
|
164
|
+
(0, ts_morph_1.CoerceClassMethod)(classDeclaration, 'getPageData', {
|
|
135
165
|
scope: ts_morph_2.Scope.Public,
|
|
136
|
-
returnType:
|
|
166
|
+
returnType: w => {
|
|
167
|
+
w.write('Promise<');
|
|
168
|
+
ts_morph_2.Writers.object({
|
|
169
|
+
list: (0, write_type_1.WriteType)({
|
|
170
|
+
isArray: true,
|
|
171
|
+
type: GetRawRowDataType(options),
|
|
172
|
+
}, sourceFile),
|
|
173
|
+
total: 'number',
|
|
174
|
+
})(w);
|
|
175
|
+
w.write('>');
|
|
176
|
+
},
|
|
137
177
|
isAsync: true,
|
|
138
178
|
parameters: [
|
|
139
179
|
{
|
|
@@ -157,116 +197,88 @@ function CoerceGetPageDataMethod(sourceFile, classDeclaration, options) {
|
|
|
157
197
|
type: 'FilterQuery[]',
|
|
158
198
|
},
|
|
159
199
|
],
|
|
160
|
-
statements:
|
|
161
|
-
`const response = await ((() => { throw new NotImplementedException() })() as any).execute({
|
|
162
|
-
parameters: {
|
|
163
|
-
page: pageIndex,
|
|
164
|
-
size: pageSize,
|
|
165
|
-
sort: sortBy,
|
|
166
|
-
order: sortDirection,
|
|
167
|
-
filter: filter.map((item) => \`\${ item.column }:\${ item.filter }\`).join(';'),
|
|
168
|
-
},
|
|
169
|
-
});`,
|
|
170
|
-
'return {',
|
|
171
|
-
' list: response.entities ?? [],',
|
|
172
|
-
' total: response.maxCount ?? 0,',
|
|
173
|
-
'};',
|
|
174
|
-
],
|
|
200
|
+
statements: statements,
|
|
175
201
|
});
|
|
176
202
|
}
|
|
177
203
|
exports.CoerceGetPageDataMethod = CoerceGetPageDataMethod;
|
|
204
|
+
function GetResponseTypeFromUpstream(upstream) {
|
|
205
|
+
var _a, _b;
|
|
206
|
+
if ((0, ts_morph_1.IsNormalizedOpenApiUpstreamOptions)(upstream)) {
|
|
207
|
+
const className = (0, ts_morph_1.OperationIdToResponseClassName)(upstream.operationId);
|
|
208
|
+
return {
|
|
209
|
+
name: `${className}['${(_b = (_a = upstream.mapper) === null || _a === void 0 ? void 0 : _a.list) !== null && _b !== void 0 ? _b : 'list'}'][number]`,
|
|
210
|
+
namedImport: className,
|
|
211
|
+
moduleSpecifier: (0, ts_morph_1.OperationIdToCommandClassImportPath)(upstream.operationId, upstream.scope, upstream.isService),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
throw new Error(`Upstream kind '${upstream.kind}' not supported`);
|
|
215
|
+
}
|
|
216
|
+
exports.GetResponseTypeFromUpstream = GetResponseTypeFromUpstream;
|
|
217
|
+
function GetRawRowDataType(options) {
|
|
218
|
+
const { upstream } = options;
|
|
219
|
+
if (upstream && (0, ts_morph_1.IsNormalizedOpenApiUpstreamOptions)(upstream)) {
|
|
220
|
+
return GetResponseTypeFromUpstream(upstream);
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
name: 'RawRowData',
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
exports.GetRawRowDataType = GetRawRowDataType;
|
|
227
|
+
function BuildGetPageUpstreamGetDataImplementation(classDeclaration, moduleSourceFile, dto, options) {
|
|
228
|
+
return (operationOptions) => {
|
|
229
|
+
var _a;
|
|
230
|
+
(_a = operationOptions.statements) !== null && _a !== void 0 ? _a : (operationOptions.statements = []);
|
|
231
|
+
operationOptions.statements = (0, utilities_1.coerceArray)(operationOptions.statements);
|
|
232
|
+
operationOptions.statements.push('const data = await this.getPageData(sortBy, sortDirection, pageSize, pageIndex, filter);');
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
exports.BuildGetPageUpstreamGetDataImplementation = BuildGetPageUpstreamGetDataImplementation;
|
|
236
|
+
function CoerceGetPageOperationDtoClass(classDeclaration, controllerName, moduleSourceFile, options) {
|
|
237
|
+
const sourceFile = classDeclaration.getSourceFile();
|
|
238
|
+
const project = sourceFile.getProject();
|
|
239
|
+
const { rowIdProperty, propertyList, coerceToRowDtoMethod = CoerceToRowDtoMethod, coerceToPageDtoMethod = CoerceToPageDtoMethod, coerceGetPageDataMethod = CoerceGetPageDataMethod, buildOperationDtoClassName = coerce_operation_1.BuildOperationDtoClassName, dtoClassName = buildOperationDtoClassName(controllerName, options) } = options;
|
|
240
|
+
const { className: rowClassName, filePath: rowFilePath, } = (0, coerce_row_dto_class_1.CoerceRowDtoClass)({
|
|
241
|
+
project,
|
|
242
|
+
name: dtoClassName,
|
|
243
|
+
propertyList,
|
|
244
|
+
rowIdType: rowIdProperty === null ? null : undefined,
|
|
245
|
+
});
|
|
246
|
+
(0, ts_morph_1.CoerceImports)(sourceFile, {
|
|
247
|
+
namedImports: [rowClassName],
|
|
248
|
+
moduleSpecifier: rowFilePath,
|
|
249
|
+
});
|
|
250
|
+
const dto = (0, coerce_page_dto_class_1.CoercePageDtoClass)({
|
|
251
|
+
project,
|
|
252
|
+
name: dtoClassName,
|
|
253
|
+
rowClassName,
|
|
254
|
+
rowFilePath,
|
|
255
|
+
});
|
|
256
|
+
const { className: pageClassName } = dto;
|
|
257
|
+
coerceGetPageDataMethod(sourceFile, classDeclaration, moduleSourceFile, options);
|
|
258
|
+
coerceToRowDtoMethod(sourceFile, classDeclaration, rowClassName, options);
|
|
259
|
+
coerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowClassName, options);
|
|
260
|
+
return dto;
|
|
261
|
+
}
|
|
262
|
+
exports.CoerceGetPageOperationDtoClass = CoerceGetPageOperationDtoClass;
|
|
263
|
+
function BuiltGetPageDtoDataMapperImplementation(classDeclaration, moduleSourceFile, dto, options) {
|
|
264
|
+
return () => {
|
|
265
|
+
return 'this.toPageDto(data.list, data.total, pageIndex, pageSize, sortBy, sortDirection, filter)';
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
exports.BuiltGetPageDtoDataMapperImplementation = BuiltGetPageDtoDataMapperImplementation;
|
|
178
269
|
function CoerceGetPageOperation(options) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
name: responseDtoName,
|
|
192
|
-
propertyList: propertyList.map(GetPageOperationColumnToDtoClassProperty),
|
|
193
|
-
rowIdType: rowIdProperty === null ? null : undefined,
|
|
194
|
-
});
|
|
195
|
-
(0, coerce_imports_1.CoerceImports)(rowSourceFile, propertyList
|
|
196
|
-
.map(c => GetPageOperationColumnTypeToTypeImport(c))
|
|
197
|
-
.filter(type => (0, ts_morph_1.RequiresTypeImport)(type))
|
|
198
|
-
.map(type => (0, ts_morph_1.TypeImportToImportStructure)(type)));
|
|
199
|
-
const { className: pageClassName, filePath: pageFilePath, } = (0, coerce_page_dto_class_1.CoercePageDtoClass)({
|
|
200
|
-
project,
|
|
201
|
-
name: responseDtoName,
|
|
202
|
-
rowClassName,
|
|
203
|
-
rowFilePath,
|
|
204
|
-
});
|
|
205
|
-
coerceGetPageDataMethod(sourceFile, classDeclaration, options);
|
|
206
|
-
coerceToRowDtoMethod(sourceFile, classDeclaration, rowClassName, options);
|
|
207
|
-
coerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowClassName, options);
|
|
208
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, [
|
|
209
|
-
{
|
|
210
|
-
namedImports: ['FilterQuery', 'FilterQueryPipe'],
|
|
211
|
-
moduleSpecifier: '@rxap/nest-utilities',
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
namedImports: ['plainToInstance'],
|
|
215
|
-
moduleSpecifier: 'class-transformer',
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
namedImports: ['classTransformOptions'],
|
|
219
|
-
moduleSpecifier: '@rxap/nest-utilities',
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
namedImports: [pageClassName],
|
|
223
|
-
moduleSpecifier: pageFilePath,
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
namedImports: [rowClassName],
|
|
227
|
-
moduleSpecifier: rowFilePath,
|
|
228
|
-
},
|
|
229
|
-
]);
|
|
230
|
-
(0, coerce_type_alias_1.CoerceTypeAlias)(sourceFile, 'RawRowData', {
|
|
231
|
-
isExported: false,
|
|
232
|
-
type: 'any',
|
|
233
|
-
});
|
|
234
|
-
return Object.assign({ queryList: [
|
|
235
|
-
{
|
|
236
|
-
name: 'pageIndex',
|
|
237
|
-
type: 'number',
|
|
238
|
-
defaultValue: '0',
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: 'pageSize',
|
|
242
|
-
type: 'number',
|
|
243
|
-
defaultValue: '5',
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: 'sortDirection',
|
|
247
|
-
type: 'string',
|
|
248
|
-
defaultValue: w => w.quote('desc'),
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: 'sortBy',
|
|
252
|
-
type: 'string',
|
|
253
|
-
defaultValue: w => w.quote('__updatedAt'),
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
name: 'filter',
|
|
257
|
-
type: 'FilterQuery[]',
|
|
258
|
-
pipeList: ['new FilterQueryPipe()'],
|
|
259
|
-
// the FilterQueryPipe will set the default value to an empty array
|
|
260
|
-
hasQuestionToken: false,
|
|
261
|
-
},
|
|
262
|
-
], returnType: pageClassName, statements: [
|
|
263
|
-
'const data = await this.getPageData(sortBy, sortDirection, pageSize, pageIndex, filter);',
|
|
264
|
-
'return plainToInstance(',
|
|
265
|
-
' ' + pageClassName + ',',
|
|
266
|
-
` this.toPageDto(data.list, data.total, pageIndex, pageSize, sortBy, sortDirection, filter),`,
|
|
267
|
-
' classTransformOptions',
|
|
268
|
-
');',
|
|
269
|
-
] }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, pageClassName, rowClassName));
|
|
270
|
+
const { operationName = 'get-page', tsMorphTransform = utilities_1.noop, upstream, builtDtoDataMapperImplementation = BuiltGetPageDtoDataMapperImplementation, coerceOperationDtoClass = CoerceGetPageOperationDtoClass, buildUpstreamGetDataImplementation = BuildGetPageUpstreamGetDataImplementation, } = options;
|
|
271
|
+
return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { operationName,
|
|
272
|
+
builtDtoDataMapperImplementation,
|
|
273
|
+
coerceOperationDtoClass,
|
|
274
|
+
buildUpstreamGetDataImplementation, tsMorphTransform: (project, sourceFile, classDeclaration, controllerName, moduleSourceFile) => {
|
|
275
|
+
if (!upstream || !(0, ts_morph_1.IsNormalizedOpenApiUpstreamOptions)(upstream)) {
|
|
276
|
+
(0, coerce_type_alias_1.CoerceTypeAlias)(sourceFile, 'RawRowData', {
|
|
277
|
+
isExported: false,
|
|
278
|
+
type: 'any',
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
return Object.assign({ queryList: table_query_list_1.TABLE_QUERY_LIST }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, moduleSourceFile, (0, coerce_page_dto_class_1.BuildPageDtoClassName)((0, coerce_operation_1.BuildOperationDtoClassName)(controllerName, options)), (0, coerce_row_dto_class_1.BuildRowDtoClassName)((0, coerce_operation_1.BuildOperationDtoClassName)(controllerName, options))));
|
|
270
282
|
} }));
|
|
271
283
|
}
|
|
272
284
|
exports.CoerceGetPageOperation = CoerceGetPageOperation;
|