@manojkmfsi/monodog 1.0.23 → 1.0.24
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -0
- package/dist/controllers/{commitController.js → commit-controller.js} +5 -4
- package/dist/controllers/{configController.js → config-controller.js} +3 -3
- package/dist/controllers/{healthController.js → health-controller.js} +3 -3
- package/dist/controllers/{packageController.js → package-controller.js} +6 -6
- package/dist/index.js +11 -236
- package/dist/middleware/dashboard-startup.js +122 -0
- package/dist/middleware/error-handler.js +43 -0
- package/dist/middleware/index.js +21 -0
- package/dist/middleware/security.js +78 -0
- package/dist/middleware/server-startup.js +111 -0
- package/dist/repositories/commit-repository.js +97 -0
- package/dist/repositories/dependency-repository.js +97 -0
- package/dist/repositories/index.js +18 -0
- package/dist/repositories/package-health-repository.js +65 -0
- package/dist/repositories/package-repository.js +126 -0
- package/dist/repositories/prisma-client.js +57 -0
- package/dist/routes/{commitRoutes.js → commit-routes.js} +2 -2
- package/dist/routes/{configRoutes.js → config-routes.js} +3 -3
- package/dist/routes/{healthRoutes.js → health-routes.js} +3 -3
- package/dist/routes/{packageRoutes.js → package-routes.js} +5 -5
- package/dist/services/{commitService.js → commit-service.js} +2 -2
- package/dist/services/{configService.js → config-service.js} +2 -40
- package/dist/services/{healthService.js → health-service.js} +11 -63
- package/dist/services/{packageService.js → package-service.js} +80 -54
- package/dist/types/git.js +11 -0
- package/dist/types/index.js +1 -0
- package/package.json +1 -1
- package/src/controllers/{commitController.ts → commit-controller.ts} +7 -5
- package/src/controllers/{configController.ts → config-controller.ts} +4 -3
- package/src/controllers/{healthController.ts → health-controller.ts} +4 -3
- package/src/controllers/{packageController.ts → package-controller.ts} +7 -6
- package/src/index.ts +9 -281
- package/src/middleware/dashboard-startup.ts +150 -0
- package/src/middleware/error-handler.ts +63 -0
- package/src/middleware/index.ts +18 -0
- package/src/middleware/security.ts +81 -0
- package/src/middleware/server-startup.ts +140 -0
- package/src/repositories/commit-repository.ts +107 -0
- package/src/repositories/dependency-repository.ts +109 -0
- package/src/repositories/index.ts +10 -0
- package/src/repositories/package-health-repository.ts +75 -0
- package/src/repositories/package-repository.ts +142 -0
- package/src/repositories/prisma-client.ts +25 -0
- package/src/routes/{commitRoutes.ts → commit-routes.ts} +1 -1
- package/src/routes/{configRoutes.ts → config-routes.ts} +1 -1
- package/src/routes/{healthRoutes.ts → health-routes.ts} +1 -1
- package/src/routes/{packageRoutes.ts → package-routes.ts} +1 -1
- package/src/services/{commitService.ts → commit-service.ts} +1 -1
- package/src/services/{configService.ts → config-service.ts} +22 -9
- package/src/services/{gitService.ts → git-service.ts} +4 -4
- package/src/services/{healthService.ts → health-service.ts} +17 -35
- package/src/services/package-service.ts +201 -0
- package/src/types/database.ts +57 -1
- package/src/types/git.ts +8 -8
- package/src/types/index.ts +1 -1
- package/dist/utils/db-utils.js +0 -227
- package/src/services/packageService.ts +0 -115
- package/src/types/monorepo-scanner.d.ts +0 -32
- package/src/utils/db-utils.ts +0 -220
- /package/dist/services/{gitService.js → git-service.js} +0 -0
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
@@ -39,9 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
6
|
exports.updatePackageConfigurationService = exports.updateConfigFileService = exports.getConfigurationFilesService = void 0;
|
|
40
7
|
const fs_1 = __importDefault(require("fs"));
|
|
41
8
|
const path_1 = __importDefault(require("path"));
|
|
42
|
-
const
|
|
43
|
-
const PrismaClient = PrismaPkg.PrismaClient || PrismaPkg.default || PrismaPkg;
|
|
44
|
-
const prisma = new PrismaClient();
|
|
9
|
+
const repositories_1 = require("../repositories");
|
|
45
10
|
// Helper function to scan for configuration files
|
|
46
11
|
async function scanConfigFiles(rootDir) {
|
|
47
12
|
const configPatterns = [
|
|
@@ -343,10 +308,7 @@ const updatePackageConfigurationService = async (packagePath, packageName, confi
|
|
|
343
308
|
if (newConfig.peerDependencies)
|
|
344
309
|
updateData.peerDependencies = JSON.stringify(newConfig.peerDependencies);
|
|
345
310
|
console.log('Updating database with:', updateData);
|
|
346
|
-
const updatedPackage = await
|
|
347
|
-
where: { name: packageName },
|
|
348
|
-
data: updateData,
|
|
349
|
-
});
|
|
311
|
+
const updatedPackage = await repositories_1.PackageRepository.updateConfig(packageName, updateData);
|
|
350
312
|
// Transform the response
|
|
351
313
|
const transformedPackage = {
|
|
352
314
|
...updatedPackage,
|
|
@@ -1,46 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.healthRefreshService = exports.getHealthSummaryService = void 0;
|
|
37
4
|
const utilities_1 = require("../utils/utilities");
|
|
38
5
|
const monorepo_scanner_1 = require("../utils/monorepo-scanner");
|
|
39
|
-
const
|
|
40
|
-
const PrismaClient = PrismaPkg.PrismaClient || PrismaPkg.default || PrismaPkg;
|
|
41
|
-
const prisma = new PrismaClient();
|
|
6
|
+
const repositories_1 = require("../repositories");
|
|
42
7
|
const getHealthSummaryService = async () => {
|
|
43
|
-
const packageHealthData = await
|
|
8
|
+
const packageHealthData = await repositories_1.PackageHealthRepository.findAll();
|
|
44
9
|
console.log('packageHealthData -->', packageHealthData.length);
|
|
45
10
|
// Transform the data to match the expected frontend format
|
|
46
11
|
const packages = packageHealthData.map((pkg) => {
|
|
@@ -101,34 +66,17 @@ const healthRefreshService = async (rootDir) => {
|
|
|
101
66
|
? 'warning'
|
|
102
67
|
: 'error';
|
|
103
68
|
console.log(pkg.name, '-->', health, packageStatus);
|
|
104
|
-
await
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
packageLintStatus: lintStatus,
|
|
113
|
-
packageSecurity: securityAudit,
|
|
114
|
-
packageDependencies: '',
|
|
115
|
-
updatedAt: new Date()
|
|
116
|
-
},
|
|
117
|
-
create: {
|
|
118
|
-
packageName: pkg.name,
|
|
119
|
-
packageOverallScore: overallScore.overallScore,
|
|
120
|
-
packageBuildStatus: buildStatus,
|
|
121
|
-
packageTestCoverage: testCoverage,
|
|
122
|
-
packageLintStatus: lintStatus,
|
|
123
|
-
packageSecurity: securityAudit,
|
|
124
|
-
packageDependencies: '',
|
|
125
|
-
},
|
|
69
|
+
await repositories_1.PackageHealthRepository.upsert({
|
|
70
|
+
packageName: pkg.name,
|
|
71
|
+
packageOverallScore: overallScore.overallScore,
|
|
72
|
+
packageBuildStatus: buildStatus,
|
|
73
|
+
packageTestCoverage: testCoverage,
|
|
74
|
+
packageLintStatus: lintStatus,
|
|
75
|
+
packageSecurity: securityAudit,
|
|
76
|
+
packageDependencies: '',
|
|
126
77
|
});
|
|
127
78
|
// update related package status as well
|
|
128
|
-
await
|
|
129
|
-
where: { name: pkg.name },
|
|
130
|
-
data: { status: packageStatus },
|
|
131
|
-
});
|
|
79
|
+
await repositories_1.PackageRepository.updateStatus(pkg.name, packageStatus);
|
|
132
80
|
return {
|
|
133
81
|
packageName: pkg.name,
|
|
134
82
|
health,
|
|
@@ -1,48 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.getPackageDetailService = exports.refreshPackagesService = exports.getPackagesService = void 0;
|
|
37
4
|
const utilities_1 = require("../utils/utilities");
|
|
38
5
|
const monorepo_scanner_1 = require("../utils/monorepo-scanner");
|
|
39
6
|
const ci_status_1 = require("../utils/ci-status");
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
7
|
+
const repositories_1 = require("../repositories");
|
|
8
|
+
const commit_service_1 = require("./commit-service");
|
|
9
|
+
/**
|
|
10
|
+
* Get package dependencies
|
|
11
|
+
*/
|
|
12
|
+
function getPackageDependenciesInfo(pkg) {
|
|
13
|
+
const allDeps = [];
|
|
14
|
+
Object.keys(pkg.dependencies || {}).forEach(depName => {
|
|
15
|
+
allDeps.push({
|
|
16
|
+
name: depName,
|
|
17
|
+
version: pkg.dependencies[depName],
|
|
18
|
+
type: 'dependency',
|
|
19
|
+
latest: '',
|
|
20
|
+
outdated: false,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
Object.keys(pkg.devDependencies || {}).forEach(depName => {
|
|
24
|
+
allDeps.push({
|
|
25
|
+
name: depName,
|
|
26
|
+
version: pkg.devDependencies[depName],
|
|
27
|
+
type: 'devDependency',
|
|
28
|
+
latest: '',
|
|
29
|
+
outdated: false,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
Object.keys(pkg.peerDependencies || {}).forEach(depName => {
|
|
33
|
+
allDeps.push({
|
|
34
|
+
name: depName,
|
|
35
|
+
version: pkg.peerDependencies[depName],
|
|
36
|
+
type: 'peerDependency',
|
|
37
|
+
latest: '',
|
|
38
|
+
outdated: false,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return allDeps;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Store packages in database using repository pattern
|
|
45
|
+
*/
|
|
46
|
+
async function storePackage(pkg) {
|
|
47
|
+
try {
|
|
48
|
+
// Create or update package using repository
|
|
49
|
+
await repositories_1.PackageRepository.upsert({
|
|
50
|
+
name: pkg.name,
|
|
51
|
+
version: pkg.version,
|
|
52
|
+
type: pkg.type,
|
|
53
|
+
path: pkg.path,
|
|
54
|
+
description: pkg.description,
|
|
55
|
+
license: pkg.license,
|
|
56
|
+
repository: pkg.repository,
|
|
57
|
+
scripts: pkg.scripts,
|
|
58
|
+
dependencies: pkg.dependencies,
|
|
59
|
+
devDependencies: pkg.devDependencies,
|
|
60
|
+
peerDependencies: pkg.peerDependencies,
|
|
61
|
+
maintainers: pkg.maintainers.join(','),
|
|
62
|
+
status: '',
|
|
63
|
+
});
|
|
64
|
+
// Store commits using repository
|
|
65
|
+
const commits = await (0, commit_service_1.getCommitsByPathService)(pkg.path ?? '');
|
|
66
|
+
if (commits.length) {
|
|
67
|
+
await repositories_1.CommitRepository.storeMany(pkg.name, commits);
|
|
68
|
+
}
|
|
69
|
+
// Store dependencies using repository
|
|
70
|
+
const dependenciesInfo = getPackageDependenciesInfo(pkg);
|
|
71
|
+
if (dependenciesInfo.length) {
|
|
72
|
+
await repositories_1.DependencyRepository.storeMany(pkg.name, dependenciesInfo);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.warn(` Failed to store report for ${pkg.name}:`, error);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
44
79
|
const getPackagesService = async (rootPath) => {
|
|
45
|
-
let dbPackages = await
|
|
80
|
+
let dbPackages = await repositories_1.PackageRepository.findAll();
|
|
46
81
|
if (!dbPackages.length) {
|
|
47
82
|
try {
|
|
48
83
|
const rootDir = rootPath;
|
|
@@ -50,13 +85,13 @@ const getPackagesService = async (rootPath) => {
|
|
|
50
85
|
const packages = (0, utilities_1.scanMonorepo)(rootDir);
|
|
51
86
|
console.log('packages --> scan', packages.length);
|
|
52
87
|
for (const pkg of packages) {
|
|
53
|
-
await
|
|
88
|
+
await storePackage(pkg);
|
|
54
89
|
}
|
|
55
90
|
}
|
|
56
91
|
catch (error) {
|
|
57
92
|
throw new Error('Error ' + error);
|
|
58
93
|
}
|
|
59
|
-
dbPackages = await
|
|
94
|
+
dbPackages = await repositories_1.PackageRepository.findAll();
|
|
60
95
|
}
|
|
61
96
|
const transformedPackages = dbPackages.map((pkg) => {
|
|
62
97
|
// We create a new object 'transformedPkg' based on the database record 'pkg'
|
|
@@ -86,27 +121,18 @@ const getPackagesService = async (rootPath) => {
|
|
|
86
121
|
};
|
|
87
122
|
exports.getPackagesService = getPackagesService;
|
|
88
123
|
const refreshPackagesService = async (rootPath) => {
|
|
89
|
-
await
|
|
124
|
+
await repositories_1.PackageRepository.deleteAll();
|
|
90
125
|
const rootDir = rootPath;
|
|
91
126
|
const packages = (0, utilities_1.scanMonorepo)(rootDir);
|
|
92
127
|
console.log('packages -->', packages.length);
|
|
93
128
|
for (const pkg of packages) {
|
|
94
|
-
await
|
|
129
|
+
await storePackage(pkg);
|
|
95
130
|
}
|
|
96
131
|
return packages;
|
|
97
132
|
};
|
|
98
133
|
exports.refreshPackagesService = refreshPackagesService;
|
|
99
134
|
const getPackageDetailService = async (name) => {
|
|
100
|
-
const pkg = await
|
|
101
|
-
where: {
|
|
102
|
-
name: name,
|
|
103
|
-
},
|
|
104
|
-
include: {
|
|
105
|
-
dependenciesInfo: true,
|
|
106
|
-
commits: true,
|
|
107
|
-
packageHealth: true,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
135
|
+
const pkg = await repositories_1.PackageRepository.findByNameWithRelations(name);
|
|
110
136
|
if (!pkg) {
|
|
111
137
|
return null;
|
|
112
138
|
}
|
|
@@ -125,8 +151,8 @@ const getPackageDetailService = async (name) => {
|
|
|
125
151
|
? JSON.parse(pkg.peerDependencies)
|
|
126
152
|
: [];
|
|
127
153
|
// Get additional package information
|
|
128
|
-
const reports = await (0, monorepo_scanner_1.generateReports)();
|
|
129
|
-
const packageReport = reports
|
|
154
|
+
const reports = (await (0, monorepo_scanner_1.generateReports)());
|
|
155
|
+
const packageReport = reports?.find((r) => r.package?.name === name);
|
|
130
156
|
const result = {
|
|
131
157
|
...transformedPkg,
|
|
132
158
|
report: packageReport,
|
package/dist/types/git.js
CHANGED
|
@@ -4,6 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.VALID_COMMIT_TYPES = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Interface representing a single commit object with key metadata.
|
|
9
|
+
*/
|
|
10
|
+
// export interface GitCommit {
|
|
11
|
+
// hash: string;
|
|
12
|
+
// author: string;
|
|
13
|
+
// packageName: string;
|
|
14
|
+
// date: Date;
|
|
15
|
+
// message: string;
|
|
16
|
+
// type: string;
|
|
17
|
+
// }
|
|
7
18
|
/**
|
|
8
19
|
* List of standard Conventional Commit types for validation.
|
|
9
20
|
* Any extracted type not in this list will be set to 'other'.
|
package/dist/types/index.js
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.VALID_COMMIT_TYPES = void 0;
|
|
7
|
+
// export type { GitCommit } from './git';
|
|
7
8
|
var git_1 = require("./git");
|
|
8
9
|
Object.defineProperty(exports, "VALID_COMMIT_TYPES", { enumerable: true, get: function () { return git_1.VALID_COMMIT_TYPES; } });
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Request, Response } from 'express';
|
|
5
|
+
import { getCommitsByPathService } from '../services/commit-service';
|
|
5
6
|
|
|
6
|
-
export const getCommitsByPath = async (_req:
|
|
7
|
+
export const getCommitsByPath = async (_req: Request, res: Response) => {
|
|
7
8
|
|
|
8
9
|
try {
|
|
9
10
|
const { packagePath } = _req.params;
|
|
@@ -17,12 +18,13 @@ export const getCommitsByPath = async (_req: any, res: any) => {
|
|
|
17
18
|
`Successfully fetched ${commits.length} commits for ${decodedPath}`
|
|
18
19
|
);
|
|
19
20
|
res.json(commits);
|
|
20
|
-
} catch (error:
|
|
21
|
+
} catch (error: unknown) {
|
|
22
|
+
const err = error as Error & { message?: string; stack?: string };
|
|
21
23
|
console.error('Error fetching commit details:', error);
|
|
22
24
|
res.status(500).json({
|
|
23
25
|
error: 'Failed to fetch commit details',
|
|
24
|
-
message:
|
|
25
|
-
stack: process.env.NODE_ENV === 'development' ?
|
|
26
|
+
message: err?.message,
|
|
27
|
+
stack: process.env.NODE_ENV === 'development' ? err?.stack : undefined,
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { getConfigurationFilesService, updateConfigFileService, updatePackageConfigurationService } from '../services/config-service';
|
|
2
3
|
|
|
3
|
-
export const getConfigurationFiles = async (_req:
|
|
4
|
+
export const getConfigurationFiles = async (_req: Request, res: Response) => {
|
|
4
5
|
try {
|
|
5
6
|
const rootDir = _req.app.locals.rootPath;
|
|
6
7
|
console.log('Monorepo root directory:', rootDir);
|
|
@@ -16,7 +17,7 @@ export const getConfigurationFiles = async (_req: any, res: any) => {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export const updateConfigFile = async (_req:
|
|
20
|
+
export const updateConfigFile = async (_req: Request, res: Response) => {
|
|
20
21
|
try {
|
|
21
22
|
const { id } = _req.params;
|
|
22
23
|
const { content } = _req.body;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { getHealthSummaryService, healthRefreshService } from '../services/health-service';
|
|
2
3
|
|
|
3
|
-
export const getPackagesHealth = async (_req:
|
|
4
|
+
export const getPackagesHealth = async (_req: Request, res: Response) => {
|
|
4
5
|
try {
|
|
5
6
|
const health = await getHealthSummaryService();
|
|
6
7
|
res.json(health);
|
|
@@ -12,7 +13,7 @@ export const getPackagesHealth = async (_req: any, res: any) => {
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export const refreshHealth = async (_req:
|
|
16
|
+
export const refreshHealth = async (_req: Request, res: Response) => {
|
|
16
17
|
try {
|
|
17
18
|
const health = await healthRefreshService(_req.app.locals.rootPath);
|
|
18
19
|
res.json(health);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { updatePackageConfigurationService } from '../services/config-service';
|
|
3
|
+
import { getPackageDetailService, getPackagesService, refreshPackagesService } from '../services/package-service';
|
|
3
4
|
|
|
4
|
-
export const getPackages = async (_req:
|
|
5
|
+
export const getPackages = async (_req: Request, res: Response) => {
|
|
5
6
|
try {
|
|
6
7
|
const transformedPackages = await getPackagesService(_req.app.locals.rootPath);
|
|
7
8
|
res.json(transformedPackages);
|
|
@@ -10,7 +11,7 @@ export const getPackages = async (_req: any, res: any) => {
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
export const refreshPackages = async (_req:
|
|
14
|
+
export const refreshPackages = async (_req: Request, res: Response) => {
|
|
14
15
|
console.log('Refreshing packages from source...'+ _req.app.locals.rootPath);
|
|
15
16
|
|
|
16
17
|
try {
|
|
@@ -21,7 +22,7 @@ export const refreshPackages = async (_req: any, res: any) => {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export const getPackageDetail = async (_req:
|
|
25
|
+
export const getPackageDetail = async (_req: Request, res: Response) => {
|
|
25
26
|
const { name } = _req.params;
|
|
26
27
|
try {
|
|
27
28
|
const packageDetail = await getPackageDetailService(name)
|
|
@@ -31,7 +32,7 @@ export const getPackageDetail = async (_req: any, res: any) => {
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export const updatePackageConfig = async (req:
|
|
35
|
+
export const updatePackageConfig = async (req: Request, res: Response) => {
|
|
35
36
|
try {
|
|
36
37
|
const { packageName, config, packagePath } = req.body;
|
|
37
38
|
|