@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.
Files changed (85) hide show
  1. package/collection.json +7 -7
  2. package/dist/common/decorators/dto/nested.decorator.d.ts +4 -0
  3. package/dist/common/decorators/dto/nested.decorator.js +17 -0
  4. package/dist/common/decorators/dto/nested.decorator.js.map +1 -0
  5. package/dist/common/decorators/dto/validator.namespace.d.ts +2 -0
  6. package/dist/common/decorators/dto/validator.namespace.js +9 -0
  7. package/dist/common/decorators/dto/validator.namespace.js.map +1 -1
  8. package/package.json +2 -8
  9. package/dist/schematics/crud/crud.factory.d.ts +0 -3
  10. package/dist/schematics/crud/crud.factory.js +0 -68
  11. package/dist/schematics/crud/crud.factory.js.map +0 -1
  12. package/dist/schematics/crud/files/ts/__name__.controller.ts +0 -61
  13. package/dist/schematics/crud/files/ts/__name__.module.ts +0 -14
  14. package/dist/schematics/crud/files/ts/__name__.service.ts +0 -11
  15. package/dist/schematics/crud/files/ts/aggregations/index.ts +0 -0
  16. package/dist/schematics/crud/files/ts/app/dto/__name__.create.dto.ts +0 -11
  17. package/dist/schematics/crud/files/ts/app/dto/__name__.update.dto.ts +0 -4
  18. package/dist/schematics/crud/files/ts/app/dto/__name__.view.ts +0 -30
  19. package/dist/schematics/crud/files/ts/app/use-cases/index.ts +0 -0
  20. package/dist/schematics/crud/files/ts/domain/__name__.domain.ts +0 -28
  21. package/dist/schematics/crud/files/ts/domain/__name__.interface.ts +0 -8
  22. package/dist/schematics/crud/files/ts/infra/__name__.mapper.ts +0 -35
  23. package/dist/schematics/crud/files/ts/infra/__name__.persistence.ts +0 -6
  24. package/dist/schematics/crud/files/ts/infra/__name__.repository.ts +0 -18
  25. package/dist/schematics/crud/files/ts/test/__name__.controller.spec.ts +0 -27
  26. package/dist/schematics/crud/files/ts/test/__name__.service.spec.ts +0 -25
  27. package/dist/schematics/crud/files/ts/test/provider/__name__.typeorm.repository.ts +0 -5
  28. package/dist/schematics/crud/schema.json +0 -43
  29. package/dist/schematics/defaults.d.ts +0 -6
  30. package/dist/schematics/defaults.js +0 -10
  31. package/dist/schematics/defaults.js.map +0 -1
  32. package/dist/schematics/init/files/ts/common/common.module.ts +0 -37
  33. package/dist/schematics/init/files/ts/common/config/api/api.config.module.ts +0 -8
  34. package/dist/schematics/init/files/ts/common/config/api/env/api.env.config.ts +0 -8
  35. package/dist/schematics/init/files/ts/common/config/api/env/api.env.validation.ts +0 -6
  36. package/dist/schematics/init/files/ts/common/config/configuration.module.ts +0 -18
  37. package/dist/schematics/init/files/ts/common/config/database/env/typeorm.env.config.ts +0 -12
  38. package/dist/schematics/init/files/ts/common/config/database/env/typeorm.env.validation.ts +0 -11
  39. package/dist/schematics/init/files/ts/common/config/database/migrations/index.ts +0 -0
  40. package/dist/schematics/init/files/ts/common/config/database/typeorm.config.module.ts +0 -15
  41. package/dist/schematics/init/files/ts/common/config/database/typeorm.data-source.ts +0 -25
  42. package/dist/schematics/init/files/ts/common/config/swagger/env/swagger.env.config.ts +0 -7
  43. package/dist/schematics/init/files/ts/common/config/swagger/env/swagger.env.validation.ts +0 -6
  44. package/dist/schematics/init/files/ts/common/config/swagger/swagger.config.module.ts +0 -8
  45. package/dist/schematics/init/files/ts/common/config/swagger/swagger.config.ts +0 -24
  46. package/dist/schematics/init/files/ts/modules/core.module.ts +0 -4
  47. package/dist/schematics/init/init.factory.d.ts +0 -3
  48. package/dist/schematics/init/init.factory.js +0 -69
  49. package/dist/schematics/init/init.factory.js.map +0 -1
  50. package/dist/schematics/init/schema.json +0 -37
  51. package/dist/schematics/use-case/files/ts/__name__.use-case.ts +0 -20
  52. package/dist/schematics/use-case/schema.json +0 -43
  53. package/dist/schematics/use-case/use-case.factory.d.ts +0 -3
  54. package/dist/schematics/use-case/use-case.factory.js +0 -68
  55. package/dist/schematics/use-case/use-case.factory.js.map +0 -1
  56. package/dist/schematics/utils/index.d.ts +0 -8
  57. package/dist/schematics/utils/index.js +0 -25
  58. package/dist/schematics/utils/index.js.map +0 -1
  59. package/dist/schematics/utils/metadata.manager.d.ts +0 -13
  60. package/dist/schematics/utils/metadata.manager.js +0 -166
  61. package/dist/schematics/utils/metadata.manager.js.map +0 -1
  62. package/dist/schematics/utils/module-import.declarator.d.ts +0 -10
  63. package/dist/schematics/utils/module-import.declarator.js +0 -40
  64. package/dist/schematics/utils/module-import.declarator.js.map +0 -1
  65. package/dist/schematics/utils/module-metadata.declarator.d.ts +0 -4
  66. package/dist/schematics/utils/module-metadata.declarator.js +0 -13
  67. package/dist/schematics/utils/module-metadata.declarator.js.map +0 -1
  68. package/dist/schematics/utils/module.declarator.d.ts +0 -22
  69. package/dist/schematics/utils/module.declarator.js +0 -30
  70. package/dist/schematics/utils/module.declarator.js.map +0 -1
  71. package/dist/schematics/utils/module.finder.d.ts +0 -13
  72. package/dist/schematics/utils/module.finder.js +0 -25
  73. package/dist/schematics/utils/module.finder.js.map +0 -1
  74. package/dist/schematics/utils/name.parser.d.ts +0 -12
  75. package/dist/schematics/utils/name.parser.js +0 -18
  76. package/dist/schematics/utils/name.parser.js.map +0 -1
  77. package/dist/schematics/utils/path.solver.d.ts +0 -4
  78. package/dist/schematics/utils/path.solver.js +0 -13
  79. package/dist/schematics/utils/path.solver.js.map +0 -1
  80. package/dist/schematics/utils/source-root.helpers.d.ts +0 -6
  81. package/dist/schematics/utils/source-root.helpers.js +0 -25
  82. package/dist/schematics/utils/source-root.helpers.js.map +0 -1
  83. package/dist/schematics/utils/string-utils.d.ts +0 -3
  84. package/dist/schematics/utils/string-utils.js +0 -15
  85. package/dist/schematics/utils/string-utils.js.map +0 -1
@@ -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,8 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { ConfigModule } from '@nestjs/config';
3
- import { ApiEnvConfig } from './env/api.env.config';
4
-
5
- @Module({
6
- imports: [ConfigModule.forFeature(ApiEnvConfig)],
7
- })
8
- export class ApiConfigModule {}
@@ -1,8 +0,0 @@
1
- import * as dotenv from 'dotenv';
2
-
3
- dotenv.config();
4
- export const ApiEnvConfig = () => ({
5
- API_HOST: process.env.API_HOST,
6
- API_PORT: Number(process.env.API_PORT) || 3000,
7
- ENVIRONMENT: process.env.NODE_ENV || 'dev',
8
- });
@@ -1,6 +0,0 @@
1
- import * as joi from 'joi';
2
-
3
- export const ApiConfigValidationSchema = joi.object({
4
- API_HOST: joi.string().required(),
5
- API_PORT: joi.string().required(),
6
- });
@@ -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
- });
@@ -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,7 +0,0 @@
1
- import * as dotenv from 'dotenv';
2
-
3
- dotenv.config();
4
- export const SwaggerEnvConfig = () => ({
5
- SWAGGER: process.env.SWAGGER,
6
- SWAGGER_JSON: process.env.SWAGGER_JSON,
7
- });
@@ -1,6 +0,0 @@
1
- import * as joi from 'joi';
2
-
3
- export const SwaggerConfigValidationSchema = joi.object({
4
- SWAGGER: joi.string().required(),
5
- SWAGGER_JSON: joi.string().required(),
6
- });
@@ -1,8 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { ConfigModule } from '@nestjs/config';
3
- import { SwaggerEnvConfig } from './env/swagger.env.config';
4
-
5
- @Module({
6
- imports: [ConfigModule.forFeature(SwaggerEnvConfig)],
7
- })
8
- export class SwaggerConfigModule {}
@@ -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,4 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
-
3
- @Module({})
4
- export class CoreModule {}
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { InitOptions } from './schema';
3
- export declare function main(options: InitOptions): Rule;
@@ -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":";;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,OAAoB;IACvC,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,OAAO,IAAA,2BAAc,EACnB,IAAA,kBAAK,EAAC;YACJ,IAAA,qCAAe,EAAC,OAAO,CAAC;YACxB,sBAAsB,CAAC,OAAO,CAAC;YAC/B,IAAA,sBAAS,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC7B,CAAC,CACH,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,OAAoB;IACrC,MAAM,MAAM,GAAgB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAEvD,MAAM,CAAC,QAAQ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CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,MAAM,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;YAC3C,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,OAAO,CAAC,IAAY;SAC3B,CAAE,CAAC;QACJ,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;QAErD,MAAM,UAAU,GAAqB,IAAI,wBAAgB,EAAE,CAAC;QAI5D,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC,EAEC,EACD,OAAO,CACR,CAAC;QAEF,IAAI,CAAC,SAAS,CACZ,OAAO,CAAC,MAAM,EACd,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAwC,CAAC,CACtE,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -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
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { UseCaseOptions } from './schema';
3
- export declare function main(options: UseCaseOptions): Rule;
@@ -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=use-case.factory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-case.factory.js","sourceRoot":"","sources":["../../../src/schematics/use-case/use-case.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,OAAuB;IAC1C,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,OAAO,IAAA,2BAAc,EACnB,IAAA,kBAAK,EAAC;YACJ,IAAA,qCAAe,EAAC,OAAO,CAAC;YACxB,sBAAsB,CAAC,OAAO,CAAC;YAC/B,IAAA,sBAAS,EAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC7B,CAAC,CACH,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,OAAuB;IACxC,MAAM,MAAM,GAAmB,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE1D,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC;IAEvB,MAAM,QAAQ,GAAa,IAAI,wBAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,CAAC,IAAI,GAAG,cAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,GAAG,IAAA,WAAI,EAAC,cAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,OAAO,MAAM,CAAC;AAChB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CAAC;QAErD,MAAM,UAAU,GAAqB,IAAI,wBAAgB,EAAE,CAAC;QAI5D,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC,EAEC,EACD,OAAO,CACR,CAAC;QAEF,IAAI,CAAC,SAAS,CACZ,OAAO,CAAC,MAAM,EACd,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,kBAAwC,CAAC,CACtE,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- export * from './metadata.manager';
2
- export * from './module-import.declarator';
3
- export * from './module-metadata.declarator';
4
- export * from './module.declarator';
5
- export * from './module.finder';
6
- export * from './name.parser';
7
- export * from './path.solver';
8
- export * from './source-root.helpers';
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./metadata.manager"), exports);
18
- __exportStar(require("./module-import.declarator"), exports);
19
- __exportStar(require("./module-metadata.declarator"), exports);
20
- __exportStar(require("./module.declarator"), exports);
21
- __exportStar(require("./module.finder"), exports);
22
- __exportStar(require("./name.parser"), exports);
23
- __exportStar(require("./path.solver"), exports);
24
- __exportStar(require("./source-root.helpers"), exports);
25
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schematics/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,6DAA2C;AAC3C,+DAA6C;AAC7C,sDAAoC;AACpC,kDAAgC;AAChC,gDAA8B;AAC9B,gDAA8B;AAC9B,wDAAsC"}
@@ -1,13 +0,0 @@
1
- import { DeclarationOptions } from './module.declarator';
2
- export declare class MetadataManager {
3
- private content;
4
- constructor(content: string);
5
- insert(metadata: string, symbol: string, staticOptions?: DeclarationOptions['staticOptions']): string;
6
- private getDecoratorMetadata;
7
- private getSourceNodes;
8
- private insertMetadataToEmptyModuleDecorator;
9
- private insertNewMetadataToDecorator;
10
- private insertSymbolToMetadata;
11
- private mergeSymbolAndExpr;
12
- private addBlankLines;
13
- }