@rxap/schematic-nestjs 0.1.0-dev.2 → 0.1.0-dev.4
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 +12 -0
- package/README.md +1 -1
- package/package.json +21 -21
- package/src/index.js +2 -1
- package/src/schematics/crud/index.js +18 -14
- package/src/schematics/crud/index.js.map +1 -1
- package/src/schematics/crud/schema.js +2 -1
- package/src/schematics/crud-init/index.js +10 -7
- package/src/schematics/crud-init/index.js.map +1 -1
- package/src/schematics/crud-init/schema.js +2 -1
- package/src/schematics/crud-service/add-module-export.js +13 -8
- package/src/schematics/crud-service/add-module-export.js.map +1 -1
- package/src/schematics/crud-service/add-module-provider.js +13 -8
- package/src/schematics/crud-service/add-module-provider.js.map +1 -1
- package/src/schematics/crud-service/coerce-class-method.js +6 -5
- package/src/schematics/crud-service/coerce-class-method.js.map +1 -1
- package/src/schematics/crud-service/coerce-class-property.js +6 -5
- package/src/schematics/crud-service/coerce-class-property.js.map +1 -1
- package/src/schematics/crud-service/coerce-collection-enum.js +13 -7
- package/src/schematics/crud-service/coerce-collection-enum.js.map +1 -1
- package/src/schematics/crud-service/coerce-module-class.js +9 -5
- package/src/schematics/crud-service/coerce-module-class.js.map +1 -1
- package/src/schematics/crud-service/coerce-source-file-rule.js +7 -3
- package/src/schematics/crud-service/coerce-source-file-rule.js.map +1 -1
- package/src/schematics/crud-service/crud-class/create-method.js +14 -10
- package/src/schematics/crud-service/crud-class/create-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/delete-method.js +13 -9
- package/src/schematics/crud-service/crud-class/delete-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/exists-method.js +13 -9
- 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 +9 -5
- 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 +13 -9
- package/src/schematics/crud-service/crud-class/find-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/get-method.js +13 -9
- package/src/schematics/crud-service/crud-class/get-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/update-field-method.js +14 -10
- package/src/schematics/crud-service/crud-class/update-field-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class/update-method.js +14 -10
- package/src/schematics/crud-service/crud-class/update-method.js.map +1 -1
- package/src/schematics/crud-service/crud-class.js +26 -22
- package/src/schematics/crud-service/crud-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/create-dto-class.js +9 -5
- package/src/schematics/crud-service/dto-class/create-dto-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/dto-class.js +25 -21
- package/src/schematics/crud-service/dto-class/dto-class.js.map +1 -1
- package/src/schematics/crud-service/dto-class/update-dto-class.js +9 -5
- package/src/schematics/crud-service/dto-class/update-dto-class.js.map +1 -1
- package/src/schematics/crud-service/index.js +70 -65
- package/src/schematics/crud-service/index.js.map +1 -1
- package/src/schematics/crud-service/options.js +2 -1
- package/src/schematics/crud-service/schema.js +2 -1
- package/src/schematics/feature-microservice/index.js +30 -24
- package/src/schematics/feature-microservice/index.js.map +1 -1
- package/src/schematics/frontend-microservice/index.js +29 -23
- package/src/schematics/frontend-microservice/index.js.map +1 -1
- package/src/schematics/health-indicator/add-health-endpoint.js +12 -8
- package/src/schematics/health-indicator/add-health-endpoint.js.map +1 -1
- package/src/schematics/health-indicator/add-health-indicator.js +14 -10
- package/src/schematics/health-indicator/add-health-indicator.js.map +1 -1
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js +14 -9
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js.map +1 -1
- package/src/schematics/health-indicator/coerce-health-controller.js +12 -8
- package/src/schematics/health-indicator/coerce-health-controller.js.map +1 -1
- package/src/schematics/health-indicator/coerce-health-module.js +14 -10
- package/src/schematics/health-indicator/coerce-health-module.js.map +1 -1
- package/src/schematics/health-indicator/index.js +21 -18
- package/src/schematics/health-indicator/index.js.map +1 -1
- package/src/schematics/health-indicator-init/index.js +15 -12
- package/src/schematics/health-indicator-init/index.js.map +1 -1
- package/src/schematics/init/index.js +144 -113
- package/src/schematics/init/index.js.map +1 -1
- package/src/schematics/jwt/index.js +17 -14
- package/src/schematics/jwt/index.js.map +1 -1
- package/src/schematics/microservice/index.js +41 -35
- package/src/schematics/microservice/index.js.map +1 -1
- package/src/schematics/open-api/index.js +15 -12
- package/src/schematics/open-api/index.js.map +1 -1
- package/src/schematics/sentry/index.js +30 -25
- package/src/schematics/sentry/index.js.map +1 -1
- package/src/schematics/validator/index.js +10 -7
- package/src/schematics/validator/index.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.4](https://gitlab.com/rxap/packages/compare/@rxap/schematic-nestjs@0.1.0-dev.3...@rxap/schematic-nestjs@0.1.0-dev.4) (2023-08-24)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- use async factory for ThrottlerModule ([57f9732](https://gitlab.com/rxap/packages/commit/57f97329b9508c47903438fb5718d403a9b21ec5))
|
|
11
|
+
|
|
12
|
+
# [0.1.0-dev.3](https://gitlab.com/rxap/packages/compare/@rxap/schematic-nestjs@0.1.0-dev.2...@rxap/schematic-nestjs@0.1.0-dev.3) (2023-08-17)
|
|
13
|
+
|
|
14
|
+
### Reverts
|
|
15
|
+
|
|
16
|
+
- change from commonjs to es2022 ([747a381](https://gitlab.com/rxap/packages/commit/747a381a090f0a276cf363da61bb19ed0c9cb5b7))
|
|
17
|
+
|
|
6
18
|
# [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
19
|
|
|
8
20
|
### 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.12 @rxap/schematics-utilities@^16.0.0-dev.9 @rxap/utilities@^16.0.0-dev.11 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.4",
|
|
4
|
+
"type": "commonjs",
|
|
5
5
|
"schematics": "./collection.json",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -38,20 +38,20 @@
|
|
|
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.12",
|
|
42
|
+
"@rxap/schematics-utilities": "^16.0.0-dev.9",
|
|
43
|
+
"@rxap/utilities": "^16.0.0-dev.11",
|
|
44
44
|
"ts-morph": "^18.0.0",
|
|
45
|
-
"@rxap/generator-utilities": "1.1.0-dev.
|
|
46
|
-
"@rxap/node-utilities": "1.1.0-dev.
|
|
47
|
-
"@rxap/plugin-angular": "16.1.0-dev.
|
|
48
|
-
"@rxap/plugin-application": "16.1.0-dev.
|
|
49
|
-
"@rxap/plugin-docker": "16.0.0-dev.
|
|
50
|
-
"@rxap/plugin-localazy": "16.1.0-dev.
|
|
51
|
-
"@rxap/plugin-nestjs": "16.1.0-dev.
|
|
52
|
-
"@rxap/plugin-utilities": "16.1.0-dev.
|
|
53
|
-
"@rxap/workspace-ts-morph": "0.1.0-dev.
|
|
54
|
-
"@rxap/workspace-utilities": "0.1.0-dev.
|
|
45
|
+
"@rxap/generator-utilities": "1.1.0-dev.6",
|
|
46
|
+
"@rxap/node-utilities": "1.1.0-dev.3",
|
|
47
|
+
"@rxap/plugin-angular": "16.1.0-dev.11",
|
|
48
|
+
"@rxap/plugin-application": "16.1.0-dev.9",
|
|
49
|
+
"@rxap/plugin-docker": "16.0.0-dev.16",
|
|
50
|
+
"@rxap/plugin-localazy": "16.1.0-dev.5",
|
|
51
|
+
"@rxap/plugin-nestjs": "16.1.0-dev.9",
|
|
52
|
+
"@rxap/plugin-utilities": "16.1.0-dev.8",
|
|
53
|
+
"@rxap/workspace-ts-morph": "0.1.0-dev.2",
|
|
54
|
+
"@rxap/workspace-utilities": "0.1.0-dev.5",
|
|
55
55
|
"fs-extra": "11.1.1",
|
|
56
56
|
"glob": "8.1.0",
|
|
57
57
|
"handlebars": "4.7.7"
|
|
@@ -60,27 +60,27 @@
|
|
|
60
60
|
"packageGroup": [
|
|
61
61
|
{
|
|
62
62
|
"package": "@rxap/plugin-nestjs",
|
|
63
|
-
"version": "16.1.0-dev.
|
|
63
|
+
"version": "16.1.0-dev.9"
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"package": "@rxap/plugin-application",
|
|
67
|
-
"version": "16.1.0-dev.
|
|
67
|
+
"version": "16.1.0-dev.8"
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
"package": "@rxap/schematics-ts-morph",
|
|
71
|
-
"version": "16.0.0-dev.
|
|
71
|
+
"version": "16.0.0-dev.12"
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"package": "@rxap/schematics-utilities",
|
|
75
|
-
"version": "16.0.0-dev.
|
|
75
|
+
"version": "16.0.0-dev.9"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"package": "@rxap/utilities",
|
|
79
|
-
"version": "16.0.0-dev.
|
|
79
|
+
"version": "16.0.0-dev.11"
|
|
80
80
|
}
|
|
81
81
|
]
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "6bc488609943234009653bd004eb986f7c03d173",
|
|
84
84
|
"main": "./src/index.js",
|
|
85
85
|
"types": "./src/index.d.ts"
|
|
86
86
|
}
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const yaml_1 = require("yaml");
|
|
7
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
8
|
function BuildCrudRule(config, options, parentCollectionList) {
|
|
6
9
|
const rules = [];
|
|
7
10
|
if (config.name) {
|
|
8
|
-
rules.push(ExecuteSchematic('crud-service', {
|
|
11
|
+
rules.push((0, schematics_utilities_1.ExecuteSchematic)('crud-service', {
|
|
9
12
|
project: options.project,
|
|
10
13
|
name: config.name,
|
|
11
14
|
collection2: parentCollectionList,
|
|
@@ -14,7 +17,7 @@ function BuildCrudRule(config, options, parentCollectionList) {
|
|
|
14
17
|
}
|
|
15
18
|
if (config.private) {
|
|
16
19
|
for (const privateName of config.private) {
|
|
17
|
-
rules.push(ExecuteSchematic('crud-service', {
|
|
20
|
+
rules.push((0, schematics_utilities_1.ExecuteSchematic)('crud-service', {
|
|
18
21
|
project: options.project,
|
|
19
22
|
name: config.name,
|
|
20
23
|
collection2: parentCollectionList,
|
|
@@ -29,17 +32,18 @@ function BuildCrudRule(config, options, parentCollectionList) {
|
|
|
29
32
|
rules.push(BuildCrudRule(collection, options, subParentCollectionList));
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
|
-
return chain(rules);
|
|
35
|
+
return (0, schematics_1.chain)(rules);
|
|
33
36
|
}
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
const basePath = join('libs', options.project, 'src');
|
|
37
|
-
const dbYamlFilePath = join(basePath, 'db.yaml');
|
|
37
|
+
function default_1(options) {
|
|
38
|
+
return (host) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const basePath = (0, path_1.join)('libs', options.project, 'src');
|
|
40
|
+
const dbYamlFilePath = (0, path_1.join)(basePath, 'db.yaml');
|
|
38
41
|
if (!host.exists(dbYamlFilePath)) {
|
|
39
|
-
throw new SchematicsException('Ensure that the db.yaml file exists in the src folder of the selected project.');
|
|
42
|
+
throw new schematics_1.SchematicsException('Ensure that the db.yaml file exists in the src folder of the selected project.');
|
|
40
43
|
}
|
|
41
|
-
const dbConfig = parse(host.read(dbYamlFilePath).toString('utf-8'));
|
|
44
|
+
const dbConfig = (0, yaml_1.parse)(host.read(dbYamlFilePath).toString('utf-8'));
|
|
42
45
|
return BuildCrudRule(dbConfig, options, []);
|
|
43
|
-
};
|
|
46
|
+
});
|
|
44
47
|
}
|
|
48
|
+
exports.default = default_1;
|
|
45
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud/index.ts"],"names":[],"mappings":";;;AAAA,2DAKoC;AACpC,+BAA4B;AAC5B,+BAA6B;AAE7B,qEAA8D;AAQ9D,SAAS,aAAa,CAAC,MAA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CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAEtD,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEjD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;YAChC,MAAM,IAAI,gCAAmB,CAAC,gFAAgF,CAAC,CAAC;SACjH;QAED,MAAM,QAAQ,GAAG,IAAA,YAAK,EAAC,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,CAAA,CAAC;AAEJ,CAAC;AAlBD,4BAkBC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
+
const { dasherize } = core_1.strings;
|
|
7
|
+
function default_1(options) {
|
|
8
|
+
return (0, schematics_1.chain)([
|
|
9
|
+
(0, schematics_utilities_1.ExecuteExternalSchematic)('@nrwl/nest', 'library', { name: options.project, importPath: options.importPath }),
|
|
8
10
|
tree => tree.create(`libs/${dasherize(options.project)}/src/db.yaml`, 'collections: []'),
|
|
9
11
|
]);
|
|
10
12
|
}
|
|
13
|
+
exports.default = default_1;
|
|
11
14
|
//# 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":"AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-init/index.ts"],"names":[],"mappings":";;AACA,2DAGoC;AACpC,+CAA+C;AAC/C,qEAAsE;AAEtE,MAAM,EAAE,SAAS,EAAE,GAAG,cAAO,CAAC;AAE9B,mBAAyB,OAAuB;IAE9C,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,+CAAwB,EAAC,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;AAPD,4BAOC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddModuleExport = exports.GetModuleOptionsObject = void 0;
|
|
4
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
function GetModuleOptionsObject(sourceFile) {
|
|
4
7
|
const classWithNgModule = sourceFile.getClasses().find(cls => cls.getDecorator('Module'));
|
|
5
8
|
if (!classWithNgModule) {
|
|
6
9
|
throw new Error('Could not find class with Module decorator!');
|
|
@@ -8,17 +11,19 @@ export function GetModuleOptionsObject(sourceFile) {
|
|
|
8
11
|
const moduleDecorator = classWithNgModule.getDecorator('Module');
|
|
9
12
|
let moduleOptions = moduleDecorator.getArguments()[0];
|
|
10
13
|
if (!moduleOptions) {
|
|
11
|
-
moduleOptions = moduleDecorator.addArgument(Writers.object({}));
|
|
14
|
+
moduleOptions = moduleDecorator.addArgument(ts_morph_1.Writers.object({}));
|
|
12
15
|
}
|
|
13
|
-
if (!(moduleOptions instanceof ObjectLiteralExpression)) {
|
|
16
|
+
if (!(moduleOptions instanceof ts_morph_1.ObjectLiteralExpression)) {
|
|
14
17
|
throw new Error('The Module options is not an object literal expression');
|
|
15
18
|
}
|
|
16
19
|
return moduleOptions;
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
exports.GetModuleOptionsObject = GetModuleOptionsObject;
|
|
22
|
+
function AddModuleExport(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
19
23
|
sourceFile.addImportDeclarations(structures);
|
|
20
24
|
const ngModuleOptions = GetModuleOptionsObject(sourceFile);
|
|
21
|
-
const providerArray = GetCoerceArrayLiteralFromObjectLiteral(ngModuleOptions, 'exports');
|
|
22
|
-
AddProviderToArray(providerObject, providerArray, overwrite);
|
|
25
|
+
const providerArray = (0, schematics_ts_morph_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'exports');
|
|
26
|
+
(0, schematics_ts_morph_1.AddProviderToArray)(providerObject, providerArray, overwrite);
|
|
23
27
|
}
|
|
28
|
+
exports.AddModuleExport = AddModuleExport;
|
|
24
29
|
//# 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":"AAAA,
|
|
1
|
+
{"version":3,"file":"add-module-export.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/add-module-export.ts"],"names":[],"mappings":";;;AAAA,mEAImC;AACnC,uCAMkB;AAElB,SAAgB,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,kBAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;KACjE;IAED,IAAI,CAAC,CAAC,aAAa,YAAY,kCAAuB,CAAC,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;KAC3E;IAED,OAAO,aAAa,CAAC;AACvB,CAAC;AArBD,wDAqBC;AAED,SAAgB,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,IAAA,4DAAsC,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAEzF,IAAA,wCAAkB,EAAC,cAAc,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAE/D,CAAC;AAfD,0CAeC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddModuleProvider = exports.GetModuleOptionsObject = void 0;
|
|
4
|
+
const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
function GetModuleOptionsObject(sourceFile) {
|
|
4
7
|
const classWithNgModule = sourceFile.getClasses().find(cls => cls.getDecorator('Module'));
|
|
5
8
|
if (!classWithNgModule) {
|
|
6
9
|
throw new Error('Could not find class with Module decorator!');
|
|
@@ -8,17 +11,19 @@ export function GetModuleOptionsObject(sourceFile) {
|
|
|
8
11
|
const moduleDecorator = classWithNgModule.getDecorator('Module');
|
|
9
12
|
let moduleOptions = moduleDecorator.getArguments()[0];
|
|
10
13
|
if (!moduleOptions) {
|
|
11
|
-
moduleOptions = moduleDecorator.addArgument(Writers.object({}));
|
|
14
|
+
moduleOptions = moduleDecorator.addArgument(ts_morph_1.Writers.object({}));
|
|
12
15
|
}
|
|
13
|
-
if (!(moduleOptions instanceof ObjectLiteralExpression)) {
|
|
16
|
+
if (!(moduleOptions instanceof ts_morph_1.ObjectLiteralExpression)) {
|
|
14
17
|
throw new Error('The Module options is not an object literal expression');
|
|
15
18
|
}
|
|
16
19
|
return moduleOptions;
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
exports.GetModuleOptionsObject = GetModuleOptionsObject;
|
|
22
|
+
function AddModuleProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
19
23
|
sourceFile.addImportDeclarations(structures);
|
|
20
24
|
const ngModuleOptions = GetModuleOptionsObject(sourceFile);
|
|
21
|
-
const providerArray = GetCoerceArrayLiteralFromObjectLiteral(ngModuleOptions, 'providers');
|
|
22
|
-
AddProviderToArray(providerObject, providerArray, overwrite);
|
|
25
|
+
const providerArray = (0, schematics_ts_morph_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'providers');
|
|
26
|
+
(0, schematics_ts_morph_1.AddProviderToArray)(providerObject, providerArray, overwrite);
|
|
23
27
|
}
|
|
28
|
+
exports.AddModuleProvider = AddModuleProvider;
|
|
24
29
|
//# 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":"AAAA,
|
|
1
|
+
{"version":3,"file":"add-module-provider.js","sour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"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceClassMethod = void 0;
|
|
4
|
+
function CoerceClassMethod(classDeclaration, methodName, methodStructure = {}) {
|
|
2
5
|
if (!classDeclaration.getMethod(methodName)) {
|
|
3
|
-
classDeclaration.addMethod({
|
|
4
|
-
...methodStructure,
|
|
5
|
-
name: methodName,
|
|
6
|
-
});
|
|
6
|
+
classDeclaration.addMethod(Object.assign(Object.assign({}, methodStructure), { name: methodName }));
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
exports.CoerceClassMethod = CoerceClassMethod;
|
|
9
10
|
//# 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":"AAMA,
|
|
1
|
+
{"version":3,"file":"coerce-class-method.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-class-method.ts"],"names":[],"mappings":";;;AAMA,SAAgB,iBAAiB,CAC/B,gBAAkC,EAClC,UAAkB,EAClB,kBAA0E,EAAE;IAG5E,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE;QAC3C,gBAAgB,CAAC,SAAS,iCACrB,eAAe,KAClB,IAAI,EAAE,UAAU,IAChB,CAAC;KACJ;AAEH,CAAC;AAbD,8CAaC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceClassProperty = void 0;
|
|
4
|
+
function CoerceClassProperty(classDeclaration, propertyName, propertyStructure) {
|
|
2
5
|
if (!classDeclaration.getProperty(propertyName)) {
|
|
3
|
-
classDeclaration.addProperty({
|
|
4
|
-
...propertyStructure,
|
|
5
|
-
name: propertyName,
|
|
6
|
-
});
|
|
6
|
+
classDeclaration.addProperty(Object.assign(Object.assign({}, propertyStructure), { name: propertyName }));
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
exports.CoerceClassProperty = CoerceClassProperty;
|
|
9
10
|
//# 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":"AAMA,
|
|
1
|
+
{"version":3,"file":"coerce-class-property.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-class-property.ts"],"names":[],"mappings":";;;AAMA,SAAgB,mBAAmB,CACjC,gBAAkC,EAClC,YAAoB,EACpB,iBAA2E;IAG3E,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE;QAC/C,gBAAgB,CAAC,WAAW,iCACvB,iBAAiB,KACpB,IAAI,EAAE,YAAY,IAClB,CAAC;KACJ;AAEH,CAAC;AAbD,kDAaC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceCollectionEnum = exports.CoerceEnumProperty = exports.CoerceEnum = void 0;
|
|
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) {
|
|
4
7
|
let enumDeclaration = sourceFile.getEnum(name);
|
|
5
8
|
if (!enumDeclaration) {
|
|
6
9
|
enumDeclaration = sourceFile.addEnum({ name, isExported: true });
|
|
7
10
|
}
|
|
8
11
|
return enumDeclaration;
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.CoerceEnum = CoerceEnum;
|
|
14
|
+
function CoerceEnumProperty(sourceFile, name, propertyKey, value) {
|
|
11
15
|
const enumDeclaration = CoerceEnum(sourceFile, name);
|
|
12
16
|
if (!enumDeclaration.getMember(propertyKey)) {
|
|
13
17
|
enumDeclaration.addMember({
|
|
@@ -16,8 +20,10 @@ export function CoerceEnumProperty(sourceFile, name, propertyKey, value) {
|
|
|
16
20
|
});
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
exports.CoerceEnumProperty = CoerceEnumProperty;
|
|
24
|
+
function CoerceCollectionEnum(project, collection) {
|
|
25
|
+
const sourceFile = (0, schematics_ts_morph_1.CoerceSourceFile)(project, 'lib/collection.ts');
|
|
26
|
+
CoerceEnumProperty(sourceFile, 'Collection', (0, strings_1.underscore)(collection).toUpperCase(), collection);
|
|
22
27
|
}
|
|
28
|
+
exports.CoerceCollectionEnum = CoerceCollectionEnum;
|
|
23
29
|
//# 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":"AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-collection-enum.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-collection-enum.ts"],"names":[],"mappings":";;;AAAA,oEAAoE;AACpE,mEAA6D;AAO7D,SAAgB,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;AAVD,gCAUC;AAED,SAAgB,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;AAhBD,gDAgBC;AAED,SAAgB,oBAAoB,CAAC,OAAgB,EAAE,UAAkB;IACvE,MAAM,UAAU,GAAG,IAAA,sCAAgB,EAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IAClE,kBAAkB,CAAC,UAAU,EAAE,YAAY,EAAE,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AACjG,CAAC;AAHD,oDAGC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceModuleClass = void 0;
|
|
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) {
|
|
4
7
|
const decorators = [
|
|
5
8
|
{
|
|
6
9
|
name: 'Module',
|
|
@@ -13,8 +16,8 @@ export function CoerceModuleClass(sourceFile, moduleName, global = false) {
|
|
|
13
16
|
arguments: [],
|
|
14
17
|
});
|
|
15
18
|
}
|
|
16
|
-
const className = CoerceSuffix(moduleName, 'Module');
|
|
17
|
-
CoerceClass(sourceFile, className, {
|
|
19
|
+
const className = (0, schematics_utilities_1.CoerceSuffix)(moduleName, 'Module');
|
|
20
|
+
(0, schematics_ts_morph_1.CoerceClass)(sourceFile, className, {
|
|
18
21
|
isExported: true,
|
|
19
22
|
decorators,
|
|
20
23
|
});
|
|
@@ -25,4 +28,5 @@ export function CoerceModuleClass(sourceFile, moduleName, global = false) {
|
|
|
25
28
|
},
|
|
26
29
|
]);
|
|
27
30
|
}
|
|
31
|
+
exports.CoerceModuleClass = CoerceModuleClass;
|
|
28
32
|
//# 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":"AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-module-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/coerce-module-class.ts"],"names":[],"mappings":";;;AAAA,mEAAwD;AAOxD,qEAA0D;AAE1D,SAAgB,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,IAAA,mCAAY,EAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAErD,IAAA,iCAAW,EAAC,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;AA/BD,8CA+BC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceSourceFileRule = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
2
5
|
/**
|
|
3
6
|
*
|
|
4
7
|
* @param project A ts-morph project instance
|
|
@@ -7,10 +10,10 @@ import { join } from 'path';
|
|
|
7
10
|
* @param initializer A initializer function called with the SourceFile instance
|
|
8
11
|
* if the file does not exists in the schematics file Tree
|
|
9
12
|
*/
|
|
10
|
-
|
|
13
|
+
function CoerceSourceFileRule(project, filePath, basePath, initializer) {
|
|
11
14
|
return tree => {
|
|
12
15
|
let content = '';
|
|
13
|
-
const treeFilePath = join(basePath, filePath);
|
|
16
|
+
const treeFilePath = (0, path_1.join)(basePath, filePath);
|
|
14
17
|
let exists = false;
|
|
15
18
|
if (tree.exists(treeFilePath)) {
|
|
16
19
|
exists = true;
|
|
@@ -22,4 +25,5 @@ export function CoerceSourceFileRule(project, filePath, basePath, initializer) {
|
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
27
|
}
|
|
28
|
+
exports.CoerceSourceFileRule = CoerceSourceFileRule;
|
|
25
29
|
//# 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":"AACA
|
|
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,+BAA4B;AAM5B;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,OAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,WAA8C;IAE9C,OAAO,IAAI,CAAC,EAAE;QAEZ,IAAI,OAAO,GAAG,EAAE,CAAC;QAEjB,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,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;AA1BD,oDA0BC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateMethod = void 0;
|
|
4
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
5
|
+
const ts_morph_1 = require("ts-morph");
|
|
6
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
7
|
+
function CreateMethod(options, className) {
|
|
5
8
|
const { classified, dtoName, camelized, documentId, collection, parentCollectionList, privateName } = options;
|
|
6
9
|
let parameters = [
|
|
7
10
|
{
|
|
@@ -18,12 +21,12 @@ export function CreateMethod(options, className) {
|
|
|
18
21
|
parameters = parameters.reverse();
|
|
19
22
|
}
|
|
20
23
|
parameters.unshift(...parentCollectionList.map(subCollection => ({
|
|
21
|
-
name: `${camelize(subCollection)}Id`,
|
|
24
|
+
name: `${(0, schematics_utilities_1.camelize)(subCollection)}Id`,
|
|
22
25
|
type: 'string',
|
|
23
26
|
})));
|
|
24
27
|
return {
|
|
25
28
|
name: 'create',
|
|
26
|
-
scope: Scope.Public,
|
|
29
|
+
scope: ts_morph_1.Scope.Public,
|
|
27
30
|
isAsync: true,
|
|
28
31
|
parameters,
|
|
29
32
|
returnType: `Promise<${dtoName}>`,
|
|
@@ -31,7 +34,7 @@ export function CreateMethod(options, className) {
|
|
|
31
34
|
`this.logger.verbose('create: ' + ${documentId}, '${className}')`,
|
|
32
35
|
`if (!(create${dtoName} instanceof Create${dtoName})) { throw new InternalServerErrorException('Not instance of Create${dtoName}') }`,
|
|
33
36
|
`const ${camelized} = ${dtoName}.FromCreate${dtoName}(create${dtoName}, ${[
|
|
34
|
-
...parentCollectionList.map(subCollection => `${camelize(subCollection)}Id`),
|
|
37
|
+
...parentCollectionList.map(subCollection => `${(0, schematics_utilities_1.camelize)(subCollection)}Id`),
|
|
35
38
|
documentId,
|
|
36
39
|
]});`,
|
|
37
40
|
`const result = validateSync(${camelized}, CrudValidatorOptions());`,
|
|
@@ -42,10 +45,10 @@ export function CreateMethod(options, className) {
|
|
|
42
45
|
writer.writeLine('plain.__updatedAt = new Date()');
|
|
43
46
|
writer.write('await this.firestore');
|
|
44
47
|
for (const subCollection of parentCollectionList) {
|
|
45
|
-
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
46
|
-
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
48
|
+
writer.writeLine(`.collection(Collection.${(0, strings_1.underscore)(subCollection).toUpperCase()})`);
|
|
49
|
+
writer.writeLine(`.doc(${(0, schematics_utilities_1.camelize)(subCollection)}Id)`);
|
|
47
50
|
}
|
|
48
|
-
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
51
|
+
writer.writeLine(`.collection(Collection.${(0, strings_1.underscore)(collection).toUpperCase()})`);
|
|
49
52
|
if (privateName) {
|
|
50
53
|
writer.writeLine(`.doc(${documentId})`);
|
|
51
54
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -62,4 +65,5 @@ export function CreateMethod(options, className) {
|
|
|
62
65
|
],
|
|
63
66
|
};
|
|
64
67
|
}
|
|
68
|
+
exports.CreateMethod = CreateMethod;
|
|
65
69
|
//# 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":"AAAA,
|
|
1
|
+
{"version":3,"file":"create-method.js","sourceRoot":"","sources":["../../../../../../../../packages/schematic/nestjs/src/schematics/crud-service/crud-class/create-method.ts"],"names":[],"mappings":";;;AAAA,oEAAoE;AACpE,uCAIkB;AAElB,qEAAsD;AAEtD,SAAgB,YAAY,CAAC,OAAgB,EAAE,SAAiB;IAC9D,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,oBAAoB,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAC9G,IAAI,UAAU,GAAG;QACf;YACE,IAAI,EAAE,SAAU,OAAQ,EAAE;YAC1B,IAAI,EAAE,SAAU,OAAQ,EAAE;SAC3B;QACD;YACE,IAAI,EAAE,GAAI,UAAW,EAAE;YACvB,IAAI,EAAE,QAAQ;YACd,gBAAgB,EAAE,CAAC,OAAO,CAAC,WAAW;SACvC;KACF,CAAC;IACF,IAAI,WAAW,EAAE;QACf,UAAU,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;KACnC;IACD,UAAU,CAAC,OAAO,CAAC,GAAG,oBAAoB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAC/D,IAAI,EAAE,GAAI,IAAA,+BAAQ,EAAC,aAAa,CAAE,IAAI;QACtC,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC,CAAC,CAAC;IACL,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,gBAAK,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI;QACb,UAAU;QACV,UAA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,QAAS,SAAU,MAAM,CAAC,CAAC;iBAC7C;gBACD,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;gBAChC,MAAM,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAC;YAClE,CAAC;YACD,mCAAoC,UAAW,MAAO,SAAU,IAAI;YACpE,UAAW,SAAU,EAAE;SACxB;KACF,CAAC;AACJ,CAAC;AA3DD,oCA2DC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteMethod = void 0;
|
|
4
|
+
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
5
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
+
const ts_morph_1 = require("ts-morph");
|
|
7
|
+
function DeleteMethod(options, className) {
|
|
5
8
|
const { classified, dtoName, documentId, camelized, collection, parentCollectionList } = options;
|
|
6
9
|
return {
|
|
7
10
|
name: 'delete',
|
|
8
|
-
scope: Scope.Public,
|
|
11
|
+
scope: ts_morph_1.Scope.Public,
|
|
9
12
|
isAsync: true,
|
|
10
13
|
parameters: [
|
|
11
14
|
...parentCollectionList.map(subCollection => ({
|
|
12
|
-
name: `${camelize(subCollection)}Id`,
|
|
15
|
+
name: `${(0, schematics_utilities_1.camelize)(subCollection)}Id`,
|
|
13
16
|
type: 'string',
|
|
14
17
|
})),
|
|
15
18
|
{
|
|
@@ -23,10 +26,10 @@ export function DeleteMethod(options, className) {
|
|
|
23
26
|
writer => {
|
|
24
27
|
writer.write('await this.firestore');
|
|
25
28
|
for (const subCollection of parentCollectionList) {
|
|
26
|
-
writer.writeLine(`.collection(Collection.${underscore(subCollection).toUpperCase()})`);
|
|
27
|
-
writer.writeLine(`.doc(${camelize(subCollection)}Id)`);
|
|
29
|
+
writer.writeLine(`.collection(Collection.${(0, strings_1.underscore)(subCollection).toUpperCase()})`);
|
|
30
|
+
writer.writeLine(`.doc(${(0, schematics_utilities_1.camelize)(subCollection)}Id)`);
|
|
28
31
|
}
|
|
29
|
-
writer.writeLine(`.collection(Collection.${underscore(collection).toUpperCase()})`);
|
|
32
|
+
writer.writeLine(`.collection(Collection.${(0, strings_1.underscore)(collection).toUpperCase()})`);
|
|
30
33
|
writer.writeLine(`.doc(${documentId})`);
|
|
31
34
|
if (options.privateName) {
|
|
32
35
|
writer.writeLine(`.collection(Collection.PRIVATE)`);
|
|
@@ -39,4 +42,5 @@ export function DeleteMethod(options, className) {
|
|
|
39
42
|
],
|
|
40
43
|
};
|
|
41
44
|
}
|
|
45
|
+
exports.DeleteMethod = DeleteMethod;
|
|
42
46
|
//# sourceMappingURL=delete-method.js.map
|