@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.
- package/dist/foundations/auth/auth.module.d.ts.map +1 -1
- package/dist/foundations/auth/auth.module.js +9 -6
- package/dist/foundations/auth/auth.module.js.map +1 -1
- package/dist/foundations/auth/controllers/auth.discord.controller.d.ts +9 -0
- package/dist/foundations/auth/controllers/auth.discord.controller.d.ts.map +1 -0
- package/dist/foundations/{discord/controllers/discord.controller.js → auth/controllers/auth.discord.controller.js} +19 -19
- package/dist/foundations/auth/controllers/auth.discord.controller.js.map +1 -0
- package/dist/foundations/{discord/services/discord.service.d.ts → auth/services/auth.discord.service.d.ts} +7 -7
- package/dist/foundations/auth/services/auth.discord.service.d.ts.map +1 -0
- package/dist/foundations/{discord/services/discord.service.js → auth/services/auth.discord.service.js} +16 -14
- package/dist/foundations/auth/services/auth.discord.service.js.map +1 -0
- package/dist/foundations/discord-user/discord.module.d.ts +3 -0
- package/dist/foundations/discord-user/discord.module.d.ts.map +1 -0
- package/dist/foundations/{discord → discord-user}/discord.module.js +10 -13
- package/dist/foundations/discord-user/discord.module.js.map +1 -0
- package/dist/foundations/{discord/entities/discord.d.ts → discord-user/entities/discord-user.d.ts} +4 -4
- package/dist/foundations/discord-user/entities/discord-user.d.ts.map +1 -0
- package/dist/foundations/{discord/entities/discord.js → discord-user/entities/discord-user.js} +7 -7
- package/dist/foundations/discord-user/entities/discord-user.js.map +1 -0
- package/dist/foundations/{discord/repositories/discord.repository.d.ts → discord-user/repositories/discord-user.repository.d.ts} +5 -5
- package/dist/foundations/discord-user/repositories/discord-user.repository.d.ts.map +1 -0
- package/dist/foundations/{discord/repositories/discord.repository.js → discord-user/repositories/discord-user.repository.js} +9 -9
- package/dist/foundations/discord-user/repositories/discord-user.repository.js.map +1 -0
- package/dist/foundations/discord-user/types/discord.user.type.d.ts.map +1 -0
- package/dist/foundations/discord-user/types/discord.user.type.js.map +1 -0
- package/dist/foundations/foundations.modules.js +2 -2
- package/dist/foundations/foundations.modules.js.map +1 -1
- package/dist/scripts/generate-module/generator.d.ts +13 -0
- package/dist/scripts/generate-module/generator.d.ts.map +1 -0
- package/dist/scripts/generate-module/generator.js +193 -0
- package/dist/scripts/generate-module/generator.js.map +1 -0
- package/dist/scripts/generate-module/index.d.ts +3 -0
- package/dist/scripts/generate-module/index.d.ts.map +1 -0
- package/dist/scripts/generate-module/index.js +70 -0
- package/dist/scripts/generate-module/index.js.map +1 -0
- package/dist/scripts/generate-module/templates/controller.template.d.ts +9 -0
- package/dist/scripts/generate-module/templates/controller.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/controller.template.js +177 -0
- package/dist/scripts/generate-module/templates/controller.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/dto.base.template.d.ts +9 -0
- package/dist/scripts/generate-module/templates/dto.base.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/dto.base.template.js +39 -0
- package/dist/scripts/generate-module/templates/dto.base.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/dto.post.template.d.ts +9 -0
- package/dist/scripts/generate-module/templates/dto.post.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/dto.post.template.js +106 -0
- package/dist/scripts/generate-module/templates/dto.post.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/dto.put.template.d.ts +10 -0
- package/dist/scripts/generate-module/templates/dto.put.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/dto.put.template.js +107 -0
- package/dist/scripts/generate-module/templates/dto.put.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/entity.template.d.ts +12 -0
- package/dist/scripts/generate-module/templates/entity.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/entity.template.js +128 -0
- package/dist/scripts/generate-module/templates/entity.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/module.template.d.ts +9 -0
- package/dist/scripts/generate-module/templates/module.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/module.template.js +39 -0
- package/dist/scripts/generate-module/templates/module.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/repository.template.d.ts +9 -0
- package/dist/scripts/generate-module/templates/repository.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/repository.template.js +38 -0
- package/dist/scripts/generate-module/templates/repository.template.js.map +1 -0
- package/dist/scripts/generate-module/templates/service.template.d.ts +9 -0
- package/dist/scripts/generate-module/templates/service.template.d.ts.map +1 -0
- package/dist/scripts/generate-module/templates/service.template.js +43 -0
- package/dist/scripts/generate-module/templates/service.template.js.map +1 -0
- package/dist/scripts/generate-module/transformers/import-resolver.d.ts +78 -0
- package/dist/scripts/generate-module/transformers/import-resolver.d.ts.map +1 -0
- package/dist/scripts/generate-module/transformers/import-resolver.js +89 -0
- package/dist/scripts/generate-module/transformers/import-resolver.js.map +1 -0
- package/dist/scripts/generate-module/transformers/name-transformer.d.ts +39 -0
- package/dist/scripts/generate-module/transformers/name-transformer.d.ts.map +1 -0
- package/dist/scripts/generate-module/transformers/name-transformer.js +69 -0
- package/dist/scripts/generate-module/transformers/name-transformer.js.map +1 -0
- package/dist/scripts/generate-module/transformers/nested-route-generator.d.ts +26 -0
- package/dist/scripts/generate-module/transformers/nested-route-generator.d.ts.map +1 -0
- package/dist/scripts/generate-module/transformers/nested-route-generator.js +55 -0
- package/dist/scripts/generate-module/transformers/nested-route-generator.js.map +1 -0
- package/dist/scripts/generate-module/transformers/relationship-mapper.d.ts +40 -0
- package/dist/scripts/generate-module/transformers/relationship-mapper.d.ts.map +1 -0
- package/dist/scripts/generate-module/transformers/relationship-mapper.js +95 -0
- package/dist/scripts/generate-module/transformers/relationship-mapper.js.map +1 -0
- package/dist/scripts/generate-module/types/json-schema.interface.d.ts +39 -0
- package/dist/scripts/generate-module/types/json-schema.interface.d.ts.map +1 -0
- package/dist/scripts/generate-module/types/json-schema.interface.js +9 -0
- package/dist/scripts/generate-module/types/json-schema.interface.js.map +1 -0
- package/dist/scripts/generate-module/types/template-data.interface.d.ts +101 -0
- package/dist/scripts/generate-module/types/template-data.interface.d.ts.map +1 -0
- package/dist/scripts/generate-module/types/template-data.interface.js +8 -0
- package/dist/scripts/generate-module/types/template-data.interface.js.map +1 -0
- package/dist/scripts/generate-module/utils/file-writer.d.ts +29 -0
- package/dist/scripts/generate-module/utils/file-writer.d.ts.map +1 -0
- package/dist/scripts/generate-module/utils/file-writer.js +89 -0
- package/dist/scripts/generate-module/utils/file-writer.js.map +1 -0
- package/dist/scripts/generate-module/utils/module-registrar.d.ts +12 -0
- package/dist/scripts/generate-module/utils/module-registrar.d.ts.map +1 -0
- package/dist/scripts/generate-module/utils/module-registrar.js +119 -0
- package/dist/scripts/generate-module/utils/module-registrar.js.map +1 -0
- package/dist/scripts/generate-module/validators/json-schema-validator.d.ts +27 -0
- package/dist/scripts/generate-module/validators/json-schema-validator.d.ts.map +1 -0
- package/dist/scripts/generate-module/validators/json-schema-validator.js +156 -0
- package/dist/scripts/generate-module/validators/json-schema-validator.js.map +1 -0
- package/package.json +17 -16
- package/dist/foundations/discord/controllers/discord.controller.d.ts +0 -9
- package/dist/foundations/discord/controllers/discord.controller.d.ts.map +0 -1
- package/dist/foundations/discord/controllers/discord.controller.js.map +0 -1
- package/dist/foundations/discord/discord.module.d.ts +0 -3
- package/dist/foundations/discord/discord.module.d.ts.map +0 -1
- package/dist/foundations/discord/discord.module.js.map +0 -1
- package/dist/foundations/discord/entities/discord.d.ts.map +0 -1
- package/dist/foundations/discord/entities/discord.js.map +0 -1
- package/dist/foundations/discord/repositories/discord.repository.d.ts.map +0 -1
- package/dist/foundations/discord/repositories/discord.repository.js.map +0 -1
- package/dist/foundations/discord/services/discord.service.d.ts.map +0 -1
- package/dist/foundations/discord/services/discord.service.js.map +0 -1
- package/dist/foundations/discord/types/discord.user.type.d.ts.map +0 -1
- package/dist/foundations/discord/types/discord.user.type.js.map +0 -1
- /package/dist/foundations/{discord → discord-user}/types/discord.user.type.d.ts +0 -0
- /package/dist/foundations/{discord → discord-user}/types/discord.user.type.js +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { NameTransforms } from "../types/template-data.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Transform a module name to all necessary case conventions
|
|
4
|
+
*
|
|
5
|
+
* @param moduleName - PascalCase module name (e.g., "Comment")
|
|
6
|
+
* @param endpoint - kebab-case plural endpoint (e.g., "comments")
|
|
7
|
+
* @returns All name transformations
|
|
8
|
+
*/
|
|
9
|
+
export declare function transformNames(moduleName: string, endpoint: string): NameTransforms;
|
|
10
|
+
/**
|
|
11
|
+
* Convert PascalCase to camelCase
|
|
12
|
+
*
|
|
13
|
+
* @param str - PascalCase string
|
|
14
|
+
* @returns camelCase string
|
|
15
|
+
*/
|
|
16
|
+
export declare function toCamelCase(str: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Convert PascalCase to kebab-case
|
|
19
|
+
*
|
|
20
|
+
* @param str - PascalCase string
|
|
21
|
+
* @returns kebab-case string
|
|
22
|
+
*/
|
|
23
|
+
export declare function toKebabCase(str: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Convert string to PascalCase
|
|
26
|
+
*
|
|
27
|
+
* @param str - Any case string
|
|
28
|
+
* @returns PascalCase string
|
|
29
|
+
*/
|
|
30
|
+
export declare function toPascalCase(str: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Simple pluralization
|
|
33
|
+
* Note: This is a basic implementation. For production, consider using a library like 'pluralize'
|
|
34
|
+
*
|
|
35
|
+
* @param str - Singular form
|
|
36
|
+
* @returns Plural form
|
|
37
|
+
*/
|
|
38
|
+
export declare function pluralize(str: string): string;
|
|
39
|
+
//# sourceMappingURL=name-transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name-transformer.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/name-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAOnF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ7C"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformNames = transformNames;
|
|
4
|
+
exports.toCamelCase = toCamelCase;
|
|
5
|
+
exports.toKebabCase = toKebabCase;
|
|
6
|
+
exports.toPascalCase = toPascalCase;
|
|
7
|
+
exports.pluralize = pluralize;
|
|
8
|
+
/**
|
|
9
|
+
* Transform a module name to all necessary case conventions
|
|
10
|
+
*
|
|
11
|
+
* @param moduleName - PascalCase module name (e.g., "Comment")
|
|
12
|
+
* @param endpoint - kebab-case plural endpoint (e.g., "comments")
|
|
13
|
+
* @returns All name transformations
|
|
14
|
+
*/
|
|
15
|
+
function transformNames(moduleName, endpoint) {
|
|
16
|
+
return {
|
|
17
|
+
pascalCase: moduleName,
|
|
18
|
+
camelCase: toCamelCase(moduleName),
|
|
19
|
+
kebabCase: toKebabCase(moduleName),
|
|
20
|
+
pluralKebab: endpoint,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Convert PascalCase to camelCase
|
|
25
|
+
*
|
|
26
|
+
* @param str - PascalCase string
|
|
27
|
+
* @returns camelCase string
|
|
28
|
+
*/
|
|
29
|
+
function toCamelCase(str) {
|
|
30
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Convert PascalCase to kebab-case
|
|
34
|
+
*
|
|
35
|
+
* @param str - PascalCase string
|
|
36
|
+
* @returns kebab-case string
|
|
37
|
+
*/
|
|
38
|
+
function toKebabCase(str) {
|
|
39
|
+
return str
|
|
40
|
+
.replace(/([A-Z])/g, "-$1")
|
|
41
|
+
.toLowerCase()
|
|
42
|
+
.replace(/^-/, "");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert string to PascalCase
|
|
46
|
+
*
|
|
47
|
+
* @param str - Any case string
|
|
48
|
+
* @returns PascalCase string
|
|
49
|
+
*/
|
|
50
|
+
function toPascalCase(str) {
|
|
51
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Simple pluralization
|
|
55
|
+
* Note: This is a basic implementation. For production, consider using a library like 'pluralize'
|
|
56
|
+
*
|
|
57
|
+
* @param str - Singular form
|
|
58
|
+
* @returns Plural form
|
|
59
|
+
*/
|
|
60
|
+
function pluralize(str) {
|
|
61
|
+
if (str.endsWith("s")) {
|
|
62
|
+
return str + "es";
|
|
63
|
+
}
|
|
64
|
+
if (str.endsWith("y") && !["a", "e", "i", "o", "u"].includes(str[str.length - 2])) {
|
|
65
|
+
return str.slice(0, -1) + "ies";
|
|
66
|
+
}
|
|
67
|
+
return str + "s";
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=name-transformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name-transformer.js","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/name-transformer.ts"],"names":[],"mappings":";;AASA,wCAOC;AAQD,kCAEC;AAQD,kCAKC;AAQD,oCAEC;AASD,8BAQC;AAhED;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,UAAkB,EAAE,QAAgB;IACjE,OAAO;QACL,UAAU,EAAE,U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NestedRoute } from "../types/template-data.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Generate nested route configurations for all relationships
|
|
4
|
+
*
|
|
5
|
+
* Nested routes allow querying entities by their relationships.
|
|
6
|
+
* For example: GET /discussions/:discussionId/comments
|
|
7
|
+
*
|
|
8
|
+
* NOTE: Routes are NOT generated for relationships with contextKey (e.g., Author)
|
|
9
|
+
* because these are system-set and not queryable by users.
|
|
10
|
+
*
|
|
11
|
+
* @param relationships - Array of descriptor relationships
|
|
12
|
+
* @param thisEntity - Current entity info (endpoint and nodeName)
|
|
13
|
+
* @returns Array of nested route configurations
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateNestedRoutes(relationships: DescriptorRelationship[], thisEntity: {
|
|
16
|
+
endpoint: string;
|
|
17
|
+
nodeName: string;
|
|
18
|
+
}): NestedRoute[];
|
|
19
|
+
/**
|
|
20
|
+
* Check if a relationship should have a nested route
|
|
21
|
+
*
|
|
22
|
+
* @param rel - Descriptor relationship
|
|
23
|
+
* @returns true if nested route should be generated
|
|
24
|
+
*/
|
|
25
|
+
export declare function shouldGenerateNestedRoute(rel: DescriptorRelationship): boolean;
|
|
26
|
+
//# sourceMappingURL=nested-route-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-route-generator.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/nested-route-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAGvF;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,sBAAsB,EAAE,EACvC,UAAU,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACjD,WAAW,EAAE,CA8Bf;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,sBAAsB,GAAG,OAAO,CAG9E"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateNestedRoutes = generateNestedRoutes;
|
|
4
|
+
exports.shouldGenerateNestedRoute = shouldGenerateNestedRoute;
|
|
5
|
+
const name_transformer_1 = require("./name-transformer");
|
|
6
|
+
/**
|
|
7
|
+
* Generate nested route configurations for all relationships
|
|
8
|
+
*
|
|
9
|
+
* Nested routes allow querying entities by their relationships.
|
|
10
|
+
* For example: GET /discussions/:discussionId/comments
|
|
11
|
+
*
|
|
12
|
+
* NOTE: Routes are NOT generated for relationships with contextKey (e.g., Author)
|
|
13
|
+
* because these are system-set and not queryable by users.
|
|
14
|
+
*
|
|
15
|
+
* @param relationships - Array of descriptor relationships
|
|
16
|
+
* @param thisEntity - Current entity info (endpoint and nodeName)
|
|
17
|
+
* @returns Array of nested route configurations
|
|
18
|
+
*/
|
|
19
|
+
function generateNestedRoutes(relationships, thisEntity) {
|
|
20
|
+
return relationships
|
|
21
|
+
.filter((rel) => {
|
|
22
|
+
// Skip relationships with contextKey (like Author)
|
|
23
|
+
// These are set by the system and not queryable
|
|
24
|
+
return !rel.contextKey;
|
|
25
|
+
})
|
|
26
|
+
.map((rel) => {
|
|
27
|
+
const relatedName = rel.relatedEntity.camelCase;
|
|
28
|
+
const relatedMeta = rel.model;
|
|
29
|
+
return {
|
|
30
|
+
// Path template using descriptor endpoint
|
|
31
|
+
// Example: ${discussionMeta.endpoint}/:discussionId/${CommentDescriptor.model.endpoint}
|
|
32
|
+
path: `\${${relatedMeta}.endpoint}/:${relatedName}Id/\${${thisEntity.nodeName}Descriptor.model.endpoint}`,
|
|
33
|
+
// Method name: findByDiscussion, findByTopic, etc.
|
|
34
|
+
methodName: `findBy${(0, name_transformer_1.toPascalCase)(rel.key)}`,
|
|
35
|
+
// Relationship key used in findByRelated call
|
|
36
|
+
// Must match the key in the descriptor's relationships
|
|
37
|
+
relationshipKey: rel.key,
|
|
38
|
+
// Parameter name in route: discussionId, topicId, etc.
|
|
39
|
+
paramName: `${relatedName}Id`,
|
|
40
|
+
// Meta import name: discussionMeta, topicMeta, etc.
|
|
41
|
+
relatedMeta: relatedMeta,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Check if a relationship should have a nested route
|
|
47
|
+
*
|
|
48
|
+
* @param rel - Descriptor relationship
|
|
49
|
+
* @returns true if nested route should be generated
|
|
50
|
+
*/
|
|
51
|
+
function shouldGenerateNestedRoute(rel) {
|
|
52
|
+
// Don't generate for contextKey relationships (Author)
|
|
53
|
+
return !rel.contextKey;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=nested-route-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-route-generator.js","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/nested-route-generator.ts"],"names":[],"mappings":";;AAgBA,oDAiCC;AAQD,8DAGC;AA3DD,yDAAkD;AAElD;;;;;;;;;;;;GAYG;AACH,SAAgB,oBAAoB,CAClC,aAAuC,EACvC,UAAkD;IAElD,OAAO,aAAa;SACjB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;QACd,mDAAmD;QACnD,gDAAgD;QAChD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;IACzB,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,MAAM,WAAW,GAAG,GAAG,CAAC,aAAa,CAAC,SAAS,CAAC;QAChD,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC;QAE9B,OAAO;YACL,0CAA0C;YAC1C,wFAAwF;YACxF,IAAI,EAAE,MAAM,WAAW,eAAe,WAAW,SAAS,UAAU,CAAC,QAAQ,4BAA4B;YAEzG,mDAAmD;YACnD,UAAU,EAAE,SAAS,IAAA,+BAAY,EAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAE5C,8CAA8C;YAC9C,uDAAuD;YACvD,eAAe,EAAE,GAAG,CAAC,GAAG;YAExB,uDAAuD;YACvD,SAAS,EAAE,GAAG,WAAW,IAAI;YAE7B,oDAAoD;YACpD,WAAW,EAAE,WAAW;SACzB,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,GAA2B;IACnE,uDAAuD;IACvD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JsonRelationshipDefinition } from "../types/json-schema.interface";
|
|
2
|
+
import { DescriptorRelationship } from "../types/template-data.interface";
|
|
3
|
+
/**
|
|
4
|
+
* Map JSON relationship definition to descriptor relationship
|
|
5
|
+
*
|
|
6
|
+
* Key mappings:
|
|
7
|
+
* - toNode: true → direction: "in" (relationship TO this entity)
|
|
8
|
+
* - toNode: false → direction: "out" (relationship FROM this entity)
|
|
9
|
+
* - single: true → cardinality: "one"
|
|
10
|
+
* - single: false → cardinality: "many"
|
|
11
|
+
* - variant: "Author" → contextKey: "userId"
|
|
12
|
+
* - variant: other → dtoKey: pluralized variant
|
|
13
|
+
*
|
|
14
|
+
* @param rel - JSON relationship definition
|
|
15
|
+
* @returns Descriptor relationship configuration
|
|
16
|
+
*/
|
|
17
|
+
export declare function mapRelationship(rel: JsonRelationshipDefinition): DescriptorRelationship;
|
|
18
|
+
/**
|
|
19
|
+
* Map multiple relationships and handle deduplication
|
|
20
|
+
*
|
|
21
|
+
* @param relationships - Array of JSON relationship definitions
|
|
22
|
+
* @returns Array of descriptor relationships
|
|
23
|
+
*/
|
|
24
|
+
export declare function mapRelationships(relationships: JsonRelationshipDefinition[]): DescriptorRelationship[];
|
|
25
|
+
/**
|
|
26
|
+
* Get unique meta imports from relationships
|
|
27
|
+
* Handles cases where multiple relationships reference the same entity
|
|
28
|
+
*
|
|
29
|
+
* @param relationships - Array of descriptor relationships
|
|
30
|
+
* @returns Deduplicated list of meta import names
|
|
31
|
+
*/
|
|
32
|
+
export declare function getUniqueMetaImports(relationships: DescriptorRelationship[]): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Get unique entity imports from relationships
|
|
35
|
+
*
|
|
36
|
+
* @param relationships - Array of descriptor relationships
|
|
37
|
+
* @returns Deduplicated list of entity names
|
|
38
|
+
*/
|
|
39
|
+
export declare function getUniqueEntityImports(relationships: DescriptorRelationship[]): string[];
|
|
40
|
+
//# sourceMappingURL=relationship-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-mapper.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/relationship-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG1E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,0BAA0B,GAAG,sBAAsB,CA8CvF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,0BAA0B,EAAE,GAAG,sBAAsB,EAAE,CAEtG;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,sBAAsB,EAAE,GAAG,MAAM,EAAE,CAGtF;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,sBAAsB,EAAE,GAAG,MAAM,EAAE,CAGxF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapRelationship = mapRelationship;
|
|
4
|
+
exports.mapRelationships = mapRelationships;
|
|
5
|
+
exports.getUniqueMetaImports = getUniqueMetaImports;
|
|
6
|
+
exports.getUniqueEntityImports = getUniqueEntityImports;
|
|
7
|
+
const name_transformer_1 = require("./name-transformer");
|
|
8
|
+
/**
|
|
9
|
+
* Map JSON relationship definition to descriptor relationship
|
|
10
|
+
*
|
|
11
|
+
* Key mappings:
|
|
12
|
+
* - toNode: true → direction: "in" (relationship TO this entity)
|
|
13
|
+
* - toNode: false → direction: "out" (relationship FROM this entity)
|
|
14
|
+
* - single: true → cardinality: "one"
|
|
15
|
+
* - single: false → cardinality: "many"
|
|
16
|
+
* - variant: "Author" → contextKey: "userId"
|
|
17
|
+
* - variant: other → dtoKey: pluralized variant
|
|
18
|
+
*
|
|
19
|
+
* @param rel - JSON relationship definition
|
|
20
|
+
* @returns Descriptor relationship configuration
|
|
21
|
+
*/
|
|
22
|
+
function mapRelationship(rel) {
|
|
23
|
+
// Core mappings
|
|
24
|
+
const direction = rel.toNode ? "in" : "out";
|
|
25
|
+
const cardinality = rel.single ? "one" : "many";
|
|
26
|
+
// Determine contextKey and dtoKey based on variant
|
|
27
|
+
let contextKey;
|
|
28
|
+
let dtoKey;
|
|
29
|
+
if (rel.variant === "Author") {
|
|
30
|
+
// Special case: Author variant uses contextKey
|
|
31
|
+
contextKey = "userId";
|
|
32
|
+
}
|
|
33
|
+
else if (rel.variant) {
|
|
34
|
+
// Other variants: use variant name as dtoKey (pluralized)
|
|
35
|
+
dtoKey = (0, name_transformer_1.pluralize)(rel.variant.toLowerCase());
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
// No variant: use entity name as dtoKey (pluralized)
|
|
39
|
+
dtoKey = (0, name_transformer_1.pluralize)(rel.name.toLowerCase());
|
|
40
|
+
}
|
|
41
|
+
// Determine relationship key (what it's called in the descriptor)
|
|
42
|
+
const key = (0, name_transformer_1.toCamelCase)(rel.variant || rel.name);
|
|
43
|
+
// Meta import name (e.g., "userMeta", "discussionMeta")
|
|
44
|
+
const model = `${(0, name_transformer_1.toCamelCase)(rel.name)}Meta`;
|
|
45
|
+
// Related entity name transformations
|
|
46
|
+
const relatedEntityNames = (0, name_transformer_1.transformNames)(rel.name, (0, name_transformer_1.pluralize)(rel.name.toLowerCase()));
|
|
47
|
+
return {
|
|
48
|
+
key,
|
|
49
|
+
model,
|
|
50
|
+
direction,
|
|
51
|
+
relationship: rel.relationshipName,
|
|
52
|
+
cardinality,
|
|
53
|
+
contextKey,
|
|
54
|
+
dtoKey,
|
|
55
|
+
nullable: rel.nullable,
|
|
56
|
+
relatedEntity: {
|
|
57
|
+
name: rel.name,
|
|
58
|
+
directory: rel.directory,
|
|
59
|
+
pascalCase: relatedEntityNames.pascalCase,
|
|
60
|
+
camelCase: relatedEntityNames.camelCase,
|
|
61
|
+
kebabCase: relatedEntityNames.kebabCase,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Map multiple relationships and handle deduplication
|
|
67
|
+
*
|
|
68
|
+
* @param relationships - Array of JSON relationship definitions
|
|
69
|
+
* @returns Array of descriptor relationships
|
|
70
|
+
*/
|
|
71
|
+
function mapRelationships(relationships) {
|
|
72
|
+
return relationships.map(mapRelationship);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get unique meta imports from relationships
|
|
76
|
+
* Handles cases where multiple relationships reference the same entity
|
|
77
|
+
*
|
|
78
|
+
* @param relationships - Array of descriptor relationships
|
|
79
|
+
* @returns Deduplicated list of meta import names
|
|
80
|
+
*/
|
|
81
|
+
function getUniqueMetaImports(relationships) {
|
|
82
|
+
const metaSet = new Set(relationships.map((rel) => rel.model));
|
|
83
|
+
return Array.from(metaSet).sort();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get unique entity imports from relationships
|
|
87
|
+
*
|
|
88
|
+
* @param relationships - Array of descriptor relationships
|
|
89
|
+
* @returns Deduplicated list of entity names
|
|
90
|
+
*/
|
|
91
|
+
function getUniqueEntityImports(relationships) {
|
|
92
|
+
const entitySet = new Set(relationships.map((rel) => rel.relatedEntity.name));
|
|
93
|
+
return Array.from(entitySet).sort();
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=relationship-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship-mapper.js","sourceRoot":"","sources":["../../../../scripts/generate-module/transformers/relationship-mapper.ts"],"names":[],"mappings":";;AAkBA,0CA8CC;AAQD,4CAEC;AASD,oDAGC;AAQD,wDAGC;AA/FD,yDAA4E;AAE5E;;;;;;;;;;;;;GAaG;AACH,SAAgB,eAAe,CAAC,GAA+B;IAC7D,gBAAgB;IAChB,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5C,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhD,mDAAmD;IACnD,IAAI,UAA8B,CAAC;IACnC,IAAI,MAA0B,CAAC;IAE/B,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC7B,+CAA+C;QAC/C,UAAU,GAAG,QAAQ,CAAC;IACxB,CAAC;SAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QACvB,0DAA0D;QAC1D,MAAM,GAAG,IAAA,4BAAS,EAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,qDAAqD;QACrD,MAAM,GAAG,IAAA,4BAAS,EAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,kEAAkE;IAClE,MAAM,GAAG,GAAG,IAAA,8BAAW,EAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAEjD,wDAAwD;IACxD,MAAM,KAAK,GAAG,GAAG,IAAA,8BAAW,EAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;IAE7C,sCAAsC;IACtC,MAAM,kBAAkB,GAAG,IAAA,iCAAc,EAAC,GAAG,CAAC,IAAI,EAAE,IAAA,4BAAS,EAA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
5
|
+
* located in the /structure folder.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Field definition in JSON schema
|
|
9
|
+
*/
|
|
10
|
+
export interface JsonFieldDefinition {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
nullable: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Relationship definition in JSON schema
|
|
17
|
+
*/
|
|
18
|
+
export interface JsonRelationshipDefinition {
|
|
19
|
+
name: string;
|
|
20
|
+
variant?: string;
|
|
21
|
+
directory: string;
|
|
22
|
+
single: boolean;
|
|
23
|
+
relationshipName: string;
|
|
24
|
+
toNode: boolean;
|
|
25
|
+
nullable: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Complete module definition from JSON
|
|
29
|
+
*/
|
|
30
|
+
export interface JsonModuleDefinition {
|
|
31
|
+
moduleId: string;
|
|
32
|
+
moduleName: string;
|
|
33
|
+
endpointName: string;
|
|
34
|
+
targetDir: string;
|
|
35
|
+
languages: string[];
|
|
36
|
+
fields: JsonFieldDefinition[];
|
|
37
|
+
relationships: JsonRelationshipDefinition[];
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=json-schema.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.interface.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/types/json-schema.interface.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,aAAa,EAAE,0BAA0B,EAAE,CAAC;CAC7C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* JSON Schema Interfaces
|
|
4
|
+
*
|
|
5
|
+
* Type definitions for the JSON module definition files
|
|
6
|
+
* located in the /structure folder.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
//# sourceMappingURL=json-schema.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema.interface.js","sourceRoot":"","sources":["../../../../scripts/generate-module/types/json-schema.interface.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template Data Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for data passed to code generation templates.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Name transformations for different casing conventions
|
|
8
|
+
*/
|
|
9
|
+
export interface NameTransforms {
|
|
10
|
+
pascalCase: string;
|
|
11
|
+
camelCase: string;
|
|
12
|
+
kebabCase: string;
|
|
13
|
+
pluralKebab: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Import statement for templates
|
|
17
|
+
*/
|
|
18
|
+
export interface ImportStatement {
|
|
19
|
+
path: string;
|
|
20
|
+
items: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Processed field for templates
|
|
24
|
+
*/
|
|
25
|
+
export interface TemplateField {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
tsType: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Processed relationship for entity descriptor
|
|
33
|
+
*/
|
|
34
|
+
export interface DescriptorRelationship {
|
|
35
|
+
key: string;
|
|
36
|
+
model: string;
|
|
37
|
+
direction: "in" | "out";
|
|
38
|
+
relationship: string;
|
|
39
|
+
cardinality: "one" | "many";
|
|
40
|
+
contextKey?: string;
|
|
41
|
+
dtoKey?: string;
|
|
42
|
+
nullable: boolean;
|
|
43
|
+
relatedEntity: {
|
|
44
|
+
name: string;
|
|
45
|
+
directory: string;
|
|
46
|
+
pascalCase: string;
|
|
47
|
+
camelCase: string;
|
|
48
|
+
kebabCase: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Nested route configuration
|
|
53
|
+
*/
|
|
54
|
+
export interface NestedRoute {
|
|
55
|
+
path: string;
|
|
56
|
+
methodName: string;
|
|
57
|
+
relationshipKey: string;
|
|
58
|
+
paramName: string;
|
|
59
|
+
relatedMeta: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* DTO field configuration
|
|
63
|
+
*/
|
|
64
|
+
export interface DTOField {
|
|
65
|
+
name: string;
|
|
66
|
+
type: string;
|
|
67
|
+
isOptional: boolean;
|
|
68
|
+
decorators: string[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* DTO relationship configuration
|
|
72
|
+
*/
|
|
73
|
+
export interface DTORelationship {
|
|
74
|
+
key: string;
|
|
75
|
+
dtoClass: string;
|
|
76
|
+
isList: boolean;
|
|
77
|
+
isOptional: boolean;
|
|
78
|
+
importPath: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Complete template data passed to all templates
|
|
82
|
+
*/
|
|
83
|
+
export interface TemplateData {
|
|
84
|
+
names: NameTransforms;
|
|
85
|
+
endpoint: string;
|
|
86
|
+
labelName: string;
|
|
87
|
+
nodeName: string;
|
|
88
|
+
isCompanyScoped: boolean;
|
|
89
|
+
targetDir: "features" | "foundations";
|
|
90
|
+
fields: TemplateField[];
|
|
91
|
+
relationships: DescriptorRelationship[];
|
|
92
|
+
libraryImports: ImportStatement[];
|
|
93
|
+
entityImports: ImportStatement[];
|
|
94
|
+
metaImports: ImportStatement[];
|
|
95
|
+
dtoImports: ImportStatement[];
|
|
96
|
+
nestedRoutes: NestedRoute[];
|
|
97
|
+
dtoFields: DTOField[];
|
|
98
|
+
postDtoRelationships: DTORelationship[];
|
|
99
|
+
putDtoRelationships: DTORelationship[];
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=template-data.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-data.interface.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/types/template-data.interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;IACxB,YAAY,EAA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AE,CAAC;IAClC,aAAa,EAAE,eAAe,EAAE,CAAC;IACjC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,UAAU,EAAE,eAAe,EAAE,CAAC;IAG9B,YAAY,EAAE,WAAW,EAAE,CAAC;IAG5B,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,oBAAoB,EAAE,eAAe,EAAE,CAAC;IACxC,mBAAmB,EAAE,eAAe,EAAE,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-data.interface.js","sourceRoot":"","sources":["../../../../scripts/generate-module/types/template-data.interface.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface FileToWrite {
|
|
2
|
+
path: string;
|
|
3
|
+
content: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Check if files exist (for conflict detection)
|
|
7
|
+
*
|
|
8
|
+
* @param files - List of files to check
|
|
9
|
+
* @returns Array of existing file paths
|
|
10
|
+
*/
|
|
11
|
+
export declare function checkFileConflicts(files: FileToWrite[]): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Write files to disk
|
|
14
|
+
*
|
|
15
|
+
* @param files - Files to write
|
|
16
|
+
* @param options - Write options
|
|
17
|
+
*/
|
|
18
|
+
export declare function writeFiles(files: FileToWrite[], options?: {
|
|
19
|
+
dryRun?: boolean;
|
|
20
|
+
force?: boolean;
|
|
21
|
+
}): void;
|
|
22
|
+
/**
|
|
23
|
+
* Build absolute file path
|
|
24
|
+
*
|
|
25
|
+
* @param relativePath - Relative path from project root
|
|
26
|
+
* @returns Absolute path
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildFilePath(relativePath: string): string;
|
|
29
|
+
//# sourceMappingURL=file-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../../../scripts/generate-module/utils/file-writer.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,EAAE,EACpB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACZ,GACL,IAAI,CA4BN;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAG1D"}
|
|
@@ -0,0 +1,89 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.checkFileConflicts = checkFileConflicts;
|
|
37
|
+
exports.writeFiles = writeFiles;
|
|
38
|
+
exports.buildFilePath = buildFilePath;
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
/**
|
|
42
|
+
* Check if files exist (for conflict detection)
|
|
43
|
+
*
|
|
44
|
+
* @param files - List of files to check
|
|
45
|
+
* @returns Array of existing file paths
|
|
46
|
+
*/
|
|
47
|
+
function checkFileConflicts(files) {
|
|
48
|
+
return files.filter((file) => fs.existsSync(file.path)).map((file) => file.path);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Write files to disk
|
|
52
|
+
*
|
|
53
|
+
* @param files - Files to write
|
|
54
|
+
* @param options - Write options
|
|
55
|
+
*/
|
|
56
|
+
function writeFiles(files, options = {}) {
|
|
57
|
+
const { dryRun = false, force = false } = options;
|
|
58
|
+
if (!force) {
|
|
59
|
+
const conflicts = checkFileConflicts(files);
|
|
60
|
+
if (conflicts.length > 0) {
|
|
61
|
+
throw new Error(`Files already exist. Use --force to overwrite:\n${conflicts.map((f) => ` - ${f}`).join("\n")}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const file of files) {
|
|
65
|
+
if (dryRun) {
|
|
66
|
+
console.log(`[DRY RUN] Would create: ${file.path}`);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
// Create directory if it doesn't exist
|
|
70
|
+
const dir = path.dirname(file.path);
|
|
71
|
+
if (!fs.existsSync(dir)) {
|
|
72
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
73
|
+
}
|
|
74
|
+
// Write file
|
|
75
|
+
fs.writeFileSync(file.path, file.content, "utf-8");
|
|
76
|
+
console.log(`✓ Created: ${file.path}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Build absolute file path
|
|
81
|
+
*
|
|
82
|
+
* @param relativePath - Relative path from project root
|
|
83
|
+
* @returns Absolute path
|
|
84
|
+
*/
|
|
85
|
+
function buildFilePath(relativePath) {
|
|
86
|
+
// Assuming the script is run from the project root
|
|
87
|
+
return path.resolve(process.cwd(), relativePath);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=file-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writer.js","sourceRoot":"","sources":["../../../../scripts/generate-module/utils/file-writer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,gDAEC;AAQD,gCAkCC;AAQD,sCAGC;AArED,uCAAyB;AACzB,2CAA6B;AAO7B;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAAoB;IACrD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnF,CAAC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CACxB,KAAoB,EACpB,UAGI,EAAE;IAEN,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAElD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,SA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