@rafikidota/iroh 0.49.1 → 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/class/exception-handler.d.ts +3 -0
- package/dist/common/class/exception-handler.js +7 -0
- package/dist/common/class/exception-handler.js.map +1 -0
- package/dist/common/class/index.d.ts +2 -0
- package/dist/{schematics/utils → common/class}/index.js +2 -8
- package/dist/common/class/index.js.map +1 -0
- package/dist/common/class/view-mapper..d.ts +3 -0
- package/dist/common/class/view-mapper..js +7 -0
- package/dist/common/class/view-mapper..js.map +1 -0
- 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/dist/common/decorators/response/error-handler.decorator.d.ts +4 -0
- package/dist/common/decorators/response/error-handler.decorator.js +8 -0
- package/dist/common/decorators/response/error-handler.decorator.js.map +1 -0
- package/dist/common/decorators/response/handle-response.decorator.d.ts +1 -2
- package/dist/common/decorators/response/handle-response.decorator.js +13 -5
- package/dist/common/decorators/response/handle-response.decorator.js.map +1 -1
- package/dist/common/decorators/response/index.d.ts +2 -0
- package/dist/common/decorators/response/index.js +2 -0
- package/dist/common/decorators/response/index.js.map +1 -1
- package/dist/common/decorators/response/mapper.decorator.d.ts +6 -0
- package/dist/common/decorators/response/mapper.decorator.js +8 -0
- package/dist/common/decorators/response/mapper.decorator.js.map +1 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/common/index.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.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
|
@@ -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"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ConfigModule } from '@nestjs/config';
|
|
3
|
-
import { LoggerModule } from '@rafikidota/iroh';
|
|
4
|
-
import { ConfigurationModule } from './config/configuration.module';
|
|
5
|
-
|
|
6
|
-
import { ApiEnvConfig } from './config/api/env/api.env.config';
|
|
7
|
-
import { TypeormEnvConfig } from './config/database/env/typeorm.env.config';
|
|
8
|
-
|
|
9
|
-
import { ApiConfigValidationSchema } from './config/api/env/api.env.validation';
|
|
10
|
-
import { TypeormConfigValidationSchema } from './config/database/env/typeorm.env.validation';
|
|
11
|
-
import { SwaggerEnvConfig } from './config/swagger/env/swagger.env.config';
|
|
12
|
-
import { SwaggerConfigValidationSchema } from './config/swagger/env/swagger.env.validation';
|
|
13
|
-
|
|
14
|
-
const schemas = [
|
|
15
|
-
ApiConfigValidationSchema,
|
|
16
|
-
SwaggerConfigValidationSchema,
|
|
17
|
-
TypeormConfigValidationSchema,
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
const validationSchema = schemas.reduce((acc, schema) => acc.concat(schema));
|
|
21
|
-
|
|
22
|
-
@Module({
|
|
23
|
-
imports: [
|
|
24
|
-
ConfigModule.forRoot({
|
|
25
|
-
isGlobal: true,
|
|
26
|
-
load: [
|
|
27
|
-
ApiEnvConfig,
|
|
28
|
-
SwaggerEnvConfig,
|
|
29
|
-
TypeormEnvConfig
|
|
30
|
-
],
|
|
31
|
-
validationSchema,
|
|
32
|
-
}),
|
|
33
|
-
ConfigurationModule,
|
|
34
|
-
LoggerModule,
|
|
35
|
-
],
|
|
36
|
-
})
|
|
37
|
-
export class CommonModule {}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ApiConfigModule } from './api/api.config.module';
|
|
3
|
-
import { SwaggerConfigModule } from './swagger/swagger.config.module';
|
|
4
|
-
import { TypeormConfigModule } from './database/typeorm.config.module';
|
|
5
|
-
|
|
6
|
-
@Module({
|
|
7
|
-
imports: [
|
|
8
|
-
ApiConfigModule,
|
|
9
|
-
SwaggerConfigModule,
|
|
10
|
-
TypeormConfigModule,
|
|
11
|
-
],
|
|
12
|
-
exports: [
|
|
13
|
-
ApiConfigModule,
|
|
14
|
-
SwaggerConfigModule,
|
|
15
|
-
TypeormConfigModule,
|
|
16
|
-
],
|
|
17
|
-
})
|
|
18
|
-
export class ConfigurationModule {}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as dotenv from 'dotenv';
|
|
2
|
-
|
|
3
|
-
dotenv.config();
|
|
4
|
-
export const TypeormEnvConfig = () => ({
|
|
5
|
-
DB_TYPE: process.env.DB_TYPE,
|
|
6
|
-
DB_HOST: process.env.DB_HOST,
|
|
7
|
-
DB_PORT: process.env.DB_PORT,
|
|
8
|
-
DB_NAME: process.env.DB_NAME,
|
|
9
|
-
DB_USERNAME: process.env.DB_USERNAME,
|
|
10
|
-
DB_PASSWORD: process.env.DB_PASSWORD,
|
|
11
|
-
DB_SYNCHRONIZE: process.env.DB_SYNCHRONIZE,
|
|
12
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as joi from 'joi';
|
|
2
|
-
|
|
3
|
-
export const TypeormConfigValidationSchema = joi.object({
|
|
4
|
-
DB_TYPE: joi.string().required(),
|
|
5
|
-
DB_HOST: joi.string().required(),
|
|
6
|
-
DB_PORT: joi.number().required(),
|
|
7
|
-
DB_NAME: joi.string().required(),
|
|
8
|
-
DB_USERNAME: joi.string().required(),
|
|
9
|
-
DB_PASSWORD: joi.string().required(),
|
|
10
|
-
DB_SYNCHRONIZE: joi.boolean().required(),
|
|
11
|
-
});
|
|
File without changes
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ConfigModule } from '@nestjs/config';
|
|
3
|
-
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
4
|
-
import { TypeOrmUnitOfWorkModule } from '@rafikidota/iroh';
|
|
5
|
-
import { TypeormEnvConfig } from './env/typeorm.env.config';
|
|
6
|
-
import AppDataSource from './typeorm.data-source';
|
|
7
|
-
|
|
8
|
-
@Module({
|
|
9
|
-
imports: [
|
|
10
|
-
ConfigModule.forFeature(TypeormEnvConfig),
|
|
11
|
-
TypeOrmModule.forRoot(AppDataSource.options),
|
|
12
|
-
TypeOrmUnitOfWorkModule,
|
|
13
|
-
],
|
|
14
|
-
})
|
|
15
|
-
export class TypeormConfigModule { }
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
import { DataSource } from 'typeorm';
|
|
3
|
-
import { DataSourceOptions } from 'typeorm';
|
|
4
|
-
import * as dotenv from 'dotenv';
|
|
5
|
-
import { SnakeNamingStrategy } from '@rafikidota/serpens';
|
|
6
|
-
|
|
7
|
-
dotenv.config();
|
|
8
|
-
const processPath = process.cwd();
|
|
9
|
-
const rootPath = path.resolve(processPath, 'dist');
|
|
10
|
-
const migrationsPath = path.resolve(processPath, 'dist','common','config','database');
|
|
11
|
-
|
|
12
|
-
const config: DataSourceOptions = {
|
|
13
|
-
type: 'postgres',
|
|
14
|
-
host: process.env.DB_HOST,
|
|
15
|
-
port: Number(process.env.DB_PORT),
|
|
16
|
-
database: process.env.DB_NAME,
|
|
17
|
-
username: process.env.DB_USERNAME,
|
|
18
|
-
password: process.env.DB_PASSWORD,
|
|
19
|
-
entities: [rootPath + '/**/*.persistence{.ts,.js}'],
|
|
20
|
-
migrations: [migrationsPath + '/migrations/*{.ts,.js}'],
|
|
21
|
-
synchronize: process.env.DB_SYNCHRONIZE === 'true',
|
|
22
|
-
namingStrategy: new SnakeNamingStrategy(),
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default new DataSource(config);
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DocumentBuilder, SwaggerCustomOptions } from '@nestjs/swagger';
|
|
2
|
-
import { readFileSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
|
|
5
|
-
const loadPackageJson = () => {
|
|
6
|
-
const path = join(process.cwd(), 'package.json');
|
|
7
|
-
const data = readFileSync(path, 'utf-8');
|
|
8
|
-
return JSON.parse(data);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const { version } = loadPackageJson();
|
|
12
|
-
|
|
13
|
-
export const SwaggerDocument = new DocumentBuilder()
|
|
14
|
-
.setTitle('NestJS API')
|
|
15
|
-
.setDescription('Nestjs Endpoints')
|
|
16
|
-
.setVersion(version)
|
|
17
|
-
.addServer(`http://${process.env.API_HOST}:${process.env.API_PORT}`)
|
|
18
|
-
.addBearerAuth()
|
|
19
|
-
.addBasicAuth()
|
|
20
|
-
.build();
|
|
21
|
-
|
|
22
|
-
export const SwaggerOptions: SwaggerCustomOptions = {
|
|
23
|
-
swaggerOptions: { persistAuthorization: true },
|
|
24
|
-
};
|
|
@@ -1,69 +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
|
-
target.skipImport = true;
|
|
27
|
-
const location = new name_parser_1.NameParser().parse(target);
|
|
28
|
-
target.name = core_1.strings.dasherize(location.name);
|
|
29
|
-
target.path = (0, core_1.join)(core_1.strings.dasherize(location.path), target.name);
|
|
30
|
-
target.language = 'ts';
|
|
31
|
-
return target;
|
|
32
|
-
}
|
|
33
|
-
function generate(options) {
|
|
34
|
-
return (context) => (0, schematics_1.apply)((0, schematics_1.url)((0, core_1.join)('./files', options.language)), [
|
|
35
|
-
(0, schematics_1.template)({
|
|
36
|
-
...core_1.strings,
|
|
37
|
-
...options,
|
|
38
|
-
lowerCase: string_utils_1.lowerCase,
|
|
39
|
-
lowercased: (name) => {
|
|
40
|
-
const classifiedName = (0, strings_1.classify)(name);
|
|
41
|
-
return (classifiedName.charAt(0).toLowerCase() + classifiedName.slice(1));
|
|
42
|
-
},
|
|
43
|
-
upperCase: string_utils_1.upperCase,
|
|
44
|
-
camelize: strings_1.camelize,
|
|
45
|
-
dashToUnderscore: string_utils_1.dashToUnderscore,
|
|
46
|
-
}),
|
|
47
|
-
(0, schematics_1.move)(options.path),
|
|
48
|
-
])(context);
|
|
49
|
-
}
|
|
50
|
-
function addDeclarationToModule(options) {
|
|
51
|
-
return (tree) => {
|
|
52
|
-
if (options.skipImport !== undefined && options.skipImport) {
|
|
53
|
-
return tree;
|
|
54
|
-
}
|
|
55
|
-
options.module = new module_finder_1.ModuleFinder(tree).find({
|
|
56
|
-
name: options.name,
|
|
57
|
-
path: options.path,
|
|
58
|
-
});
|
|
59
|
-
if (!options.module) {
|
|
60
|
-
return tree;
|
|
61
|
-
}
|
|
62
|
-
const content = tree.read(options.module).toString();
|
|
63
|
-
const declarator = new utils_1.ModuleDeclarator();
|
|
64
|
-
const declarationOptions = Object.assign({}, options);
|
|
65
|
-
tree.overwrite(options.module, declarator.declare(content, declarationOptions));
|
|
66
|
-
return tree;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=init.factory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.factory.js","sourceRoot":"","sources":["../../../src/schematics/init/init.factory.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "InitSchema",
|
|
4
|
-
"title": "Nest Base Init Module Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"name": {
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "The name of the module.",
|
|
10
|
-
"default": ""
|
|
11
|
-
},
|
|
12
|
-
"path": {
|
|
13
|
-
"type": "string",
|
|
14
|
-
"format": "path",
|
|
15
|
-
"description": "The path to create the module.",
|
|
16
|
-
"default": ""
|
|
17
|
-
},
|
|
18
|
-
"module": {
|
|
19
|
-
"type": "string",
|
|
20
|
-
"format": "path",
|
|
21
|
-
"description": "The path to import the module."
|
|
22
|
-
},
|
|
23
|
-
"language": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"description": "Nest module language (ts/js)."
|
|
26
|
-
},
|
|
27
|
-
"sourceRoot": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"description": "Nest module source root directory."
|
|
30
|
-
},
|
|
31
|
-
"skipImport": {
|
|
32
|
-
"description": "Flag to skip the module import.",
|
|
33
|
-
"default": true
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
"required": []
|
|
37
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { Result } from '@rafikidota/iroh';
|
|
3
|
-
import { TypeOrmUnitOfWork } from '@rafikidota/iroh';
|
|
4
|
-
|
|
5
|
-
@Injectable()
|
|
6
|
-
export class <%= classify(name) %>UseCase {
|
|
7
|
-
constructor(readonly typeOrmUnitOfWork: TypeOrmUnitOfWork) {}
|
|
8
|
-
|
|
9
|
-
async execute() {
|
|
10
|
-
await this.typeOrmUnitOfWork.start();
|
|
11
|
-
|
|
12
|
-
return this.typeOrmUnitOfWork.commit(() => {
|
|
13
|
-
return this.work();
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async work() {
|
|
18
|
-
return Result.Ok();
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "UseCaseSchema",
|
|
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": true
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"required": [
|
|
41
|
-
"name"
|
|
42
|
-
]
|
|
43
|
-
}
|