@hamak/smart-data-dico 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/backend/dist/server.mjs +82212 -0
  2. package/bin/cli.js +28 -17
  3. package/package.json +28 -27
  4. package/backend/package.json +0 -51
  5. package/backend/src/__tests__/integration/api.test.ts +0 -149
  6. package/backend/src/__tests__/setup.ts +0 -24
  7. package/backend/src/__tests__/utils/testUtils.ts +0 -76
  8. package/backend/src/adapters/EntityFileAdapter.ts +0 -154
  9. package/backend/src/adapters/YamlFileInfoEnricher.ts +0 -52
  10. package/backend/src/controllers/authController.ts +0 -131
  11. package/backend/src/controllers/diagramController.ts +0 -143
  12. package/backend/src/controllers/dictionaryController.ts +0 -306
  13. package/backend/src/controllers/importExportController.ts +0 -64
  14. package/backend/src/controllers/perspectiveController.ts +0 -90
  15. package/backend/src/controllers/serviceController.ts +0 -418
  16. package/backend/src/controllers/stereotypeController.ts +0 -59
  17. package/backend/src/controllers/versionController.ts +0 -226
  18. package/backend/src/kernel/config.ts +0 -43
  19. package/backend/src/middleware/auth.ts +0 -128
  20. package/backend/src/middleware/jwtAuth.ts +0 -100
  21. package/backend/src/models/Dictionary.ts +0 -38
  22. package/backend/src/models/EntitySchema.ts +0 -393
  23. package/backend/src/models/__tests__/Dictionary.test.ts +0 -92
  24. package/backend/src/models/__tests__/EntitySchema.test.ts +0 -119
  25. package/backend/src/routes/index.ts +0 -120
  26. package/backend/src/scripts/migrate-to-uuid.ts +0 -24
  27. package/backend/src/server.ts +0 -158
  28. package/backend/src/services/__mocks__/entityService.ts +0 -38
  29. package/backend/src/services/__mocks__/serviceService.ts +0 -88
  30. package/backend/src/services/__mocks__/versionService.ts +0 -38
  31. package/backend/src/services/__tests__/dictionaryService.test.ts +0 -74
  32. package/backend/src/services/diagramService.ts +0 -165
  33. package/backend/src/services/dictionaryService.ts +0 -582
  34. package/backend/src/services/entityService.ts +0 -102
  35. package/backend/src/services/exportService.ts +0 -172
  36. package/backend/src/services/importService.ts +0 -208
  37. package/backend/src/services/perspectiveService.ts +0 -276
  38. package/backend/src/services/qualityService.ts +0 -121
  39. package/backend/src/services/serviceService.ts +0 -763
  40. package/backend/src/services/stereotypeService.ts +0 -98
  41. package/backend/src/services/versionService.ts +0 -135
  42. package/backend/src/setupTests.ts +0 -12
  43. package/backend/src/utils/__mocks__/fileOperations.ts +0 -116
  44. package/backend/src/utils/fileOperations.ts +0 -602
  45. package/backend/src/utils/logger.ts +0 -38
  46. package/backend/src/utils/migration.ts +0 -254
  47. package/backend/src/utils/swagger.ts +0 -358
  48. package/backend/src/utils/uuid.ts +0 -41
  49. package/backend/tsconfig.json +0 -20
@@ -1,121 +0,0 @@
1
- import { listMicroservices, listMicroserviceEntities, readEntityFile, readRelationshipsFile, getPackagePath } from '../utils/fileOperations.js';
2
- import { stereotypeService } from './stereotypeService.js';
3
- import { logger } from '../utils/logger.js';
4
-
5
- interface EntityQuality {
6
- name: string;
7
- uuid: string;
8
- descriptionFilled: boolean;
9
- attributeDescriptionRate: number;
10
- stereotypeCompliant: boolean;
11
- hasRelationships: boolean;
12
- score: number;
13
- }
14
-
15
- interface PackageQuality {
16
- name: string;
17
- entityCount: number;
18
- descriptionCoverage: number;
19
- metadataCoverage: number;
20
- relationshipCoverage: number;
21
- overallScore: number;
22
- entities: EntityQuality[];
23
- }
24
-
25
- interface QualityReport {
26
- overall: number;
27
- totalEntities: number;
28
- totalAttributes: number;
29
- packages: PackageQuality[];
30
- }
31
-
32
- class QualityService {
33
- async getQualityReport(service?: string): Promise<QualityReport> {
34
- const services = service ? [service] : await listMicroservices();
35
- const packages: PackageQuality[] = [];
36
-
37
- for (const svc of services) {
38
- const entityNames = await listMicroserviceEntities(svc);
39
- const entities: EntityQuality[] = [];
40
-
41
- let relEntityUuids = new Set<string>();
42
- try {
43
- const rels = await readRelationshipsFile(getPackagePath(svc));
44
- for (const rel of rels) {
45
- relEntityUuids.add(rel.source.entity);
46
- relEntityUuids.add(rel.target.entity);
47
- }
48
- } catch { /* ok */ }
49
-
50
- for (const rawName of entityNames) {
51
- const name = rawName.includes('_') ? rawName.split('_').slice(1).join('_') : rawName;
52
- const entity = await readEntityFile(svc, name);
53
- if (!entity) continue;
54
-
55
- const descFilled = !!entity.description;
56
- const totalAttrs = entity.attributes.length;
57
- const attrsWithDesc = entity.attributes.filter(a => a.description && a.description.trim()).length;
58
- const attrDescRate = totalAttrs > 0 ? (attrsWithDesc / totalAttrs) * 100 : 100;
59
- const hasRels = relEntityUuids.has(entity.uuid);
60
-
61
- // Check stereotype compliance
62
- let stereotypeCompliant = true;
63
- if (entity.stereotype) {
64
- const stereotype = await stereotypeService.getStereotype(entity.stereotype);
65
- if (stereotype) {
66
- const errors = stereotypeService.validateMetadata(stereotype, entity.metadata);
67
- stereotypeCompliant = errors.length === 0;
68
- }
69
- }
70
-
71
- // Score: description 30%, attribute descriptions 30%, relationships 20%, stereotype 20%
72
- const score = (
73
- (descFilled ? 30 : 0) +
74
- (attrDescRate * 0.3) +
75
- (hasRels ? 20 : 0) +
76
- (stereotypeCompliant ? 20 : 0)
77
- );
78
-
79
- entities.push({
80
- name: entity.name,
81
- uuid: entity.uuid,
82
- descriptionFilled: descFilled,
83
- attributeDescriptionRate: Math.round(attrDescRate),
84
- stereotypeCompliant,
85
- hasRelationships: hasRels,
86
- score: Math.round(score),
87
- });
88
- }
89
-
90
- const entityCount = entities.length;
91
- const descCoverage = entityCount > 0
92
- ? Math.round((entities.filter(e => e.descriptionFilled).length / entityCount) * 100) : 100;
93
- const metaCoverage = entityCount > 0
94
- ? Math.round((entities.filter(e => e.stereotypeCompliant).length / entityCount) * 100) : 100;
95
- const relCoverage = entityCount > 0
96
- ? Math.round((entities.filter(e => e.hasRelationships).length / entityCount) * 100) : 100;
97
- const overallScore = entityCount > 0
98
- ? Math.round(entities.reduce((sum, e) => sum + e.score, 0) / entityCount) : 100;
99
-
100
- packages.push({
101
- name: svc,
102
- entityCount,
103
- descriptionCoverage: descCoverage,
104
- metadataCoverage: metaCoverage,
105
- relationshipCoverage: relCoverage,
106
- overallScore,
107
- entities,
108
- });
109
- }
110
-
111
- const totalEntities = packages.reduce((sum, p) => sum + p.entityCount, 0);
112
- const totalAttributes = packages.reduce((sum, p) =>
113
- sum + p.entities.reduce((s, e) => s + (e.attributeDescriptionRate > 0 ? 1 : 0), 0), 0);
114
- const overall = packages.length > 0
115
- ? Math.round(packages.reduce((sum, p) => sum + p.overallScore, 0) / packages.length) : 100;
116
-
117
- return { overall, totalEntities, totalAttributes, packages };
118
- }
119
- }
120
-
121
- export const qualityService = new QualityService();