@xbg.solutions/backend-core 1.1.8 → 1.2.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/lib/core/src/generator/generator.d.ts +2 -3
- package/lib/core/src/generator/generator.d.ts.map +1 -1
- package/lib/core/src/generator/generator.js +6 -8
- package/lib/core/src/generator/generator.js.map +1 -1
- package/lib/core/src/generator/parser.js +9 -3
- package/lib/core/src/generator/parser.js.map +1 -1
- package/lib/core/src/generator/templates.d.ts +30 -0
- package/lib/core/src/generator/templates.d.ts.map +1 -0
- package/lib/core/src/generator/templates.js +348 -0
- package/lib/core/src/generator/templates.js.map +1 -0
- package/lib/core/src/generator/types.d.ts +1 -0
- package/lib/core/src/generator/types.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -7,15 +7,14 @@ import { EntitySpecification, GeneratorConfig } from './types';
|
|
|
7
7
|
* Code Generator Class
|
|
8
8
|
*/
|
|
9
9
|
export declare class CodeGenerator {
|
|
10
|
-
private templatesDir;
|
|
11
10
|
private outputDir;
|
|
12
|
-
constructor(
|
|
11
|
+
constructor(outputDir: string);
|
|
13
12
|
/**
|
|
14
13
|
* Generate all code for an entity
|
|
15
14
|
*/
|
|
16
15
|
generateEntity(entityName: string, spec: EntitySpecification, config?: Partial<GeneratorConfig>): Promise<void>;
|
|
17
16
|
/**
|
|
18
|
-
* Generate from
|
|
17
|
+
* Generate from an embedded template
|
|
19
18
|
*/
|
|
20
19
|
private generateFromTemplate;
|
|
21
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/generator/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAmB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/generator/generator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAmB,MAAM,SAAS,CAAC;AAmBhF;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,SAAS,CAAS;gBAEd,SAAS,EAAE,MAAM;IAI7B;;OAEG;IACG,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,mBAAmB,EACzB,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,GACpC,OAAO,CAAC,IAAI,CAAC;IA8BhB;;OAEG;YACW,oBAAoB;IAmBlC;;OAEG;YACW,aAAa;IAK3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;CAsB7C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa,CAGjE"}
|
|
@@ -46,6 +46,7 @@ const fs = __importStar(require("fs"));
|
|
|
46
46
|
const path = __importStar(require("path"));
|
|
47
47
|
const handlebars_1 = __importDefault(require("handlebars"));
|
|
48
48
|
const parser_1 = require("./parser");
|
|
49
|
+
const templates_1 = require("./templates");
|
|
49
50
|
/**
|
|
50
51
|
* Register Handlebars helpers
|
|
51
52
|
*/
|
|
@@ -62,8 +63,7 @@ handlebars_1.default.registerHelper('uppercase', (str) => {
|
|
|
62
63
|
* Code Generator Class
|
|
63
64
|
*/
|
|
64
65
|
class CodeGenerator {
|
|
65
|
-
constructor(
|
|
66
|
-
this.templatesDir = templatesDir;
|
|
66
|
+
constructor(outputDir) {
|
|
67
67
|
this.outputDir = outputDir;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -88,12 +88,11 @@ class CodeGenerator {
|
|
|
88
88
|
console.log(`✅ Generated code for ${entityName}`);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
|
-
* Generate from
|
|
91
|
+
* Generate from an embedded template
|
|
92
92
|
*/
|
|
93
93
|
async generateFromTemplate(templateName, context, outputPath) {
|
|
94
|
-
//
|
|
95
|
-
const
|
|
96
|
-
const templateContent = fs.readFileSync(templatePath, 'utf-8');
|
|
94
|
+
// Get embedded template content
|
|
95
|
+
const templateContent = (0, templates_1.getTemplate)(templateName);
|
|
97
96
|
// Compile template
|
|
98
97
|
const template = handlebars_1.default.compile(templateContent);
|
|
99
98
|
// Generate code
|
|
@@ -152,8 +151,7 @@ exports.CodeGenerator = CodeGenerator;
|
|
|
152
151
|
* Helper function to create generator instance
|
|
153
152
|
*/
|
|
154
153
|
function createGenerator(outputDir) {
|
|
155
|
-
const templatesDir = path.join(__dirname, '../templates');
|
|
156
154
|
const output = outputDir || path.join(__dirname, '../generated');
|
|
157
|
-
return new CodeGenerator(
|
|
155
|
+
return new CodeGenerator(output);
|
|
158
156
|
}
|
|
159
157
|
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/generator/generator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../src/generator/generator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsJH,0CAGC;AAvJD,uCAAyB;AACzB,2CAA6B;AAC7B,4DAAoC;AAEpC,qCAAoD;AACpD,2CAA0C;AAE1C;;GAEG;AACH,oBAAU,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,GAAW,EAAE,EAAE;IACtD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,oBAAU,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,GAAW,EAAE,EAAE;IACrD,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;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|
|
|
27
27
|
businessRules: spec.businessRules,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Base entity field names (should not be duplicated in generated entities)
|
|
32
|
+
*/
|
|
33
|
+
const BASE_ENTITY_FIELDS = new Set(['id', 'createdAt', 'updatedAt', 'deletedAt', 'version']);
|
|
30
34
|
/**
|
|
31
35
|
* Parse field definitions
|
|
32
36
|
*/
|
|
@@ -41,6 +45,7 @@ function parseFields(fields) {
|
|
|
41
45
|
defaultValue: formatDefaultValue(def.default, def.type),
|
|
42
46
|
validation: generateValidationRules(name, def),
|
|
43
47
|
description: def.description,
|
|
48
|
+
isBaseEntityField: BASE_ENTITY_FIELDS.has(name),
|
|
44
49
|
}));
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
@@ -153,11 +158,12 @@ function generateValidationRules(fieldName, field) {
|
|
|
153
158
|
*/
|
|
154
159
|
function generateImports(fields, relationships) {
|
|
155
160
|
const imports = [
|
|
156
|
-
"import { BaseEntity, ValidationResult, ValidationHelper } from '@xbg.solutions/backend-core';",
|
|
161
|
+
"import { BaseEntity, BaseEntityData, ValidationResult, ValidationHelper } from '@xbg.solutions/backend-core';",
|
|
157
162
|
"import { Timestamp, FieldValue } from 'firebase-admin/firestore';",
|
|
158
163
|
];
|
|
159
|
-
// Add relationship imports
|
|
160
|
-
|
|
164
|
+
// Add relationship imports (only if relationships are actually used)
|
|
165
|
+
// Note: Currently these imports are commented out in templates, but kept here for future use
|
|
166
|
+
const relatedEntities = new Set(relationships.map((r) => r.entity).filter(e => e));
|
|
161
167
|
relatedEntities.forEach((entity) => {
|
|
162
168
|
imports.push(`import { ${entity} } from './${entity}';`);
|
|
163
169
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../src/generator/parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAeH,4DAuBC;AA1BD;;GAEG;AACH,SAAgB,wBAAwB,CACtC,UAAkB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,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,2CAA2C;IAC3C,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,OAAO,GAAG,GAAG,GAAG,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded Handlebars Templates
|
|
3
|
+
* All code generation templates as string constants
|
|
4
|
+
* This ensures templates are bundled with the compiled code
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Entity Template
|
|
8
|
+
* Generates entity class with data interface
|
|
9
|
+
*/
|
|
10
|
+
export declare const ENTITY_TEMPLATE = "/**\n * {{entityName}} Entity\n * Generated from data model specification\n */\n\n{{#each imports}}\n{{{this}}}\n{{/each}}\n\nexport interface {{entityName}}Data extends BaseEntityData {\n{{#each fields}}\n{{#unless isBaseEntityField}}\n {{name}}{{#unless required}}?{{/unless}}: {{{tsType}}};\n{{/unless}}\n{{/each}}\n}\n\nexport class {{entityName}} extends BaseEntity {\n{{#each fields}}\n{{#unless isBaseEntityField}}\n {{name}}{{#unless required}}?{{/unless}}: {{{tsType}}};\n{{/unless}}\n{{/each}}\n\n constructor(data: {{entityName}}Data) {\n super(data);\n{{#each fields}}\n{{#unless isBaseEntityField}}\n this.{{name}} = data.{{name}}{{#if hasDefault}} || {{{defaultValue}}}{{/if}};\n{{/unless}}\n{{/each}}\n }\n\n /**\n * Get entity-specific data for Firestore\n */\n protected getEntityData(): Record<string, any> {\n return {\n{{#each fields}}\n{{#unless isBaseEntityField}}\n {{name}}: this.{{name}},\n{{/unless}}\n{{/each}}\n };\n }\n\n /**\n * Validate entity\n */\n validate(): ValidationResult {\n const errors = ValidationHelper.collectErrors(\n{{#each fields}}\n {{#each validation}}\n {{{this}}},\n {{/each}}\n{{/each}}\n );\n\n return ValidationHelper.isValidResult(errors);\n }\n\n /**\n * Create entity from Firestore document\n */\n static fromFirestore(id: string, data: Record<string, any>): {{entityName}} {\n return new {{entityName}}({\n id,\n ...data,\n });\n }\n\n /**\n * Convert to plain object for API responses\n */\n toJSON(): Record<string, any> {\n return {\n id: this.id,\n{{#each fields}}\n{{#unless isBaseEntityField}}\n {{name}}: this.{{name}},\n{{/unless}}\n{{/each}}\n createdAt: this.createdAt,\n updatedAt: this.updatedAt,\n {{#if hasSoftDelete}}\n deletedAt: this.deletedAt,\n {{/if}}\n };\n }\n}\n";
|
|
11
|
+
/**
|
|
12
|
+
* Repository Template
|
|
13
|
+
* Generates repository class for entity
|
|
14
|
+
*/
|
|
15
|
+
export declare const REPOSITORY_TEMPLATE = "/**\n * {{entityName}} Repository\n * Generated from data model specification\n */\n\nimport { Firestore, DocumentData } from 'firebase-admin/firestore';\nimport { BaseRepository } from '@xbg.solutions/backend-core';\nimport { {{entityName}} } from '../entities/{{entityName}}';\n\nexport class {{entityName}}Repository extends BaseRepository<{{entityName}}> {\n protected collectionName = '{{collectionName}}';\n\n constructor(db: Firestore) {\n super(db);\n }\n\n /**\n * Convert Firestore document to entity\n */\n protected fromFirestore(id: string, data: DocumentData): {{entityName}} {\n return {{entityName}}.fromFirestore(id, data);\n }\n\n{{#each fields}}\n{{#if unique}}\n /**\n * Find {{../entityName}} by {{name}}\n */\n async findBy{{capitalize name}}({{name}}: {{{tsType}}}): Promise<{{../entityName}} | null> {\n const snapshot = await this.getCollection()\n .where('{{name}}', '==', {{name}})\n .where('deletedAt', '==', null)\n .limit(1)\n .get();\n\n if (snapshot.empty) {\n return null;\n }\n\n const doc = snapshot.docs[0];\n return this.fromFirestore(doc.id, doc.data());\n }\n{{/if}}\n{{/each}}\n\n{{#each relationships}}\n /**\n * Get {{name}} for {{../entityName}}\n */\n async get{{capitalize name}}({{../entityNameLower}}Id: string): Promise<{{entity}}[]> {\n // Implementation depends on relationship type\n // TODO: Implement relationship query\n return [];\n }\n{{/each}}\n}\n";
|
|
16
|
+
/**
|
|
17
|
+
* Service Template
|
|
18
|
+
* Generates service class for business logic
|
|
19
|
+
*/
|
|
20
|
+
export declare const SERVICE_TEMPLATE = "/**\n * {{entityName}} Service\n * Generated from data model specification\n */\n\nimport { BaseService, RequestContext } from '@xbg.solutions/backend-core';\nimport { {{entityName}}, {{entityName}}Data } from '../entities/{{entityName}}';\nimport { {{entityName}}Repository } from '../repositories/{{entityName}}Repository';\n\nexport class {{entityName}}Service extends BaseService<{{entityName}}> {\n protected entityName = '{{entityName}}';\n\n constructor(repository: {{entityName}}Repository) {\n super(repository);\n }\n\n /**\n * Build entity from partial data\n */\n protected async buildEntity(data: Partial<{{entityName}}Data>): Promise<{{entityName}}> {\n return new {{entityName}}(data as {{entityName}}Data);\n }\n\n /**\n * Merge existing entity with updates\n */\n protected async mergeEntity(existing: {{entityName}}, updates: Partial<{{entityName}}Data>): Promise<{{entityName}}> {\n return new {{entityName}}({\n ...existing.toJSON(),\n ...updates,\n id: existing.id,\n });\n }\n\n{{#if accessRules}}\n /**\n * Check read access\n */\n protected async checkReadAccess(entity: {{entityName}}, context: RequestContext): Promise<boolean> {\n {{#if accessRules.read}}\n const allowedRoles = [{{#each accessRules.read}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];\n\n // Check if user has required role\n if (context.userRole && allowedRoles.includes(context.userRole)) {\n return true;\n }\n\n // Check if user owns the resource\n if (allowedRoles.includes('self')) {\n // TODO: Implement ownership check based on your entity structure\n return true;\n }\n\n return false;\n {{else}}\n return true;\n {{/if}}\n }\n\n /**\n * Check update access\n */\n protected async checkUpdateAccess(entity: {{entityName}}, context: RequestContext): Promise<boolean> {\n {{#if accessRules.update}}\n const allowedRoles = [{{#each accessRules.update}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];\n\n if (context.userRole && allowedRoles.includes(context.userRole)) {\n return true;\n }\n\n if (allowedRoles.includes('self')) {\n // TODO: Implement ownership check\n return true;\n }\n\n return false;\n {{else}}\n return true;\n {{/if}}\n }\n\n /**\n * Check delete access\n */\n protected async checkDeleteAccess(entity: {{entityName}}, context: RequestContext): Promise<boolean> {\n {{#if accessRules.delete}}\n const allowedRoles = [{{#each accessRules.delete}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];\n\n if (context.userRole && allowedRoles.includes(context.userRole)) {\n return true;\n }\n\n return false;\n {{else}}\n return true;\n {{/if}}\n }\n{{/if}}\n\n{{#if businessRules}}\n /**\n * Business Rules:\n{{#each businessRules}}\n * - {{this}}\n{{/each}}\n */\n{{/if}}\n}\n";
|
|
21
|
+
/**
|
|
22
|
+
* Controller Template
|
|
23
|
+
* Generates controller class for HTTP endpoints
|
|
24
|
+
*/
|
|
25
|
+
export declare const CONTROLLER_TEMPLATE = "/**\n * {{entityName}} Controller\n * Generated from data model specification\n */\n\nimport { BaseController } from '@xbg.solutions/backend-core';\nimport { {{entityName}} } from '../entities/{{entityName}}';\nimport { {{entityName}}Service } from '../services/{{entityName}}Service';\n\nexport class {{entityName}}Controller extends BaseController<{{entityName}}> {\n constructor(service: {{entityName}}Service, basePath = '/{{entityNameLower}}s') {\n super(service, basePath);\n }\n\n /**\n * Register custom routes\n */\n protected registerRoutes(): void {\n // Register standard CRUD routes\n super.registerRoutes();\n\n // Add custom routes here\n{{#each fields}}\n{{#if unique}}\n // this.router.get('/by-{{name}}/:{{name}}', this.handleFindBy{{capitalize name}}.bind(this));\n{{/if}}\n{{/each}}\n }\n\n{{#each fields}}\n{{#if unique}}\n /**\n * Find {{../entityName}} by {{name}}\n */\n // protected async handleFindBy{{capitalize name}}(req: Request, res: Response, next: NextFunction): Promise<void> {\n // try {\n // const context = this.createContext(req);\n // const { {{name}} } = req.params;\n //\n // // Implementation here\n // } catch (error) {\n // next(error);\n // }\n // }\n{{/if}}\n{{/each}}\n}\n";
|
|
26
|
+
/**
|
|
27
|
+
* Get template by name
|
|
28
|
+
*/
|
|
29
|
+
export declare function getTemplate(name: string): string;
|
|
30
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../../src/generator/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,eAAe,g1DA0F3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,i9CAwD/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,61FA4G5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,qwCA+C/B,CAAC;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAahD"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Embedded Handlebars Templates
|
|
4
|
+
* All code generation templates as string constants
|
|
5
|
+
* This ensures templates are bundled with the compiled code
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.CONTROLLER_TEMPLATE = exports.SERVICE_TEMPLATE = exports.REPOSITORY_TEMPLATE = exports.ENTITY_TEMPLATE = void 0;
|
|
9
|
+
exports.getTemplate = getTemplate;
|
|
10
|
+
/**
|
|
11
|
+
* Entity Template
|
|
12
|
+
* Generates entity class with data interface
|
|
13
|
+
*/
|
|
14
|
+
exports.ENTITY_TEMPLATE = `/**
|
|
15
|
+
* {{entityName}} Entity
|
|
16
|
+
* Generated from data model specification
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
{{#each imports}}
|
|
20
|
+
{{{this}}}
|
|
21
|
+
{{/each}}
|
|
22
|
+
|
|
23
|
+
export interface {{entityName}}Data extends BaseEntityData {
|
|
24
|
+
{{#each fields}}
|
|
25
|
+
{{#unless isBaseEntityField}}
|
|
26
|
+
{{name}}{{#unless required}}?{{/unless}}: {{{tsType}}};
|
|
27
|
+
{{/unless}}
|
|
28
|
+
{{/each}}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class {{entityName}} extends BaseEntity {
|
|
32
|
+
{{#each fields}}
|
|
33
|
+
{{#unless isBaseEntityField}}
|
|
34
|
+
{{name}}{{#unless required}}?{{/unless}}: {{{tsType}}};
|
|
35
|
+
{{/unless}}
|
|
36
|
+
{{/each}}
|
|
37
|
+
|
|
38
|
+
constructor(data: {{entityName}}Data) {
|
|
39
|
+
super(data);
|
|
40
|
+
{{#each fields}}
|
|
41
|
+
{{#unless isBaseEntityField}}
|
|
42
|
+
this.{{name}} = data.{{name}}{{#if hasDefault}} || {{{defaultValue}}}{{/if}};
|
|
43
|
+
{{/unless}}
|
|
44
|
+
{{/each}}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get entity-specific data for Firestore
|
|
49
|
+
*/
|
|
50
|
+
protected getEntityData(): Record<string, any> {
|
|
51
|
+
return {
|
|
52
|
+
{{#each fields}}
|
|
53
|
+
{{#unless isBaseEntityField}}
|
|
54
|
+
{{name}}: this.{{name}},
|
|
55
|
+
{{/unless}}
|
|
56
|
+
{{/each}}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Validate entity
|
|
62
|
+
*/
|
|
63
|
+
validate(): ValidationResult {
|
|
64
|
+
const errors = ValidationHelper.collectErrors(
|
|
65
|
+
{{#each fields}}
|
|
66
|
+
{{#each validation}}
|
|
67
|
+
{{{this}}},
|
|
68
|
+
{{/each}}
|
|
69
|
+
{{/each}}
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
return ValidationHelper.isValidResult(errors);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Create entity from Firestore document
|
|
77
|
+
*/
|
|
78
|
+
static fromFirestore(id: string, data: Record<string, any>): {{entityName}} {
|
|
79
|
+
return new {{entityName}}({
|
|
80
|
+
id,
|
|
81
|
+
...data,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Convert to plain object for API responses
|
|
87
|
+
*/
|
|
88
|
+
toJSON(): Record<string, any> {
|
|
89
|
+
return {
|
|
90
|
+
id: this.id,
|
|
91
|
+
{{#each fields}}
|
|
92
|
+
{{#unless isBaseEntityField}}
|
|
93
|
+
{{name}}: this.{{name}},
|
|
94
|
+
{{/unless}}
|
|
95
|
+
{{/each}}
|
|
96
|
+
createdAt: this.createdAt,
|
|
97
|
+
updatedAt: this.updatedAt,
|
|
98
|
+
{{#if hasSoftDelete}}
|
|
99
|
+
deletedAt: this.deletedAt,
|
|
100
|
+
{{/if}}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
/**
|
|
106
|
+
* Repository Template
|
|
107
|
+
* Generates repository class for entity
|
|
108
|
+
*/
|
|
109
|
+
exports.REPOSITORY_TEMPLATE = `/**
|
|
110
|
+
* {{entityName}} Repository
|
|
111
|
+
* Generated from data model specification
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
import { Firestore, DocumentData } from 'firebase-admin/firestore';
|
|
115
|
+
import { BaseRepository } from '@xbg.solutions/backend-core';
|
|
116
|
+
import { {{entityName}} } from '../entities/{{entityName}}';
|
|
117
|
+
|
|
118
|
+
export class {{entityName}}Repository extends BaseRepository<{{entityName}}> {
|
|
119
|
+
protected collectionName = '{{collectionName}}';
|
|
120
|
+
|
|
121
|
+
constructor(db: Firestore) {
|
|
122
|
+
super(db);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Convert Firestore document to entity
|
|
127
|
+
*/
|
|
128
|
+
protected fromFirestore(id: string, data: DocumentData): {{entityName}} {
|
|
129
|
+
return {{entityName}}.fromFirestore(id, data);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
{{#each fields}}
|
|
133
|
+
{{#if unique}}
|
|
134
|
+
/**
|
|
135
|
+
* Find {{../entityName}} by {{name}}
|
|
136
|
+
*/
|
|
137
|
+
async findBy{{capitalize name}}({{name}}: {{{tsType}}}): Promise<{{../entityName}} | null> {
|
|
138
|
+
const snapshot = await this.getCollection()
|
|
139
|
+
.where('{{name}}', '==', {{name}})
|
|
140
|
+
.where('deletedAt', '==', null)
|
|
141
|
+
.limit(1)
|
|
142
|
+
.get();
|
|
143
|
+
|
|
144
|
+
if (snapshot.empty) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const doc = snapshot.docs[0];
|
|
149
|
+
return this.fromFirestore(doc.id, doc.data());
|
|
150
|
+
}
|
|
151
|
+
{{/if}}
|
|
152
|
+
{{/each}}
|
|
153
|
+
|
|
154
|
+
{{#each relationships}}
|
|
155
|
+
/**
|
|
156
|
+
* Get {{name}} for {{../entityName}}
|
|
157
|
+
*/
|
|
158
|
+
async get{{capitalize name}}({{../entityNameLower}}Id: string): Promise<{{entity}}[]> {
|
|
159
|
+
// Implementation depends on relationship type
|
|
160
|
+
// TODO: Implement relationship query
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
{{/each}}
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
/**
|
|
167
|
+
* Service Template
|
|
168
|
+
* Generates service class for business logic
|
|
169
|
+
*/
|
|
170
|
+
exports.SERVICE_TEMPLATE = `/**
|
|
171
|
+
* {{entityName}} Service
|
|
172
|
+
* Generated from data model specification
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
import { BaseService, RequestContext } from '@xbg.solutions/backend-core';
|
|
176
|
+
import { {{entityName}}, {{entityName}}Data } from '../entities/{{entityName}}';
|
|
177
|
+
import { {{entityName}}Repository } from '../repositories/{{entityName}}Repository';
|
|
178
|
+
|
|
179
|
+
export class {{entityName}}Service extends BaseService<{{entityName}}> {
|
|
180
|
+
protected entityName = '{{entityName}}';
|
|
181
|
+
|
|
182
|
+
constructor(repository: {{entityName}}Repository) {
|
|
183
|
+
super(repository);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Build entity from partial data
|
|
188
|
+
*/
|
|
189
|
+
protected async buildEntity(data: Partial<{{entityName}}Data>): Promise<{{entityName}}> {
|
|
190
|
+
return new {{entityName}}(data as {{entityName}}Data);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Merge existing entity with updates
|
|
195
|
+
*/
|
|
196
|
+
protected async mergeEntity(existing: {{entityName}}, updates: Partial<{{entityName}}Data>): Promise<{{entityName}}> {
|
|
197
|
+
return new {{entityName}}({
|
|
198
|
+
...existing.toJSON(),
|
|
199
|
+
...updates,
|
|
200
|
+
id: existing.id,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
{{#if accessRules}}
|
|
205
|
+
/**
|
|
206
|
+
* Check read access
|
|
207
|
+
*/
|
|
208
|
+
protected async checkReadAccess(entity: {{entityName}}, context: RequestContext): Promise<boolean> {
|
|
209
|
+
{{#if accessRules.read}}
|
|
210
|
+
const allowedRoles = [{{#each accessRules.read}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];
|
|
211
|
+
|
|
212
|
+
// Check if user has required role
|
|
213
|
+
if (context.userRole && allowedRoles.includes(context.userRole)) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Check if user owns the resource
|
|
218
|
+
if (allowedRoles.includes('self')) {
|
|
219
|
+
// TODO: Implement ownership check based on your entity structure
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return false;
|
|
224
|
+
{{else}}
|
|
225
|
+
return true;
|
|
226
|
+
{{/if}}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Check update access
|
|
231
|
+
*/
|
|
232
|
+
protected async checkUpdateAccess(entity: {{entityName}}, context: RequestContext): Promise<boolean> {
|
|
233
|
+
{{#if accessRules.update}}
|
|
234
|
+
const allowedRoles = [{{#each accessRules.update}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];
|
|
235
|
+
|
|
236
|
+
if (context.userRole && allowedRoles.includes(context.userRole)) {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (allowedRoles.includes('self')) {
|
|
241
|
+
// TODO: Implement ownership check
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return false;
|
|
246
|
+
{{else}}
|
|
247
|
+
return true;
|
|
248
|
+
{{/if}}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Check delete access
|
|
253
|
+
*/
|
|
254
|
+
protected async checkDeleteAccess(entity: {{entityName}}, context: RequestContext): Promise<boolean> {
|
|
255
|
+
{{#if accessRules.delete}}
|
|
256
|
+
const allowedRoles = [{{#each accessRules.delete}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];
|
|
257
|
+
|
|
258
|
+
if (context.userRole && allowedRoles.includes(context.userRole)) {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return false;
|
|
263
|
+
{{else}}
|
|
264
|
+
return true;
|
|
265
|
+
{{/if}}
|
|
266
|
+
}
|
|
267
|
+
{{/if}}
|
|
268
|
+
|
|
269
|
+
{{#if businessRules}}
|
|
270
|
+
/**
|
|
271
|
+
* Business Rules:
|
|
272
|
+
{{#each businessRules}}
|
|
273
|
+
* - {{this}}
|
|
274
|
+
{{/each}}
|
|
275
|
+
*/
|
|
276
|
+
{{/if}}
|
|
277
|
+
}
|
|
278
|
+
`;
|
|
279
|
+
/**
|
|
280
|
+
* Controller Template
|
|
281
|
+
* Generates controller class for HTTP endpoints
|
|
282
|
+
*/
|
|
283
|
+
exports.CONTROLLER_TEMPLATE = `/**
|
|
284
|
+
* {{entityName}} Controller
|
|
285
|
+
* Generated from data model specification
|
|
286
|
+
*/
|
|
287
|
+
|
|
288
|
+
import { BaseController } from '@xbg.solutions/backend-core';
|
|
289
|
+
import { {{entityName}} } from '../entities/{{entityName}}';
|
|
290
|
+
import { {{entityName}}Service } from '../services/{{entityName}}Service';
|
|
291
|
+
|
|
292
|
+
export class {{entityName}}Controller extends BaseController<{{entityName}}> {
|
|
293
|
+
constructor(service: {{entityName}}Service, basePath = '/{{entityNameLower}}s') {
|
|
294
|
+
super(service, basePath);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Register custom routes
|
|
299
|
+
*/
|
|
300
|
+
protected registerRoutes(): void {
|
|
301
|
+
// Register standard CRUD routes
|
|
302
|
+
super.registerRoutes();
|
|
303
|
+
|
|
304
|
+
// Add custom routes here
|
|
305
|
+
{{#each fields}}
|
|
306
|
+
{{#if unique}}
|
|
307
|
+
// this.router.get('/by-{{name}}/:{{name}}', this.handleFindBy{{capitalize name}}.bind(this));
|
|
308
|
+
{{/if}}
|
|
309
|
+
{{/each}}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
{{#each fields}}
|
|
313
|
+
{{#if unique}}
|
|
314
|
+
/**
|
|
315
|
+
* Find {{../entityName}} by {{name}}
|
|
316
|
+
*/
|
|
317
|
+
// protected async handleFindBy{{capitalize name}}(req: Request, res: Response, next: NextFunction): Promise<void> {
|
|
318
|
+
// try {
|
|
319
|
+
// const context = this.createContext(req);
|
|
320
|
+
// const { {{name}} } = req.params;
|
|
321
|
+
//
|
|
322
|
+
// // Implementation here
|
|
323
|
+
// } catch (error) {
|
|
324
|
+
// next(error);
|
|
325
|
+
// }
|
|
326
|
+
// }
|
|
327
|
+
{{/if}}
|
|
328
|
+
{{/each}}
|
|
329
|
+
}
|
|
330
|
+
`;
|
|
331
|
+
/**
|
|
332
|
+
* Get template by name
|
|
333
|
+
*/
|
|
334
|
+
function getTemplate(name) {
|
|
335
|
+
switch (name) {
|
|
336
|
+
case 'entity':
|
|
337
|
+
return exports.ENTITY_TEMPLATE;
|
|
338
|
+
case 'repository':
|
|
339
|
+
return exports.REPOSITORY_TEMPLATE;
|
|
340
|
+
case 'service':
|
|
341
|
+
return exports.SERVICE_TEMPLATE;
|
|
342
|
+
case 'controller':
|
|
343
|
+
return exports.CONTROLLER_TEMPLATE;
|
|
344
|
+
default:
|
|
345
|
+
throw new Error(`Unknown template: ${name}`);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../../src/generator/templates.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA0UH,kCAaC;AArVD;;;GAGG;AACU,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0F9B,CAAC;AAEF;;;GAGG;AACU,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDlC,CAAC;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BAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbg.solutions/backend-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "XBG Backend Core - Base classes, middleware, config, and code generator",
|
|
5
5
|
"main": "lib/core/src/index.js",
|
|
6
6
|
"types": "lib/core/src/index.d.ts",
|
|
@@ -15,18 +15,20 @@
|
|
|
15
15
|
"prepublishOnly": "npm run build"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
"@xbg.solutions/utils-
|
|
21
|
-
"@xbg.solutions/utils-
|
|
22
|
-
"@xbg.solutions/utils-
|
|
23
|
-
"@xbg.solutions/utils-
|
|
18
|
+
"@types/cors": "^2.8.17",
|
|
19
|
+
"@types/express": "^4.17.21",
|
|
20
|
+
"@xbg.solutions/utils-cache-connector": "^1.2.0",
|
|
21
|
+
"@xbg.solutions/utils-events": "^1.2.0",
|
|
22
|
+
"@xbg.solutions/utils-firebase-event-bridge": "^1.2.0",
|
|
23
|
+
"@xbg.solutions/utils-firestore-connector": "^1.2.0",
|
|
24
|
+
"@xbg.solutions/utils-logger": "^1.2.0",
|
|
25
|
+
"@xbg.solutions/utils-token-handler": "^1.2.0",
|
|
24
26
|
"cors": "^2.8.5",
|
|
25
27
|
"dotenv": "^16.3.1",
|
|
26
28
|
"express": "^4.18.2",
|
|
27
29
|
"express-rate-limit": "^7.1.5",
|
|
28
30
|
"express-validator": "^7.0.1",
|
|
29
|
-
"firebase-admin": "^
|
|
31
|
+
"firebase-admin": "^13.7.0",
|
|
30
32
|
"firebase-functions": "^4.6.0",
|
|
31
33
|
"handlebars": "^4.7.8",
|
|
32
34
|
"helmet": "^7.1.0",
|
|
@@ -34,8 +36,6 @@
|
|
|
34
36
|
"uuid": "^9.0.1"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@types/cors": "^2.8.17",
|
|
38
|
-
"@types/express": "^4.17.21",
|
|
39
39
|
"@types/node": "^20.11.0",
|
|
40
40
|
"@types/uuid": "^9.0.7",
|
|
41
41
|
"typescript": "^5.3.3"
|