@rxap/schematic-nestjs 0.0.2-dev.0
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 +8 -0
- package/GETSTARTED.md +0 -0
- package/GUIDES.md +0 -0
- package/README.md +21 -0
- package/collection.json +74 -0
- package/package.json +67 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +3 -0
- package/src/index.js.map +1 -0
- package/src/schematics/crud/index.d.ts +3 -0
- package/src/schematics/crud/index.js +49 -0
- package/src/schematics/crud/index.js.map +1 -0
- package/src/schematics/crud/schema.d.ts +7 -0
- package/src/schematics/crud/schema.js +3 -0
- package/src/schematics/crud/schema.js.map +1 -0
- package/src/schematics/crud/schema.json +17 -0
- package/src/schematics/crud-init/index.d.ts +3 -0
- package/src/schematics/crud-init/index.js +14 -0
- package/src/schematics/crud-init/index.js.map +1 -0
- package/src/schematics/crud-init/schema.d.ts +4 -0
- package/src/schematics/crud-init/schema.js +3 -0
- package/src/schematics/crud-init/schema.js.map +1 -0
- package/src/schematics/crud-init/schema.json +18 -0
- package/src/schematics/crud-service/add-module-export.d.ts +4 -0
- package/src/schematics/crud-service/add-module-export.js +29 -0
- package/src/schematics/crud-service/add-module-export.js.map +1 -0
- package/src/schematics/crud-service/add-module-provider.d.ts +4 -0
- package/src/schematics/crud-service/add-module-provider.js +29 -0
- package/src/schematics/crud-service/add-module-provider.js.map +1 -0
- package/src/schematics/crud-service/coerce-class-method.d.ts +2 -0
- package/src/schematics/crud-service/coerce-class-method.js +10 -0
- package/src/schematics/crud-service/coerce-class-method.js.map +1 -0
- package/src/schematics/crud-service/coerce-class-property.d.ts +2 -0
- package/src/schematics/crud-service/coerce-class-property.js +10 -0
- package/src/schematics/crud-service/coerce-class-property.js.map +1 -0
- package/src/schematics/crud-service/coerce-collection-enum.d.ts +4 -0
- package/src/schematics/crud-service/coerce-collection-enum.js +29 -0
- package/src/schematics/crud-service/coerce-collection-enum.js.map +1 -0
- package/src/schematics/crud-service/coerce-module-class.d.ts +2 -0
- package/src/schematics/crud-service/coerce-module-class.js +32 -0
- package/src/schematics/crud-service/coerce-module-class.js.map +1 -0
- package/src/schematics/crud-service/coerce-source-file-rule.d.ts +11 -0
- package/src/schematics/crud-service/coerce-source-file-rule.js +29 -0
- package/src/schematics/crud-service/coerce-source-file-rule.js.map +1 -0
- package/src/schematics/crud-service/crud-class/create-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/create-method.js +69 -0
- package/src/schematics/crud-service/crud-class/create-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/delete-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/delete-method.js +46 -0
- package/src/schematics/crud-service/crud-class/delete-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/exists-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/exists-method.js +46 -0
- package/src/schematics/crud-service/crud-class/exists-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/find-in-group-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/find-in-group-method.js +37 -0
- package/src/schematics/crud-service/crud-class/find-in-group-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/find-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/find-method.js +46 -0
- package/src/schematics/crud-service/crud-class/find-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/get-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/get-method.js +52 -0
- package/src/schematics/crud-service/crud-class/get-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/update-field-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/update-field-method.js +68 -0
- package/src/schematics/crud-service/crud-class/update-field-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class/update-method.d.ts +3 -0
- package/src/schematics/crud-service/crud-class/update-method.js +59 -0
- package/src/schematics/crud-service/crud-class/update-method.js.map +1 -0
- package/src/schematics/crud-service/crud-class.d.ts +3 -0
- package/src/schematics/crud-service/crud-class.js +125 -0
- package/src/schematics/crud-service/crud-class.js.map +1 -0
- package/src/schematics/crud-service/dto-class/create-dto-class.d.ts +3 -0
- package/src/schematics/crud-service/dto-class/create-dto-class.js +26 -0
- package/src/schematics/crud-service/dto-class/create-dto-class.js.map +1 -0
- package/src/schematics/crud-service/dto-class/dto-class.d.ts +3 -0
- package/src/schematics/crud-service/dto-class/dto-class.js +133 -0
- package/src/schematics/crud-service/dto-class/dto-class.js.map +1 -0
- package/src/schematics/crud-service/dto-class/update-dto-class.d.ts +3 -0
- package/src/schematics/crud-service/dto-class/update-dto-class.js +28 -0
- package/src/schematics/crud-service/dto-class/update-dto-class.js.map +1 -0
- package/src/schematics/crud-service/index.d.ts +3 -0
- package/src/schematics/crud-service/index.js +215 -0
- package/src/schematics/crud-service/index.js.map +1 -0
- package/src/schematics/crud-service/options.d.ts +11 -0
- package/src/schematics/crud-service/options.js +3 -0
- package/src/schematics/crud-service/options.js.map +1 -0
- package/src/schematics/crud-service/schema.d.ts +53 -0
- package/src/schematics/crud-service/schema.js +3 -0
- package/src/schematics/crud-service/schema.js.map +1 -0
- package/src/schematics/crud-service/schema.json +57 -0
- package/src/schematics/feature-microservice/index.d.ts +11 -0
- package/src/schematics/feature-microservice/index.js +65 -0
- package/src/schematics/feature-microservice/index.js.map +1 -0
- package/src/schematics/feature-microservice/schema.d.ts +15 -0
- package/src/schematics/feature-microservice/schema.json +69 -0
- package/src/schematics/frontend-microservice/index.d.ts +11 -0
- package/src/schematics/frontend-microservice/index.js +61 -0
- package/src/schematics/frontend-microservice/index.js.map +1 -0
- package/src/schematics/frontend-microservice/schema.d.ts +16 -0
- package/src/schematics/frontend-microservice/schema.json +75 -0
- package/src/schematics/health-indicator/add-health-endpoint.d.ts +2 -0
- package/src/schematics/health-indicator/add-health-endpoint.js +58 -0
- package/src/schematics/health-indicator/add-health-endpoint.js.map +1 -0
- package/src/schematics/health-indicator/add-health-indicator.d.ts +2 -0
- package/src/schematics/health-indicator/add-health-indicator.js +61 -0
- package/src/schematics/health-indicator/add-health-indicator.js.map +1 -0
- package/src/schematics/health-indicator/add-to-global-health-endpoint.d.ts +2 -0
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js +54 -0
- package/src/schematics/health-indicator/add-to-global-health-endpoint.js.map +1 -0
- package/src/schematics/health-indicator/coerce-health-controller.d.ts +2 -0
- package/src/schematics/health-indicator/coerce-health-controller.js +25 -0
- package/src/schematics/health-indicator/coerce-health-controller.js.map +1 -0
- package/src/schematics/health-indicator/coerce-health-module.d.ts +2 -0
- package/src/schematics/health-indicator/coerce-health-module.js +48 -0
- package/src/schematics/health-indicator/coerce-health-module.js.map +1 -0
- package/src/schematics/health-indicator/index.d.ts +3 -0
- package/src/schematics/health-indicator/index.js +29 -0
- package/src/schematics/health-indicator/index.js.map +1 -0
- package/src/schematics/health-indicator/schema.d.ts +4 -0
- package/src/schematics/health-indicator/schema.json +29 -0
- package/src/schematics/health-indicator-init/index.d.ts +3 -0
- package/src/schematics/health-indicator-init/index.js +23 -0
- package/src/schematics/health-indicator-init/index.js.map +1 -0
- package/src/schematics/health-indicator-init/schema.d.ts +3 -0
- package/src/schematics/health-indicator-init/schema.json +19 -0
- package/src/schematics/init/files/Dockerfile.template +24 -0
- package/src/schematics/init/files/healthcheck.js.template +35 -0
- package/src/schematics/init/files/main.ts.template +77 -0
- package/src/schematics/init/index.d.ts +6 -0
- package/src/schematics/init/index.js +463 -0
- package/src/schematics/init/index.js.map +1 -0
- package/src/schematics/init/schema.d.ts +23 -0
- package/src/schematics/init/schema.json +103 -0
- package/src/schematics/jwt/index.d.ts +2 -0
- package/src/schematics/jwt/index.js +46 -0
- package/src/schematics/jwt/index.js.map +1 -0
- package/src/schematics/jwt/schema.d.ts +3 -0
- package/src/schematics/jwt/schema.json +15 -0
- package/src/schematics/microservice/index.d.ts +12 -0
- package/src/schematics/microservice/index.js +117 -0
- package/src/schematics/microservice/index.js.map +1 -0
- package/src/schematics/microservice/schema.d.ts +15 -0
- package/src/schematics/microservice/schema.json +69 -0
- package/src/schematics/open-api/index.d.ts +2 -0
- package/src/schematics/open-api/index.js +39 -0
- package/src/schematics/open-api/index.js.map +1 -0
- package/src/schematics/open-api/schema.d.ts +3 -0
- package/src/schematics/open-api/schema.json +15 -0
- package/src/schematics/sentry/index.d.ts +3 -0
- package/src/schematics/sentry/index.js +129 -0
- package/src/schematics/sentry/index.js.map +1 -0
- package/src/schematics/sentry/schema.d.ts +5 -0
- package/src/schematics/sentry/schema.json +27 -0
- package/src/schematics/swagger/files/environments/environment.swagger.ts.template +7 -0
- package/src/schematics/swagger/files/swagger.ts.template +19 -0
- package/src/schematics/swagger/index.d.ts +3 -0
- package/src/schematics/swagger/index.js +88 -0
- package/src/schematics/swagger/index.js.map +1 -0
- package/src/schematics/swagger/schema.d.ts +4 -0
- package/src/schematics/swagger/schema.json +19 -0
- package/src/schematics/validator/index.d.ts +3 -0
- package/src/schematics/validator/index.js +15 -0
- package/src/schematics/validator/index.js.map +1 -0
- package/src/schematics/validator/schema.d.ts +3 -0
- package/src/schematics/validator/schema.json +19 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 0.0.2-dev.0 (2023-08-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rxap/schematic-nestjs
|
package/GETSTARTED.md
ADDED
|
File without changes
|
package/GUIDES.md
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @rxap/schematic-nestjs
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@rxap/schematic-nestjs)
|
|
4
|
+
[](https://commitizen.github.io/cz-cli/)
|
|
5
|
+
[](https://github.com/prettier/prettier)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
|
|
14
|
+
**Add the package to your workspace:**
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @rxap/schematic-nestjs
|
|
17
|
+
```
|
|
18
|
+
**Install peer dependencies:**
|
|
19
|
+
```bash
|
|
20
|
+
yarn add
|
|
21
|
+
```
|
package/collection.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schematics": {
|
|
3
|
+
"microservice": {
|
|
4
|
+
"factory": "./src/schematics/microservice/index",
|
|
5
|
+
"schema": "./src/schematics/microservice/schema.json",
|
|
6
|
+
"description": "microservice schematic"
|
|
7
|
+
},
|
|
8
|
+
"feature-microservice": {
|
|
9
|
+
"factory": "./src/schematics/feature-microservice/index",
|
|
10
|
+
"schema": "./src/schematics/feature-microservice/schema.json",
|
|
11
|
+
"description": "feature-microservice schematic"
|
|
12
|
+
},
|
|
13
|
+
"frontend-microservice": {
|
|
14
|
+
"factory": "./src/schematics/frontend-microservice/index",
|
|
15
|
+
"schema": "./src/schematics/frontend-microservice/schema.json",
|
|
16
|
+
"description": "frontend-microservice schematic"
|
|
17
|
+
},
|
|
18
|
+
"crud": {
|
|
19
|
+
"schema": "./src/schematics/crud/schema.json",
|
|
20
|
+
"factory": "./src/schematics/crud/index",
|
|
21
|
+
"description": "The crud schematic"
|
|
22
|
+
},
|
|
23
|
+
"crud-init": {
|
|
24
|
+
"schema": "./src/schematics/crud-init/schema.json",
|
|
25
|
+
"factory": "./src/schematics/crud-init/index",
|
|
26
|
+
"description": "The crud-init schematic"
|
|
27
|
+
},
|
|
28
|
+
"crud-service": {
|
|
29
|
+
"schema": "./src/schematics/crud-service/schema.json",
|
|
30
|
+
"factory": "./src/schematics/crud-service/index",
|
|
31
|
+
"description": "The crud-service schematic"
|
|
32
|
+
},
|
|
33
|
+
"health-indicator": {
|
|
34
|
+
"schema": "./src/schematics/health-indicator/schema.json",
|
|
35
|
+
"factory": "./src/schematics/health-indicator/index",
|
|
36
|
+
"description": "The health-indicator schematic"
|
|
37
|
+
},
|
|
38
|
+
"health-indicator-init": {
|
|
39
|
+
"schema": "./src/schematics/health-indicator-init/schema.json",
|
|
40
|
+
"factory": "./src/schematics/health-indicator-init/index",
|
|
41
|
+
"description": "The health-indicator-init schematic"
|
|
42
|
+
},
|
|
43
|
+
"init": {
|
|
44
|
+
"schema": "./src/schematics/init/schema.json",
|
|
45
|
+
"factory": "./src/schematics/init/index",
|
|
46
|
+
"description": "The init schematic"
|
|
47
|
+
},
|
|
48
|
+
"sentry": {
|
|
49
|
+
"schema": "./src/schematics/sentry/schema.json",
|
|
50
|
+
"factory": "./src/schematics/sentry/index",
|
|
51
|
+
"description": "The sentry schematic"
|
|
52
|
+
},
|
|
53
|
+
"swagger": {
|
|
54
|
+
"schema": "./src/schematics/swagger/schema.json",
|
|
55
|
+
"factory": "./src/schematics/swagger/index",
|
|
56
|
+
"description": "The swagger schematic"
|
|
57
|
+
},
|
|
58
|
+
"validator": {
|
|
59
|
+
"schema": "./src/schematics/validator/schema.json",
|
|
60
|
+
"factory": "./src/schematics/validator/index",
|
|
61
|
+
"description": "The validator schematic"
|
|
62
|
+
},
|
|
63
|
+
"open-api": {
|
|
64
|
+
"factory": "./src/schematics/open-api/index",
|
|
65
|
+
"schema": "./src/schematics/open-api/schema.json",
|
|
66
|
+
"description": "open-api schematic"
|
|
67
|
+
},
|
|
68
|
+
"jwt": {
|
|
69
|
+
"factory": "./src/schematics/jwt/index",
|
|
70
|
+
"schema": "./src/schematics/jwt/schema.json",
|
|
71
|
+
"description": "jwt schematic"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rxap/schematic-nestjs",
|
|
3
|
+
"version": "0.0.2-dev.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"schematics": "./collection.json",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"directory": "../../../dist/packages/schematic/nestjs"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"rxap",
|
|
12
|
+
"packages",
|
|
13
|
+
"schematic",
|
|
14
|
+
"nestjs"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https:/gitlab.com/rxap/packages/packages/schematic/nestjs",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
19
|
+
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
20
|
+
},
|
|
21
|
+
"license": "GPL-3.0-or-later",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://gitlab.com/rxap/packages.git",
|
|
25
|
+
"directory": "packages/schematic/nestjs"
|
|
26
|
+
},
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "Merzough Münker",
|
|
29
|
+
"email": "mmuenker@digitaix.com"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"ignore": "^5.2.4",
|
|
33
|
+
"semver": "^7.3.5",
|
|
34
|
+
"tslib": "2.6.1",
|
|
35
|
+
"yaml": "2.3.1"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@angular-devkit/core": "^16.1.4",
|
|
39
|
+
"@angular-devkit/schematics": "^16.1.4",
|
|
40
|
+
"@rxap/schematics-ts-morph": "^16.0.0-dev.5",
|
|
41
|
+
"@rxap/schematics-utilities": "^16.0.0-dev.6",
|
|
42
|
+
"@rxap/utilities": "^16.0.0-dev.4",
|
|
43
|
+
"ts-morph": "^18.0.0",
|
|
44
|
+
"@rxap/node-utilities": "1.0.1-dev.2",
|
|
45
|
+
"@rxap/workspace-ts-morph": "0.0.2-dev.0",
|
|
46
|
+
"@rxap/workspace-utilities": "0.1.0-dev.0"
|
|
47
|
+
},
|
|
48
|
+
"nx-migrations": {
|
|
49
|
+
"packageGroup": [
|
|
50
|
+
{
|
|
51
|
+
"package": "@rxap/schematics-ts-morph",
|
|
52
|
+
"version": "16.0.0-dev.5"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"package": "@rxap/schematics-utilities",
|
|
56
|
+
"version": "16.0.0-dev.6"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"package": "@rxap/utilities",
|
|
60
|
+
"version": "16.0.0-dev.4"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"gitHead": "ed3a0788894aa734ec2a8e9e957cf73cabe033d6",
|
|
65
|
+
"main": "./src/index.js",
|
|
66
|
+
"types": "./src/index.d.ts"
|
|
67
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/schematic/nestjs/src/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
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");
|
|
8
|
+
function BuildCrudRule(config, options, parentCollectionList) {
|
|
9
|
+
const rules = [];
|
|
10
|
+
if (config.name) {
|
|
11
|
+
rules.push((0, schematics_utilities_1.ExecuteSchematic)('crud-service', {
|
|
12
|
+
project: options.project,
|
|
13
|
+
name: config.name,
|
|
14
|
+
collection2: parentCollectionList,
|
|
15
|
+
overwrite: !!options.overwrite,
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
if (config.private) {
|
|
19
|
+
for (const privateName of config.private) {
|
|
20
|
+
rules.push((0, schematics_utilities_1.ExecuteSchematic)('crud-service', {
|
|
21
|
+
project: options.project,
|
|
22
|
+
name: config.name,
|
|
23
|
+
collection2: parentCollectionList,
|
|
24
|
+
private: privateName,
|
|
25
|
+
overwrite: !!options.overwrite,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (config.collections) {
|
|
30
|
+
const subParentCollectionList = config.name ? [...parentCollectionList, config.name] : parentCollectionList;
|
|
31
|
+
for (const collection of config.collections) {
|
|
32
|
+
rules.push(BuildCrudRule(collection, options, subParentCollectionList));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return (0, schematics_1.chain)(rules);
|
|
36
|
+
}
|
|
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');
|
|
41
|
+
if (!host.exists(dbYamlFilePath)) {
|
|
42
|
+
throw new schematics_1.SchematicsException('Ensure that the db.yaml file exists in the src folder of the selected project.');
|
|
43
|
+
}
|
|
44
|
+
const dbConfig = (0, yaml_1.parse)(host.read(dbYamlFilePath).toString('utf-8'));
|
|
45
|
+
return BuildCrudRule(dbConfig, options, []);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.default = default_1;
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAoB,EAAE,OAAmB,EAAE,oBAA8B;IAE9F,MAAM,KAAK,GAAW,EAAE,CAAC;IAEzB,IAAI,MAAM,CAAC,IAAI,EAAE;QACf,KAAK,CAAC,IAAI,CAAC,IAAA,uCAAgB,EAAC,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,IAAA,uCAAgB,EAAC,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,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;AAEtB,CAAC;AAED,mBAAyB,OAAmB;IAE1C,OAAO,CAAO,IAAU,EAAE,EAAE;QAE1B,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,MAAM,EAAE,OAAO,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "crud",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"default": "crud"
|
|
11
|
+
},
|
|
12
|
+
"overwrite": {
|
|
13
|
+
"type": "boolean"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": []
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 }),
|
|
10
|
+
tree => tree.create(`libs/${dasherize(options.project)}/src/db.yaml`, 'collections: []'),
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
13
|
+
exports.default = default_1;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/nestjs/src/schematics/crud-init/schema.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "crud-init",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "",
|
|
10
|
+
"default": "crud"
|
|
11
|
+
},
|
|
12
|
+
"importPath": {
|
|
13
|
+
"description": "The library name used to import it, like @myorg/my-awesome-lib. Must be a valid npm name.",
|
|
14
|
+
"type": "string"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": []
|
|
18
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ProviderObject } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { ImportDeclarationStructure, ObjectLiteralExpression, OptionalKind, SourceFile } from 'ts-morph';
|
|
3
|
+
export declare function GetModuleOptionsObject(sourceFile: SourceFile): ObjectLiteralExpression;
|
|
4
|
+
export declare function AddModuleExport(sourceFile: SourceFile, providerObject: ProviderObject | string, structures?: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>, overwrite?: boolean): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
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) {
|
|
7
|
+
const classWithNgModule = sourceFile.getClasses().find(cls => cls.getDecorator('Module'));
|
|
8
|
+
if (!classWithNgModule) {
|
|
9
|
+
throw new Error('Could not find class with Module decorator!');
|
|
10
|
+
}
|
|
11
|
+
const moduleDecorator = classWithNgModule.getDecorator('Module');
|
|
12
|
+
let moduleOptions = moduleDecorator.getArguments()[0];
|
|
13
|
+
if (!moduleOptions) {
|
|
14
|
+
moduleOptions = moduleDecorator.addArgument(ts_morph_1.Writers.object({}));
|
|
15
|
+
}
|
|
16
|
+
if (!(moduleOptions instanceof ts_morph_1.ObjectLiteralExpression)) {
|
|
17
|
+
throw new Error('The Module options is not an object literal expression');
|
|
18
|
+
}
|
|
19
|
+
return moduleOptions;
|
|
20
|
+
}
|
|
21
|
+
exports.GetModuleOptionsObject = GetModuleOptionsObject;
|
|
22
|
+
function AddModuleExport(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
23
|
+
sourceFile.addImportDeclarations(structures);
|
|
24
|
+
const ngModuleOptions = GetModuleOptionsObject(sourceFile);
|
|
25
|
+
const providerArray = (0, schematics_ts_morph_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'exports');
|
|
26
|
+
(0, schematics_ts_morph_1.AddProviderToArray)(providerObject, providerArray, overwrite);
|
|
27
|
+
}
|
|
28
|
+
exports.AddModuleExport = AddModuleExport;
|
|
29
|
+
//# sourceMappingURL=add-module-export.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ProviderObject } from '@rxap/schematics-ts-morph';
|
|
2
|
+
import { ImportDeclarationStructure, ObjectLiteralExpression, OptionalKind, SourceFile } from 'ts-morph';
|
|
3
|
+
export declare function GetModuleOptionsObject(sourceFile: SourceFile): ObjectLiteralExpression;
|
|
4
|
+
export declare function AddModuleProvider(sourceFile: SourceFile, providerObject: ProviderObject | string, structures?: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>, overwrite?: boolean): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
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) {
|
|
7
|
+
const classWithNgModule = sourceFile.getClasses().find(cls => cls.getDecorator('Module'));
|
|
8
|
+
if (!classWithNgModule) {
|
|
9
|
+
throw new Error('Could not find class with Module decorator!');
|
|
10
|
+
}
|
|
11
|
+
const moduleDecorator = classWithNgModule.getDecorator('Module');
|
|
12
|
+
let moduleOptions = moduleDecorator.getArguments()[0];
|
|
13
|
+
if (!moduleOptions) {
|
|
14
|
+
moduleOptions = moduleDecorator.addArgument(ts_morph_1.Writers.object({}));
|
|
15
|
+
}
|
|
16
|
+
if (!(moduleOptions instanceof ts_morph_1.ObjectLiteralExpression)) {
|
|
17
|
+
throw new Error('The Module options is not an object literal expression');
|
|
18
|
+
}
|
|
19
|
+
return moduleOptions;
|
|
20
|
+
}
|
|
21
|
+
exports.GetModuleOptionsObject = GetModuleOptionsObject;
|
|
22
|
+
function AddModuleProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
23
|
+
sourceFile.addImportDeclarations(structures);
|
|
24
|
+
const ngModuleOptions = GetModuleOptionsObject(sourceFile);
|
|
25
|
+
const providerArray = (0, schematics_ts_morph_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'providers');
|
|
26
|
+
(0, schematics_ts_morph_1.AddProviderToArray)(providerObject, providerArray, overwrite);
|
|
27
|
+
}
|
|
28
|
+
exports.AddModuleProvider = AddModuleProvider;
|
|
29
|
+
//# sourceMappingURL=add-module-provider.js.map
|
|
@@ -0,0 +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,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,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,IAAA,4DAAsC,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAE3F,IAAA,wCAAkB,EAAC,cAAc,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAE/D,CAAC;AAfD,8CAeC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceClassMethod = void 0;
|
|
4
|
+
function CoerceClassMethod(classDeclaration, methodName, methodStructure = {}) {
|
|
5
|
+
if (!classDeclaration.getMethod(methodName)) {
|
|
6
|
+
classDeclaration.addMethod(Object.assign(Object.assign({}, methodStructure), { name: methodName }));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.CoerceClassMethod = CoerceClassMethod;
|
|
10
|
+
//# sourceMappingURL=coerce-class-method.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceClassProperty = void 0;
|
|
4
|
+
function CoerceClassProperty(classDeclaration, propertyName, propertyStructure) {
|
|
5
|
+
if (!classDeclaration.getProperty(propertyName)) {
|
|
6
|
+
classDeclaration.addProperty(Object.assign(Object.assign({}, propertyStructure), { name: propertyName }));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.CoerceClassProperty = CoerceClassProperty;
|
|
10
|
+
//# sourceMappingURL=coerce-class-property.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EnumDeclaration, Project, SourceFile } from 'ts-morph';
|
|
2
|
+
export declare function CoerceEnum(sourceFile: SourceFile, name: string): EnumDeclaration;
|
|
3
|
+
export declare function CoerceEnumProperty(sourceFile: SourceFile, name: string, propertyKey: string, value: string | number | undefined): void;
|
|
4
|
+
export declare function CoerceCollectionEnum(project: Project, collection: string): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
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) {
|
|
7
|
+
let enumDeclaration = sourceFile.getEnum(name);
|
|
8
|
+
if (!enumDeclaration) {
|
|
9
|
+
enumDeclaration = sourceFile.addEnum({ name, isExported: true });
|
|
10
|
+
}
|
|
11
|
+
return enumDeclaration;
|
|
12
|
+
}
|
|
13
|
+
exports.CoerceEnum = CoerceEnum;
|
|
14
|
+
function CoerceEnumProperty(sourceFile, name, propertyKey, value) {
|
|
15
|
+
const enumDeclaration = CoerceEnum(sourceFile, name);
|
|
16
|
+
if (!enumDeclaration.getMember(propertyKey)) {
|
|
17
|
+
enumDeclaration.addMember({
|
|
18
|
+
name: propertyKey,
|
|
19
|
+
value: value,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
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);
|
|
27
|
+
}
|
|
28
|
+
exports.CoerceCollectionEnum = CoerceCollectionEnum;
|
|
29
|
+
//# sourceMappingURL=coerce-collection-enum.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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) {
|
|
7
|
+
const decorators = [
|
|
8
|
+
{
|
|
9
|
+
name: 'Module',
|
|
10
|
+
arguments: ['{}'],
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
if (global) {
|
|
14
|
+
decorators.unshift({
|
|
15
|
+
name: 'Global',
|
|
16
|
+
arguments: [],
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const className = (0, schematics_utilities_1.CoerceSuffix)(moduleName, 'Module');
|
|
20
|
+
(0, schematics_ts_morph_1.CoerceClass)(sourceFile, className, {
|
|
21
|
+
isExported: true,
|
|
22
|
+
decorators,
|
|
23
|
+
});
|
|
24
|
+
sourceFile.addImportDeclarations([
|
|
25
|
+
{
|
|
26
|
+
namedImports: ['Global', 'Module', 'Inject'],
|
|
27
|
+
moduleSpecifier: '@nestjs/common',
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
exports.CoerceModuleClass = CoerceModuleClass;
|
|
32
|
+
//# sourceMappingURL=coerce-module-class.js.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { Project, SourceFile } from 'ts-morph';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param project A ts-morph project instance
|
|
6
|
+
* @param filePath The absolute file path with extension
|
|
7
|
+
* @param basePath The basePath in the schematics file Tree
|
|
8
|
+
* @param initializer A initializer function called with the SourceFile instance
|
|
9
|
+
* if the file does not exists in the schematics file Tree
|
|
10
|
+
*/
|
|
11
|
+
export declare function CoerceSourceFileRule(project: Project, filePath: string, basePath: string, initializer?: (sourceFile: SourceFile) => void): Rule;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceSourceFileRule = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param project A ts-morph project instance
|
|
8
|
+
* @param filePath The absolute file path with extension
|
|
9
|
+
* @param basePath The basePath in the schematics file Tree
|
|
10
|
+
* @param initializer A initializer function called with the SourceFile instance
|
|
11
|
+
* if the file does not exists in the schematics file Tree
|
|
12
|
+
*/
|
|
13
|
+
function CoerceSourceFileRule(project, filePath, basePath, initializer) {
|
|
14
|
+
return tree => {
|
|
15
|
+
let content = '';
|
|
16
|
+
const treeFilePath = (0, path_1.join)(basePath, filePath);
|
|
17
|
+
let exists = false;
|
|
18
|
+
if (tree.exists(treeFilePath)) {
|
|
19
|
+
exists = true;
|
|
20
|
+
content = tree.get(treeFilePath).content.toString('utf-8');
|
|
21
|
+
}
|
|
22
|
+
const sourceFile = project.createSourceFile(filePath, content, { overwrite: true });
|
|
23
|
+
if (!exists && initializer) {
|
|
24
|
+
initializer(sourceFile);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.CoerceSourceFileRule = CoerceSourceFileRule;
|
|
29
|
+
//# sourceMappingURL=coerce-source-file-rule.js.map
|
|
@@ -0,0 +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,+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"}
|