@carlonicora/nestjs-neo4jsonapi 1.3.1 → 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/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
|
@@ -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,MAKjC;IACC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAExD,iEAAiE;IACjE,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACtB,OAAO,MAAM,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,2DAA2D;IAC3D,mEAAmE;IACnE,gEAAgE;IAChE,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,4DAA4D;IAChF,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAC;IAEpC,OAAO,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,uBAAuB,CAAC,MAKvC;IACC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,GAAG,QAAQ,aAAa,MAAM,CAAC,QAAQ,SAAS,CAAC;AAC1D,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CAAC,MAKrC;IACC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,GAAG,QAAQ,aAAa,MAAM,CAAC,QAAQ,OAAO,CAAC;AACxD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAAC,MAKpC;IACC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,GAAG,QAAQ,SAAS,MAAM,CAAC,QAAQ,MAAM,CAAC;AACnD,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,yBAAyB,CAAC,OAAe;IACvD,OAAO,MAAM,OAAO,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -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,UAAU;QACtB,SAAS,EAAE,WAAW,CAAC,UAAU,CAAC;QAClC,SAAS,EAAE,WAAW,CAAC,UAAU,CAAC;QAClC,WAAW,EAAE,QAAQ;KACtB,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;SAC1B,WAAW,EAAE;SACb,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,GAAW;IACnC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAClF,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IACD,OAAO,GAAG,GAAG,GAAG,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DescriptorRelationship, 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,EAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAEvF,OAAO;QACL,GAAG;QACH,KAAK;QACL,SAAS;QACT,YAAY,EAAE,GAAG,CAAC,gBAAgB;QAClC,WAAW;QACX,UAAU;QACV,MAAM;QACN,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,aAAa,EAAE;YACb,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,UAAU,EAAE,kBAAkB,CAAC,UAAU;YACzC,SAAS,EAAE,kBAAkB,CAAC,SAAS;YACvC,SAAS,EAAE,kBAAkB,CAAC,SAAS;SACxC;KACF,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,aAA2C;IAC1E,OAAO,aAAa,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAAC,aAAuC;IAC1E,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,aAAuC;IAC5E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the JSON module definition files
|
|
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,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE;QACb,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAE3B,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IAGjB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,UAAU,GAAG,aAAa,CAAC;IAGtC,MAAM,EAAE,aAAa,EAAE,CAAC;IAGxB,aAAa,EAAE,sBAAsB,EAAE,CAAC;IAGxC,cAAc,EAAE,eAAe,EAAE,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
|