@solidxai/code-builder 0.1.4 → 0.1.6-beta.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 (53) hide show
  1. package/CLAUDE.md +18 -0
  2. package/LICENSE +89 -0
  3. package/README.md +17 -19
  4. package/dist/code-builder/index.js +6 -6
  5. package/dist/code-builder/index.js.map +1 -1
  6. package/dist/code-builder/lib/field/decorator-managers/dto/RegexDecoratorManager.js +11 -1
  7. package/dist/code-builder/lib/field/decorator-managers/dto/RegexDecoratorManager.js.map +1 -1
  8. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToManyDecoratorManager.js +6 -5
  9. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToManyDecoratorManager.js.map +1 -1
  10. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.js +3 -3
  11. package/dist/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.js.map +1 -1
  12. package/dist/code-builder/lib/field/decorator-managers/entity/OneToManyDecoratorManager.js +7 -6
  13. package/dist/code-builder/lib/field/decorator-managers/entity/OneToManyDecoratorManager.js.map +1 -1
  14. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.js +5 -4
  15. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.js.map +1 -1
  16. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.js +5 -4
  17. package/dist/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.js.map +1 -1
  18. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.js +26 -19
  19. package/dist/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.js.map +1 -1
  20. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForDto.js +5 -4
  21. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForDto.js.map +1 -1
  22. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForEntity.js +6 -5
  23. package/dist/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForEntity.js.map +1 -1
  24. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForEntity.js +7 -6
  25. package/dist/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForEntity.js.map +1 -1
  26. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForDto.js +5 -4
  27. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForDto.js.map +1 -1
  28. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForEntity.js +6 -5
  29. package/dist/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForEntity.js.map +1 -1
  30. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.js +26 -19
  31. package/dist/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.js.map +1 -1
  32. package/dist/code-builder/lib/model/helpers.js +30 -29
  33. package/dist/code-builder/lib/model/helpers.js.map +1 -1
  34. package/dist/code-builder/lib/string.utils.d.ts +1 -0
  35. package/dist/code-builder/lib/string.utils.js +7 -0
  36. package/dist/code-builder/lib/string.utils.js.map +1 -0
  37. package/package.json +2 -2
  38. package/src/code-builder/index.ts +6 -9
  39. package/src/code-builder/lib/field/decorator-managers/dto/RegexDecoratorManager.ts +16 -1
  40. package/src/code-builder/lib/field/decorator-managers/entity/ManyToManyDecoratorManager.ts +5 -5
  41. package/src/code-builder/lib/field/decorator-managers/entity/ManyToOneDecoratorManager.ts +1 -1
  42. package/src/code-builder/lib/field/decorator-managers/entity/OneToManyDecoratorManager.ts +6 -6
  43. package/src/code-builder/lib/field/field-managers/base/BaseFieldManagerForDto.ts +4 -6
  44. package/src/code-builder/lib/field/field-managers/base/BaseFieldManagerForEntity.ts +3 -9
  45. package/src/code-builder/lib/field/field-managers/long-text/LongTextFieldManagerForEntity.ts +27 -27
  46. package/src/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForDto.ts +3 -2
  47. package/src/code-builder/lib/field/field-managers/relation/ManyToManyRelationFieldManagerForEntity.ts +4 -3
  48. package/src/code-builder/lib/field/field-managers/relation/ManyToOneRelationFieldManagerForEntity.ts +4 -3
  49. package/src/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForDto.ts +3 -4
  50. package/src/code-builder/lib/field/field-managers/relation/OneToManyRelationFieldManagerForEntity.ts +4 -4
  51. package/src/code-builder/lib/field/field-managers/rich-text/RichTextFieldManagerForEntity.ts +27 -27
  52. package/src/code-builder/lib/model/helpers.ts +18 -19
  53. package/src/code-builder/lib/string.utils.ts +3 -0
@@ -2,7 +2,7 @@ import { Tree } from '@angular-devkit/schematics';
2
2
  import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
3
3
  import { FieldManager, FieldType } from '../../FieldManager';
4
4
  import { BaseFieldManagerForEntity } from '../base/BaseFieldManagerForEntity';
5
- import { SupportedDatabases, transformColumnOptionForDatabase } from '../../db-helpers';
5
+ import { SupportedDatabases } from '../../db-helpers';
6
6
 
7
7
  //FIXME Implementation pending
8
8
  export class LongTextFieldManagerForEntity
@@ -24,15 +24,15 @@ export class LongTextFieldManagerForEntity
24
24
  protected override additionalColumnDecoratorOptions(): Map<string, any> {
25
25
  const options = new Map<string, any>();
26
26
  //console.log(`Configuring LongText field with max length ${this.field.max} for database ${this.dataSourceType}`);
27
- if (this.field.max) {
28
- options.set('length', transformColumnOptionForDatabase(
29
- 'length',
30
- this.field.max,
31
- this.field.ormType,
32
- this.dataSourceType,
33
- )
34
- );
35
- }
27
+ // if (this.field.max) {
28
+ // options.set('length', transformColumnOptionForDatabase(
29
+ // 'length',
30
+ // this.field.max,
31
+ // this.field.ormType,
32
+ // this.dataSourceType,
33
+ // )
34
+ // );
35
+ // }
36
36
 
37
37
  options.set('default', this.defaultValueInitializer(this.field.defaultValue)?.value ?? null);
38
38
  return options;
@@ -40,24 +40,24 @@ export class LongTextFieldManagerForEntity
40
40
 
41
41
  protected override additionalColumnDecoratorOptionExpressions(): Map<string, ts.Expression | null> {
42
42
  const options = new Map<string, ts.Expression | null>();
43
- if (this.field.max) {
44
- const lengthValue = transformColumnOptionForDatabase(
45
- 'length',
46
- this.field.max,
47
- this.field.ormType,
48
- this.dataSourceType,
49
- );
43
+ // if (this.field.max) {
44
+ // const lengthValue = transformColumnOptionForDatabase(
45
+ // 'length',
46
+ // this.field.max,
47
+ // this.field.ormType,
48
+ // this.dataSourceType,
49
+ // );
50
50
 
51
- if (typeof lengthValue === 'number') {
52
- options.set('length', ts.factory.createNumericLiteral(lengthValue));
53
- } else if (typeof lengthValue === 'string') {
54
- options.set('length', ts.factory.createStringLiteral(lengthValue));
55
- } else {
56
- options.set('length', null);
57
- }
58
- } else {
59
- options.set('length', null);
60
- }
51
+ // if (typeof lengthValue === 'number') {
52
+ // options.set('length', ts.factory.createNumericLiteral(lengthValue));
53
+ // } else if (typeof lengthValue === 'string') {
54
+ // options.set('length', ts.factory.createStringLiteral(lengthValue));
55
+ // } else {
56
+ // options.set('length', null);
57
+ // }
58
+ // } else {
59
+ // options.set('length', null);
60
+ // }
61
61
 
62
62
  options.set('default', this.defaultValueInitializer(this.field.defaultValue)?.expression ?? null);
63
63
  return options
@@ -1,4 +1,5 @@
1
- import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
1
+ import { kebabCase } from 'lodash';
2
+ import { classify } from '../../../string.utils';
2
3
  import { Tree } from '@angular-devkit/schematics';
3
4
  import ts, { PropertyDeclaration } from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
4
5
  import { Change } from '@schematics/angular/utility/change';
@@ -270,7 +271,7 @@ export class ManyToManyRelationFieldManagerForDto
270
271
  }
271
272
 
272
273
  relatedFieldImport(): Change {
273
- const relatedEntityImportName = `update-${dasherize(this.field.relationCoModelSingularName)}.dto`;
274
+ const relatedEntityImportName = `update-${kebabCase(this.field.relationCoModelSingularName)}.dto`;
274
275
  const relatedEntityPath = this.field.relationModelModuleName ? `src/${this.field.relationModelModuleName}/dtos/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
275
276
  return safeInsertImport(this.source, `Update${classify(this.field.relationCoModelSingularName)}Dto`, relatedEntityPath, this.moduleName);
276
277
  // return insertImport(this.source, this.source.fileName, `Update${classify(this.field.relationCoModelSingularName)}Dto`, relatedEntityPath);
@@ -1,4 +1,5 @@
1
- import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
1
+ import { kebabCase } from 'lodash';
2
+ import { classify } from '../../../string.utils';
2
3
  import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
3
4
  import { Change } from '@schematics/angular/utility/change';
4
5
  import { FieldChange, FieldManager, FieldType, safeInsertImport } from '../../FieldManager';
@@ -51,8 +52,8 @@ export class ManyToManyRelationFieldManagerForEntity
51
52
  }
52
53
 
53
54
  relatedFieldImport(): Change {
54
- const relatedEntityImportName = `${dasherize(this.field.relationCoModelSingularName)}.entity`;
55
- const relatedEntityPath = this.field.relationModelModuleName ? `src/${dasherize(this.field.relationModelModuleName)}/entities/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
55
+ const relatedEntityImportName = `${kebabCase(this.field.relationCoModelSingularName)}.entity`;
56
+ const relatedEntityPath = this.field.relationModelModuleName ? `src/${kebabCase(this.field.relationModelModuleName)}/entities/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
56
57
  return safeInsertImport(this.source, classify(this.field.relationCoModelSingularName), relatedEntityPath, this.moduleName);
57
58
  }
58
59
 
@@ -1,4 +1,5 @@
1
- import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
1
+ import { kebabCase } from 'lodash';
2
+ import { classify } from '../../../string.utils';
2
3
  import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
3
4
  import { Change } from '@schematics/angular/utility/change';
4
5
  import { FieldChange, FieldManager, FieldType, safeInsertImport } from '../../FieldManager';
@@ -45,8 +46,8 @@ export class ManyToOneRelationFieldManagerForEntity
45
46
  }
46
47
 
47
48
  relatedFieldImport(): Change {
48
- const relatedEntityImportName = `${dasherize(this.field.relationCoModelSingularName)}.entity`;
49
- const relatedEntityPath = this.field.relationModelModuleName ? `src/${dasherize(this.field.relationModelModuleName)}/entities/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
49
+ const relatedEntityImportName = `${kebabCase(this.field.relationCoModelSingularName)}.entity`;
50
+ const relatedEntityPath = this.field.relationModelModuleName ? `src/${kebabCase(this.field.relationModelModuleName)}/entities/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
50
51
  return safeInsertImport(this.source, classify(this.field.relationCoModelSingularName), relatedEntityPath, this.moduleName);
51
52
  }
52
53
 
@@ -1,4 +1,5 @@
1
- import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
1
+ import { kebabCase } from 'lodash';
2
+ import { classify } from '../../../string.utils';
2
3
  import { Tree } from '@angular-devkit/schematics';
3
4
  import ts, { PropertyDeclaration } from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
4
5
  import { Change } from '@schematics/angular/utility/change';
@@ -134,7 +135,6 @@ export class OneToManyRelationFieldManagerForDto
134
135
 
135
136
  }
136
137
 
137
-
138
138
  override updateField(): FieldChange[] {
139
139
  const fieldChanges: FieldChange[] = super.updateField();
140
140
 
@@ -215,7 +215,6 @@ export class OneToManyRelationFieldManagerForDto
215
215
  }
216
216
  }
217
217
 
218
-
219
218
  override removeAdditionalField(): FieldChange[] {
220
219
  const fieldChanges: FieldChange[] = [];
221
220
 
@@ -243,7 +242,7 @@ export class OneToManyRelationFieldManagerForDto
243
242
  }
244
243
 
245
244
  relatedFieldImport(): Change {
246
- const relatedEntityImportName = `update-${dasherize(this.field.relationCoModelSingularName)}.dto`;
245
+ const relatedEntityImportName = `update-${kebabCase(this.field.relationCoModelSingularName)}.dto`;
247
246
  const relatedEntityPath = this.field.relationModelModuleName ? `src/${this.field.relationModelModuleName}/dtos/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
248
247
  return safeInsertImport(this.source, `Update${classify(this.field.relationCoModelSingularName)}Dto`, relatedEntityPath, this.moduleName);
249
248
  // return insertImport(this.source, this.source.fileName, `Update${classify(this.field.relationCoModelSingularName)}Dto`, relatedEntityPath);
@@ -1,4 +1,5 @@
1
- import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
1
+ import { kebabCase } from 'lodash';
2
+ import { classify } from '../../../string.utils';
2
3
  import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
3
4
  import { Change } from '@schematics/angular/utility/change';
4
5
  import { FieldChange, FieldManager, FieldType, safeInsertImport } from '../../FieldManager';
@@ -29,12 +30,11 @@ export class OneToManyRelationFieldManagerForEntity
29
30
  }
30
31
 
31
32
  relatedFieldImport(): Change {
32
- const relatedEntityImportName = `${dasherize(this.field.relationCoModelSingularName)}.entity`;
33
- const relatedEntityPath = this.field.relationModelModuleName ? `src/${dasherize(this.field.relationModelModuleName)}/entities/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
33
+ const relatedEntityImportName = `${kebabCase(this.field.relationCoModelSingularName)}.entity`;
34
+ const relatedEntityPath = this.field.relationModelModuleName ? `src/${kebabCase(this.field.relationModelModuleName)}/entities/${relatedEntityImportName}` : `./${relatedEntityImportName}`;
34
35
  return safeInsertImport(this.source, classify(this.field.relationCoModelSingularName), relatedEntityPath, this.moduleName);
35
36
  }
36
37
 
37
-
38
38
  fieldType(): FieldType { // The inverse field type will remain the same for both one-to-many and many-to-many relations
39
39
  const type = `${classify(this.field.relationCoModelSingularName)}`
40
40
  const text = `${type}[]`
@@ -2,7 +2,7 @@ import { Tree } from '@angular-devkit/schematics';
2
2
  import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
3
3
  import { FieldManager, FieldType } from '../../FieldManager';
4
4
  import { BaseFieldManagerForEntity } from '../base/BaseFieldManagerForEntity';
5
- import { SupportedDatabases, transformColumnOptionForDatabase } from '../../db-helpers';
5
+ import { SupportedDatabases } from '../../db-helpers';
6
6
 
7
7
  //FIXME Implementation pending
8
8
  export class RichTextFieldManagerForEntity
@@ -23,39 +23,39 @@ export class RichTextFieldManagerForEntity
23
23
 
24
24
  protected override additionalColumnDecoratorOptions(): Map<string, any> {
25
25
  const options = new Map<string, any>();
26
- if (this.field.max) {
27
- options.set('length', transformColumnOptionForDatabase(
28
- 'length',
29
- this.field.max,
30
- this.field.ormType,
31
- this.dataSourceType,
32
- )
33
- );
34
- }
26
+ // if (this.field.max) {
27
+ // options.set('length', transformColumnOptionForDatabase(
28
+ // 'length',
29
+ // this.field.max,
30
+ // this.field.ormType,
31
+ // this.dataSourceType,
32
+ // )
33
+ // );
34
+ // }
35
35
  options.set('default', this.defaultValueInitializer(this.field.defaultValue)?.value ?? null);
36
36
  return options;
37
37
  }
38
38
 
39
39
  protected override additionalColumnDecoratorOptionExpressions(): Map<string, ts.Expression | null> {
40
40
  const options = new Map<string, ts.Expression | null>();
41
- if (this.field.max) {
42
- const lengthValue = transformColumnOptionForDatabase(
43
- 'length',
44
- this.field.max,
45
- this.field.ormType,
46
- this.dataSourceType,
47
- );
41
+ // if (this.field.max) {
42
+ // const lengthValue = transformColumnOptionForDatabase(
43
+ // 'length',
44
+ // this.field.max,
45
+ // this.field.ormType,
46
+ // this.dataSourceType,
47
+ // );
48
48
 
49
- if (typeof lengthValue === 'number') {
50
- options.set('length', ts.factory.createNumericLiteral(lengthValue));
51
- } else if (typeof lengthValue === 'string') {
52
- options.set('length', ts.factory.createStringLiteral(lengthValue));
53
- } else {
54
- options.set('length', null);
55
- }
56
- } else {
57
- options.set('length', null);
58
- }
49
+ // if (typeof lengthValue === 'number') {
50
+ // options.set('length', ts.factory.createNumericLiteral(lengthValue));
51
+ // } else if (typeof lengthValue === 'string') {
52
+ // options.set('length', ts.factory.createStringLiteral(lengthValue));
53
+ // } else {
54
+ // options.set('length', null);
55
+ // }
56
+ // } else {
57
+ // options.set('length', null);
58
+ // }
59
59
  options.set('default', this.defaultValueInitializer(this.field.defaultValue)?.expression ?? null);
60
60
  return options
61
61
  }
@@ -1,4 +1,5 @@
1
- import { classify, dasherize } from '@angular-devkit/core/src/utils/strings';
1
+ import { kebabCase } from 'lodash';
2
+ import { classify } from '../string.utils';
2
3
  import { Tree } from '@angular-devkit/schematics';
3
4
  import { MetadataManager } from '@nestjs/schematics';
4
5
  import ts from '@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript';
@@ -17,7 +18,6 @@ import { SupportedDatabases } from '../field/db-helpers';
17
18
  export const SOLID_CORE_MODULE_NAME = 'solid-core';
18
19
  export const SOLID_CORE_MODULE_NPM_PACKAGE_NAME = '@solidxai/core';
19
20
 
20
-
21
21
  // export const CHECKSUM_FILE_PATH = 'code-builder/output/checksums.json';
22
22
  export const CHECKSUM_HASH_ALGORITHM = 'md5';
23
23
  export enum Command {
@@ -95,27 +95,27 @@ export function getSolidImports(
95
95
  case SolidProviderType.Dto:
96
96
  return {
97
97
  symbolName: `Create${classify(modelName)}Dto`,
98
- importPath: `./dtos/create-${dasherize(modelName)}.dto`,
98
+ importPath: `./dtos/create-${kebabCase(modelName)}.dto`,
99
99
  };
100
100
  case SolidProviderType.Service:
101
101
  return {
102
102
  symbolName: `${classify(modelName)}Service`,
103
- importPath: `./services/${dasherize(modelName)}.service`,
103
+ importPath: `./services/${kebabCase(modelName)}.service`,
104
104
  };
105
105
  case SolidProviderType.Controller:
106
106
  return {
107
107
  symbolName: `${classify(modelName)}Controller`,
108
- importPath: `./controllers/${dasherize(modelName)}.controller`,
108
+ importPath: `./controllers/${kebabCase(modelName)}.controller`,
109
109
  };
110
110
  case SolidProviderType.Entity:
111
111
  return {
112
112
  symbolName: `${classify(modelName)}`,
113
- importPath: `./entities/${dasherize(modelName)}.entity`,
113
+ importPath: `./entities/${kebabCase(modelName)}.entity`,
114
114
  };
115
115
  case SolidProviderType.Repository:
116
116
  return {
117
117
  symbolName: `${classify(modelName)}Repository`,
118
- importPath: `./repositories/${dasherize(modelName)}.repository`,
118
+ importPath: `./repositories/${kebabCase(modelName)}.repository`,
119
119
  };
120
120
  default:
121
121
  throw Error('Invalid SolidProviderType');
@@ -251,7 +251,7 @@ function getModuleMetadataFilePath(moduleName: string) {
251
251
  return `src/${moduleName}/seeders/seed-data/${moduleName}-metadata.json`
252
252
  }
253
253
  else {
254
- return `module-metadata/${dasherize(moduleName)}/${dasherize(moduleName)}-metadata.json`;
254
+ return `module-metadata/${kebabCase(moduleName)}/${kebabCase(moduleName)}-metadata.json`;
255
255
  }
256
256
  }
257
257
 
@@ -262,7 +262,6 @@ function getModuleMetadataFilePath(moduleName: string) {
262
262
  // return checksums.filter((checksum: Checksum) => checksum.filePath === filePath).pop();
263
263
  // }
264
264
 
265
-
266
265
  function applyChanges(tree: Tree, filePath: string, changes: Change[]) {
267
266
  /*
268
267
  //Given the filePath, generate a checksum of the file from the content of the file
@@ -416,15 +415,15 @@ export function getSourceFilePathsAffected(command: Command, options: any): stri
416
415
  const sourceFilePaths: string[] = [];
417
416
  switch (command) {
418
417
  case Command.AddModule:
419
- sourceFilePaths.push(`src/${dasherize(options.module)}/${dasherize(options.module)}.module.ts`);
418
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/${kebabCase(options.module)}.module.ts`);
420
419
  break;
421
420
  case Command.AddModel:
422
- sourceFilePaths.push(`src/${dasherize(options.module)}/${dasherize(options.module)}.module.ts`);
423
- sourceFilePaths.push(`src/${dasherize(options.module)}/services/${dasherize(options.model)}.service.ts`);
424
- sourceFilePaths.push(`src/${dasherize(options.module)}/controllers/${dasherize(options.model)}.controller.ts`);
425
- sourceFilePaths.push(`src/${dasherize(options.module)}/entities/${dasherize(options.model)}.entity.ts`);
426
- sourceFilePaths.push(`src/${dasherize(options.module)}/dtos/create-${dasherize(options.model)}.dto.ts`);
427
- sourceFilePaths.push(`src/${dasherize(options.module)}/dtos/update-${dasherize(options.model)}.dto.ts`);
421
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/${kebabCase(options.module)}.module.ts`);
422
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/services/${kebabCase(options.model)}.service.ts`);
423
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/controllers/${kebabCase(options.model)}.controller.ts`);
424
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/entities/${kebabCase(options.model)}.entity.ts`);
425
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/dtos/create-${kebabCase(options.model)}.dto.ts`);
426
+ sourceFilePaths.push(`src/${kebabCase(options.module)}/dtos/update-${kebabCase(options.model)}.dto.ts`);
428
427
  break;
429
428
  default:
430
429
  throw Error('Invalid command');
@@ -543,7 +542,7 @@ export function outputEntitySuperClassImport(module: string, isLegacyTable: bool
543
542
  let importPath: string = isLegacyTableWithId ? SOLID_CORE_MODULE_NPM_PACKAGE_NAME : isLegacyTable ? SOLID_CORE_MODULE_NPM_PACKAGE_NAME : calculateModuleFileImportPath(module, `src/entities/common.entity`);
544
543
  let importSymbol: string = isLegacyTableWithId ? "LegacyCommonWithIdEntity" : isLegacyTable ? "LegacyCommonEntity" : "CommonEntity";
545
544
  if (parentModel != null) {
546
- importPath = calculateParentModuleFileImportPath(parentModule, `src/${dasherize(parentModule)}/entities/${dasherize(parentModel)}.entity`);
545
+ importPath = calculateParentModuleFileImportPath(parentModule, `src/${kebabCase(parentModule)}/entities/${kebabCase(parentModel)}.entity`);
547
546
  importSymbol = `${classify(parentModel)}`;
548
547
  }
549
548
  return `import { ${importSymbol} } from '${importPath}';`;
@@ -556,10 +555,10 @@ export function outputParentImportPathForDto(parentModel: string | null = null,
556
555
  let importPath = ``;
557
556
  let importSymbol = ``;
558
557
  if (context === DtoSourceType.Update) {
559
- importPath = parentModule === SOLID_CORE_MODULE_NAME ? SOLID_CORE_MODULE_NPM_PACKAGE_NAME : `src/${dasherize(parentModule)}/dtos/update-${dasherize(parentModel)}.dto.ts`;
558
+ importPath = parentModule === SOLID_CORE_MODULE_NAME ? SOLID_CORE_MODULE_NPM_PACKAGE_NAME : `src/${kebabCase(parentModule)}/dtos/update-${kebabCase(parentModel)}.dto.ts`;
560
559
  importSymbol = `Update${classify(parentModel)}Dto`;
561
560
  } else if (context === DtoSourceType.Create) {
562
- importPath = parentModule === SOLID_CORE_MODULE_NAME ? SOLID_CORE_MODULE_NPM_PACKAGE_NAME : `src/${dasherize(parentModule)}/dtos/create-${dasherize(parentModel)}.dto.ts`;
561
+ importPath = parentModule === SOLID_CORE_MODULE_NAME ? SOLID_CORE_MODULE_NPM_PACKAGE_NAME : `src/${kebabCase(parentModule)}/dtos/create-${kebabCase(parentModel)}.dto.ts`;
563
562
  importSymbol = `Create${classify(parentModel)}Dto`;
564
563
  }
565
564
  return `import { ${importSymbol} } from '${importPath}';`;
@@ -0,0 +1,3 @@
1
+ import { upperFirst, camelCase } from 'lodash';
2
+
3
+ export const classify = (s: string): string => upperFirst(camelCase(s));