@rafikidota/iroh 0.50.0 → 0.51.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/collection.json +7 -7
- package/dist/common/decorators/dto/nested.decorator.d.ts +4 -0
- package/dist/common/decorators/dto/nested.decorator.js +17 -0
- package/dist/common/decorators/dto/nested.decorator.js.map +1 -0
- package/dist/common/decorators/dto/validator.namespace.d.ts +2 -0
- package/dist/common/decorators/dto/validator.namespace.js +9 -0
- package/dist/common/decorators/dto/validator.namespace.js.map +1 -1
- package/package.json +2 -8
- package/dist/schematics/crud/crud.factory.d.ts +0 -3
- package/dist/schematics/crud/crud.factory.js +0 -68
- package/dist/schematics/crud/crud.factory.js.map +0 -1
- package/dist/schematics/crud/files/ts/__name__.controller.ts +0 -61
- package/dist/schematics/crud/files/ts/__name__.module.ts +0 -14
- package/dist/schematics/crud/files/ts/__name__.service.ts +0 -11
- package/dist/schematics/crud/files/ts/aggregations/index.ts +0 -0
- package/dist/schematics/crud/files/ts/app/dto/__name__.create.dto.ts +0 -11
- package/dist/schematics/crud/files/ts/app/dto/__name__.update.dto.ts +0 -4
- package/dist/schematics/crud/files/ts/app/dto/__name__.view.ts +0 -30
- package/dist/schematics/crud/files/ts/app/use-cases/index.ts +0 -0
- package/dist/schematics/crud/files/ts/domain/__name__.domain.ts +0 -28
- package/dist/schematics/crud/files/ts/domain/__name__.interface.ts +0 -8
- package/dist/schematics/crud/files/ts/infra/__name__.mapper.ts +0 -35
- package/dist/schematics/crud/files/ts/infra/__name__.persistence.ts +0 -6
- package/dist/schematics/crud/files/ts/infra/__name__.repository.ts +0 -18
- package/dist/schematics/crud/files/ts/test/__name__.controller.spec.ts +0 -27
- package/dist/schematics/crud/files/ts/test/__name__.service.spec.ts +0 -25
- package/dist/schematics/crud/files/ts/test/provider/__name__.typeorm.repository.ts +0 -5
- package/dist/schematics/crud/schema.json +0 -43
- package/dist/schematics/defaults.d.ts +0 -6
- package/dist/schematics/defaults.js +0 -10
- package/dist/schematics/defaults.js.map +0 -1
- package/dist/schematics/init/files/ts/common/common.module.ts +0 -37
- package/dist/schematics/init/files/ts/common/config/api/api.config.module.ts +0 -8
- package/dist/schematics/init/files/ts/common/config/api/env/api.env.config.ts +0 -8
- package/dist/schematics/init/files/ts/common/config/api/env/api.env.validation.ts +0 -6
- package/dist/schematics/init/files/ts/common/config/configuration.module.ts +0 -18
- package/dist/schematics/init/files/ts/common/config/database/env/typeorm.env.config.ts +0 -12
- package/dist/schematics/init/files/ts/common/config/database/env/typeorm.env.validation.ts +0 -11
- package/dist/schematics/init/files/ts/common/config/database/migrations/index.ts +0 -0
- package/dist/schematics/init/files/ts/common/config/database/typeorm.config.module.ts +0 -15
- package/dist/schematics/init/files/ts/common/config/database/typeorm.data-source.ts +0 -25
- package/dist/schematics/init/files/ts/common/config/swagger/env/swagger.env.config.ts +0 -7
- package/dist/schematics/init/files/ts/common/config/swagger/env/swagger.env.validation.ts +0 -6
- package/dist/schematics/init/files/ts/common/config/swagger/swagger.config.module.ts +0 -8
- package/dist/schematics/init/files/ts/common/config/swagger/swagger.config.ts +0 -24
- package/dist/schematics/init/files/ts/modules/core.module.ts +0 -4
- package/dist/schematics/init/init.factory.d.ts +0 -3
- package/dist/schematics/init/init.factory.js +0 -69
- package/dist/schematics/init/init.factory.js.map +0 -1
- package/dist/schematics/init/schema.json +0 -37
- package/dist/schematics/use-case/files/ts/__name__.use-case.ts +0 -20
- package/dist/schematics/use-case/schema.json +0 -43
- package/dist/schematics/use-case/use-case.factory.d.ts +0 -3
- package/dist/schematics/use-case/use-case.factory.js +0 -68
- package/dist/schematics/use-case/use-case.factory.js.map +0 -1
- package/dist/schematics/utils/index.d.ts +0 -8
- package/dist/schematics/utils/index.js +0 -25
- package/dist/schematics/utils/index.js.map +0 -1
- package/dist/schematics/utils/metadata.manager.d.ts +0 -13
- package/dist/schematics/utils/metadata.manager.js +0 -166
- package/dist/schematics/utils/metadata.manager.js.map +0 -1
- package/dist/schematics/utils/module-import.declarator.d.ts +0 -10
- package/dist/schematics/utils/module-import.declarator.js +0 -40
- package/dist/schematics/utils/module-import.declarator.js.map +0 -1
- package/dist/schematics/utils/module-metadata.declarator.d.ts +0 -4
- package/dist/schematics/utils/module-metadata.declarator.js +0 -13
- package/dist/schematics/utils/module-metadata.declarator.js.map +0 -1
- package/dist/schematics/utils/module.declarator.d.ts +0 -22
- package/dist/schematics/utils/module.declarator.js +0 -30
- package/dist/schematics/utils/module.declarator.js.map +0 -1
- package/dist/schematics/utils/module.finder.d.ts +0 -13
- package/dist/schematics/utils/module.finder.js +0 -25
- package/dist/schematics/utils/module.finder.js.map +0 -1
- package/dist/schematics/utils/name.parser.d.ts +0 -12
- package/dist/schematics/utils/name.parser.js +0 -18
- package/dist/schematics/utils/name.parser.js.map +0 -1
- package/dist/schematics/utils/path.solver.d.ts +0 -4
- package/dist/schematics/utils/path.solver.js +0 -13
- package/dist/schematics/utils/path.solver.js.map +0 -1
- package/dist/schematics/utils/source-root.helpers.d.ts +0 -6
- package/dist/schematics/utils/source-root.helpers.js +0 -25
- package/dist/schematics/utils/source-root.helpers.js.map +0 -1
- package/dist/schematics/utils/string-utils.d.ts +0 -3
- package/dist/schematics/utils/string-utils.js +0 -15
- package/dist/schematics/utils/string-utils.js.map +0 -1
package/collection.json
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
"schematics": {
|
|
4
4
|
"crud": {
|
|
5
5
|
"description": "Schematic to generate a dynamic crud module.",
|
|
6
|
-
"factory": "./
|
|
7
|
-
"schema": "./
|
|
6
|
+
"factory": "./node_modules/@rafikidota/iroh-schematics/dist/crud/crud.factory#main",
|
|
7
|
+
"schema": "./node_modules/@rafikidota/iroh-schematics/dist/crud/schema.json"
|
|
8
8
|
},
|
|
9
9
|
"init": {
|
|
10
10
|
"description": "Schematic to generate dynamic basic modules.",
|
|
11
|
-
"factory": "./
|
|
12
|
-
"schema": "./
|
|
11
|
+
"factory": "./node_modules/@rafikidota/iroh-schematics/dist/init/init.factory#main",
|
|
12
|
+
"schema": "./node_modules/@rafikidota/iroh-schematics/dist/init/schema.json"
|
|
13
13
|
},
|
|
14
14
|
"use-case": {
|
|
15
15
|
"description": "Schematic to generate use cases.",
|
|
16
|
-
"factory": "./
|
|
17
|
-
"schema": "./
|
|
16
|
+
"factory": "./node_modules/@rafikidota/iroh-schematics/dist/use-case/use-case.factory#main",
|
|
17
|
+
"schema": "./node_modules/@rafikidota/iroh-schematics/dist/use-case/schema.json"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Type as NestType } from '@nestjs/common';
|
|
2
|
+
import { ValidationOptions } from 'class-validator';
|
|
3
|
+
export declare function NestedRequired<T extends object>(dto: NestType<T>, options?: ValidationOptions): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
4
|
+
export declare function NestedOptional<T extends object>(dto: NestType<T>, options?: ValidationOptions): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NestedRequired = NestedRequired;
|
|
4
|
+
exports.NestedOptional = NestedOptional;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const class_validator_1 = require("class-validator");
|
|
7
|
+
const class_validator_2 = require("class-validator");
|
|
8
|
+
const class_transformer_1 = require("class-transformer");
|
|
9
|
+
function NestedRequired(dto, options) {
|
|
10
|
+
const decorators = [(0, class_transformer_1.Type)(() => dto), (0, class_validator_1.ValidateNested)(options)];
|
|
11
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
12
|
+
}
|
|
13
|
+
function NestedOptional(dto, options) {
|
|
14
|
+
const decorators = [(0, class_transformer_1.Type)(() => dto), (0, class_validator_1.ValidateNested)(options), (0, class_validator_2.IsOptional)()];
|
|
15
|
+
return (0, common_1.applyDecorators)(...decorators);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=nested.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested.decorator.js","sourceRoot":"","sources":["../../../../src/common/decorators/dto/nested.decorator.ts"],"names":[],"mappings":";;AAOA,wCAMC;AAED,wCAMC;AArBD,2CAAmE;AAEnE,qDAAiD;AACjD,qDAA6C;AAE7C,yDAAyC;AAEzC,SAAgB,cAAc,CAC5B,GAAgB,EAChB,OAA2B;IAE3B,MAAM,UAAU,GAAG,CAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAA,gCAAc,EAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,SAAgB,cAAc,CAC5B,GAAgB,EAChB,OAA2B;IAE3B,MAAM,UAAU,GAAG,CAAC,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAA,gCAAc,EAAC,OAAO,CAAC,EAAE,IAAA,4BAAU,GAAE,CAAC,CAAC;IAC5E,OAAO,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -6,6 +6,7 @@ export declare namespace Validator {
|
|
|
6
6
|
function Email(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
7
7
|
function PhoneNumber(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
8
8
|
function EntityId(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
9
|
+
function Nested<T extends object>(dto: new () => T): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
9
10
|
namespace Optional {
|
|
10
11
|
function String(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
11
12
|
function Number(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -14,5 +15,6 @@ export declare namespace Validator {
|
|
|
14
15
|
function Email(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
15
16
|
function PhoneNumber(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
16
17
|
function EntityId(): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
18
|
+
function Nested<T extends object>(dto: new () => T): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
@@ -8,6 +8,7 @@ const enum_decorator_1 = require("./enum.decorator");
|
|
|
8
8
|
const email_decorator_1 = require("./email.decorator");
|
|
9
9
|
const phone_decorator_1 = require("./phone.decorator");
|
|
10
10
|
const entity_id_decorator_1 = require("./entity-id.decorator");
|
|
11
|
+
const nested_decorator_1 = require("./nested.decorator");
|
|
11
12
|
var Validator;
|
|
12
13
|
(function (Validator) {
|
|
13
14
|
function String() {
|
|
@@ -38,6 +39,10 @@ var Validator;
|
|
|
38
39
|
return (0, entity_id_decorator_1.EntityIdRequired)();
|
|
39
40
|
}
|
|
40
41
|
Validator.EntityId = EntityId;
|
|
42
|
+
function Nested(dto) {
|
|
43
|
+
return (0, nested_decorator_1.NestedRequired)(dto);
|
|
44
|
+
}
|
|
45
|
+
Validator.Nested = Nested;
|
|
41
46
|
let Optional;
|
|
42
47
|
(function (Optional) {
|
|
43
48
|
function String() {
|
|
@@ -68,6 +73,10 @@ var Validator;
|
|
|
68
73
|
return (0, entity_id_decorator_1.EntityIdOptional)();
|
|
69
74
|
}
|
|
70
75
|
Optional.EntityId = EntityId;
|
|
76
|
+
function Nested(dto) {
|
|
77
|
+
return (0, nested_decorator_1.NestedOptional)(dto);
|
|
78
|
+
}
|
|
79
|
+
Optional.Nested = Nested;
|
|
71
80
|
})(Optional = Validator.Optional || (Validator.Optional = {}));
|
|
72
81
|
})(Validator || (exports.Validator = Validator = {}));
|
|
73
82
|
//# sourceMappingURL=validator.namespace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.namespace.js","sourceRoot":"","sources":["../../../../src/common/decorators/dto/validator.namespace.ts"],"names":[],"mappings":";;;AAAA,yDAAoE;AACpE,yDAAoE;AACpE,2DAAuE;AACvE,qDAA8D;AAC9D,uDAAiE;AACjE,uDAAuE;AACvE,+DAA2E;
|
|
1
|
+
{"version":3,"file":"validator.namespace.js","sourceRoot":"","sources":["../../../../src/common/decorators/dto/validator.namespace.ts"],"names":[],"mappings":";;;AAAA,yDAAoE;AACpE,yDAAoE;AACpE,2DAAuE;AACvE,qDAA8D;AAC9D,uDAAiE;AACjE,uDAAuE;AACvE,+DAA2E;AAC3E,yDAAoE;AAEpE,IAAiB,SAAS,CA4DzB;AA5DD,WAAiB,SAAS;IACxB,SAAgB,MAAM;QACpB,OAAO,IAAA,iCAAc,GAAE,CAAC;IAC1B,CAAC;IAFe,gBAAM,SAErB,CAAA;IAED,SAAgB,MAAM;QACpB,OAAO,IAAA,iCAAc,GAAE,CAAC;IAC1B,CAAC;IAFe,gBAAM,SAErB,CAAA;IAED,SAAgB,OAAO;QACrB,OAAO,IAAA,mCAAe,GAAE,CAAC;IAC3B,CAAC;IAFe,iBAAO,UAEtB,CAAA;IAED,SAAgB,IAA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AEvB,CAAA;QAED,SAAgB,MAAM,CAAmB,GAAgB;YACvD,OAAO,IAAA,iCAAc,EAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QAFe,eAAM,SAErB,CAAA;IACH,CAAC,EA1BgB,QAAQ,GAAR,kBAAQ,KAAR,kBAAQ,QA0BxB;AACH,CAAC,EA5DgB,SAAS,yBAAT,SAAS,QA4DzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rafikidota/iroh",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "Sometimes, the best way to solve your own problems is to help someone else.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
"module": "./dist/index.js",
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@rafikidota/iroh-schematics": "0.0.1",
|
|
18
19
|
"chalk": "4.1.2"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"@angular-devkit/core": "19.2.13",
|
|
22
|
-
"@angular-devkit/schematics": "19.2.13",
|
|
23
|
-
"@angular-devkit/schematics-cli": "19.2.13",
|
|
24
22
|
"@eslint/eslintrc": "3.3.1",
|
|
25
23
|
"@eslint/js": "9.39.1",
|
|
26
24
|
"@nestjs/common": "11.1.9",
|
|
@@ -107,10 +105,6 @@
|
|
|
107
105
|
"scripts": {
|
|
108
106
|
"prebuild": "rimraf -rf dist",
|
|
109
107
|
"build": "tsc -p tsconfig.json",
|
|
110
|
-
"postbuild": "npm run move:crud && npm run move:init && npm run move:usecase",
|
|
111
|
-
"move:crud": "mkdir -p dist/schematics/crud/files/ts && cp -ar ./src/schematics/crud/files/ts/* dist/schematics/crud/files/ts",
|
|
112
|
-
"move:init": "mkdir -p dist/schematics/init/files/ts && cp -ar ./src/schematics/init/files/ts/* dist/schematics/init/files/ts",
|
|
113
|
-
"move:usecase": "mkdir -p dist/schematics/use-case/files/ts && cp -ar ./src/schematics/use-case/files/ts/* dist/schematics/use-case/files/ts",
|
|
114
108
|
"lint": "npx eslint --debug . --fix",
|
|
115
109
|
"format": "prettier --write \"**/*.ts\""
|
|
116
110
|
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main = main;
|
|
4
|
-
const core_1 = require("@angular-devkit/core");
|
|
5
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
const module_finder_1 = require("../utils/module.finder");
|
|
8
|
-
const name_parser_1 = require("../utils/name.parser");
|
|
9
|
-
const source_root_helpers_1 = require("../utils/source-root.helpers");
|
|
10
|
-
const string_utils_1 = require("../utils/string-utils");
|
|
11
|
-
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
12
|
-
function main(options) {
|
|
13
|
-
options = transform(options);
|
|
14
|
-
return (tree, context) => {
|
|
15
|
-
return (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
|
|
16
|
-
(0, source_root_helpers_1.mergeSourceRoot)(options),
|
|
17
|
-
addDeclarationToModule(options),
|
|
18
|
-
(0, schematics_1.mergeWith)(generate(options)),
|
|
19
|
-
]))(tree, context);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function transform(options) {
|
|
23
|
-
const target = Object.assign({}, options);
|
|
24
|
-
target.metadata = 'imports';
|
|
25
|
-
target.type = 'module';
|
|
26
|
-
const location = new name_parser_1.NameParser().parse(target);
|
|
27
|
-
target.name = core_1.strings.dasherize(location.name);
|
|
28
|
-
target.path = (0, core_1.join)(core_1.strings.dasherize(location.path), target.name);
|
|
29
|
-
target.language = 'ts';
|
|
30
|
-
return target;
|
|
31
|
-
}
|
|
32
|
-
function generate(options) {
|
|
33
|
-
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
34
|
-
(0, schematics_1.template)({
|
|
35
|
-
...core_1.strings,
|
|
36
|
-
...options,
|
|
37
|
-
lowerCase: string_utils_1.lowerCase,
|
|
38
|
-
lowercased: (name) => {
|
|
39
|
-
const classifiedName = (0, strings_1.classify)(name);
|
|
40
|
-
return (classifiedName.charAt(0).toLowerCase() + classifiedName.slice(1));
|
|
41
|
-
},
|
|
42
|
-
upperCase: string_utils_1.upperCase,
|
|
43
|
-
camelize: strings_1.camelize,
|
|
44
|
-
dashToUnderscore: string_utils_1.dashToUnderscore,
|
|
45
|
-
}),
|
|
46
|
-
(0, schematics_1.move)(options.path),
|
|
47
|
-
])(context);
|
|
48
|
-
}
|
|
49
|
-
function addDeclarationToModule(options) {
|
|
50
|
-
return (tree) => {
|
|
51
|
-
if (options.skipImport !== undefined && options.skipImport) {
|
|
52
|
-
return tree;
|
|
53
|
-
}
|
|
54
|
-
options.module = new module_finder_1.ModuleFinder(tree).find({
|
|
55
|
-
name: options.name,
|
|
56
|
-
path: options.path,
|
|
57
|
-
});
|
|
58
|
-
if (!options.module) {
|
|
59
|
-
return tree;
|
|
60
|
-
}
|
|
61
|
-
const content = tree.read(options.module).toString();
|
|
62
|
-
const declarator = new utils_1.ModuleDeclarator();
|
|
63
|
-
const declarationOptions = Object.assign({}, options);
|
|
64
|
-
tree.overwrite(options.module, declarator.declare(content, declarationOptions));
|
|
65
|
-
return tree;
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=crud.factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crud.factory.js","sourceRoot":"","sources":["../../../src/schematics/crud/crud.factory.ts"],"names":[],"mappings":";;AAyBA,oBAWC;AApCD,+CAA2D;AAC3D,2DAWoC;AAEpC,oCAAgE;AAEhE,0DAAsD;AACtD,sDAA4D;AAC5D,sEAA+D;AAI/D,wDAA+E;AAC/E,oEAA4E;AAE5E,SAAgB,IAAI,CAAC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CAAC;AACJ,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Controller } from '@nestjs/common';
|
|
2
|
-
import { Query } from '@nestjs/common';
|
|
3
|
-
import { Body } from '@nestjs/common';
|
|
4
|
-
import { Param } from '@nestjs/common';
|
|
5
|
-
import { ParseUUIDPipe } from '@nestjs/common';
|
|
6
|
-
import { ApiTags } from '@nestjs/swagger';
|
|
7
|
-
|
|
8
|
-
import { IrohController } from '@rafikidota/iroh';
|
|
9
|
-
import { GenericPost } from '@rafikidota/iroh';
|
|
10
|
-
import { GenericGet } from '@rafikidota/iroh';
|
|
11
|
-
import { GenericGetById } from '@rafikidota/iroh';
|
|
12
|
-
import { GenericPatch } from '@rafikidota/iroh';
|
|
13
|
-
import { GenericDelete } from '@rafikidota/iroh';
|
|
14
|
-
import { ParseQueryPipe } from '@rafikidota/iroh';
|
|
15
|
-
import { SearchDto } from '@rafikidota/iroh';
|
|
16
|
-
import { QueryOptionDto } from '@rafikidota/iroh';
|
|
17
|
-
|
|
18
|
-
import { <%= classify(name) %>Service } from './<%= lowerCase(name) %>.service';
|
|
19
|
-
import { <%= classify(name) %>Mapper } from './infra/<%= lowerCase(name) %>.mapper';
|
|
20
|
-
import { Create<%= classify(name) %>Dto } from './app/dto/<%= lowerCase(name) %>.create.dto';
|
|
21
|
-
import { Update<%= classify(name) %>Dto } from './app/dto/<%= lowerCase(name) %>.update.dto';
|
|
22
|
-
import { <%= classify(name) %>View } from './app/dto/<%= lowerCase(name) %>.view';
|
|
23
|
-
|
|
24
|
-
@ApiTags('<%= classify(name) %>')
|
|
25
|
-
@Controller('<%= dasherize(name) %>')
|
|
26
|
-
export class <%= classify(name) %>Controller extends IrohController<<%= classify(name) %>Mapper> {
|
|
27
|
-
constructor(readonly service: <%= classify(name) %>Service) {
|
|
28
|
-
super(service);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@GenericPost(Create<%= classify(name) %>Dto, <%= classify(name) %>View)
|
|
32
|
-
create(body: Create<%= classify(name) %>Dto): Promise<<%= classify(name) %>View> {
|
|
33
|
-
return super.create(body);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@GenericGet(<%= classify(name) %>View)
|
|
37
|
-
paginate(@Query(ParseQueryPipe) query: SearchDto): Promise<<%= classify(name) %>View[]> {
|
|
38
|
-
return super.paginate(query);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@GenericGetById(<%= classify(name) %>View)
|
|
42
|
-
findById(
|
|
43
|
-
@Param('id', ParseUUIDPipe) id: string,
|
|
44
|
-
@Query(ParseQueryPipe) query: QueryOptionDto,
|
|
45
|
-
): Promise<<%= classify(name) %>View> {
|
|
46
|
-
return super.findById(id, query);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@GenericPatch(Update<%= classify(name) %>Dto, <%= classify(name) %>View)
|
|
50
|
-
update(
|
|
51
|
-
@Param('id', ParseUUIDPipe) id: string,
|
|
52
|
-
@Body() body: Update<%= classify(name) %>Dto,
|
|
53
|
-
): Promise<<%= classify(name) %>View> {
|
|
54
|
-
return super.update(id, body);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@GenericDelete()
|
|
58
|
-
remove(@Param('id', ParseUUIDPipe) id: string): Promise<<%= classify(name) %>View> {
|
|
59
|
-
return super.remove(id);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
3
|
-
import { <%= classify(name) %>Controller } from './<%= lowerCase(name) %>.controller';
|
|
4
|
-
import { <%= classify(name) %>Service } from './<%= lowerCase(name) %>.service';
|
|
5
|
-
import { <%= classify(name) %>Repository } from './infra/<%= lowerCase(name) %>.repository';
|
|
6
|
-
import { <%= classify(name) %>Persistence } from './infra/<%= lowerCase(name) %>.persistence';
|
|
7
|
-
|
|
8
|
-
@Module({
|
|
9
|
-
controllers: [<%= classify(name) %>Controller],
|
|
10
|
-
providers: [<%= classify(name) %>Service, <%= classify(name) %>Repository],
|
|
11
|
-
imports: [TypeOrmModule.forFeature([<%= classify(name) %>Persistence])],
|
|
12
|
-
exports: [TypeOrmModule, <%= classify(name) %>Service, <%= classify(name) %>Repository],
|
|
13
|
-
})
|
|
14
|
-
export class <%= classify(name) %>Module {}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { IrohService } from '@rafikidota/iroh';
|
|
3
|
-
import { <%= classify(name) %>Repository } from './infra/<%= lowerCase(name) %>.repository';
|
|
4
|
-
import { <%= classify(name) %>Mapper } from './infra/<%= lowerCase(name) %>.mapper';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class <%= classify(name) %>Service extends IrohService<<%= classify(name) %>Mapper> {
|
|
8
|
-
constructor(readonly repository: <%= classify(name) %>Repository) {
|
|
9
|
-
super(repository);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DtoMapper } from '@rafikidota/iroh';
|
|
2
|
-
import { <%= classify(name) %>Domain } from '../../domain/<%= lowerCase(name) %>.domain';
|
|
3
|
-
import { New<%= classify(name) %>Props } from '../../domain/<%= lowerCase(name) %>.domain';
|
|
4
|
-
|
|
5
|
-
export class Create<%= classify(name) %>Dto
|
|
6
|
-
implements New<%= classify(name) %>Props, DtoMapper<<%= classify(name) %>Domain, Create<%= classify(name) %>Dto>
|
|
7
|
-
{
|
|
8
|
-
ToDomain(dto: Create<%= classify(name) %>Dto): <%= classify(name) %>Domain {
|
|
9
|
-
return <%= classify(name) %>Domain.create(dto).unwrap();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IntersectionType } from '@nestjs/swagger';
|
|
3
|
-
import { OmitType } from '@nestjs/swagger';
|
|
4
|
-
import { PartialType } from '@nestjs/swagger';
|
|
5
|
-
import { View } from '@rafikidota/iroh';
|
|
6
|
-
import { Create<%= classify(name) %>Dto } from './<%= lowerCase(name) %>.create.dto';
|
|
7
|
-
import { <%= classify(name) %>Domain } from '../../domain/<%= lowerCase(name) %>.domain';
|
|
8
|
-
import { I<%= classify(name) %> } from '../../domain/<%= lowerCase(name) %>.interface';
|
|
9
|
-
|
|
10
|
-
export class <%= classify(name) %>View
|
|
11
|
-
extends OmitType(
|
|
12
|
-
IntersectionType(PartialType(Create<%= classify(name) %>Dto), View),
|
|
13
|
-
[],
|
|
14
|
-
)
|
|
15
|
-
implements I<%= classify(name) %>
|
|
16
|
-
{
|
|
17
|
-
@ApiProperty()
|
|
18
|
-
id: string;
|
|
19
|
-
@ApiProperty()
|
|
20
|
-
createdAt: Date;
|
|
21
|
-
@ApiProperty()
|
|
22
|
-
updatedAt: Date;
|
|
23
|
-
|
|
24
|
-
constructor(domain: <%= classify(name) %>Domain) {
|
|
25
|
-
super();
|
|
26
|
-
this.id = domain.id;
|
|
27
|
-
this.createdAt = domain.createdAt;
|
|
28
|
-
this.updatedAt = domain.updatedAt;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
File without changes
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { DeepPartial } from 'typeorm';
|
|
2
|
-
import { Result } from '@rafikidota/iroh';
|
|
3
|
-
import { DomainFactory } from '@rafikidota/iroh';
|
|
4
|
-
import { Domain } from '@rafikidota/iroh';
|
|
5
|
-
import { IUpdatableDomain } from '@rafikidota/iroh';
|
|
6
|
-
import { Props } from '@rafikidota/iroh';
|
|
7
|
-
import { I<%= classify(name) %> } from './<%= lowerCase(name) %>.interface';
|
|
8
|
-
|
|
9
|
-
export type <%= classify(name) %>Props = Props<<%= classify(name) %>Domain>;
|
|
10
|
-
|
|
11
|
-
export type New<%= classify(name) %>Props = Omit<<%= classify(name) %>Props, ''>;
|
|
12
|
-
|
|
13
|
-
export type Update<%= classify(name) %>Props = DeepPartial<New<%= classify(name) %>Props>;
|
|
14
|
-
|
|
15
|
-
export type I<%= classify(name) %>Domain = I<%= classify(name) %> & IUpdatableDomain<<%= classify(name) %>Domain>;
|
|
16
|
-
|
|
17
|
-
export class <%= classify(name) %>Domain extends Domain implements I<%= classify(name) %>Domain {
|
|
18
|
-
|
|
19
|
-
static create(props: New<%= classify(name) %>Props): Result<<%= classify(name) %>Domain> {
|
|
20
|
-
const domain = DomainFactory.create(<%= classify(name) %>Domain, { ...props });
|
|
21
|
-
return Result.Ok(domain);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public update(props: Update<%= classify(name) %>Props): Result<<%= classify(name) %>Domain> {
|
|
25
|
-
Object.assign(this, { updatedAt: new Date(), ...props });
|
|
26
|
-
return Result.Ok(this);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IGenericEntityProps } from '@rafikidota/iroh';
|
|
2
|
-
import { <%= classify(name) %>Persistence } from '../infra/<%= lowerCase(name) %>.persistence';
|
|
3
|
-
import { <%= classify(name) %>Domain } from './<%= lowerCase(name) %>.domain';
|
|
4
|
-
import { <%= classify(name) %>View } from '../app/dto/<%= lowerCase(name) %>.view';
|
|
5
|
-
|
|
6
|
-
export interface I<%= classify(name) %> extends IGenericEntityProps { }
|
|
7
|
-
|
|
8
|
-
export type <%= classify(name) %> = <%= classify(name) %>Persistence | <%= classify(name) %>Domain | <%= classify(name) %>View;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { DomainFactory } from '@rafikidota/iroh';
|
|
2
|
-
import { PersistenceFactory } from '@rafikidota/iroh';
|
|
3
|
-
import { DomainProps } from '@rafikidota/iroh';
|
|
4
|
-
import { IrohMapper } from '@rafikidota/iroh';
|
|
5
|
-
import { <%= classify(name) %>Persistence } from './<%= lowerCase(name) %>.persistence';
|
|
6
|
-
import { <%= classify(name) %>Domain } from '../domain/<%= lowerCase(name) %>.domain';
|
|
7
|
-
import { <%= classify(name) %>View } from '../app/dto/<%= lowerCase(name) %>.view';
|
|
8
|
-
|
|
9
|
-
const Mapper = IrohMapper<<%= classify(name) %>Persistence, <%= classify(name) %>Domain, <%= classify(name) %>View>;
|
|
10
|
-
|
|
11
|
-
export class <%= classify(name) %>Mapper extends Mapper {
|
|
12
|
-
PersistenceToDomain(persistence: <%= classify(name) %>Persistence): <%= classify(name) %>Domain {
|
|
13
|
-
const props: Partial<DomainProps<<%= classify(name) %>Domain>> = {
|
|
14
|
-
id: persistence.id,
|
|
15
|
-
createdAt: persistence.createdAt,
|
|
16
|
-
updatedAt: persistence.updatedAt,
|
|
17
|
-
deletedAt: persistence.deletedAt,
|
|
18
|
-
};
|
|
19
|
-
return DomainFactory.instance(<%= classify(name) %>Domain, { ...props });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
DomainToPersistence(domain: <%= classify(name) %>Domain): <%= classify(name) %>Persistence {
|
|
23
|
-
const props: Partial<DomainProps<<%= classify(name) %>Domain>> = {
|
|
24
|
-
id: domain.id,
|
|
25
|
-
createdAt: domain.createdAt,
|
|
26
|
-
updatedAt: domain.updatedAt,
|
|
27
|
-
deletedAt: domain.deletedAt,
|
|
28
|
-
};
|
|
29
|
-
return PersistenceFactory.create(<%= classify(name) %>Persistence, { ...props });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
DomainToView(domain: <%= classify(name) %>Domain): <%= classify(name) %>View {
|
|
33
|
-
return new <%= classify(name) %>View(domain);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Entity } from 'typeorm';
|
|
2
|
-
import { Persistence } from '@rafikidota/iroh';
|
|
3
|
-
import { I<%= classify(name) %> } from '../domain/<%= lowerCase(name) %>.interface';
|
|
4
|
-
|
|
5
|
-
@Entity('<%= dashToUnderscore(name) %>')
|
|
6
|
-
export class <%= classify(name) %>Persistence extends Persistence implements I<%= classify(name) %> {}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { Repository } from 'typeorm';
|
|
4
|
-
import { IrohRepository } from '@rafikidota/iroh';
|
|
5
|
-
import { <%= classify(name) %>Mapper } from './<%= lowerCase(name) %>.mapper';
|
|
6
|
-
import { <%= classify(name) %>Persistence } from './<%= lowerCase(name) %>.persistence';
|
|
7
|
-
|
|
8
|
-
@Injectable()
|
|
9
|
-
export class <%= classify(name) %>Repository extends IrohRepository<<%= classify(name) %>Mapper> {
|
|
10
|
-
constructor(
|
|
11
|
-
@InjectRepository(<%= classify(name) %>Persistence)
|
|
12
|
-
repository: Repository<<%= classify(name) %>Persistence>,
|
|
13
|
-
) {
|
|
14
|
-
super(repository);
|
|
15
|
-
this.mapper = new <%= classify(name) %>Mapper();
|
|
16
|
-
this.Entity = <%= classify(name) %>Persistence;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Test } from '@nestjs/testing';
|
|
2
|
-
import { TestingModule } from '@nestjs/testing';
|
|
3
|
-
import { <%= classify(name) %>Controller } from '../<%= lowerCase(name) %>.controller';
|
|
4
|
-
import { <%= classify(name) %>Service } from '../<%= lowerCase(name) %>.service';
|
|
5
|
-
import { <%= classify(name) %>Repository } from '../infra/<%= lowerCase(name) %>.repository';
|
|
6
|
-
import { <%= classify(name) %>PersistenceRepository } from './provider/<%= lowerCase(name) %>.typeorm.repository';
|
|
7
|
-
|
|
8
|
-
describe('<%= classify(name) %>Controller', () => {
|
|
9
|
-
let controller: <%= classify(name) %>Controller;
|
|
10
|
-
|
|
11
|
-
beforeEach(async () => {
|
|
12
|
-
const module: TestingModule = await Test.createTestingModule({
|
|
13
|
-
controllers: [<%= classify(name) %>Controller],
|
|
14
|
-
providers: [
|
|
15
|
-
<%= classify(name) %>Service,
|
|
16
|
-
<%= classify(name) %>Repository,
|
|
17
|
-
<%= classify(name) %>PersistenceRepository,
|
|
18
|
-
],
|
|
19
|
-
}).compile();
|
|
20
|
-
|
|
21
|
-
controller = module.get<<%= classify(name) %>Controller>(<%= classify(name) %>Controller);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should be defined', () => {
|
|
25
|
-
expect(controller).toBeDefined();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Test } from '@nestjs/testing';
|
|
2
|
-
import { TestingModule } from '@nestjs/testing';
|
|
3
|
-
import { <%= classify(name) %>Service } from '../<%= lowerCase(name) %>.service';
|
|
4
|
-
import { <%= classify(name) %>Repository } from '../infra/<%= lowerCase(name) %>.repository';
|
|
5
|
-
import { <%= classify(name) %>PersistenceRepository } from './provider/<%= lowerCase(name) %>.typeorm.repository';
|
|
6
|
-
|
|
7
|
-
describe('<%= classify(name) %>Service', () => {
|
|
8
|
-
let service: <%= classify(name) %>Service;
|
|
9
|
-
|
|
10
|
-
beforeEach(async () => {
|
|
11
|
-
const module: TestingModule = await Test.createTestingModule({
|
|
12
|
-
providers: [
|
|
13
|
-
<%= classify(name) %>Service,
|
|
14
|
-
<%= classify(name) %>Repository,
|
|
15
|
-
<%= classify(name) %>PersistenceRepository,
|
|
16
|
-
],
|
|
17
|
-
}).compile();
|
|
18
|
-
|
|
19
|
-
service = module.get<<%= classify(name) %>Service>(<%= classify(name) %>Service);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('should be defined', () => {
|
|
23
|
-
expect(service).toBeDefined();
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { getRepositoryToken } from '@nestjs/typeorm';
|
|
2
|
-
import { <%= classify(name) %>Persistence } from '../../infra/<%= lowerCase(name) %>.persistence';
|
|
3
|
-
|
|
4
|
-
const token = getRepositoryToken(<%= classify(name) %>Persistence);
|
|
5
|
-
export const <%= classify(name) %>PersistenceRepository = { provide: token, useValue: {} };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "CrudSchema",
|
|
4
|
-
"title": "Nest Base Crud Module Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"name": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "The name of the module.",
|
|
10
|
-
"$default": {
|
|
11
|
-
"$source": "argv",
|
|
12
|
-
"index": 0
|
|
13
|
-
},
|
|
14
|
-
"x-prompt": "What name would you like to use for the module?"
|
|
15
|
-
},
|
|
16
|
-
"path": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"format": "path",
|
|
19
|
-
"description": "The path to create the module.",
|
|
20
|
-
"default": "modules"
|
|
21
|
-
},
|
|
22
|
-
"module": {
|
|
23
|
-
"type": "string",
|
|
24
|
-
"format": "path",
|
|
25
|
-
"description": "The path to import the module."
|
|
26
|
-
},
|
|
27
|
-
"language": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "Nest module language (ts/js)."
|
|
30
|
-
},
|
|
31
|
-
"sourceRoot": {
|
|
32
|
-
"type": "string",
|
|
33
|
-
"description": "Nest module source root directory."
|
|
34
|
-
},
|
|
35
|
-
"skipImport": {
|
|
36
|
-
"description": "Flag to skip the module import.",
|
|
37
|
-
"default": false
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"required": [
|
|
41
|
-
"name"
|
|
42
|
-
]
|
|
43
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const DEFAULT_AUTHOR = "";
|
|
2
|
-
export declare const DEFAULT_DESCRIPTION = "";
|
|
3
|
-
export declare const DEFAULT_LANGUAGE = "ts";
|
|
4
|
-
export declare const DEFAULT_VERSION = "1.0.0";
|
|
5
|
-
export declare const DEFAULT_PATH_NAME = "src";
|
|
6
|
-
export declare const DEFAULT_LIB_PATH = "dist";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_LIB_PATH = exports.DEFAULT_PATH_NAME = exports.DEFAULT_VERSION = exports.DEFAULT_LANGUAGE = exports.DEFAULT_DESCRIPTION = exports.DEFAULT_AUTHOR = void 0;
|
|
4
|
-
exports.DEFAULT_AUTHOR = '';
|
|
5
|
-
exports.DEFAULT_DESCRIPTION = '';
|
|
6
|
-
exports.DEFAULT_LANGUAGE = 'ts';
|
|
7
|
-
exports.DEFAULT_VERSION = '1.0.0';
|
|
8
|
-
exports.DEFAULT_PATH_NAME = 'src';
|
|
9
|
-
exports.DEFAULT_LIB_PATH = 'dist';
|
|
10
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/schematics/defaults.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,EAAE,CAAC;AACpB,QAAA,mBAAmB,GAAG,EAAE,CAAC;AACzB,QAAA,gBAAgB,GAAG,IAAI,CAAC;AACxB,QAAA,eAAe,GAAG,OAAO,CAAC;AAC1B,QAAA,iBAAiB,GAAG,KAAK,CAAC;AAC1B,QAAA,gBAAgB,GAAG,MAAM,CAAC"}
|