@rxap/schematic-nestjs 0.1.0-dev.0 → 0.1.0-dev.2
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 +13 -0
- package/README.md +1 -1
- package/package.json +30 -12
- package/src/index.js +1 -2
- package/src/schematics/crud/index.js +14 -18
- package/src/schematics/crud/index.js.map +1 -1
- package/src/schematics/crud/schema.js +1 -2
- package/src/schematics/crud-init/index.js +7 -10
- package/src/schematics/crud-init/index.js.map +1 -1
- package/src/schematics/crud-init/schema.js +1 -2
- package/src/schematics/crud-service/add-module-export.js +8 -13
- package/src/schematics/crud-service/add-module-export.js.map +1 -1
- package/src/schematics/crud-service/add-module-provider.js +8 -13
- package/src/schematics/crud-service/add-module-provider.js.map +1 -1
- package/src/schematics/crud-service/coerce-class-method.js +5 -6
- package/src/schematics/crud-service/coerce-class-method.js.map +1 -1
- package/src/schematics/crud-service/coerce-class-property.js +5 -6
- package/src/schematics/crud-service/coerce-class-property.js.map +1 -1
- package/src/schematics/crud-service/coerce-collection-enum.js +7 -13
- package/src/schematics/crud-service/coerce-collection-enum.js.map +1 -1
- package/src/schematics/crud-service/coerce-module-class.js +5 -9
- package/src/schematics/crud-service/coerce-module-class.js.map +1 -1
- package/src/schematics/crud-service/coerce-source-file-rule.js +3 -7
- package/src/schematics/crud-service/coerce-source-file-rule.js.map +1 -1
- package/src/schematics/crud-service/crud-class/create-method.js +10 -14
- package/src/schematics/crud-service/crud-class/create-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/delete-method.js +9 -13
- package/src/schematics/crud-service/crud-class/delete-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/exists-method.js +9 -13
- package/src/schematics/crud-service/crud-class/exists-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/find-in-group-method.js +5 -9
- package/src/schematics/crud-service/crud-class/find-in-group-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/find-method.js +9 -13
- package/src/schematics/crud-service/crud-class/find-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/get-method.js +9 -13
- package/src/schematics/crud-service/crud-class/get-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/update-field-method.js +10 -14
- package/src/schematics/crud-service/crud-class/update-field-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/update-method.js +10 -14
- package/src/schematics/crud-service/crud-class/update-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class.js +22 -26
- package/src/schematics/crud-service/crud-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/create-dto-class.js +5 -9
- package/src/schematics/crud-service/dto-class/create-dto-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/dto-class.js +21 -25
- package/src/schematics/crud-service/dto-class/dto-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/update-dto-class.js +5 -9
- package/src/schematics/crud-service/dto-class/update-dto-class.js.map +1 -1
- package/src/schematics/crud-service/index.js +65 -70
- package/src/schematics/crud-service/index.js.map +1 -1
- package/src/schematics/crud-service/options.js +1 -2
- package/src/schematics/crud-service/schema.js +1 -2
- package/src/schematics/feature-microservice/index.js +24 -30
- package/src/schematics/feature-microservice/index.js.map +1 -1
- package/src/schematics/frontend-microservice/index.js +23 -29
- package/src/schematics/frontend-microservice/index.js.map +1 -1
- package/src/schematics/health-indicator/add-health-endpoint.js +8 -12
- package/src/schematics/health-indicator/add-health-endpoint.js.map +1 -1
- package/src/schematics/health-indicator/add-health-indicator.js +10 -14
- package/src/schematics/health-indicator/add-health-indicator.js.map +1 -1
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js +9 -14
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js.map +1 -1
- package/src/schematics/health-indicator/coerce-health-controller.js +8 -12
- package/src/schematics/health-indicator/coerce-health-controller.js.map +1 -1
- package/src/schematics/health-indicator/coerce-health-module.js +10 -14
- package/src/schematics/health-indicator/coerce-health-module.js.map +1 -1
- package/src/schematics/health-indicator/index.js +18 -21
- package/src/schematics/health-indicator/index.js.map +1 -1
- package/src/schematics/health-indicator-init/index.js +12 -15
- package/src/schematics/health-indicator-init/index.js.map +1 -1
- package/src/schematics/init/index.js +117 -129
- package/src/schematics/init/index.js.map +1 -1
- package/src/schematics/jwt/index.js +14 -17
- package/src/schematics/jwt/index.js.map +1 -1
- package/src/schematics/microservice/index.js +35 -41
- package/src/schematics/microservice/index.js.map +1 -1
- package/src/schematics/open-api/index.js +12 -15
- package/src/schematics/open-api/index.js.map +1 -1
- package/src/schematics/sentry/index.js +25 -30
- package/src/schematics/sentry/index.js.map +1 -1
- package/src/schematics/validator/index.js +7 -10
- package/src/schematics/validator/index.js.map +1 -1
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
|
+
# [0.1.0-dev.2](https://gitlab.com/rxap/packages/compare/@rxap/schematic-nestjs@0.1.0-dev.1...@rxap/schematic-nestjs@0.1.0-dev.2) (2023-08-16)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- change from commonjs to es2022 ([fd0f2ba](https://gitlab.com/rxap/packages/commit/fd0f2bae24eae7c854e96f630076cd5598c30be6))
|
|
11
|
+
|
|
12
|
+
# [0.1.0-dev.1](https://gitlab.com/rxap/packages/compare/@rxap/schematic-nestjs@0.1.0-dev.0...@rxap/schematic-nestjs@0.1.0-dev.1) (2023-08-14)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- controller naming and route ([6004d02](https://gitlab.com/rxap/packages/commit/6004d02890eb4d9b4d8369a9fa9b7726f7af28e2))
|
|
17
|
+
- prevent undefined access error ([9c249a3](https://gitlab.com/rxap/packages/commit/9c249a3f1edf494e50e765700f3d62dcdfe9bcf0))
|
|
18
|
+
|
|
6
19
|
# [0.1.0-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/schematic-nestjs@0.0.2-dev.1...@rxap/schematic-nestjs@0.1.0-dev.0) (2023-08-04)
|
|
7
20
|
|
|
8
21
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -17,5 +17,5 @@ yarn add @rxap/schematic-nestjs
|
|
|
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-ts-morph@^16.0.0-dev.
|
|
20
|
+
yarn add @angular-devkit/core@^16.1.4 @angular-devkit/schematics@^16.1.4 @rxap/schematics-ts-morph@^16.0.0-dev.9 @rxap/schematics-utilities@^16.0.0-dev.7 @rxap/utilities@^16.0.0-dev.8 ts-morph@^18.0.0
|
|
21
21
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxap/schematic-nestjs",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
4
|
-
"type": "
|
|
3
|
+
"version": "0.1.0-dev.2",
|
|
4
|
+
"type": "module",
|
|
5
5
|
"schematics": "./collection.json",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -38,31 +38,49 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@angular-devkit/core": "^16.1.4",
|
|
40
40
|
"@angular-devkit/schematics": "^16.1.4",
|
|
41
|
-
"@rxap/schematics-ts-morph": "^16.0.0-dev.
|
|
42
|
-
"@rxap/schematics-utilities": "^16.0.0-dev.
|
|
43
|
-
"@rxap/utilities": "^16.0.0-dev.
|
|
41
|
+
"@rxap/schematics-ts-morph": "^16.0.0-dev.9",
|
|
42
|
+
"@rxap/schematics-utilities": "^16.0.0-dev.7",
|
|
43
|
+
"@rxap/utilities": "^16.0.0-dev.8",
|
|
44
44
|
"ts-morph": "^18.0.0",
|
|
45
|
-
"@rxap/
|
|
46
|
-
"@rxap/
|
|
47
|
-
"@rxap/
|
|
45
|
+
"@rxap/generator-utilities": "1.1.0-dev.5",
|
|
46
|
+
"@rxap/node-utilities": "1.1.0-dev.2",
|
|
47
|
+
"@rxap/plugin-angular": "16.1.0-dev.10",
|
|
48
|
+
"@rxap/plugin-application": "16.1.0-dev.7",
|
|
49
|
+
"@rxap/plugin-docker": "16.0.0-dev.15",
|
|
50
|
+
"@rxap/plugin-localazy": "16.1.0-dev.4",
|
|
51
|
+
"@rxap/plugin-nestjs": "16.1.0-dev.8",
|
|
52
|
+
"@rxap/plugin-utilities": "16.1.0-dev.7",
|
|
53
|
+
"@rxap/workspace-ts-morph": "0.1.0-dev.1",
|
|
54
|
+
"@rxap/workspace-utilities": "0.1.0-dev.4",
|
|
55
|
+
"fs-extra": "11.1.1",
|
|
56
|
+
"glob": "8.1.0",
|
|
57
|
+
"handlebars": "4.7.7"
|
|
48
58
|
},
|
|
49
59
|
"nx-migrations": {
|
|
50
60
|
"packageGroup": [
|
|
61
|
+
{
|
|
62
|
+
"package": "@rxap/plugin-nestjs",
|
|
63
|
+
"version": "16.1.0-dev.7"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"package": "@rxap/plugin-application",
|
|
67
|
+
"version": "16.1.0-dev.5"
|
|
68
|
+
},
|
|
51
69
|
{
|
|
52
70
|
"package": "@rxap/schematics-ts-morph",
|
|
53
|
-
"version": "16.0.0-dev.
|
|
71
|
+
"version": "16.0.0-dev.9"
|
|
54
72
|
},
|
|
55
73
|
{
|
|
56
74
|
"package": "@rxap/schematics-utilities",
|
|
57
|
-
"version": "16.0.0-dev.
|
|
75
|
+
"version": "16.0.0-dev.7"
|
|
58
76
|
},
|
|
59
77
|
{
|
|
60
78
|
"package": "@rxap/utilities",
|
|
61
|
-
"version": "16.0.0-dev.
|
|
79
|
+
"version": "16.0.0-dev.8"
|
|
62
80
|
}
|
|
63
81
|
]
|
|
64
82
|
},
|
|
65
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "bbab80e59acbe435a02e69c9fec022780cf4640d",
|
|
66
84
|
"main": "./src/index.js",
|
|
67
85
|
"types": "./src/index.d.ts"
|
|
68
86
|
}
|
package/src/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const yaml_1 = require("yaml");
|
|
7
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
1
|
+
import { chain, SchematicsException, } from '@angular-devkit/schematics';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { parse } from 'yaml';
|
|
4
|
+
import { ExecuteSchematic } from '@rxap/schematics-utilities';
|
|
8
5
|
function BuildCrudRule(config, options, parentCollectionList) {
|
|
9
6
|
const rules = [];
|
|
10
7
|
if (config.name) {
|
|
11
|
-
rules.push(
|
|
8
|
+
rules.push(ExecuteSchematic('crud-service', {
|
|
12
9
|
project: options.project,
|
|
13
10
|
name: config.name,
|
|
14
11
|
collection2: parentCollectionList,
|
|
@@ -17,7 +14,7 @@ function BuildCrudRule(config, options, parentCollectionList) {
|
|
|
17
14
|
}
|
|
18
15
|
if (config.private) {
|
|
19
16
|
for (const privateName of config.private) {
|
|
20
|
-
rules.push(
|
|
17
|
+
rules.push(ExecuteSchematic('crud-service', {
|
|
21
18
|
project: options.project,
|
|
22
19
|
name: config.name,
|
|
23
20
|
collection2: parentCollectionList,
|
|
@@ -32,18 +29,17 @@ function BuildCrudRule(config, options, parentCollectionList) {
|
|
|
32
29
|
rules.push(BuildCrudRule(collection, options, subParentCollectionList));
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
|
-
return
|
|
32
|
+
return chain(rules);
|
|
36
33
|
}
|
|
37
|
-
function
|
|
38
|
-
return (host) =>
|
|
39
|
-
const basePath =
|
|
40
|
-
const dbYamlFilePath =
|
|
34
|
+
export default function (options) {
|
|
35
|
+
return async (host) => {
|
|
36
|
+
const basePath = join('libs', options.project, 'src');
|
|
37
|
+
const dbYamlFilePath = join(basePath, 'db.yaml');
|
|
41
38
|
if (!host.exists(dbYamlFilePath)) {
|
|
42
|
-
throw new
|
|
39
|
+
throw new SchematicsException('Ensure that the db.yaml file exists in the src folder of the selected project.');
|
|
43
40
|
}
|
|
44
|
-
const dbConfig =
|
|
41
|
+
const dbConfig = parse(host.read(dbYamlFilePath).toString('utf-8'));
|
|
45
42
|
return BuildCrudRule(dbConfig, options, []);
|
|
46
|
-
}
|
|
43
|
+
};
|
|
47
44
|
}
|
|
48
|
-
exports.default = default_1;
|
|
49
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAEL,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAQ9D,SAAS,aAAa,CAAC,MAAoB,EAAE,OAAmB,EAAE,oBAA8B;IAE9F,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE;YAC1C,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,WAAW,EAAE,oBAAoB;YACjC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS;SAC/B,CAAC,CAAC,CAAC;KACL;IAED,IAAI,MAAM,CAAC,OAAO,EAAE;QAClB,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,OAAO,EAAE;YACxC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE;gBAC1C,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,WAAW,EAAE,oBAAoB;gBACjC,OAAO,EAAE,WAAW;gBACpB,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS;aAC/B,CAAC,CAAC,CAAC;SACL;KACF;IAED,IAAI,MAAM,CAAC,WAAW,EAAE;QACtB,MAAM,uBAAuB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAE,GAAG,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC;QAC9G,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,WAAW,EAAE;YAC3C,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC;SACzE;KACF;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;AAEtB,CAAC;AAED,MAAM,CAAC,OAAO,WAAW,OAAmB;IAE1C,OAAO,KAAK,EAAE,IAAU,EAAE,EAAE;QAE1B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEtD,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;YAChC,MAAM,IAAI,mBAAmB,CAAC,gFAAgF,CAAC,CAAC;SACjH;QAED,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAErE,OAAO,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAE9C,CAAC,CAAC;AAEJ,CAAC"}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return (0, schematics_1.chain)([
|
|
9
|
-
(0, schematics_utilities_1.ExecuteExternalSchematic)('@nrwl/nest', 'library', { name: options.project, importPath: options.importPath }),
|
|
1
|
+
import { chain, } from '@angular-devkit/schematics';
|
|
2
|
+
import { strings } from '@angular-devkit/core';
|
|
3
|
+
import { ExecuteExternalSchematic } from '@rxap/schematics-utilities';
|
|
4
|
+
const { dasherize } = strings;
|
|
5
|
+
export default function (options) {
|
|
6
|
+
return chain([
|
|
7
|
+
ExecuteExternalSchematic('@nrwl/nest', 'library', { name: options.project, importPath: options.importPath }),
|
|
10
8
|
tree => tree.create(`libs/${dasherize(options.project)}/src/db.yaml`, 'collections: []'),
|
|
11
9
|
]);
|
|
12
10
|
}
|
|
13
|
-
exports.default = default_1;
|
|
14
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-init/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-init/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,GAEN,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;AAE9B,MAAM,CAAC,OAAO,WAAW,OAAuB;IAE9C,OAAO,KAAK,CAAC;QACX,wBAAwB,CAAC,YAAY,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;QAC5G,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAS,SAAS,CAAC,OAAO,CAAC,OAAO,CAAE,cAAc,EAAE,iBAAiB,CAAC;KAC3F,CAAC,CAAC;AAEL,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
6
|
-
function GetModuleOptionsObject(sourceFile) {
|
|
1
|
+
import { AddProviderToArray, GetCoerceArrayLiteralFromObjectLiteral, } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { ObjectLiteralExpression, Writers, } from 'ts-morph';
|
|
3
|
+
export function GetModuleOptionsObject(sourceFile) {
|
|
7
4
|
const classWithNgModule = sourceFile.getClasses().find(cls => cls.getDecorator('Module'));
|
|
8
5
|
if (!classWithNgModule) {
|
|
9
6
|
throw new Error('Could not find class with Module decorator!');
|
|
@@ -11,19 +8,17 @@ function GetModuleOptionsObject(sourceFile) {
|
|
|
11
8
|
const moduleDecorator = classWithNgModule.getDecorator('Module');
|
|
12
9
|
let moduleOptions = moduleDecorator.getArguments()[0];
|
|
13
10
|
if (!moduleOptions) {
|
|
14
|
-
moduleOptions = moduleDecorator.addArgument(
|
|
11
|
+
moduleOptions = moduleDecorator.addArgument(Writers.object({}));
|
|
15
12
|
}
|
|
16
|
-
if (!(moduleOptions instanceof
|
|
13
|
+
if (!(moduleOptions instanceof ObjectLiteralExpression)) {
|
|
17
14
|
throw new Error('The Module options is not an object literal expression');
|
|
18
15
|
}
|
|
19
16
|
return moduleOptions;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
function AddModuleExport(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
18
|
+
export function AddModuleExport(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
23
19
|
sourceFile.addImportDeclarations(structures);
|
|
24
20
|
const ngModuleOptions = GetModuleOptionsObject(sourceFile);
|
|
25
|
-
const providerArray =
|
|
26
|
-
|
|
21
|
+
const providerArray = GetCoerceArrayLiteralFromObjectLiteral(ngModuleOptions, 'exports');
|
|
22
|
+
AddProviderToArray(providerObject, providerArray, overwrite);
|
|
27
23
|
}
|
|
28
|
-
exports.AddModuleExport = AddModuleExport;
|
|
29
24
|
//# sourceMappingURL=add-module-export.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-module-export.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/add-module-export.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-module-export.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/add-module-export.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,uBAAuB,EAGvB,OAAO,GACR,MAAM,UAAU,CAAC;AAElB,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAG3D,MAAM,iBAAiB,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE1F,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAChE;IAED,MAAM,eAAe,GAAG,iBAAiB,CAAC,YAAY,CAAC,QAAQ,CAAE,CAAC;IAClE,IAAI,aAAa,GAAG,eAAe,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;IAEtD,IAAI,CAAC,aAAa,EAAE;QAClB,aAAa,GAAG,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;KACjE;IAED,IAAI,CAAC,CAAC,aAAa,YAAY,uBAAuB,CAAC,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,cAAuC,EACvC,aAAsE,EAAE,EACxE,SAAS,GAAG,KAAK;IAGjB,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE7C,MAAM,eAAe,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAE3D,MAAM,aAAa,GAAG,sCAAsC,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAEzF,kBAAkB,CAAC,cAAc,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAE/D,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
6
|
-
function GetModuleOptionsObject(sourceFile) {
|
|
1
|
+
import { AddProviderToArray, GetCoerceArrayLiteralFromObjectLiteral, } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { ObjectLiteralExpression, Writers, } from 'ts-morph';
|
|
3
|
+
export function GetModuleOptionsObject(sourceFile) {
|
|
7
4
|
const classWithNgModule = sourceFile.getClasses().find(cls => cls.getDecorator('Module'));
|
|
8
5
|
if (!classWithNgModule) {
|
|
9
6
|
throw new Error('Could not find class with Module decorator!');
|
|
@@ -11,19 +8,17 @@ function GetModuleOptionsObject(sourceFile) {
|
|
|
11
8
|
const moduleDecorator = classWithNgModule.getDecorator('Module');
|
|
12
9
|
let moduleOptions = moduleDecorator.getArguments()[0];
|
|
13
10
|
if (!moduleOptions) {
|
|
14
|
-
moduleOptions = moduleDecorator.addArgument(
|
|
11
|
+
moduleOptions = moduleDecorator.addArgument(Writers.object({}));
|
|
15
12
|
}
|
|
16
|
-
if (!(moduleOptions instanceof
|
|
13
|
+
if (!(moduleOptions instanceof ObjectLiteralExpression)) {
|
|
17
14
|
throw new Error('The Module options is not an object literal expression');
|
|
18
15
|
}
|
|
19
16
|
return moduleOptions;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
function AddModuleProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
18
|
+
export function AddModuleProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
23
19
|
sourceFile.addImportDeclarations(structures);
|
|
24
20
|
const ngModuleOptions = GetModuleOptionsObject(sourceFile);
|
|
25
|
-
const providerArray =
|
|
26
|
-
|
|
21
|
+
const providerArray = GetCoerceArrayLiteralFromObjectLiteral(ngModuleOptions, 'providers');
|
|
22
|
+
AddProviderToArray(providerObject, providerArray, overwrite);
|
|
27
23
|
}
|
|
28
|
-
exports.AddModuleProvider = AddModuleProvider;
|
|
29
24
|
//# sourceMappingURL=add-module-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-module-provider.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/add-module-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-module-provider.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/add-module-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,sCAAsC,GAEvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,uBAAuB,EAGvB,OAAO,GACR,MAAM,UAAU,CAAC;AAElB,MAAM,UAAU,sBAAsB,CAAC,UAAsB;IAG3D,MAAM,iBAAiB,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE1F,IAAI,CAAC,iBAAiB,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAChE;IAED,MAAM,eAAe,GAAG,iBAAiB,CAAC,YAAY,CAAC,QAAQ,CAAE,CAAC;IAClE,IAAI,aAAa,GAAG,eAAe,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;IAEtD,IAAI,CAAC,aAAa,EAAE;QAClB,aAAa,GAAG,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;KACjE;IAED,IAAI,CAAC,CAAC,aAAa,YAAY,uBAAuB,CAAC,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,UAAsB,EACtB,cAAuC,EACvC,aAAsE,EAAE,EACxE,SAAS,GAAG,KAAK;IAGjB,UAAU,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAE7C,MAAM,eAAe,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IAE3D,MAAM,aAAa,GAAG,sCAAsC,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAE3F,kBAAkB,CAAC,cAAc,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAE/D,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoerceClassMethod = void 0;
|
|
4
|
-
function CoerceClassMethod(classDeclaration, methodName, methodStructure = {}) {
|
|
1
|
+
export function CoerceClassMethod(classDeclaration, methodName, methodStructure = {}) {
|
|
5
2
|
if (!classDeclaration.getMethod(methodName)) {
|
|
6
|
-
classDeclaration.addMethod(
|
|
3
|
+
classDeclaration.addMethod({
|
|
4
|
+
...methodStructure,
|
|
5
|
+
name: methodName,
|
|
6
|
+
});
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
exports.CoerceClassMethod = CoerceClassMethod;
|
|
10
9
|
//# sourceMappingURL=coerce-class-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-class-method.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-class-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coerce-class-method.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-class-method.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,iBAAiB,CAC/B,gBAAkC,EAClC,UAAkB,EAClB,kBAA0E,EAAE;IAG5E,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;QAC3C,gBAAgB,CAAC,SAAS,CAAC;YACzB,GAAG,eAAe;YAClB,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;KACJ;AAEH,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoerceClassProperty = void 0;
|
|
4
|
-
function CoerceClassProperty(classDeclaration, propertyName, propertyStructure) {
|
|
1
|
+
export function CoerceClassProperty(classDeclaration, propertyName, propertyStructure) {
|
|
5
2
|
if (!classDeclaration.getProperty(propertyName)) {
|
|
6
|
-
classDeclaration.addProperty(
|
|
3
|
+
classDeclaration.addProperty({
|
|
4
|
+
...propertyStructure,
|
|
5
|
+
name: propertyName,
|
|
6
|
+
});
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
exports.CoerceClassProperty = CoerceClassProperty;
|
|
10
9
|
//# sourceMappingURL=coerce-class-property.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-class-property.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-class-property.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coerce-class-property.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-class-property.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,mBAAmB,CACjC,gBAAkC,EAClC,YAAoB,EACpB,iBAA2E;IAG3E,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE;QAC/C,gBAAgB,CAAC,WAAW,CAAC;YAC3B,GAAG,iBAAiB;YACpB,IAAI,EAAE,YAAY;SACnB,CAAC,CAAC;KACJ;AAEH,CAAC"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
5
|
-
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
6
|
-
function CoerceEnum(sourceFile, name) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { CoerceSourceFile } from '@rxap/schematics-ts-morph';
|
|
3
|
+
export function CoerceEnum(sourceFile, name) {
|
|
7
4
|
let enumDeclaration = sourceFile.getEnum(name);
|
|
8
5
|
if (!enumDeclaration) {
|
|
9
6
|
enumDeclaration = sourceFile.addEnum({ name, isExported: true });
|
|
10
7
|
}
|
|
11
8
|
return enumDeclaration;
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
function CoerceEnumProperty(sourceFile, name, propertyKey, value) {
|
|
10
|
+
export function CoerceEnumProperty(sourceFile, name, propertyKey, value) {
|
|
15
11
|
const enumDeclaration = CoerceEnum(sourceFile, name);
|
|
16
12
|
if (!enumDeclaration.getMember(propertyKey)) {
|
|
17
13
|
enumDeclaration.addMember({
|
|
@@ -20,10 +16,8 @@ function CoerceEnumProperty(sourceFile, name, propertyKey, value) {
|
|
|
20
16
|
});
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
CoerceEnumProperty(sourceFile, 'Collection', (0, strings_1.underscore)(collection).toUpperCase(), collection);
|
|
19
|
+
export function CoerceCollectionEnum(project, collection) {
|
|
20
|
+
const sourceFile = CoerceSourceFile(project, 'lib/collection.ts');
|
|
21
|
+
CoerceEnumProperty(sourceFile, 'Collection', underscore(collection).toUpperCase(), collection);
|
|
27
22
|
}
|
|
28
|
-
exports.CoerceCollectionEnum = CoerceCollectionEnum;
|
|
29
23
|
//# sourceMappingURL=coerce-collection-enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-collection-enum.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-collection-enum.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coerce-collection-enum.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-collection-enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAO7D,MAAM,UAAU,UAAU,CAAC,UAAsB,EAAE,IAAY;IAE7D,IAAI,eAAe,GAAgC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5E,IAAI,CAAC,eAAe,EAAE;QACpB,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;KAClE;IAED,OAAO,eAAe,CAAC;AAEzB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,UAAsB,EACtB,IAAY,EACZ,WAAmB,EACnB,KAAkC;IAGlC,MAAM,eAAe,GAAG,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE;QAC3C,eAAe,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;KACJ;AAEH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAgB,EAAE,UAAkB;IACvE,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAClE,kBAAkB,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
function CoerceModuleClass(sourceFile, moduleName, global = false) {
|
|
1
|
+
import { CoerceClass } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { CoerceSuffix } from '@rxap/schematics-utilities';
|
|
3
|
+
export function CoerceModuleClass(sourceFile, moduleName, global = false) {
|
|
7
4
|
const decorators = [
|
|
8
5
|
{
|
|
9
6
|
name: 'Module',
|
|
@@ -16,8 +13,8 @@ function CoerceModuleClass(sourceFile, moduleName, global = false) {
|
|
|
16
13
|
arguments: [],
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
|
-
const className =
|
|
20
|
-
|
|
16
|
+
const className = CoerceSuffix(moduleName, 'Module');
|
|
17
|
+
CoerceClass(sourceFile, className, {
|
|
21
18
|
isExported: true,
|
|
22
19
|
decorators,
|
|
23
20
|
});
|
|
@@ -28,5 +25,4 @@ function CoerceModuleClass(sourceFile, moduleName, global = false) {
|
|
|
28
25
|
},
|
|
29
26
|
]);
|
|
30
27
|
}
|
|
31
|
-
exports.CoerceModuleClass = CoerceModuleClass;
|
|
32
28
|
//# sourceMappingURL=coerce-module-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-module-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-module-class.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coerce-module-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-module-class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAOxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,UAAU,iBAAiB,CAAC,UAAsB,EAAE,UAAkB,EAAE,MAAM,GAAG,KAAK;IAE1F,MAAM,UAAU,GAA4C;QAC1D;YACE,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAE,IAAI,CAAE;SACpB;KACF,CAAC;IAGF,IAAI,MAAM,EAAE;QACV,UAAU,CAAC,OAAO,CAAC;YACjB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,EAAE;SACd,CAAC,CAAC;KACJ;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAErD,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE;QACjC,UAAU,EAAE,IAAI;QAChB,UAAU;KACX,CAAC,CAAC;IAEH,UAAU,CAAC,qBAAqB,CAAC;QAC/B;YACE,YAAY,EAAE,CAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAE;YAC9C,eAAe,EAAE,gBAAgB;SAClC;KACF,CAAC,CAAC;AAEL,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CoerceSourceFileRule = void 0;
|
|
4
|
-
const path_1 = require("path");
|
|
1
|
+
import { join } from 'path';
|
|
5
2
|
/**
|
|
6
3
|
*
|
|
7
4
|
* @param project A ts-morph project instance
|
|
@@ -10,10 +7,10 @@ const path_1 = require("path");
|
|
|
10
7
|
* @param initializer A initializer function called with the SourceFile instance
|
|
11
8
|
* if the file does not exists in the schematics file Tree
|
|
12
9
|
*/
|
|
13
|
-
function CoerceSourceFileRule(project, filePath, basePath, initializer) {
|
|
10
|
+
export function CoerceSourceFileRule(project, filePath, basePath, initializer) {
|
|
14
11
|
return tree => {
|
|
15
12
|
let content = '';
|
|
16
|
-
const treeFilePath =
|
|
13
|
+
const treeFilePath = join(basePath, filePath);
|
|
17
14
|
let exists = false;
|
|
18
15
|
if (tree.exists(treeFilePath)) {
|
|
19
16
|
exists = true;
|
|
@@ -25,5 +22,4 @@ function CoerceSourceFileRule(project, filePath, basePath, initializer) {
|
|
|
25
22
|
}
|
|
26
23
|
};
|
|
27
24
|
}
|
|
28
|
-
exports.CoerceSourceFileRule = CoerceSourceFileRule;
|
|
29
25
|
//# sourceMappingURL=coerce-source-file-rule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-source-file-rule.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-source-file-rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"coerce-source-file-rule.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-source-file-rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAM5B;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,WAA8C;IAE9C,OAAO,IAAI,CAAC,EAAE;QAEZ,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAE9C,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;YAC7B,MAAM,GAAG,IAAI,CAAC;YACd,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC7D;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAEpF,IAAI,CAAC,MAAM,IAAI,WAAW,EAAE;YAC1B,WAAW,CAAC,UAAU,CAAC,CAAC;SACzB;IAEH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const ts_morph_1 = require("ts-morph");
|
|
6
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
7
|
-
function CreateMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { Scope, } from 'ts-morph';
|
|
3
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
4
|
+
export function CreateMethod(options, className) {
|
|
8
5
|
const { classified, dtoName, camelized, documentId, collection, parentCollectionList, privateName } = options;
|
|
9
6
|
let parameters = [
|
|
10
7
|
{
|
|
@@ -21,12 +18,12 @@ function CreateMethod(options, className) {
|
|
|
21
18
|
parameters = parameters.reverse();
|
|
22
19
|
}
|
|
23
20
|
parameters.unshift(...parentCollectionList.map(subCollection => ({
|
|
24
|
-
name: `${
|
|
21
|
+
name: `${camelize(subCollection)}Id`,
|
|
25
22
|
type: 'string',
|
|
26
23
|
})));
|
|
27
24
|
return {
|
|
28
25
|
name: 'create',
|
|
29
|
-
scope:
|
|
26
|
+
scope: Scope.Public,
|
|
30
27
|
isAsync: true,
|
|
31
28
|
parameters,
|
|
32
29
|
returnType: `Promise<${dtoName}>`,
|
|
@@ -34,7 +31,7 @@ function CreateMethod(options, className) {
|
|
|
34
31
|
`this.logger.verbose('create: ' + ${documentId}, '${className}')`,
|
|
35
32
|
`if (!(create${dtoName} instanceof Create${dtoName})) { throw new InternalServerErrorException('Not instance of Create${dtoName}') }`,
|
|
36
33
|
`const ${camelized} = ${dtoName}.FromCreate${dtoName}(create${dtoName}, ${[
|
|
37
|
-
...parentCollectionList.map(subCollection => `${
|
|
34
|
+
...parentCollectionList.map(subCollection => `${camelize(subCollection)}Id`),
|
|
38
35
|
documentId,
|
|
39
36
|
]});`,
|
|
40
37
|
`const result = validateSync(${camelized}, CrudValidatorOptions());`,
|
|
@@ -45,10 +42,10 @@ function CreateMethod(options, className) {
|
|
|
45
42
|
writer.writeLine('plain.__updatedAt = new Date()');
|
|
46
43
|
writer.write('await this.firestore');
|
|
47
44
|
for (const subCollection of parentCollectionList) {
|
|
48
|
-
writer.writeLine(`.collection(Collection.${
|
|
49
|
-
writer.writeLine(`.doc(${
|
|
45
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
46
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
50
47
|
}
|
|
51
|
-
writer.writeLine(`.collection(Collection.${
|
|
48
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
52
49
|
if (privateName) {
|
|
53
50
|
writer.writeLine(`.doc(${documentId})`);
|
|
54
51
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -65,5 +62,4 @@ function CreateMethod(options, className) {
|
|
|
65
62
|
],
|
|
66
63
|
};
|
|
67
64
|
}
|
|
68
|
-
exports.CreateMethod = CreateMethod;
|
|
69
65
|
//# sourceMappingURL=create-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/create-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/create-method.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
-
const ts_morph_1 = require("ts-morph");
|
|
7
|
-
function DeleteMethod(options, className) {
|
|
1
|
+
import { underscore } from '@angular-devkit/core/src/utils/strings';
|
|
2
|
+
import { camelize } from '@rxap/schematics-utilities';
|
|
3
|
+
import { Scope, } from 'ts-morph';
|
|
4
|
+
export function DeleteMethod(options, className) {
|
|
8
5
|
const { classified, dtoName, documentId, camelized, collection, parentCollectionList } = options;
|
|
9
6
|
return {
|
|
10
7
|
name: 'delete',
|
|
11
|
-
scope:
|
|
8
|
+
scope: Scope.Public,
|
|
12
9
|
isAsync: true,
|
|
13
10
|
parameters: [
|
|
14
11
|
...parentCollectionList.map(subCollection => ({
|
|
15
|
-
name: `${
|
|
12
|
+
name: `${camelize(subCollection)}Id`,
|
|
16
13
|
type: 'string',
|
|
17
14
|
})),
|
|
18
15
|
{
|
|
@@ -26,10 +23,10 @@ function DeleteMethod(options, className) {
|
|
|
26
23
|
writer => {
|
|
27
24
|
writer.write('await this.firestore');
|
|
28
25
|
for (const subCollection of parentCollectionList) {
|
|
29
|
-
writer.writeLine(`.collection(Collection.${
|
|
30
|
-
writer.writeLine(`.doc(${
|
|
26
|
+
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
27
|
+
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
31
28
|
}
|
|
32
|
-
writer.writeLine(`.collection(Collection.${
|
|
29
|
+
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
33
30
|
writer.writeLine(`.doc(${documentId})`);
|
|
34
31
|
if (options.privateName) {
|
|
35
32
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -42,5 +39,4 @@ function DeleteMethod(options, className) {
|
|
|
42
39
|
],
|
|
43
40
|
};
|
|
44
41
|
}
|
|
45
|
-
exports.DeleteMethod = DeleteMethod;
|
|
46
42
|
//# sourceMappingURL=delete-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/delete-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/delete-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAGL,KAAK,GACN,MAAM,UAAU,CAAC;AAGlB,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,SAAiB;IAC9D,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC;IACjG,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE;YACV,GAAG,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBAC5C,IAAI,EAAE,GAAI,QAAQ,CAAC,aAAa,CAAE,IAAI;gBACtC,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YACH;gBACE,IAAI,EAAE,GAAI,UAAW,EAAE;gBACvB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,UAAU,EAAE,eAAe;QAC3B,UAAU,EAAE;YACV,oCAAqC,UAAW,MAAO,SAAU,IAAI;YACrE,MAAM,CAAC,EAAE;gBACP,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBACrC,KAAK,MAAM,aAAa,IAAI,oBAAoB,EAAE;oBAChD,MAAM,CAAC,SAAS,CAAC,0BAA2B,UAAU,CAAC,aAAa,CAAC,CAAC,WAAW,EAAG,GAAG,CAAC,CAAC;oBACzF,MAAM,CAAC,SAAS,CAAC,QAAS,QAAQ,CAAC,aAAa,CAAE,KAAK,CAAC,CAAC;iBAC1D;gBACD,MAAM,CAAC,SAAS,CAAC,0BAA2B,UAAU,CAAC,UAAU,CAAC,CAAC,WAAW,EAAG,GAAG,CAAC,CAAC;gBACtF,MAAM,CAAC,SAAS,CAAC,QAAS,UAAW,GAAG,CAAC,CAAC;gBAC1C,IAAI,OAAO,CAAC,WAAW,EAAE;oBACvB,MAAM,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAAC;oBACpD,MAAM,CAAC,SAAS,CAAC,SAAU,OAAO,CAAC,WAAY,IAAI,CAAC,CAAC;iBACtD;gBACD,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;gBAC9B,MAAM,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAC;YAClE,CAAC;YACD,mCAAoC,UAAW,MAAO,SAAU,IAAI;SACrE;KACF,CAAC;AACJ,CAAC"}
|