@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 +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":";;;
|
|
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,EAC7B,aAAa,GAAG,KAAK;IACrB,qGAAqG;IACrG,UAAU,GAAG,IAAI,GAClB,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,37 +1,36 @@
|
|
|
1
|
-
import { NormalizedUpstreamOptions, TypeImport } from '@rxap/ts-morph';
|
|
2
|
-
import { ClassDeclaration, Project, SourceFile } from 'ts-morph';
|
|
1
|
+
import { NormalizedDataProperty, 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
|
-
export interface GetPageOperationProperty {
|
|
7
|
-
name: string;
|
|
8
|
-
type: TypeImport;
|
|
4
|
+
import { CoerceDtoClassOutput } from './coerce-dto-class';
|
|
5
|
+
import { CoerceOperationOptions, TransformOperation } from './coerce-operation';
|
|
6
|
+
export interface GetPageOperationProperty extends NormalizedDataProperty {
|
|
9
7
|
/**
|
|
10
8
|
* the property name of the source object. if not defined the name will be used
|
|
11
9
|
*/
|
|
12
10
|
source?: string;
|
|
13
11
|
}
|
|
14
|
-
export interface CoerceGetPageOperationOptions extends Omit<
|
|
15
|
-
propertyList
|
|
16
|
-
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration, controllerName: string, pageClassName: string, rowClassName: string) => Partial<OperationOptions>;
|
|
12
|
+
export interface CoerceGetPageOperationOptions extends Omit<CoerceOperationOptions, 'operationName' | 'tsMorphTransform' | 'coerceOperationDtoClass'> {
|
|
13
|
+
propertyList?: GetPageOperationProperty[];
|
|
14
|
+
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, pageClassName: string, rowClassName: string) => Partial<OperationOptions>;
|
|
17
15
|
/**
|
|
18
16
|
* the name of the property used as row id value. defaults to the value 'uuid'. If null the __rowId property will be
|
|
19
17
|
* set to the absolute row index absolute row index = page * pageSize + rowIndex
|
|
20
18
|
*/
|
|
21
19
|
rowIdProperty?: string | null;
|
|
22
20
|
operationName?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The base name of the page and row DTO class name. Defaults to the controller name
|
|
25
|
-
*/
|
|
26
|
-
responseDtoName?: string;
|
|
27
21
|
coerceToRowDtoMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, rowClassName: string, options: CoerceGetPageOperationOptions) => void;
|
|
28
22
|
coerceToPageDtoMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, pageClassName: string, rowClassName: string, options: CoerceGetPageOperationOptions) => void;
|
|
29
|
-
coerceGetPageDataMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, options: CoerceGetPageOperationOptions) => void;
|
|
23
|
+
coerceGetPageDataMethod?: (sourceFile: SourceFile, classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, options: CoerceGetPageOperationOptions) => void;
|
|
24
|
+
coerceOperationDtoClass?: (classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, options: Readonly<CoerceGetPageOperationOptions>) => CoerceDtoClassOutput | null;
|
|
30
25
|
upstream?: NormalizedUpstreamOptions | null;
|
|
31
26
|
}
|
|
32
|
-
export declare function GetPageOperationColumnToDtoClassProperty(property: GetPageOperationProperty): DtoClassProperty;
|
|
33
27
|
export declare function GetPageOperationColumnToCodeText(property: GetPageOperationProperty): string;
|
|
34
28
|
export declare function CoerceToRowDtoMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, rowClassName: string, options: CoerceGetPageOperationOptions): void;
|
|
35
29
|
export declare function CoerceToPageDtoMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, pageClassName: string, rowClassName: string, options: CoerceGetPageOperationOptions): void;
|
|
36
|
-
export declare function CoerceGetPageDataMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration,
|
|
30
|
+
export declare function CoerceGetPageDataMethod(sourceFile: SourceFile, classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, options: CoerceGetPageOperationOptions): void;
|
|
31
|
+
export declare function GetResponseTypeFromUpstream(upstream: NormalizedUpstreamOptions): TypeImport;
|
|
32
|
+
export declare function GetRawRowDataType(options: Readonly<CoerceGetPageOperationOptions>): TypeImport;
|
|
33
|
+
export declare function BuildGetPageUpstreamGetDataImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation;
|
|
34
|
+
export declare function CoerceGetPageOperationDtoClass(classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, options: Readonly<CoerceGetPageOperationOptions>): CoerceDtoClassOutput | null;
|
|
35
|
+
export declare function BuiltGetPageDtoDataMapperImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation<string | WriterFunction>;
|
|
37
36
|
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
8
|
const coerce_type_alias_1 = require("../ts-morph/coerce-type-alias");
|
|
9
|
-
const
|
|
9
|
+
const write_type_1 = require("../ts-morph/write-type");
|
|
10
10
|
const coerce_operation_1 = require("./coerce-operation");
|
|
11
11
|
const coerce_page_dto_class_1 = require("./coerce-page-dto-class");
|
|
12
12
|
const coerce_row_dto_class_1 = require("./coerce-row-dto-class");
|
|
13
13
|
const table_query_list_1 = require("./table-query-list");
|
|
14
|
-
function GetPageOperationColumnTypeToTypeImport(property) {
|
|
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;
|
|
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;
|
|
26
|
+
var _a, _b, _c;
|
|
53
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,7 +61,7 @@ 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
|
});
|
|
@@ -94,7 +74,10 @@ function CoerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowC
|
|
|
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,13 +113,13 @@ function CoerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowC
|
|
|
130
113
|
});
|
|
131
114
|
}
|
|
132
115
|
exports.CoerceToPageDtoMethod = CoerceToPageDtoMethod;
|
|
133
|
-
function CoerceGetPageDataMethod(sourceFile, classDeclaration,
|
|
116
|
+
function CoerceGetPageDataMethod(sourceFile, classDeclaration, moduleSourceFile, options) {
|
|
134
117
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
118
|
+
const { upstream } = options;
|
|
135
119
|
const statements = [];
|
|
136
120
|
if (upstream && (0, ts_morph_1.IsNormalizedOpenApiUpstreamOptions)(upstream)) {
|
|
137
|
-
const commandClassName = (0,
|
|
138
|
-
|
|
139
|
-
(0, coerce_dto_class_1.CoercePropertyDeclaration)(classDeclaration, memberName, {
|
|
121
|
+
const { memberName, className: commandClassName } = (0, coerce_operation_1.CoerceUpstreamBasicOperationImplementation)(classDeclaration, moduleSourceFile, upstream);
|
|
122
|
+
(0, ts_morph_1.CoercePropertyDeclaration)(classDeclaration, memberName, {
|
|
140
123
|
type: commandClassName,
|
|
141
124
|
scope: ts_morph_2.Scope.Private,
|
|
142
125
|
hasExclamationToken: true,
|
|
@@ -180,7 +163,17 @@ function CoerceGetPageDataMethod(sourceFile, classDeclaration, { upstream }) {
|
|
|
180
163
|
}
|
|
181
164
|
(0, ts_morph_1.CoerceClassMethod)(classDeclaration, 'getPageData', {
|
|
182
165
|
scope: ts_morph_2.Scope.Public,
|
|
183
|
-
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
|
+
},
|
|
184
177
|
isAsync: true,
|
|
185
178
|
parameters: [
|
|
186
179
|
{
|
|
@@ -208,83 +201,84 @@ function CoerceGetPageDataMethod(sourceFile, classDeclaration, { upstream }) {
|
|
|
208
201
|
});
|
|
209
202
|
}
|
|
210
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;
|
|
211
269
|
function CoerceGetPageOperation(options) {
|
|
212
|
-
const { operationName = 'get-page',
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const { className: rowClassName, filePath: rowFilePath, sourceFile: rowSourceFile, } = (0, coerce_row_dto_class_1.CoerceRowDtoClass)({
|
|
222
|
-
project,
|
|
223
|
-
name: responseDtoName,
|
|
224
|
-
propertyList: propertyList.map(GetPageOperationColumnToDtoClassProperty),
|
|
225
|
-
rowIdType: rowIdProperty === null ? null : undefined,
|
|
226
|
-
});
|
|
227
|
-
(0, ts_morph_1.CoerceImports)(rowSourceFile, propertyList
|
|
228
|
-
.map(c => GetPageOperationColumnTypeToTypeImport(c))
|
|
229
|
-
.filter(type => (0, ts_morph_1.RequiresTypeImport)(type))
|
|
230
|
-
.map(type => (0, ts_morph_1.TypeImportToImportStructure)(type)));
|
|
231
|
-
const { className: pageClassName, filePath: pageFilePath, } = (0, coerce_page_dto_class_1.CoercePageDtoClass)({
|
|
232
|
-
project,
|
|
233
|
-
name: responseDtoName,
|
|
234
|
-
rowClassName,
|
|
235
|
-
rowFilePath,
|
|
236
|
-
});
|
|
237
|
-
coerceGetPageDataMethod(sourceFile, classDeclaration, options);
|
|
238
|
-
coerceToRowDtoMethod(sourceFile, classDeclaration, rowClassName, options);
|
|
239
|
-
coerceToPageDtoMethod(sourceFile, classDeclaration, pageClassName, rowClassName, options);
|
|
240
|
-
if (upstream && (0, ts_morph_1.IsNormalizedOpenApiUpstreamOptions)(upstream)) {
|
|
241
|
-
(0, ts_morph_1.CoerceNestModuleProvider)(moduleSourceFile, {
|
|
242
|
-
providerObject: (0, ts_morph_1.OperationIdToCommandClassName)(upstream.operationId),
|
|
243
|
-
moduleSpecifier: (0, ts_morph_1.OperationIdToCommandClassImportPath)(upstream.operationId, upstream.scope, upstream.isService),
|
|
244
|
-
});
|
|
245
|
-
(0, ts_morph_1.CoerceNestModuleImport)(moduleSourceFile, {
|
|
246
|
-
moduleName: 'HttpModule',
|
|
247
|
-
moduleSpecifier: '@nestjs/axios',
|
|
248
|
-
});
|
|
249
|
-
(0, ts_morph_1.CoerceNestModuleProvider)(moduleSourceFile, {
|
|
250
|
-
providerObject: 'Logger',
|
|
251
|
-
moduleSpecifier: '@nestjs/common',
|
|
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',
|
|
252
279
|
});
|
|
253
280
|
}
|
|
254
|
-
(0,
|
|
255
|
-
{
|
|
256
|
-
namedImports: ['FilterQuery', 'FilterQueryPipe'],
|
|
257
|
-
moduleSpecifier: '@rxap/nest-utilities',
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
namedImports: ['plainToInstance'],
|
|
261
|
-
moduleSpecifier: 'class-transformer',
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
namedImports: ['classTransformOptions'],
|
|
265
|
-
moduleSpecifier: '@rxap/nest-utilities',
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
namedImports: [pageClassName],
|
|
269
|
-
moduleSpecifier: pageFilePath,
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
namedImports: [rowClassName],
|
|
273
|
-
moduleSpecifier: rowFilePath,
|
|
274
|
-
},
|
|
275
|
-
]);
|
|
276
|
-
(0, coerce_type_alias_1.CoerceTypeAlias)(sourceFile, 'RawRowData', {
|
|
277
|
-
isExported: false,
|
|
278
|
-
type: 'any',
|
|
279
|
-
});
|
|
280
|
-
return Object.assign({ queryList: table_query_list_1.TABLE_QUERY_LIST, returnType: pageClassName, statements: [
|
|
281
|
-
'const data = await this.getPageData(sortBy, sortDirection, pageSize, pageIndex, filter);',
|
|
282
|
-
'return plainToInstance(',
|
|
283
|
-
' ' + pageClassName + ',',
|
|
284
|
-
` this.toPageDto(data.list, data.total, pageIndex, pageSize, sortBy, sortDirection, filter),`,
|
|
285
|
-
' classTransformOptions',
|
|
286
|
-
');',
|
|
287
|
-
] }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, pageClassName, rowClassName));
|
|
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))));
|
|
288
282
|
} }));
|
|
289
283
|
}
|
|
290
284
|
exports.CoerceGetPageOperation = CoerceGetPageOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-get-page-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-page-operation.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"coerce-get-page-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-page-operation.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,6CAUwB;AACxB,+CAGyB;AACzB,uCAOkB;AAClB,qEAAgE;AAChE,uDAAmD;AAGnD,yDAM4B;AAC5B,mEAGiC;AACjC,iEAGgC;AAChC,yDAAsD;AAuDtD,SAAgB,gCAAgC,CAAC,QAAkC;;IACjF,IAAI,YAAY,GAAG,IAAA,+BAAQ,EAAC,Q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
|
|
2
|
-
|
|
3
|
-
export interface CoerceGetRootOperationOptions extends Omit<CoerceOperationOptions, 'operationName'> {
|
|
4
|
-
propertyList?: DtoClassProperty[];
|
|
5
|
-
operationName?: string;
|
|
1
|
+
import { CoerceGetByIdControllerOptions } from './coerce-get-by-id-operation';
|
|
2
|
+
export interface CoerceGetRootOperationOptions extends CoerceGetByIdControllerOptions {
|
|
6
3
|
}
|
|
7
4
|
export declare function CoerceGetRootOperation(options: Readonly<CoerceGetRootOperationOptions>): import("@angular-devkit/schematics").Rule;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceGetRootOperation = void 0;
|
|
4
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
4
|
const utilities_1 = require("@rxap/utilities");
|
|
6
|
-
const
|
|
7
|
-
const coerce_dto_class_1 = require("./coerce-dto-class");
|
|
8
|
-
const coerce_operation_1 = require("./coerce-operation");
|
|
5
|
+
const coerce_get_by_id_operation_1 = require("./coerce-get-by-id-operation");
|
|
9
6
|
const table_query_list_1 = require("./table-query-list");
|
|
10
7
|
function CoerceGetRootOperation(options) {
|
|
11
|
-
const { tsMorphTransform = utilities_1.noop, propertyList = [], operationName = 'get-root', } = options;
|
|
8
|
+
const { tsMorphTransform = utilities_1.noop, propertyList = [], operationName = 'get-root', idProperty = null, dtoClassNameSuffix = '-item', isArray = true, } = options;
|
|
12
9
|
(0, utilities_1.CoerceArrayItems)(propertyList, [
|
|
13
10
|
{
|
|
14
11
|
name: 'hasChildren',
|
|
@@ -22,23 +19,11 @@ function CoerceGetRootOperation(options) {
|
|
|
22
19
|
isType: true,
|
|
23
20
|
},
|
|
24
21
|
], (a, b) => a.name === b.name);
|
|
25
|
-
return (0,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
(0, coerce_imports_1.CoerceImports)(sourceFile, [
|
|
32
|
-
{
|
|
33
|
-
namedImports: ['FilterQuery', 'FilterQueryPipe'],
|
|
34
|
-
moduleSpecifier: '@rxap/nest-utilities',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
namedImports: [className],
|
|
38
|
-
moduleSpecifier: filePath,
|
|
39
|
-
},
|
|
40
|
-
]);
|
|
41
|
-
return Object.assign({ queryList: table_query_list_1.TABLE_QUERY_LIST, returnType: className + '[]' }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, moduleSourceFile));
|
|
22
|
+
return (0, coerce_get_by_id_operation_1.CoerceGetByIdOperation)(Object.assign(Object.assign({}, options), { operationName,
|
|
23
|
+
idProperty,
|
|
24
|
+
dtoClassNameSuffix,
|
|
25
|
+
isArray, tsMorphTransform: (project, sourceFile, classDeclaration, controllerName, moduleSourceFile, dto) => {
|
|
26
|
+
return Object.assign({ queryList: table_query_list_1.TABLE_QUERY_LIST }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, moduleSourceFile, dto));
|
|
42
27
|
} }));
|
|
43
28
|
}
|
|
44
29
|
exports.CoerceGetRootOperation = CoerceGetRootOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-get-root-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-root-operation.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"coerce-get-root-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-get-root-operation.ts"],"names":[],"mappings":";;;AAAA,+CAGyB;AACzB,6EAGsC;AACtC,yDAAsD;AAMtD,SAAgB,sBAAsB,CAAC,OAAgD;IACrF,MAAM,EACJ,gBAAgB,GAAG,gBAAI,EACvB,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,UAAU,EAC1B,UAAU,GAAG,IAAI,EACjB,kBAAkB,GAAG,OAAO,EAC5B,OAAO,GAAG,IAAI,GACf,GAAG,OAAO,CAAC;IACZ,IAAA,4BAAgB,EAAC,YAAY,EAAE;QAC7B;YACE,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,SAAS;SAChB;QACD;YACE,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,IAAI;YAChB,MAAM,EAAE,IAAI;SACb;KACF,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,IAAA,mDAAsB,kCACxB,OAAO,KACV,aAAa;QACb,UAAU;QACV,kBAAkB;QAClB,OAAO,EACP,gBAAgB,EAAE,CAChB,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,GAAG,EACH,EAAE;YAEF,uBACE,SAAS,EAAE,mCAAgB,IACxB,gBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAClG;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AA3CD,wDA2CC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
-
import {
|
|
3
|
-
import { TsMorphNestProjectTransformOptions } from '
|
|
2
|
+
import { UpstreamOptions } from '@rxap/ts-morph';
|
|
3
|
+
import { TsMorphNestProjectTransformOptions } from '@rxap/workspace-ts-morph';
|
|
4
|
+
import { ClassDeclaration, Project, SourceFile, WriterFunction } from 'ts-morph';
|
|
4
5
|
import { OperationOptions, OperationParameter } from './add-operation-to-controller';
|
|
5
|
-
|
|
6
|
+
import { CoerceDtoClassOutput } from './coerce-dto-class';
|
|
7
|
+
import { DtoClassProperty } from './dto-class-property';
|
|
8
|
+
export interface BuildUpstreamGetParametersImplementationOutput {
|
|
9
|
+
commandParameter: string | WriterFunction;
|
|
10
|
+
statements: Array<string | WriterFunction>;
|
|
11
|
+
}
|
|
12
|
+
export interface CoerceOperationOptions<Options = Record<string, any>> extends TsMorphNestProjectTransformOptions {
|
|
6
13
|
controllerName: string;
|
|
7
14
|
shared?: boolean;
|
|
8
15
|
nestModule?: string | null;
|
|
9
16
|
skipCoerce?: boolean;
|
|
10
17
|
paramList?: OperationParameter[];
|
|
11
18
|
queryList?: OperationParameter[];
|
|
12
|
-
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile) => Partial<OperationOptions>;
|
|
19
|
+
tsMorphTransform?: (project: Project, sourceFile: SourceFile, classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null) => Partial<OperationOptions>;
|
|
13
20
|
operationName: string;
|
|
14
21
|
path?: string;
|
|
15
22
|
controllerPath?: string;
|
|
@@ -18,9 +25,29 @@ export interface CoerceOperationOptions extends TsMorphNestProjectTransformOptio
|
|
|
18
25
|
*/
|
|
19
26
|
overwriteControllerPath?: boolean;
|
|
20
27
|
context?: string | null;
|
|
28
|
+
coerceUpstreamOperationImplementation?: (classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions & Options>) => TransformOperation;
|
|
29
|
+
buildUpstreamGetParametersImplementation?: (classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions & Options>) => TransformOperation<string | WriterFunction>;
|
|
30
|
+
buildDtoReturnImplementation?: (classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions & Options>) => TransformOperation;
|
|
31
|
+
builtDtoDataMapperImplementation?: (classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions & Options>) => TransformOperation<string | WriterFunction>;
|
|
32
|
+
buildUpstreamGetDataImplementation?: (classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions & Options>) => TransformOperation<void>;
|
|
33
|
+
coerceOperationDtoClass?: (classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, options: Readonly<CoerceOperationOptions & Options>) => CoerceDtoClassOutput | null;
|
|
34
|
+
buildOperationDtoClassName?: (controllerName: string, options: Readonly<Pick<CoerceOperationOptions, 'dtoClassNameSuffix' | 'dtoClassName'>>) => string;
|
|
35
|
+
upstream?: UpstreamOptions | null;
|
|
36
|
+
propertyList?: DtoClassProperty[];
|
|
37
|
+
isArray?: boolean;
|
|
38
|
+
isReturnVoid?: boolean;
|
|
39
|
+
dtoClassNameSuffix?: string;
|
|
40
|
+
dtoClassName?: string;
|
|
21
41
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare function
|
|
42
|
+
export declare function CoerceUpstreamBasicOperationImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, upstream: UpstreamOptions): {
|
|
43
|
+
className: string;
|
|
44
|
+
memberName: string;
|
|
45
|
+
};
|
|
46
|
+
export declare function BuildOperationDtoClassName(controllerName: string, options: Readonly<Pick<CoerceOperationOptions, 'dtoClassNameSuffix' | 'dtoClassName'>>): string;
|
|
47
|
+
export declare function CoerceOperationDtoClass(classDeclaration: ClassDeclaration, controllerName: string, moduleSourceFile: SourceFile, options: Readonly<CoerceOperationOptions>): CoerceDtoClassOutput | null;
|
|
48
|
+
export type TransformOperation<T = void> = (operationOptions: OperationOptions) => T;
|
|
49
|
+
export declare function BuiltDtoDataMapperImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation<string | WriterFunction>;
|
|
50
|
+
export declare function BuildDtoReturnImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation;
|
|
51
|
+
export declare function BuildUpstreamGetDataImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation;
|
|
52
|
+
export declare function CoerceUpstreamDefaultOperationImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation;
|
|
53
|
+
export declare function CoerceOperation<Options = Record<string, any>>(options: CoerceOperationOptions<Options>): Rule;
|