@carlonicora/nestjs-neo4jsonapi 1.3.0 → 1.4.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 (120) hide show
  1. package/dist/foundations/auth/auth.module.d.ts.map +1 -1
  2. package/dist/foundations/auth/auth.module.js +9 -6
  3. package/dist/foundations/auth/auth.module.js.map +1 -1
  4. package/dist/foundations/auth/controllers/auth.discord.controller.d.ts +9 -0
  5. package/dist/foundations/auth/controllers/auth.discord.controller.d.ts.map +1 -0
  6. package/dist/foundations/{discord/controllers/discord.controller.js → auth/controllers/auth.discord.controller.js} +19 -19
  7. package/dist/foundations/auth/controllers/auth.discord.controller.js.map +1 -0
  8. package/dist/foundations/{discord/services/discord.service.d.ts → auth/services/auth.discord.service.d.ts} +7 -7
  9. package/dist/foundations/auth/services/auth.discord.service.d.ts.map +1 -0
  10. package/dist/foundations/{discord/services/discord.service.js → auth/services/auth.discord.service.js} +16 -14
  11. package/dist/foundations/auth/services/auth.discord.service.js.map +1 -0
  12. package/dist/foundations/discord-user/discord.module.d.ts +3 -0
  13. package/dist/foundations/discord-user/discord.module.d.ts.map +1 -0
  14. package/dist/foundations/{discord → discord-user}/discord.module.js +10 -13
  15. package/dist/foundations/discord-user/discord.module.js.map +1 -0
  16. package/dist/foundations/{discord/entities/discord.d.ts → discord-user/entities/discord-user.d.ts} +4 -4
  17. package/dist/foundations/discord-user/entities/discord-user.d.ts.map +1 -0
  18. package/dist/foundations/{discord/entities/discord.js → discord-user/entities/discord-user.js} +7 -7
  19. package/dist/foundations/discord-user/entities/discord-user.js.map +1 -0
  20. package/dist/foundations/{discord/repositories/discord.repository.d.ts → discord-user/repositories/discord-user.repository.d.ts} +5 -5
  21. package/dist/foundations/discord-user/repositories/discord-user.repository.d.ts.map +1 -0
  22. package/dist/foundations/{discord/repositories/discord.repository.js → discord-user/repositories/discord-user.repository.js} +9 -9
  23. package/dist/foundations/discord-user/repositories/discord-user.repository.js.map +1 -0
  24. package/dist/foundations/discord-user/types/discord.user.type.d.ts.map +1 -0
  25. package/dist/foundations/discord-user/types/discord.user.type.js.map +1 -0
  26. package/dist/foundations/foundations.modules.js +2 -2
  27. package/dist/foundations/foundations.modules.js.map +1 -1
  28. package/dist/scripts/generate-module/generator.d.ts +13 -0
  29. package/dist/scripts/generate-module/generator.d.ts.map +1 -0
  30. package/dist/scripts/generate-module/generator.js +193 -0
  31. package/dist/scripts/generate-module/generator.js.map +1 -0
  32. package/dist/scripts/generate-module/index.d.ts +3 -0
  33. package/dist/scripts/generate-module/index.d.ts.map +1 -0
  34. package/dist/scripts/generate-module/index.js +70 -0
  35. package/dist/scripts/generate-module/index.js.map +1 -0
  36. package/dist/scripts/generate-module/templates/controller.template.d.ts +9 -0
  37. package/dist/scripts/generate-module/templates/controller.template.d.ts.map +1 -0
  38. package/dist/scripts/generate-module/templates/controller.template.js +177 -0
  39. package/dist/scripts/generate-module/templates/controller.template.js.map +1 -0
  40. package/dist/scripts/generate-module/templates/dto.base.template.d.ts +9 -0
  41. package/dist/scripts/generate-module/templates/dto.base.template.d.ts.map +1 -0
  42. package/dist/scripts/generate-module/templates/dto.base.template.js +39 -0
  43. package/dist/scripts/generate-module/templates/dto.base.template.js.map +1 -0
  44. package/dist/scripts/generate-module/templates/dto.post.template.d.ts +9 -0
  45. package/dist/scripts/generate-module/templates/dto.post.template.d.ts.map +1 -0
  46. package/dist/scripts/generate-module/templates/dto.post.template.js +106 -0
  47. package/dist/scripts/generate-module/templates/dto.post.template.js.map +1 -0
  48. package/dist/scripts/generate-module/templates/dto.put.template.d.ts +10 -0
  49. package/dist/scripts/generate-module/templates/dto.put.template.d.ts.map +1 -0
  50. package/dist/scripts/generate-module/templates/dto.put.template.js +107 -0
  51. package/dist/scripts/generate-module/templates/dto.put.template.js.map +1 -0
  52. package/dist/scripts/generate-module/templates/entity.template.d.ts +12 -0
  53. package/dist/scripts/generate-module/templates/entity.template.d.ts.map +1 -0
  54. package/dist/scripts/generate-module/templates/entity.template.js +128 -0
  55. package/dist/scripts/generate-module/templates/entity.template.js.map +1 -0
  56. package/dist/scripts/generate-module/templates/module.template.d.ts +9 -0
  57. package/dist/scripts/generate-module/templates/module.template.d.ts.map +1 -0
  58. package/dist/scripts/generate-module/templates/module.template.js +39 -0
  59. package/dist/scripts/generate-module/templates/module.template.js.map +1 -0
  60. package/dist/scripts/generate-module/templates/repository.template.d.ts +9 -0
  61. package/dist/scripts/generate-module/templates/repository.template.d.ts.map +1 -0
  62. package/dist/scripts/generate-module/templates/repository.template.js +38 -0
  63. package/dist/scripts/generate-module/templates/repository.template.js.map +1 -0
  64. package/dist/scripts/generate-module/templates/service.template.d.ts +9 -0
  65. package/dist/scripts/generate-module/templates/service.template.d.ts.map +1 -0
  66. package/dist/scripts/generate-module/templates/service.template.js +43 -0
  67. package/dist/scripts/generate-module/templates/service.template.js.map +1 -0
  68. package/dist/scripts/generate-module/transformers/import-resolver.d.ts +78 -0
  69. package/dist/scripts/generate-module/transformers/import-resolver.d.ts.map +1 -0
  70. package/dist/scripts/generate-module/transformers/import-resolver.js +89 -0
  71. package/dist/scripts/generate-module/transformers/import-resolver.js.map +1 -0
  72. package/dist/scripts/generate-module/transformers/name-transformer.d.ts +39 -0
  73. package/dist/scripts/generate-module/transformers/name-transformer.d.ts.map +1 -0
  74. package/dist/scripts/generate-module/transformers/name-transformer.js +69 -0
  75. package/dist/scripts/generate-module/transformers/name-transformer.js.map +1 -0
  76. package/dist/scripts/generate-module/transformers/nested-route-generator.d.ts +26 -0
  77. package/dist/scripts/generate-module/transformers/nested-route-generator.d.ts.map +1 -0
  78. package/dist/scripts/generate-module/transformers/nested-route-generator.js +55 -0
  79. package/dist/scripts/generate-module/transformers/nested-route-generator.js.map +1 -0
  80. package/dist/scripts/generate-module/transformers/relationship-mapper.d.ts +40 -0
  81. package/dist/scripts/generate-module/transformers/relationship-mapper.d.ts.map +1 -0
  82. package/dist/scripts/generate-module/transformers/relationship-mapper.js +95 -0
  83. package/dist/scripts/generate-module/transformers/relationship-mapper.js.map +1 -0
  84. package/dist/scripts/generate-module/types/json-schema.interface.d.ts +39 -0
  85. package/dist/scripts/generate-module/types/json-schema.interface.d.ts.map +1 -0
  86. package/dist/scripts/generate-module/types/json-schema.interface.js +9 -0
  87. package/dist/scripts/generate-module/types/json-schema.interface.js.map +1 -0
  88. package/dist/scripts/generate-module/types/template-data.interface.d.ts +101 -0
  89. package/dist/scripts/generate-module/types/template-data.interface.d.ts.map +1 -0
  90. package/dist/scripts/generate-module/types/template-data.interface.js +8 -0
  91. package/dist/scripts/generate-module/types/template-data.interface.js.map +1 -0
  92. package/dist/scripts/generate-module/utils/file-writer.d.ts +29 -0
  93. package/dist/scripts/generate-module/utils/file-writer.d.ts.map +1 -0
  94. package/dist/scripts/generate-module/utils/file-writer.js +89 -0
  95. package/dist/scripts/generate-module/utils/file-writer.js.map +1 -0
  96. package/dist/scripts/generate-module/utils/module-registrar.d.ts +12 -0
  97. package/dist/scripts/generate-module/utils/module-registrar.d.ts.map +1 -0
  98. package/dist/scripts/generate-module/utils/module-registrar.js +119 -0
  99. package/dist/scripts/generate-module/utils/module-registrar.js.map +1 -0
  100. package/dist/scripts/generate-module/validators/json-schema-validator.d.ts +27 -0
  101. package/dist/scripts/generate-module/validators/json-schema-validator.d.ts.map +1 -0
  102. package/dist/scripts/generate-module/validators/json-schema-validator.js +156 -0
  103. package/dist/scripts/generate-module/validators/json-schema-validator.js.map +1 -0
  104. package/package.json +17 -16
  105. package/dist/foundations/discord/controllers/discord.controller.d.ts +0 -9
  106. package/dist/foundations/discord/controllers/discord.controller.d.ts.map +0 -1
  107. package/dist/foundations/discord/controllers/discord.controller.js.map +0 -1
  108. package/dist/foundations/discord/discord.module.d.ts +0 -3
  109. package/dist/foundations/discord/discord.module.d.ts.map +0 -1
  110. package/dist/foundations/discord/discord.module.js.map +0 -1
  111. package/dist/foundations/discord/entities/discord.d.ts.map +0 -1
  112. package/dist/foundations/discord/entities/discord.js.map +0 -1
  113. package/dist/foundations/discord/repositories/discord.repository.d.ts.map +0 -1
  114. package/dist/foundations/discord/repositories/discord.repository.js.map +0 -1
  115. package/dist/foundations/discord/services/discord.service.d.ts.map +0 -1
  116. package/dist/foundations/discord/services/discord.service.js.map +0 -1
  117. package/dist/foundations/discord/types/discord.user.type.d.ts.map +0 -1
  118. package/dist/foundations/discord/types/discord.user.type.js.map +0 -1
  119. /package/dist/foundations/{discord → discord-user}/types/discord.user.type.d.ts +0 -0
  120. /package/dist/foundations/{discord → discord-user}/types/discord.user.type.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.post.template.js","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/dto.post.template.ts"],"names":[],"mappings":";;AAQA,kDA4GC;AAlHD;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,IAAkB;IACpD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAEzD,6DAA6D;IAC7D,MAAM,cAAc,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEtD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,8CAA8C;QAC9C,IAAI,GAAG,CAAC,UAAU;YAAE,SAAS;QAE7B,MAAM,UAAU,GAAG,SAAS,GAAG,CAAC,aAAa,CAAC,SAAS,IAAI,GAAG,CAAC,aAAa,CAAC,SAAS,SAAS,GAAG,CAAC,aAAa,CAAC,SAAS,MAAM,CAAC;QAEjI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACpC,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QAC5C,CAAC;QAED,kCAAkC;QAClC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,SAAS,CAAC,CAAC;QACxE,IAAI,GAAG,CAAC,WAA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;;;eAGrE,KAAK,CAAC,UAAU;YACnB,KAAK,CAAC,UAAU;;;;;;;;gBAQZ,KAAK,CAAC,UAAU;gBAChB,KAAK,CAAC,UAAU;;;;gBAIhB,KAAK,CAAC,UAAU;mBACb,KAAK,CAAC,UAAU;;;eAGpB,KAAK,CAAC,UAAU;;;gBAGf,KAAK,CAAC,UAAU;UACtB,KAAK,CAAC,UAAU;;CAEzB,CAAC;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { TemplateData } from "../types/template-data.interface";
2
+ /**
3
+ * Generate PUT DTO file content
4
+ * Same as POST but excludes contextKey relationships (like Author)
5
+ *
6
+ * @param data - Template data
7
+ * @returns Generated TypeScript code
8
+ */
9
+ export declare function generatePutDTOFile(data: TemplateData): string;
10
+ //# sourceMappingURL=dto.put.template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.put.template.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/dto.put.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CA4G7D"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatePutDTOFile = generatePutDTOFile;
4
+ /**
5
+ * Generate PUT DTO file content
6
+ * Same as POST but excludes contextKey relationships (like Author)
7
+ *
8
+ * @param data - Template data
9
+ * @returns Generated TypeScript code
10
+ */
11
+ function generatePutDTOFile(data) {
12
+ const { names, targetDir, fields, relationships } = data;
13
+ // Build DTO imports for relationships (excluding contextKey)
14
+ const dtoImportPaths = new Map();
15
+ for (const rel of relationships) {
16
+ // Skip contextKey relationships (like Author) - same as POST
17
+ if (rel.contextKey)
18
+ continue;
19
+ const importPath = `../../${rel.relatedEntity.directory}/${rel.relatedEntity.kebabCase}/dtos/${rel.relatedEntity.kebabCase}.dto`;
20
+ if (!dtoImportPaths.has(importPath)) {
21
+ dtoImportPaths.set(importPath, new Set());
22
+ }
23
+ // Add both singular and list DTOs
24
+ dtoImportPaths.get(importPath).add(`${rel.relatedEntity.name}DataDTO`);
25
+ if (rel.cardinality === "many") {
26
+ dtoImportPaths.get(importPath).add(`${rel.relatedEntity.name}DataListDTO`);
27
+ }
28
+ }
29
+ const dtoImportsCode = dtoImportPaths.size > 0
30
+ ? `\n${Array.from(dtoImportPaths.entries())
31
+ .map(([path, items]) => `import { ${Array.from(items).join(", ")} } from "${path}";`)
32
+ .join("\n")}\n`
33
+ : "";
34
+ // Build attribute validation (same as POST)
35
+ const attributeFields = fields
36
+ .map((field) => {
37
+ const decorators = [];
38
+ decorators.push("@IsDefined()");
39
+ decorators.push("@IsNotEmpty()");
40
+ decorators.push(`@IsString()`); // Simplified - all fields are strings in current schema
41
+ const optional = !field.required ? "?" : "";
42
+ return ` ${decorators.join("\n ")}\n ${field.name}${optional}: ${field.tsType};`;
43
+ })
44
+ .join("\n\n");
45
+ // Build relationship validation (exclude contextKey - same as POST)
46
+ const relationshipFields = relationships
47
+ .filter((rel) => !rel.contextKey) // Exclude Author and other contextKey relationships
48
+ .map((rel) => {
49
+ const decorators = [];
50
+ const dtoClass = rel.cardinality === "many" ? `${rel.relatedEntity.name}DataListDTO` : `${rel.relatedEntity.name}DataDTO`;
51
+ if (rel.cardinality === "many") {
52
+ decorators.push("@ValidateNested({ each: true })");
53
+ }
54
+ else {
55
+ decorators.push("@ValidateNested()");
56
+ }
57
+ if (rel.nullable) {
58
+ decorators.push("@IsOptional()");
59
+ }
60
+ else {
61
+ decorators.push("@IsDefined()");
62
+ }
63
+ decorators.push(`@Type(() => ${dtoClass})`);
64
+ const optional = rel.nullable ? "?" : "";
65
+ const dtoKey = rel.dtoKey || rel.key;
66
+ return ` ${decorators.join("\n ")}\n ${dtoKey}${optional}: ${dtoClass};`;
67
+ })
68
+ .join("\n\n");
69
+ return `import { Type } from "class-transformer";
70
+ import { Equals, IsDefined, IsNotEmpty, IsOptional, IsString, IsUUID, ValidateNested } from "class-validator";${dtoImportsCode}
71
+ import { ${names.pascalCase}Descriptor } from "src/${targetDir}/${names.kebabCase}/entities/${names.kebabCase}";
72
+
73
+ export class ${names.pascalCase}PutAttributesDTO {
74
+ ${attributeFields}
75
+ }
76
+
77
+ export class ${names.pascalCase}PutRelationshipsDTO {
78
+ ${relationshipFields || " // No relationships (excluding contextKey relationships)"}
79
+ }
80
+
81
+ export class ${names.pascalCase}PutDataDTO {
82
+ @Equals(${names.pascalCase}Descriptor.model.endpoint)
83
+ type: string;
84
+
85
+ @IsUUID()
86
+ id: string;
87
+
88
+ @ValidateNested()
89
+ @IsNotEmpty()
90
+ @Type(() => ${names.pascalCase}PutAttributesDTO)
91
+ attributes: ${names.pascalCase}PutAttributesDTO;
92
+
93
+ @ValidateNested()
94
+ @IsNotEmpty()
95
+ @Type(() => ${names.pascalCase}PutRelationshipsDTO)
96
+ relationships: ${names.pascalCase}PutRelationshipsDTO;
97
+ }
98
+
99
+ export class ${names.pascalCase}PutDTO {
100
+ @ValidateNested()
101
+ @IsNotEmpty()
102
+ @Type(() => ${names.pascalCase}PutDataDTO)
103
+ data: ${names.pascalCase}PutDataDTO;
104
+ }
105
+ `;
106
+ }
107
+ //# sourceMappingURL=dto.put.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dto.put.template.js","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/dto.put.template.ts"],"names":[],"mappings":";;AASA,gDA4GC;AAnHD;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAAC,IAAkB;IACnD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC;IAEzD,6DAA6D;IAC7D,MAAM,cAAc,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEtD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,6DAA6D;QAC7D,IAAI,GAA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AAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC;QACrC,OAAO,KAAK,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,MAAM,GAAG,QAAQ,KAAK,QAAQ,GAAG,CAAC;IAC9E,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;IAEhB,OAAO;gHACuG,cAAc;WACnH,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;;eAE9F,KAAK,CAAC,UAAU;EAC7B,eAAe;;;eAGF,KAAK,CAAC,UAAU;EAC7B,kBAAkB,IAAI,4DAA4D;;;eAGrE,KAAK,CAAC,UAAU;YACnB,KAAK,CAAC,UAAU;;;;;;;;gBAQZ,KAAK,CAAC,UAAU;gBAChB,KAAK,CAAC,UAAU;;;;gBAIhB,KAAK,CAAC,UAAU;mBACb,KAAK,CAAC,UAAU;;;eAGpB,KAAK,CAAC,UAAU;;;gBAGf,KAAK,CAAC,UAAU;UACtB,KAAK,CAAC,UAAU;;CAEzB,CAAC;AACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { TemplateData } from "../types/template-data.interface";
2
+ /**
3
+ * Generate entity file content (Type + Descriptor)
4
+ *
5
+ * This is the most critical file - it defines both the TypeScript type
6
+ * and the descriptor using defineEntity()
7
+ *
8
+ * @param data - Template data
9
+ * @returns Generated TypeScript code
10
+ */
11
+ export declare function generateEntityFile(data: TemplateData): string;
12
+ //# sourceMappingURL=entity.template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.template.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/entity.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CA8H7D"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateEntityFile = generateEntityFile;
4
+ /**
5
+ * Generate entity file content (Type + Descriptor)
6
+ *
7
+ * This is the most critical file - it defines both the TypeScript type
8
+ * and the descriptor using defineEntity()
9
+ *
10
+ * @param data - Template data
11
+ * @returns Generated TypeScript code
12
+ */
13
+ function generateEntityFile(data) {
14
+ const { names, endpoint, nodeName, labelName, fields, relationships, entityImports, metaImports } = data;
15
+ // Build imports
16
+ const libraryImports = ["defineEntity", "Entity"];
17
+ if (data.isCompanyScoped) {
18
+ libraryImports.push("Company");
19
+ }
20
+ // Add entity imports for relationships
21
+ const uniqueEntityImports = new Set();
22
+ const entityImportsByPath = new Map();
23
+ for (const rel of relationships) {
24
+ if (!uniqueEntityImports.has(rel.relatedEntity.name)) {
25
+ uniqueEntityImports.add(rel.relatedEntity.name);
26
+ // Group by import path
27
+ const importPath = `../../${rel.relatedEntity.directory}/${rel.relatedEntity.kebabCase}/entities/${rel.relatedEntity.kebabCase}.entity`;
28
+ if (!entityImportsByPath.has(importPath)) {
29
+ entityImportsByPath.set(importPath, []);
30
+ }
31
+ entityImportsByPath.get(importPath).push(rel.relatedEntity.name);
32
+ }
33
+ }
34
+ // Add meta imports for relationships
35
+ const uniqueMetaImports = new Set();
36
+ const metaImportsByPath = new Map();
37
+ for (const rel of relationships) {
38
+ if (!uniqueMetaImports.has(rel.model)) {
39
+ uniqueMetaImports.add(rel.model);
40
+ // Group by import path
41
+ const importPath = `../../${rel.relatedEntity.directory}/${rel.relatedEntity.kebabCase}/entities/${rel.relatedEntity.kebabCase}.meta`;
42
+ if (!metaImportsByPath.has(importPath)) {
43
+ metaImportsByPath.set(importPath, []);
44
+ }
45
+ metaImportsByPath.get(importPath).push(rel.model);
46
+ }
47
+ }
48
+ // Build field definitions for descriptor
49
+ const fieldDefinitions = fields
50
+ .map((field) => {
51
+ const parts = [];
52
+ parts.push(`type: "${field.type}"`);
53
+ if (field.required) {
54
+ parts.push(`required: true`);
55
+ }
56
+ return ` ${field.name}: { ${parts.join(", ")} },`;
57
+ })
58
+ .join("\n");
59
+ // Build relationship definitions for descriptor
60
+ const relationshipDefinitions = relationships
61
+ .map((rel) => {
62
+ const parts = [];
63
+ parts.push(`model: ${rel.model}`);
64
+ parts.push(`direction: "${rel.direction}"`);
65
+ parts.push(`relationship: "${rel.relationship}"`);
66
+ parts.push(`cardinality: "${rel.cardinality}"`);
67
+ if (rel.contextKey) {
68
+ parts.push(`contextKey: "${rel.contextKey}"`);
69
+ }
70
+ if (rel.dtoKey) {
71
+ parts.push(`dtoKey: "${rel.dtoKey}"`);
72
+ }
73
+ return ` ${rel.key}: {\n ${parts.join(",\n ")},\n },`;
74
+ })
75
+ .join("\n");
76
+ return `import { ${libraryImports.join(", ")} } from "@carlonicora/nestjs-neo4jsonapi";
77
+ ${Array.from(entityImportsByPath.entries())
78
+ .map(([path, items]) => `import { ${items.join(", ")} } from "${path}";`)
79
+ .join("\n")}
80
+ ${Array.from(metaImportsByPath.entries())
81
+ .map(([path, items]) => `import { ${items.join(", ")} } from "${path}";`)
82
+ .join("\n")}
83
+
84
+ /**
85
+ * ${names.pascalCase} Entity Type
86
+ */
87
+ export type ${names.pascalCase} = Entity & {
88
+ ${fields
89
+ .map((field) => {
90
+ const optional = !field.required ? "?" : "";
91
+ return ` ${field.name}${optional}: ${field.tsType};`;
92
+ })
93
+ .join("\n")}
94
+
95
+ ${data.isCompanyScoped ? " company: Company;\n" : ""}${relationships
96
+ .map((rel) => {
97
+ const optional = rel.nullable ? "?" : "";
98
+ const type = rel.cardinality === "many" ? `${rel.relatedEntity.name}[]` : rel.relatedEntity.name;
99
+ return ` ${rel.key}${optional}: ${type};`;
100
+ })
101
+ .join("\n")}
102
+ };
103
+
104
+ /**
105
+ * ${names.pascalCase} Entity Descriptor
106
+ *
107
+ * Single source of truth for the ${names.pascalCase} entity configuration.
108
+ * Auto-generates mapper, serialiser, constraints, and indexes.
109
+ */
110
+ export const ${names.pascalCase}Descriptor = defineEntity<${names.pascalCase}>()({
111
+ type: "${endpoint}",
112
+ endpoint: "${endpoint}",
113
+ nodeName: "${nodeName}",
114
+ labelName: "${labelName}",
115
+ ${!data.isCompanyScoped ? "\n isCompanyScoped: false,\n" : ""}
116
+ fields: {
117
+ ${fieldDefinitions}
118
+ },
119
+
120
+ relationships: {
121
+ ${relationshipDefinitions}
122
+ },
123
+ });
124
+
125
+ export type ${names.pascalCase}DescriptorType = typeof ${names.pascalCase}Descriptor;
126
+ `;
127
+ }
128
+ //# sourceMappingURL=entity.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.template.js","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/entity.template.ts"],"names":[],"mappings":";;AAWA,gDA8HC;AAvID;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,IAAkB;IACnD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IAEzG,gBAAgB;IAChB,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;QACzB,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,uCAAuC;IACvC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9C,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAoB,CAAC;IAExD,KAAK,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;QAChC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;YACrD,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YAE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G,CAAC,GAAG,GAAG,QAAQ,KAAK,IAAI,GAAG,CAAC;IAC7C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC;;;;KAIR,KAAK,CAAC,UAAU;;oCAEe,KAAK,CAAC,UAAU;;;eAGrC,KAAK,CAAC,UAAU,6BAA6B,KAAK,CAAC,UAAU;WACjE,QAAQ;eACJ,QAAQ;eACR,QAAQ;gBACP,SAAS;EACvB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE;;EAE5D,gBAAgB;;;;EAIhB,uBAAuB;;;;cAIX,KAAK,CAAC,UAAU,2BAA2B,KAAK,CAAC,UAAU;CACxE,CAAC;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { TemplateData } from "../types/template-data.interface";
2
+ /**
3
+ * Generate module file content
4
+ *
5
+ * @param data - Template data
6
+ * @returns Generated TypeScript code
7
+ */
8
+ export declare function generateModuleFile(data: TemplateData): string;
9
+ //# sourceMappingURL=module.template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.template.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/module.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CA6B7D"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateModuleFile = generateModuleFile;
4
+ /**
5
+ * Generate module file content
6
+ *
7
+ * @param data - Template data
8
+ * @returns Generated TypeScript code
9
+ */
10
+ function generateModuleFile(data) {
11
+ const { names, targetDir } = data;
12
+ return `import {
13
+ AuditModule,
14
+ modelRegistry,
15
+ } from "@carlonicora/nestjs-neo4jsonapi";
16
+ import { Module, OnModuleInit } from "@nestjs/common";
17
+ import { ${names.pascalCase}Controller } from "src/${targetDir}/${names.kebabCase}/controllers/${names.kebabCase}.controller";
18
+ import { ${names.pascalCase}Descriptor } from "src/${targetDir}/${names.kebabCase}/entities/${names.kebabCase}";
19
+ import { ${names.pascalCase}Repository } from "src/${targetDir}/${names.kebabCase}/repositories/${names.kebabCase}.repository";
20
+ import { ${names.pascalCase}Service } from "src/${targetDir}/${names.kebabCase}/services/${names.kebabCase}.service";
21
+
22
+ @Module({
23
+ controllers: [${names.pascalCase}Controller],
24
+ providers: [
25
+ ${names.pascalCase}Descriptor.model.serialiser,
26
+ ${names.pascalCase}Repository,
27
+ ${names.pascalCase}Service,
28
+ ],
29
+ exports: [],
30
+ imports: [AuditModule],
31
+ })
32
+ export class ${names.pascalCase}Module implements OnModuleInit {
33
+ onModuleInit() {
34
+ modelRegistry.register(${names.pascalCase}Descriptor.model);
35
+ }
36
+ }
37
+ `;
38
+ }
39
+ //# sourceMappingURL=module.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.template.js","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/module.template.ts"],"names":[],"mappings":";;AAQA,gDA6BC;AAnCD;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,IAAkB;IACnD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAElC,OAAO;;;;;WAKE,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,gBAAgB,KAAK,CAAC,SAAS;WACrG,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;WAClG,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,iBAAiB,KAAK,CAAC,SAAS;WACtG,KAAK,CAAC,UAAU,uBAAuB,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;;;kBAGxF,KAAK,CAAC,UAAU;;MAE5B,KAAK,CAAC,UAAU;MAChB,KAAK,CAAC,UAAU;MAChB,KAAK,CAAC,UAAU;;;;;eAKP,KAAK,CAAC,UAAU;;6BAEF,KAAK,CAAC,UAAU;;;CAG5C,CAAC;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { TemplateData } from "../types/template-data.interface";
2
+ /**
3
+ * Generate repository file content
4
+ *
5
+ * @param data - Template data
6
+ * @returns Generated TypeScript code
7
+ */
8
+ export declare function generateRepositoryFile(data: TemplateData): string;
9
+ //# sourceMappingURL=repository.template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.template.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/repository.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CA4BjE"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateRepositoryFile = generateRepositoryFile;
4
+ /**
5
+ * Generate repository file content
6
+ *
7
+ * @param data - Template data
8
+ * @returns Generated TypeScript code
9
+ */
10
+ function generateRepositoryFile(data) {
11
+ const { names, targetDir } = data;
12
+ return `import { Injectable } from "@nestjs/common";
13
+ import {
14
+ AbstractRepository,
15
+ Neo4jService,
16
+ SecurityService,
17
+ } from "@carlonicora/nestjs-neo4jsonapi";
18
+ import { ${names.pascalCase} } from "src/${targetDir}/${names.kebabCase}/entities/${names.kebabCase}";
19
+ import { ${names.pascalCase}Descriptor } from "src/${targetDir}/${names.kebabCase}/entities/${names.kebabCase}";
20
+
21
+ @Injectable()
22
+ export class ${names.pascalCase}Repository extends AbstractRepository<${names.pascalCase}, typeof ${names.pascalCase}Descriptor.relationships> {
23
+ protected readonly descriptor = ${names.pascalCase}Descriptor;
24
+
25
+ constructor(neo4j: Neo4jService, securityService: SecurityService) {
26
+ super(neo4j, securityService);
27
+ }
28
+
29
+ // Inherited methods:
30
+ // - find, findById, create, put, patch, delete
31
+ // - findByRelated
32
+ // - onModuleInit (creates constraints and indexes)
33
+
34
+ // Add custom Cypher queries here if needed
35
+ }
36
+ `;
37
+ }
38
+ //# sourceMappingURL=repository.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.template.js","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/repository.template.ts"],"names":[],"mappings":";;AAQA,wDA4BC;AAlCD;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,IAAkB;IACvD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAElC,OAAO;;;;;;WAME,KAAK,CAAC,UAAU,gBAAgB,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;WACxF,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;;;eAG9F,KAAK,CAAC,UAAU,yCAAyC,KAAK,CAAC,UAAU,YAAY,KAAK,CAAC,UAAU;oCAChF,KAAK,CAAC,UAAU;;;;;;;;;;;;;CAanD,CAAC;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { TemplateData } from "../types/template-data.interface";
2
+ /**
3
+ * Generate service file content
4
+ *
5
+ * @param data - Template data
6
+ * @returns Generated TypeScript code
7
+ */
8
+ export declare function generateServiceFile(data: TemplateData): string;
9
+ //# sourceMappingURL=service.template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.template.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/service.template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAiC9D"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateServiceFile = generateServiceFile;
4
+ /**
5
+ * Generate service file content
6
+ *
7
+ * @param data - Template data
8
+ * @returns Generated TypeScript code
9
+ */
10
+ function generateServiceFile(data) {
11
+ const { names, targetDir } = data;
12
+ return `import { Injectable } from "@nestjs/common";
13
+ import { ClsService } from "nestjs-cls";
14
+ import {
15
+ AbstractService,
16
+ JsonApiService,
17
+ } from "@carlonicora/nestjs-neo4jsonapi";
18
+ import { ${names.pascalCase} } from "src/${targetDir}/${names.kebabCase}/entities/${names.kebabCase}";
19
+ import { ${names.pascalCase}Descriptor } from "src/${targetDir}/${names.kebabCase}/entities/${names.kebabCase}";
20
+ import { ${names.pascalCase}Repository } from "src/${targetDir}/${names.kebabCase}/repositories/${names.kebabCase}.repository";
21
+
22
+ @Injectable()
23
+ export class ${names.pascalCase}Service extends AbstractService<${names.pascalCase}, typeof ${names.pascalCase}Descriptor.relationships> {
24
+ protected readonly descriptor = ${names.pascalCase}Descriptor;
25
+
26
+ constructor(
27
+ jsonApiService: JsonApiService,
28
+ private readonly ${names.camelCase}Repository: ${names.pascalCase}Repository,
29
+ clsService: ClsService,
30
+ ) {
31
+ super(jsonApiService, ${names.camelCase}Repository, clsService, ${names.pascalCase}Descriptor.model);
32
+ }
33
+
34
+ // Inherited methods:
35
+ // - find, findById, create, put, patch, delete
36
+ // - createFromDTO, putFromDTO, patchFromDTO
37
+ // - findByRelated
38
+
39
+ // Add custom business logic methods here if needed
40
+ }
41
+ `;
42
+ }
43
+ //# sourceMappingURL=service.template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.template.js","sourceRoot":"","sources":["../../../../scripts/generate-module/templates/service.template.ts"],"names":[],"mappings":";;AAQA,kDAiCC;AAvCD;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,IAAkB;IACpD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAElC,OAAO;;;;;;WAME,KAAK,CAAC,UAAU,gBAAgB,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;WACxF,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,SAAS;WAClG,KAAK,CAAC,UAAU,0BAA0B,SAAS,IAAI,KAAK,CAAC,SAAS,iBAAiB,KAAK,CAAC,SAAS;;;eAGlG,KAAK,CAAC,UAAU,mCAAmC,KAAK,CAAC,UAAU,YAAY,KAAK,CAAC,UAAU;oCAC1E,KAAK,CAAC,UAAU;;;;uBAI7B,KAAK,CAAC,SAAS,eAAe,KAAK,CAAC,UAAU;;;4BAGzC,KAAK,CAAC,SAAS,2BAA2B,KAAK,CAAC,UAAU;;;;;;;;;;CAUrF,CAAC;AACF,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Resolve relative import path between two modules
3
+ *
4
+ * @param params - From and to directories and modules
5
+ * @returns Relative import path
6
+ *
7
+ * @example
8
+ * From: src/features/comment
9
+ * To: src/foundations/user
10
+ * Result: "../../foundations/user"
11
+ */
12
+ export declare function resolveImportPath(params: {
13
+ fromDir: string;
14
+ fromModule: string;
15
+ toDir: string;
16
+ toModule: string;
17
+ }): string;
18
+ /**
19
+ * Resolve import path for entity file
20
+ *
21
+ * @param params - From and to module info
22
+ * @returns Import path to entity file
23
+ *
24
+ * @example
25
+ * resolveEntityImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
26
+ * // Returns: "../../foundations/user/entities/user.entity"
27
+ */
28
+ export declare function resolveEntityImportPath(params: {
29
+ fromDir: string;
30
+ fromModule: string;
31
+ toDir: string;
32
+ toModule: string;
33
+ }): string;
34
+ /**
35
+ * Resolve import path for meta file
36
+ *
37
+ * @param params - From and to module info
38
+ * @returns Import path to meta file
39
+ *
40
+ * @example
41
+ * resolveMetaImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
42
+ * // Returns: "../../foundations/user/entities/user.meta"
43
+ */
44
+ export declare function resolveMetaImportPath(params: {
45
+ fromDir: string;
46
+ fromModule: string;
47
+ toDir: string;
48
+ toModule: string;
49
+ }): string;
50
+ /**
51
+ * Resolve import path for DTO file
52
+ *
53
+ * @param params - From and to module info
54
+ * @returns Import path to DTO file
55
+ *
56
+ * @example
57
+ * resolveDtoImportPath({ fromDir: "features", fromModule: "comment", toDir: "features", toModule: "discussion" })
58
+ * // Returns: "../discussion/dtos/discussion.dto"
59
+ */
60
+ export declare function resolveDtoImportPath(params: {
61
+ fromDir: string;
62
+ fromModule: string;
63
+ toDir: string;
64
+ toModule: string;
65
+ }): string;
66
+ /**
67
+ * Resolve import path relative to module root
68
+ * Used for imports within the same module
69
+ *
70
+ * @param subpath - Subpath within module (e.g., "entities/comment", "services/comment.service")
71
+ * @returns Relative import path
72
+ *
73
+ * @example
74
+ * resolveModuleInternalPath("entities/comment")
75
+ * // Returns: "../entities/comment"
76
+ */
77
+ export declare function resolveModuleInternalPath(subpath: string): string;
78
+ //# sourceMappingURL=import-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-resolver.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/import-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAgBT;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAGT;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAGT;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAGT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEjE"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveImportPath = resolveImportPath;
4
+ exports.resolveEntityImportPath = resolveEntityImportPath;
5
+ exports.resolveMetaImportPath = resolveMetaImportPath;
6
+ exports.resolveDtoImportPath = resolveDtoImportPath;
7
+ exports.resolveModuleInternalPath = resolveModuleInternalPath;
8
+ /**
9
+ * Resolve relative import path between two modules
10
+ *
11
+ * @param params - From and to directories and modules
12
+ * @returns Relative import path
13
+ *
14
+ * @example
15
+ * From: src/features/comment
16
+ * To: src/foundations/user
17
+ * Result: "../../foundations/user"
18
+ */
19
+ function resolveImportPath(params) {
20
+ const { fromDir, fromModule, toDir, toModule } = params;
21
+ // If in same directory, just go up one level and into the module
22
+ if (fromDir === toDir) {
23
+ return `../${toModule}`;
24
+ }
25
+ // Different directories: go up to src, then down to target
26
+ // From: src/features/comment → need to go up 2 levels to reach src
27
+ // To: src/foundations/user → then go down into foundations/user
28
+ const upLevels = 2; // Always 2: one for module folder, one for directory folder
29
+ const up = "../".repeat(upLevels);
30
+ const down = `${toDir}/${toModule}`;
31
+ return `${up}${down}`;
32
+ }
33
+ /**
34
+ * Resolve import path for entity file
35
+ *
36
+ * @param params - From and to module info
37
+ * @returns Import path to entity file
38
+ *
39
+ * @example
40
+ * resolveEntityImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
41
+ * // Returns: "../../foundations/user/entities/user.entity"
42
+ */
43
+ function resolveEntityImportPath(params) {
44
+ const basePath = resolveImportPath(params);
45
+ return `${basePath}/entities/${params.toModule}.entity`;
46
+ }
47
+ /**
48
+ * Resolve import path for meta file
49
+ *
50
+ * @param params - From and to module info
51
+ * @returns Import path to meta file
52
+ *
53
+ * @example
54
+ * resolveMetaImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
55
+ * // Returns: "../../foundations/user/entities/user.meta"
56
+ */
57
+ function resolveMetaImportPath(params) {
58
+ const basePath = resolveImportPath(params);
59
+ return `${basePath}/entities/${params.toModule}.meta`;
60
+ }
61
+ /**
62
+ * Resolve import path for DTO file
63
+ *
64
+ * @param params - From and to module info
65
+ * @returns Import path to DTO file
66
+ *
67
+ * @example
68
+ * resolveDtoImportPath({ fromDir: "features", fromModule: "comment", toDir: "features", toModule: "discussion" })
69
+ * // Returns: "../discussion/dtos/discussion.dto"
70
+ */
71
+ function resolveDtoImportPath(params) {
72
+ const basePath = resolveImportPath(params);
73
+ return `${basePath}/dtos/${params.toModule}.dto`;
74
+ }
75
+ /**
76
+ * Resolve import path relative to module root
77
+ * Used for imports within the same module
78
+ *
79
+ * @param subpath - Subpath within module (e.g., "entities/comment", "services/comment.service")
80
+ * @returns Relative import path
81
+ *
82
+ * @example
83
+ * resolveModuleInternalPath("entities/comment")
84
+ * // Returns: "../entities/comment"
85
+ */
86
+ function resolveModuleInternalPath(subpath) {
87
+ return `../${subpath}`;
88
+ }
89
+ //# sourceMappingURL=import-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-resolver.js","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/import-resolver.ts"],"names":[],"mappings":";;AAWA,8CAqBC;AAYD,0DAQC;AAYD,sDAQC;AAYD,oDAQC;AAaD,8DAEC;AA3GD;;;;;;;;;;GAUG;AACH,SAAgB,iBAAiB,CAAC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