@carlonicora/nestjs-neo4jsonapi 1.3.1 → 1.4.1
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 +180 -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 +109 -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 +110 -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 +133 -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 +93 -0
- package/dist/scripts/generate-module/transformers/import-resolver.d.ts.map +1 -0
- package/dist/scripts/generate-module/transformers/import-resolver.js +108 -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,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Foundation package name constant
|
|
3
|
+
*/
|
|
4
|
+
export declare const FOUNDATION_PACKAGE = "@carlonicora/nestjs-neo4jsonapi";
|
|
5
|
+
/**
|
|
6
|
+
* Check if a directory represents a foundation import (from the package)
|
|
7
|
+
*
|
|
8
|
+
* @param directory - The directory string from relationship definition
|
|
9
|
+
* @returns True if this should import from the foundation package
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* isFoundationImport("@foundation") // true
|
|
13
|
+
* isFoundationImport("features/campaign") // false
|
|
14
|
+
*/
|
|
15
|
+
export declare function isFoundationImport(directory: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve relative import path between two modules
|
|
18
|
+
*
|
|
19
|
+
* @param params - From and to directories and modules
|
|
20
|
+
* @returns Relative import path
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* From: src/features/comment
|
|
24
|
+
* To: src/foundations/user
|
|
25
|
+
* Result: "../../foundations/user"
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveImportPath(params: {
|
|
28
|
+
fromDir: string;
|
|
29
|
+
fromModule: string;
|
|
30
|
+
toDir: string;
|
|
31
|
+
toModule: string;
|
|
32
|
+
}): string;
|
|
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
|
+
export declare function resolveEntityImportPath(params: {
|
|
44
|
+
fromDir: string;
|
|
45
|
+
fromModule: string;
|
|
46
|
+
toDir: string;
|
|
47
|
+
toModule: string;
|
|
48
|
+
}): string;
|
|
49
|
+
/**
|
|
50
|
+
* Resolve import path for meta file
|
|
51
|
+
*
|
|
52
|
+
* @param params - From and to module info
|
|
53
|
+
* @returns Import path to meta file
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* resolveMetaImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
|
|
57
|
+
* // Returns: "../../foundations/user/entities/user.meta"
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveMetaImportPath(params: {
|
|
60
|
+
fromDir: string;
|
|
61
|
+
fromModule: string;
|
|
62
|
+
toDir: string;
|
|
63
|
+
toModule: string;
|
|
64
|
+
}): string;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve import path for DTO file
|
|
67
|
+
*
|
|
68
|
+
* @param params - From and to module info
|
|
69
|
+
* @returns Import path to DTO file
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* resolveDtoImportPath({ fromDir: "features", fromModule: "comment", toDir: "features", toModule: "discussion" })
|
|
73
|
+
* // Returns: "../discussion/dtos/discussion.dto"
|
|
74
|
+
*/
|
|
75
|
+
export declare function resolveDtoImportPath(params: {
|
|
76
|
+
fromDir: string;
|
|
77
|
+
fromModule: string;
|
|
78
|
+
toDir: string;
|
|
79
|
+
toModule: string;
|
|
80
|
+
}): string;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve import path relative to module root
|
|
83
|
+
* Used for imports within the same module
|
|
84
|
+
*
|
|
85
|
+
* @param subpath - Subpath within module (e.g., "entities/comment", "services/comment.service")
|
|
86
|
+
* @returns Relative import path
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* resolveModuleInternalPath("entities/comment")
|
|
90
|
+
* // Returns: "../entities/comment"
|
|
91
|
+
*/
|
|
92
|
+
export declare function resolveModuleInternalPath(subpath: string): string;
|
|
93
|
+
//# 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;;GAEG;AACH,eAAO,MAAM,kBAAkB,oCAAoC,CAAC;AAEpE;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;;;;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,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FOUNDATION_PACKAGE = void 0;
|
|
4
|
+
exports.isFoundationImport = isFoundationImport;
|
|
5
|
+
exports.resolveImportPath = resolveImportPath;
|
|
6
|
+
exports.resolveEntityImportPath = resolveEntityImportPath;
|
|
7
|
+
exports.resolveMetaImportPath = resolveMetaImportPath;
|
|
8
|
+
exports.resolveDtoImportPath = resolveDtoImportPath;
|
|
9
|
+
exports.resolveModuleInternalPath = resolveModuleInternalPath;
|
|
10
|
+
/**
|
|
11
|
+
* Foundation package name constant
|
|
12
|
+
*/
|
|
13
|
+
exports.FOUNDATION_PACKAGE = "@carlonicora/nestjs-neo4jsonapi";
|
|
14
|
+
/**
|
|
15
|
+
* Check if a directory represents a foundation import (from the package)
|
|
16
|
+
*
|
|
17
|
+
* @param directory - The directory string from relationship definition
|
|
18
|
+
* @returns True if this should import from the foundation package
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* isFoundationImport("@foundation") // true
|
|
22
|
+
* isFoundationImport("features/campaign") // false
|
|
23
|
+
*/
|
|
24
|
+
function isFoundationImport(directory) {
|
|
25
|
+
return directory === "@foundation" || directory.startsWith("@foundation/");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve relative import path between two modules
|
|
29
|
+
*
|
|
30
|
+
* @param params - From and to directories and modules
|
|
31
|
+
* @returns Relative import path
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* From: src/features/comment
|
|
35
|
+
* To: src/foundations/user
|
|
36
|
+
* Result: "../../foundations/user"
|
|
37
|
+
*/
|
|
38
|
+
function resolveImportPath(params) {
|
|
39
|
+
const { fromDir, fromModule, toDir, toModule } = params;
|
|
40
|
+
// If in same directory, just go up one level and into the module
|
|
41
|
+
if (fromDir === toDir) {
|
|
42
|
+
return `../${toModule}`;
|
|
43
|
+
}
|
|
44
|
+
// Different directories: go up to src, then down to target
|
|
45
|
+
// From: src/features/comment → need to go up 2 levels to reach src
|
|
46
|
+
// To: src/foundations/user → then go down into foundations/user
|
|
47
|
+
const upLevels = 2; // Always 2: one for module folder, one for directory folder
|
|
48
|
+
const up = "../".repeat(upLevels);
|
|
49
|
+
const down = `${toDir}/${toModule}`;
|
|
50
|
+
return `${up}${down}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve import path for entity file
|
|
54
|
+
*
|
|
55
|
+
* @param params - From and to module info
|
|
56
|
+
* @returns Import path to entity file
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* resolveEntityImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
|
|
60
|
+
* // Returns: "../../foundations/user/entities/user.entity"
|
|
61
|
+
*/
|
|
62
|
+
function resolveEntityImportPath(params) {
|
|
63
|
+
const basePath = resolveImportPath(params);
|
|
64
|
+
return `${basePath}/entities/${params.toModule}.entity`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Resolve import path for meta file
|
|
68
|
+
*
|
|
69
|
+
* @param params - From and to module info
|
|
70
|
+
* @returns Import path to meta file
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* resolveMetaImportPath({ fromDir: "features", fromModule: "comment", toDir: "foundations", toModule: "user" })
|
|
74
|
+
* // Returns: "../../foundations/user/entities/user.meta"
|
|
75
|
+
*/
|
|
76
|
+
function resolveMetaImportPath(params) {
|
|
77
|
+
const basePath = resolveImportPath(params);
|
|
78
|
+
return `${basePath}/entities/${params.toModule}.meta`;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Resolve import path for DTO file
|
|
82
|
+
*
|
|
83
|
+
* @param params - From and to module info
|
|
84
|
+
* @returns Import path to DTO file
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* resolveDtoImportPath({ fromDir: "features", fromModule: "comment", toDir: "features", toModule: "discussion" })
|
|
88
|
+
* // Returns: "../discussion/dtos/discussion.dto"
|
|
89
|
+
*/
|
|
90
|
+
function resolveDtoImportPath(params) {
|
|
91
|
+
const basePath = resolveImportPath(params);
|
|
92
|
+
return `${basePath}/dtos/${params.toModule}.dto`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve import path relative to module root
|
|
96
|
+
* Used for imports within the same module
|
|
97
|
+
*
|
|
98
|
+
* @param subpath - Subpath within module (e.g., "entities/comment", "services/comment.service")
|
|
99
|
+
* @returns Relative import path
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* resolveModuleInternalPath("entities/comment")
|
|
103
|
+
* // Returns: "../entities/comment"
|
|
104
|
+
*/
|
|
105
|
+
function resolveModuleInternalPath(subpath) {
|
|
106
|
+
return `../${subpath}`;
|
|
107
|
+
}
|
|
108
|
+
//# 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":";;;AAeA,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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/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,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,wD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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"}
|