@rxap/schematics-ts-morph 16.0.1-dev.1 → 16.1.0-dev.1
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 +27 -0
- package/README.md +1 -1
- package/package.json +8 -8
- package/src/lib/angular/add-component-import.d.ts +9 -0
- package/src/lib/angular/add-component-import.js +9 -0
- package/src/lib/angular/add-component-import.js.map +1 -1
- package/src/lib/angular/add-component-input.d.ts +2 -1
- package/src/lib/angular/add-component-input.js +4 -3
- package/src/lib/angular/add-component-input.js.map +1 -1
- package/src/lib/angular/coerce-component-class.d.ts +2 -2
- package/src/lib/angular/coerce-component-class.js +2 -2
- package/src/lib/angular/coerce-component-class.js.map +1 -1
- package/src/lib/angular/coerce-component.js +4 -24
- package/src/lib/angular/coerce-component.js.map +1 -1
- package/src/lib/angular/coerce-form-definition-control.js +7 -3
- package/src/lib/angular/coerce-form-definition-control.js.map +1 -1
- package/src/lib/angular/coerce-form-definition.js +0 -8
- package/src/lib/angular/coerce-form-definition.js.map +1 -1
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.js +1 -5
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.js.map +1 -1
- package/src/lib/nest/add-operation-to-controller.d.ts +2 -1
- package/src/lib/nest/add-operation-to-controller.js +20 -19
- package/src/lib/nest/add-operation-to-controller.js.map +1 -1
- package/src/lib/nest/coerce-dto-class.d.ts +4 -1
- package/src/lib/nest/coerce-dto-class.js +34 -25
- package/src/lib/nest/coerce-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-form-submit-operation.d.ts +1 -1
- package/src/lib/nest/coerce-form-submit-operation.js +1 -4
- package/src/lib/nest/coerce-form-submit-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-by-id-operation.d.ts +2 -0
- package/src/lib/nest/coerce-get-by-id-operation.js +14 -15
- 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 +17 -20
- package/src/lib/nest/coerce-get-children-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-page-operation.d.ts +1 -1
- package/src/lib/nest/coerce-get-root-operation.d.ts +4 -1
- package/src/lib/nest/coerce-get-root-operation.js +17 -19
- package/src/lib/nest/coerce-get-root-operation.js.map +1 -1
- package/src/lib/nest/coerce-options-operation.js +2 -2
- package/src/lib/nest/coerce-options-operation.js.map +1 -1
- package/src/lib/nest/create-dto-class.d.ts +10 -5
- package/src/lib/nest/create-dto-class.js +11 -40
- package/src/lib/nest/create-dto-class.js.map +1 -1
- package/src/lib/ts-morph/coerce-interface.d.ts +2 -0
- package/src/lib/ts-morph/coerce-interface.js +6 -4
- package/src/lib/ts-morph/coerce-interface.js.map +1 -1
- package/src/lib/ts-morph/write-type.d.ts +16 -4
- package/src/lib/ts-morph/write-type.js +56 -19
- package/src/lib/ts-morph/write-type.js.map +1 -1
- package/src/lib/types/form-definition-control.d.ts +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoerceInterfaceRule = exports.CoerceInterface = void 0;
|
|
4
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
4
5
|
const utilities_1 = require("@rxap/utilities");
|
|
5
6
|
function CoerceInterface(sourceFile, interfaceName, structure = {}) {
|
|
6
7
|
let interfaceDeclaration = sourceFile.getInterface(interfaceName);
|
|
@@ -11,17 +12,18 @@ function CoerceInterface(sourceFile, interfaceName, structure = {}) {
|
|
|
11
12
|
}
|
|
12
13
|
exports.CoerceInterface = CoerceInterface;
|
|
13
14
|
function CoerceInterfaceRule(options, tsMorphTransForm) {
|
|
14
|
-
|
|
15
|
+
const { tsMorphTransform = utilities_1.noop, project, feature, shared, directory, structure = { isExported: true }, propertyList, } = options;
|
|
16
|
+
let { name } = options;
|
|
15
17
|
name = (0, utilities_1.classify)(name);
|
|
16
|
-
structure !== null && structure !== void 0 ? structure : (structure = {});
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
18
|
-
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => { });
|
|
19
18
|
return tsMorphTransForm({
|
|
20
19
|
project,
|
|
21
20
|
feature,
|
|
22
21
|
shared,
|
|
23
22
|
directory,
|
|
24
23
|
}, (project, [sourceFile]) => {
|
|
24
|
+
if (propertyList) {
|
|
25
|
+
structure.properties = propertyList.map(p => (0, ts_morph_1.NormalizeDataPropertyToPropertySignatureStructure)(p, sourceFile));
|
|
26
|
+
}
|
|
25
27
|
const interfaceDeclaration = CoerceInterface(sourceFile, name, structure);
|
|
26
28
|
tsMorphTransform(project, sourceFile, interfaceDeclaration);
|
|
27
29
|
}, [(0, utilities_1.dasherize)(name) + '.ts?']);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-interface.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/ts-morph/coerce-interface.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"coerce-interface.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/ts-morph/coerce-interface.ts"],"names":[],"mappings":";;;AAAA,6CAGwB;AACxB,+CAIyB;AAczB,SAAgB,eAAe,CAC7B,UAAsB,EACtB,aAAqB,EACrB,YAAuE,EAAE;IAEzE,IAAI,oBAAoB,GAAG,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAClE,IAAI,CAAC,oBAAoB,EAAE;QACzB,oBAAoB,GAAG,UAAU,CAAC,YAAY,iCACzC,SAAS,KACZ,IAAI,EAAE,aAAa,IACnB,CAAC;KACJ;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAbD,0CAaC;AAUD,SAAgB,mBAAmB,CACjC,OAAmC,EACnC,gBAA0H;IAE1H,MAAM,EACJ,gBAAgB,GAAG,gBAAI,EACvB,OAAO,EACP,OAAO,EACP,MAAM,EACN,SAAS,EACT,SAAS,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,EAChC,YAAY,GACb,GAAG,OAAO,CAAC;IACZ,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACvB,IAAI,GAAG,IAAA,oBAAQ,EAAC,IAAI,CAAC,CAAC;IAEtB,OAAO,gBAAgB,CAAC;QACtB,OAAO;QACP,OAAO;QACP,MAAM;QACN,SAAS;KACV,EAAE,CAAC,OAAO,EAAE,CAAE,UAAU,CAAE,EAAE,EAAE;QAC7B,IAAI,YAAY,EAAE;YAChB,SAAS,CAAC,UAAU,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,4DAAiD,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;SAChH;QACD,MAAM,oBAAoB,GAAG,eAAe,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC1E,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC;IAC9D,CAAC,EAAE,CAAE,IAAA,qBAAS,EAAC,IAAI,CAAC,GAAG,MAAM,CAAE,CAAC,CAAC;AACnC,CAAC;AA5BD,kDA4BC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeImport } from '@rxap/ts-morph';
|
|
2
|
+
import { CodeBlockWriter, SourceFile, WriterFunction } from 'ts-morph';
|
|
3
|
+
export type WriteType = string | TypeImport | WriterFunction;
|
|
2
4
|
export interface WriteTypeOptions {
|
|
3
|
-
isArray?: boolean;
|
|
4
|
-
type:
|
|
5
|
+
isArray?: boolean | null;
|
|
6
|
+
type: WriteType;
|
|
5
7
|
}
|
|
6
|
-
export declare function
|
|
8
|
+
export declare function IsWriteTypeOptions(value: any): value is WriteTypeOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Uses the CodeBlockWriter to write the type to the AST thereby the value of the property type is evaluated
|
|
11
|
+
* to determine the value that should be written to the AST
|
|
12
|
+
* @param type
|
|
13
|
+
* @param w
|
|
14
|
+
* @constructor
|
|
15
|
+
*/
|
|
16
|
+
export declare function WriteStringType(type: string, w: CodeBlockWriter): void;
|
|
17
|
+
export declare function WriteType(type: WriteType, sourceFile: SourceFile): WriterFunction;
|
|
18
|
+
export declare function WriteType(property: WriteTypeOptions, sourceFile: SourceFile): WriterFunction;
|
|
@@ -1,31 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WriteType = void 0;
|
|
4
|
-
|
|
3
|
+
exports.WriteType = exports.WriteStringType = exports.IsWriteTypeOptions = void 0;
|
|
4
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
5
|
+
function IsWriteTypeOptions(value) {
|
|
6
|
+
return value && typeof value === 'object' && value.type;
|
|
7
|
+
}
|
|
8
|
+
exports.IsWriteTypeOptions = IsWriteTypeOptions;
|
|
9
|
+
/**
|
|
10
|
+
* Uses the CodeBlockWriter to write the type to the AST thereby the value of the property type is evaluated
|
|
11
|
+
* to determine the value that should be written to the AST
|
|
12
|
+
* @param type
|
|
13
|
+
* @param w
|
|
14
|
+
* @constructor
|
|
15
|
+
*/
|
|
16
|
+
function WriteStringType(type, w) {
|
|
17
|
+
switch (type) {
|
|
18
|
+
case 'date':
|
|
19
|
+
w.write('Date');
|
|
20
|
+
break;
|
|
21
|
+
case 'uuid':
|
|
22
|
+
w.write('string');
|
|
23
|
+
break;
|
|
24
|
+
default:
|
|
25
|
+
w.write(type);
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.WriteStringType = WriteStringType;
|
|
30
|
+
function WriteType(propertyOrType, sourceFile) {
|
|
31
|
+
var _a;
|
|
32
|
+
let isArray = false;
|
|
33
|
+
let type;
|
|
34
|
+
if (IsWriteTypeOptions(propertyOrType)) {
|
|
35
|
+
isArray = (_a = propertyOrType.isArray) !== null && _a !== void 0 ? _a : isArray;
|
|
36
|
+
type = propertyOrType.type;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
type = propertyOrType;
|
|
40
|
+
}
|
|
41
|
+
if ((0, ts_morph_1.IsTypeImport)(type)) {
|
|
42
|
+
if (sourceFile) {
|
|
43
|
+
(0, ts_morph_1.CoerceImports)(sourceFile, (0, ts_morph_1.TypeImportToImportStructure)(type));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.warn('WriteType :: No source file provided to coerce imports');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
5
49
|
return (w) => {
|
|
6
|
-
if (
|
|
50
|
+
if (isArray) {
|
|
7
51
|
w.write('Array<');
|
|
8
52
|
}
|
|
9
|
-
if (typeof
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
default:
|
|
18
|
-
w.write(property.type);
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else if (typeof property.type === 'function') {
|
|
23
|
-
property.type(w);
|
|
53
|
+
if (typeof type === 'string') {
|
|
54
|
+
WriteStringType(type, w);
|
|
55
|
+
}
|
|
56
|
+
else if (typeof type === 'function') {
|
|
57
|
+
type(w);
|
|
58
|
+
}
|
|
59
|
+
else if ((0, ts_morph_1.IsTypeImport)(type)) {
|
|
60
|
+
WriteStringType(type.name, w);
|
|
24
61
|
}
|
|
25
62
|
else {
|
|
26
63
|
throw new Error('Invalid type');
|
|
27
64
|
}
|
|
28
|
-
if (
|
|
65
|
+
if (isArray) {
|
|
29
66
|
w.write('>');
|
|
30
67
|
}
|
|
31
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-type.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/ts-morph/write-type.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"write-type.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/ts-morph/write-type.ts"],"names":[],"mappings":";;;AAAA,6CAKwB;AAcxB,SAAgB,kBAAkB,CAAC,KAAU;IAC3C,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC;AAC1D,CAAC;AAFD,gDAEC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,CAAkB;IAC9D,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChB,MAAM;QACR,KAAK,MAAM;YACT,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAClB,MAAM;QACR;YACE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACd,MAAM;KACT;AACH,CAAC;AAZD,0CAYC;AAID,SAAgB,SAAS,CAAC,cAA4C,EAAE,UAAsB;;IAC5F,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,IAAe,CAAC;IACpB,IAAI,kBAAkB,CAAC,cAAc,CAAC,EAAE;QACtC,OAAO,GAAG,MAAA,cAAc,CAAC,OAAO,mCAAI,OAAO,CAAC;QAC5C,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC;KAC5B;SAAM;QACL,IAAI,GAAG,cAAc,CAAC;KACvB;IACD,IAAI,IAAA,uBAAY,EAAC,IAAI,CAAC,EAAE;QACtB,IAAI,UAAU,EAAE;YACd,IAAA,wBAAa,EAAC,UAAU,EAAE,IAAA,sCAA2B,EAAC,IAAI,CAAC,CAAC,CAAC;SAC9D;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;SACxE;KACF;IACD,OAAO,CAAC,CAAkB,EAAE,EAAE;QAC5B,IAAI,OAAO,EAAE;YACX,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;SACnB;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SAC1B;aAAM,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;YACrC,IAAI,CAAC,CAAC,CAAC,CAAC;SACT;aAAM,IAAI,IAAA,uBAAY,EAAC,IAAI,CAAC,EAAE;YAC7B,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SAC/B;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;SACjC;QACD,IAAI,OAAO,EAAE;YACX,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACd;IACH,CAAC,CAAC;AACJ,CAAC;AAjCD,8BAiCC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { TypeImport } from '@rxap/ts-morph';
|
|
1
2
|
import { WriterFunction } from 'ts-morph';
|
|
2
3
|
export interface FormDefinitionControl {
|
|
3
4
|
name: string;
|
|
4
|
-
type?: string | WriterFunction;
|
|
5
|
+
type?: string | TypeImport | WriterFunction;
|
|
5
6
|
isArray?: boolean;
|
|
6
7
|
state?: string | WriterFunction | null;
|
|
7
8
|
isRequired?: boolean;
|