@rxap/schematics-ts-morph 16.1.0-dev.16 → 16.1.0-dev.18

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 CHANGED
@@ -3,6 +3,19 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [16.1.0-dev.18](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.1.0-dev.17...@rxap/schematics-ts-morph@16.1.0-dev.18) (2024-03-07)
7
+
8
+ ### Bug Fixes
9
+
10
+ - add default get tree operation mapper ([f4f8e08](https://gitlab.com/rxap/packages/commit/f4f8e08bca2a78cab843a21578826502490fc40c))
11
+ - add default options operation mapper ([d519836](https://gitlab.com/rxap/packages/commit/d5198369f0c5d5d883d233b907b9ebde37638069))
12
+
13
+ # [16.1.0-dev.17](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.1.0-dev.16...@rxap/schematics-ts-morph@16.1.0-dev.17) (2024-03-07)
14
+
15
+ ### Bug Fixes
16
+
17
+ - select form backend generation ([e5ba3c8](https://gitlab.com/rxap/packages/commit/e5ba3c8b183c6ee76eb90c1a05e1f4acbc1cf66f))
18
+
6
19
  # [16.1.0-dev.16](https://gitlab.com/rxap/packages/compare/@rxap/schematics-ts-morph@16.1.0-dev.15...@rxap/schematics-ts-morph@16.1.0-dev.16) (2024-03-07)
7
20
 
8
21
  ### Bug Fixes
package/README.md CHANGED
@@ -17,5 +17,5 @@ yarn add @rxap/schematics-ts-morph
17
17
  ```
18
18
  **Install peer dependencies:**
19
19
  ```bash
20
- yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/schematics-utilities@^16.0.1-dev.1 @rxap/ts-morph@^1.1.0-dev.14 @rxap/utilities@^16.1.0-dev.6 @rxap/workspace-ts-morph@^16.0.2-dev.1 colors@^1.4.0 handlebars@^4.7.7 ts-morph@^18.0.0 tslib@2.6.2
20
+ yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/schematics-utilities@^16.0.1-dev.1 @rxap/ts-morph@^1.1.0-dev.15 @rxap/utilities@^16.1.0-dev.6 @rxap/workspace-ts-morph@^16.0.2-dev.1 colors@^1.4.0 handlebars@^4.7.7 ts-morph@^18.0.0 tslib@2.6.2
21
21
  ```
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "16.1.0-dev.16",
2
+ "version": "16.1.0-dev.18",
3
3
  "name": "@rxap/schematics-ts-morph",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
@@ -13,7 +13,7 @@
13
13
  "@angular-devkit/core": "^16.1.4",
14
14
  "@angular-devkit/schematics": "^16.1.4",
15
15
  "@rxap/schematics-utilities": "^16.0.1-dev.1",
16
- "@rxap/ts-morph": "^1.1.0-dev.14",
16
+ "@rxap/ts-morph": "^1.1.0-dev.15",
17
17
  "@rxap/utilities": "^16.1.0-dev.6",
18
18
  "@rxap/workspace-ts-morph": "^16.0.2-dev.1",
19
19
  "colors": "^1.4.0",
@@ -49,7 +49,7 @@
49
49
  },
50
50
  {
51
51
  "package": "@rxap/ts-morph",
52
- "version": "1.1.0-dev.14"
52
+ "version": "1.1.0-dev.15"
53
53
  },
54
54
  {
55
55
  "package": "@rxap/utilities",
@@ -71,7 +71,7 @@
71
71
  "directory": "packages/schematic/ts-morph"
72
72
  },
73
73
  "type": "commonjs",
74
- "gitHead": "3425a2fec349f7773f4eeaec482c1f4f8a4861c1",
74
+ "gitHead": "3c073a7e053b826644a62bc36977a7b0c8544653",
75
75
  "main": "./src/index.js",
76
76
  "types": "./src/index.d.ts"
77
77
  }
@@ -1,4 +1,8 @@
1
+ import { ClassDeclaration, SourceFile, WriterFunction } from 'ts-morph';
2
+ import { CoerceDtoClassOutput } from './coerce-dto-class';
1
3
  import { CoerceGetByIdControllerOptions } from './coerce-get-by-id-operation';
4
+ import { CoerceOperationOptions, TransformOperation } from './coerce-operation';
2
5
  export interface CoerceGetRootOperationOptions extends CoerceGetByIdControllerOptions {
3
6
  }
7
+ export declare function BuildGetRootDtoDataMapperImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation<string | WriterFunction>;
4
8
  export declare function CoerceGetRootOperation(options: Readonly<CoerceGetRootOperationOptions>): import("@angular-devkit/schematics").Rule;
@@ -1,11 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CoerceGetRootOperation = void 0;
3
+ exports.CoerceGetRootOperation = exports.BuildGetRootDtoDataMapperImplementation = void 0;
4
4
  const utilities_1 = require("@rxap/utilities");
5
5
  const coerce_get_by_id_operation_1 = require("./coerce-get-by-id-operation");
6
6
  const table_query_list_1 = require("./table-query-list");
7
+ function BuildGetRootDtoDataMapperImplementation(classDeclaration, moduleSourceFile, dto, options) {
8
+ const { isArray, } = options;
9
+ return () => {
10
+ // TODO : implement the data mapper
11
+ return isArray ? '[]' : '{}';
12
+ };
13
+ }
14
+ exports.BuildGetRootDtoDataMapperImplementation = BuildGetRootDtoDataMapperImplementation;
7
15
  function CoerceGetRootOperation(options) {
8
- const { tsMorphTransform = utilities_1.noop, propertyList = [], operationName = 'get-root', idProperty = null, dtoClassNameSuffix = '-item', isArray = true, } = options;
16
+ const { tsMorphTransform = utilities_1.noop, propertyList = [], operationName = 'get-root', builtDtoDataMapperImplementation = BuildGetRootDtoDataMapperImplementation, idProperty = null, dtoClassNameSuffix = '-item', isArray = true, } = options;
9
17
  (0, utilities_1.CoerceArrayItems)(propertyList, [
10
18
  {
11
19
  name: 'hasChildren',
@@ -22,7 +30,8 @@ function CoerceGetRootOperation(options) {
22
30
  return (0, coerce_get_by_id_operation_1.CoerceGetByIdOperation)(Object.assign(Object.assign({}, options), { operationName,
23
31
  idProperty,
24
32
  dtoClassNameSuffix,
25
- isArray, tsMorphTransform: (project, sourceFile, classDeclaration, controllerName, moduleSourceFile, dto) => {
33
+ isArray,
34
+ builtDtoDataMapperImplementation, tsMorphTransform: (project, sourceFile, classDeclaration, controllerName, moduleSourceFile, dto) => {
26
35
  return Object.assign({ queryList: table_query_list_1.TABLE_QUERY_LIST }, tsMorphTransform(project, sourceFile, classDeclaration, controllerName, moduleSourceFile, dto));
27
36
  } }));
28
37
  }
@@ -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,+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
+ {"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;AAOzB,6EAGsC;AAKtC,yDAAsD;AAMtD,SAAgB,uCAAuC,CACrD,gBAAkC,EAClC,gBAA4B,EAC5B,GAAgC,EAChC,OAAyC;IAEzC,MAAM,EACJ,OAAO,GACR,GAAG,OAAO,CAAC;IACZ,OAAO,GAAG,EAAE;QACV,mCAAmC;QACnC,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAbD,0FAaC;AAED,SAAgB,sBAAsB,CAAC,OAAgD;IACrF,MAAM,EACJ,gBAAgB,GAAG,gBAAI,EACvB,YAAY,GAAG,EAAE,EACjB,aAAa,GAAG,UAAU,EAC1B,gCAAgC,GAAG,uCAAuC,EAC1E,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;QACP,gCAAgC,EAChC,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;AA7CD,wDA6CC"}
@@ -1,8 +1,11 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
+ import { ClassDeclaration, SourceFile, WriterFunction } from 'ts-morph';
2
3
  import { AbstractControl } from '../types/abstract-control';
3
- import { CoerceOperationOptions } from './coerce-operation';
4
+ import { CoerceDtoClassOutput } from './coerce-dto-class';
5
+ import { CoerceOperationOptions, TransformOperation } from './coerce-operation';
4
6
  export interface CoerceOptionsOperationRuleOptions extends CoerceOperationOptions {
5
7
  control: Required<AbstractControl>;
6
8
  responseDtoName?: string;
7
9
  }
10
+ export declare function BuildOptionsDtoDataMapperImplementation(classDeclaration: ClassDeclaration, moduleSourceFile: SourceFile, dto: CoerceDtoClassOutput | null, options: Readonly<CoerceOperationOptions>): TransformOperation<string | WriterFunction>;
8
11
  export declare function CoerceOptionsOperationRule(options: Readonly<CoerceOptionsOperationRuleOptions>): Rule;
@@ -1,22 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CoerceOptionsOperationRule = void 0;
3
+ exports.CoerceOptionsOperationRule = exports.BuildOptionsDtoDataMapperImplementation = void 0;
4
4
  const utilities_1 = require("@rxap/utilities");
5
5
  const coerce_operation_1 = require("./coerce-operation");
6
+ function BuildOptionsDtoDataMapperImplementation(classDeclaration, moduleSourceFile, dto, options) {
7
+ const { isArray, } = options;
8
+ return () => {
9
+ // TODO : implement the data mapper
10
+ return isArray ? '[]' : '{}';
11
+ };
12
+ }
13
+ exports.BuildOptionsDtoDataMapperImplementation = BuildOptionsDtoDataMapperImplementation;
6
14
  function CoerceOptionsOperationRule(options) {
7
- const { control, isArray = true, responseDtoName, propertyList = [
15
+ const { control, builtDtoDataMapperImplementation = BuildOptionsDtoDataMapperImplementation, isArray = true, responseDtoName, propertyList = [
8
16
  {
9
17
  name: 'display',
10
18
  type: 'string',
11
19
  },
12
20
  {
13
21
  name: 'value',
14
- type: control,
22
+ type: control.type,
15
23
  },
16
24
  ], } = options;
17
25
  return (0, coerce_operation_1.CoerceOperation)(Object.assign(Object.assign({}, options), { propertyList,
18
- isArray, buildOperationDtoClassName: (controllerName, { dtoClassName, dtoClassNameSuffix }) => {
19
- return dtoClassName !== null && dtoClassName !== void 0 ? dtoClassName : (dtoClassNameSuffix ? (0, utilities_1.CoerceSuffix)(responseDtoName !== null && responseDtoName !== void 0 ? responseDtoName : (0, utilities_1.joinWithDash)([dtoClassName, 'control', control.name, 'options']), dtoClassNameSuffix) : responseDtoName !== null && responseDtoName !== void 0 ? responseDtoName : (0, utilities_1.joinWithDash)([dtoClassName, 'control', control.name, 'options']));
26
+ isArray,
27
+ builtDtoDataMapperImplementation, buildOperationDtoClassName: (controllerName, { dtoClassName, dtoClassNameSuffix }) => {
28
+ const className = responseDtoName !== null && responseDtoName !== void 0 ? responseDtoName : (0, utilities_1.joinWithDash)([dtoClassName !== null && dtoClassName !== void 0 ? dtoClassName : controllerName, control.name, 'control', 'options']);
29
+ return dtoClassName !== null && dtoClassName !== void 0 ? dtoClassName : (dtoClassNameSuffix ? (0, utilities_1.CoerceSuffix)(className, dtoClassNameSuffix) : className);
20
30
  } }));
21
31
  }
22
32
  exports.CoerceOptionsOperationRule = CoerceOptionsOperationRule;
@@ -1 +1 @@
1
- {"version":3,"file":"coerce-options-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-options-operation.ts"],"names":[],"mappings":";;;AACA,+CAGyB;AAEzB,yDAG4B;AAO5B,SAAgB,0BAA0B,CAAC,OAAoD;IAC7F,MAAM,EACJ,OAAO,EACP,OAAO,GAAG,IAAI,EACd,eAAe,EACf,YAAY,GAAG;QACb;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO;SACd;KACF,GACF,GAAG,OAAO,CAAC;IACZ,OAAO,IAAA,kCAAe,kCACjB,OAAO,KACV,YAAY;QACZ,OAAO,EACP,0BAA0B,EAAE,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,EAAE;YACnF,OAAO,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,CACrB,kBAAkB,CAAC,CAAC,CAAC,IAAA,wBAAY,EAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAA,wBAAY,EAAC,CAAE,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAE,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAA,wBAAY,EAAC,CAAE,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAE,CAAC,CACrO,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AA1BD,gEA0BC"}
1
+ {"version":3,"file":"coerce-options-operation.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/nest/coerce-options-operation.ts"],"names":[],"mappings":";;;AACA,+CAGyB;AAQzB,yDAI4B;AAO5B,SAAgB,uCAAuC,CACrD,gBAAkC,EAClC,gBAA4B,EAC5B,GAAgC,EAChC,OAAyC;IAEzC,MAAM,EACJ,OAAO,GACR,GAAG,OAAO,CAAC;IACZ,OAAO,GAAG,EAAE;QACV,mCAAmC;QACnC,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAbD,0FAaC;AAED,SAAgB,0BAA0B,CAAC,OAAoD;IAC7F,MAAM,EACJ,OAAO,EACP,gCAAgC,GAAG,uCAAuC,EAC1E,OAAO,GAAG,IAAI,EACd,eAAe,EACf,YAAY,GAAG;QACb;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB;KACF,GACF,GAAG,OAAO,CAAC;IACZ,OAAO,IAAA,kCAAe,kCACjB,OAAO,KACV,YAAY;QACZ,OAAO;QACP,gCAAgC,EAChC,0BAA0B,EAAE,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,EAAE;YACnF,MAAM,SAAS,GAAG,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAA,wBAAY,EAAC,CAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,cAAc,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAE,CAAC,CAAC;YAC1H,OAAO,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,CACrB,kBAAkB,CAAC,CAAC,CAAC,IAAA,wBAAY,EAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,SAAS,CAC7E,CAAC;QACJ,CAAC,IACD,CAAC;AACL,CAAC;AA7BD,gEA6BC"}