@emaenriquez/projectmanager-cli 0.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.
- package/README.md +98 -0
- package/dist/application/ConfigManager.d.ts +73 -0
- package/dist/application/ConfigManager.d.ts.map +1 -0
- package/dist/application/ConfigManager.js +253 -0
- package/dist/application/ConfigManager.js.map +1 -0
- package/dist/application/errors/ErrorHandler.d.ts +27 -0
- package/dist/application/errors/ErrorHandler.d.ts.map +1 -0
- package/dist/application/errors/ErrorHandler.js +88 -0
- package/dist/application/errors/ErrorHandler.js.map +1 -0
- package/dist/application/state/StateManager.d.ts +26 -0
- package/dist/application/state/StateManager.d.ts.map +1 -0
- package/dist/application/state/StateManager.js +114 -0
- package/dist/application/state/StateManager.js.map +1 -0
- package/dist/application/use_cases/AddProjectUseCase.d.ts +9 -0
- package/dist/application/use_cases/AddProjectUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/AddProjectUseCase.js +85 -0
- package/dist/application/use_cases/AddProjectUseCase.js.map +1 -0
- package/dist/application/use_cases/ListProjectsUseCase.d.ts +7 -0
- package/dist/application/use_cases/ListProjectsUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/ListProjectsUseCase.js +14 -0
- package/dist/application/use_cases/ListProjectsUseCase.js.map +1 -0
- package/dist/application/use_cases/OpenProjectUseCase.d.ts +10 -0
- package/dist/application/use_cases/OpenProjectUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/OpenProjectUseCase.js +168 -0
- package/dist/application/use_cases/OpenProjectUseCase.js.map +1 -0
- package/dist/application/use_cases/RemoveProjectUseCase.d.ts +7 -0
- package/dist/application/use_cases/RemoveProjectUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/RemoveProjectUseCase.js +24 -0
- package/dist/application/use_cases/RemoveProjectUseCase.js.map +1 -0
- package/dist/application/use_cases/ScanProjectsUseCase.d.ts +13 -0
- package/dist/application/use_cases/ScanProjectsUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/ScanProjectsUseCase.js +57 -0
- package/dist/application/use_cases/ScanProjectsUseCase.js.map +1 -0
- package/dist/application/use_cases/SyncProjectsUseCase.d.ts +12 -0
- package/dist/application/use_cases/SyncProjectsUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/SyncProjectsUseCase.js +74 -0
- package/dist/application/use_cases/SyncProjectsUseCase.js.map +1 -0
- package/dist/application/use_cases/SystemDiagnostics.d.ts +16 -0
- package/dist/application/use_cases/SystemDiagnostics.d.ts.map +1 -0
- package/dist/application/use_cases/SystemDiagnostics.js +35 -0
- package/dist/application/use_cases/SystemDiagnostics.js.map +1 -0
- package/dist/application/use_cases/TagProjectUseCase.d.ts +9 -0
- package/dist/application/use_cases/TagProjectUseCase.d.ts.map +1 -0
- package/dist/application/use_cases/TagProjectUseCase.js +41 -0
- package/dist/application/use_cases/TagProjectUseCase.js.map +1 -0
- package/dist/domain/patterns/ProjectPatterns.d.ts +47 -0
- package/dist/domain/patterns/ProjectPatterns.d.ts.map +1 -0
- package/dist/domain/patterns/ProjectPatterns.js +200 -0
- package/dist/domain/patterns/ProjectPatterns.js.map +1 -0
- package/dist/domain/services/GitService.d.ts +23 -0
- package/dist/domain/services/GitService.d.ts.map +1 -0
- package/dist/domain/services/GitService.js +155 -0
- package/dist/domain/services/GitService.js.map +1 -0
- package/dist/domain/services/IgnoreFileParser.d.ts +55 -0
- package/dist/domain/services/IgnoreFileParser.d.ts.map +1 -0
- package/dist/domain/services/IgnoreFileParser.js +200 -0
- package/dist/domain/services/IgnoreFileParser.js.map +1 -0
- package/dist/domain/services/ProjectScanner.d.ts +65 -0
- package/dist/domain/services/ProjectScanner.d.ts.map +1 -0
- package/dist/domain/services/ProjectScanner.js +207 -0
- package/dist/domain/services/ProjectScanner.js.map +1 -0
- package/dist/domain/services/TechnologyDetector.d.ts +78 -0
- package/dist/domain/services/TechnologyDetector.d.ts.map +1 -0
- package/dist/domain/services/TechnologyDetector.js +633 -0
- package/dist/domain/services/TechnologyDetector.js.map +1 -0
- package/dist/domain/services/ToolDetector.d.ts +74 -0
- package/dist/domain/services/ToolDetector.d.ts.map +1 -0
- package/dist/domain/services/ToolDetector.js +344 -0
- package/dist/domain/services/ToolDetector.js.map +1 -0
- package/dist/domain/services/index.d.ts +5 -0
- package/dist/domain/services/index.d.ts.map +1 -0
- package/dist/domain/services/index.js +12 -0
- package/dist/domain/services/index.js.map +1 -0
- package/dist/domain/types/Config.d.ts +37 -0
- package/dist/domain/types/Config.d.ts.map +1 -0
- package/dist/domain/types/Config.js +6 -0
- package/dist/domain/types/Config.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/database/DatabaseConnection.d.ts +88 -0
- package/dist/infrastructure/database/DatabaseConnection.d.ts.map +1 -0
- package/dist/infrastructure/database/DatabaseConnection.js +318 -0
- package/dist/infrastructure/database/DatabaseConnection.js.map +1 -0
- package/dist/infrastructure/database/DatabaseValidator.d.ts +154 -0
- package/dist/infrastructure/database/DatabaseValidator.d.ts.map +1 -0
- package/dist/infrastructure/database/DatabaseValidator.js +583 -0
- package/dist/infrastructure/database/DatabaseValidator.js.map +1 -0
- package/dist/infrastructure/database/index.d.ts +8 -0
- package/dist/infrastructure/database/index.d.ts.map +1 -0
- package/dist/infrastructure/database/index.js +14 -0
- package/dist/infrastructure/database/index.js.map +1 -0
- package/dist/infrastructure/database/migrations/001_initial.d.ts +24 -0
- package/dist/infrastructure/database/migrations/001_initial.d.ts.map +1 -0
- package/dist/infrastructure/database/migrations/001_initial.js +109 -0
- package/dist/infrastructure/database/migrations/001_initial.js.map +1 -0
- package/dist/infrastructure/database/migrations/Migration.d.ts +27 -0
- package/dist/infrastructure/database/migrations/Migration.d.ts.map +1 -0
- package/dist/infrastructure/database/migrations/Migration.js +3 -0
- package/dist/infrastructure/database/migrations/Migration.js.map +1 -0
- package/dist/infrastructure/database/migrations/MigrationRunner.d.ts +52 -0
- package/dist/infrastructure/database/migrations/MigrationRunner.d.ts.map +1 -0
- package/dist/infrastructure/database/migrations/MigrationRunner.js +167 -0
- package/dist/infrastructure/database/migrations/MigrationRunner.js.map +1 -0
- package/dist/infrastructure/database/migrations/index.d.ts +10 -0
- package/dist/infrastructure/database/migrations/index.d.ts.map +1 -0
- package/dist/infrastructure/database/migrations/index.js +22 -0
- package/dist/infrastructure/database/migrations/index.js.map +1 -0
- package/dist/infrastructure/filesystem/DirectoryManager.d.ts +50 -0
- package/dist/infrastructure/filesystem/DirectoryManager.d.ts.map +1 -0
- package/dist/infrastructure/filesystem/DirectoryManager.js +143 -0
- package/dist/infrastructure/filesystem/DirectoryManager.js.map +1 -0
- package/dist/infrastructure/filesystem/index.d.ts +2 -0
- package/dist/infrastructure/filesystem/index.d.ts.map +1 -0
- package/dist/infrastructure/filesystem/index.js +6 -0
- package/dist/infrastructure/filesystem/index.js.map +1 -0
- package/dist/infrastructure/logging/LogRotator.d.ts +43 -0
- package/dist/infrastructure/logging/LogRotator.d.ts.map +1 -0
- package/dist/infrastructure/logging/LogRotator.js +172 -0
- package/dist/infrastructure/logging/LogRotator.js.map +1 -0
- package/dist/infrastructure/logging/Logger.d.ts +59 -0
- package/dist/infrastructure/logging/Logger.d.ts.map +1 -0
- package/dist/infrastructure/logging/Logger.js +182 -0
- package/dist/infrastructure/logging/Logger.js.map +1 -0
- package/dist/infrastructure/logging/index.d.ts +3 -0
- package/dist/infrastructure/logging/index.d.ts.map +1 -0
- package/dist/infrastructure/logging/index.js +8 -0
- package/dist/infrastructure/logging/index.js.map +1 -0
- package/dist/infrastructure/repositories/ProjectRepository.d.ts +20 -0
- package/dist/infrastructure/repositories/ProjectRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/ProjectRepository.js +61 -0
- package/dist/infrastructure/repositories/ProjectRepository.js.map +1 -0
- package/dist/infrastructure/repositories/QueryBuilder.d.ts +24 -0
- package/dist/infrastructure/repositories/QueryBuilder.d.ts.map +1 -0
- package/dist/infrastructure/repositories/QueryBuilder.js +92 -0
- package/dist/infrastructure/repositories/QueryBuilder.js.map +1 -0
- package/dist/infrastructure/repositories/TagRepository.d.ts +18 -0
- package/dist/infrastructure/repositories/TagRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/TagRepository.js +66 -0
- package/dist/infrastructure/repositories/TagRepository.js.map +1 -0
- package/dist/infrastructure/repositories/TechnologyRepository.d.ts +16 -0
- package/dist/infrastructure/repositories/TechnologyRepository.d.ts.map +1 -0
- package/dist/infrastructure/repositories/TechnologyRepository.js +46 -0
- package/dist/infrastructure/repositories/TechnologyRepository.js.map +1 -0
- package/dist/infrastructure/repositories/TransactionManager.d.ts +11 -0
- package/dist/infrastructure/repositories/TransactionManager.d.ts.map +1 -0
- package/dist/infrastructure/repositories/TransactionManager.js +21 -0
- package/dist/infrastructure/repositories/TransactionManager.js.map +1 -0
- package/dist/infrastructure/ui/ScreenManager.d.ts +11 -0
- package/dist/infrastructure/ui/ScreenManager.d.ts.map +1 -0
- package/dist/infrastructure/ui/ScreenManager.js +69 -0
- package/dist/infrastructure/ui/ScreenManager.js.map +1 -0
- package/dist/ui/cli/CLI.d.ts +9 -0
- package/dist/ui/cli/CLI.d.ts.map +1 -0
- package/dist/ui/cli/CLI.js +211 -0
- package/dist/ui/cli/CLI.js.map +1 -0
- package/dist/ui/components/DetailsPanel.d.ts +11 -0
- package/dist/ui/components/DetailsPanel.d.ts.map +1 -0
- package/dist/ui/components/DetailsPanel.js +181 -0
- package/dist/ui/components/DetailsPanel.js.map +1 -0
- package/dist/ui/components/ProjectListView.d.ts +15 -0
- package/dist/ui/components/ProjectListView.d.ts.map +1 -0
- package/dist/ui/components/ProjectListView.js +122 -0
- package/dist/ui/components/ProjectListView.js.map +1 -0
- package/dist/ui/tui/TUIApplication.d.ts +17 -0
- package/dist/ui/tui/TUIApplication.d.ts.map +1 -0
- package/dist/ui/tui/TUIApplication.js +532 -0
- package/dist/ui/tui/TUIApplication.js.map +1 -0
- package/dist/ui/tui/Theme.d.ts +25 -0
- package/dist/ui/tui/Theme.d.ts.map +1 -0
- package/dist/ui/tui/Theme.js +62 -0
- package/dist/ui/tui/Theme.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LogRotator handles daily log rotation, optional compression, and cleanup
|
|
3
|
+
* of logs older than 30 days to prevent disk space issues
|
|
4
|
+
*/
|
|
5
|
+
export declare class LogRotator {
|
|
6
|
+
private logsDir;
|
|
7
|
+
private maxLogAgeDays;
|
|
8
|
+
private lastRotationDate;
|
|
9
|
+
constructor(logsDir: string);
|
|
10
|
+
/**
|
|
11
|
+
* Check if logs should be rotated (new day)
|
|
12
|
+
*/
|
|
13
|
+
shouldRotate(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Perform log rotation
|
|
16
|
+
*/
|
|
17
|
+
rotate(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Cleanup logs older than configured days
|
|
20
|
+
*/
|
|
21
|
+
cleanupOldLogs(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Compress a log file using gzip
|
|
24
|
+
*/
|
|
25
|
+
private compressLogFile;
|
|
26
|
+
/**
|
|
27
|
+
* Get today's date string in YYYY-MM-DD format
|
|
28
|
+
*/
|
|
29
|
+
private getTodayDateString;
|
|
30
|
+
/**
|
|
31
|
+
* Get logs directory
|
|
32
|
+
*/
|
|
33
|
+
getLogsDir(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Set maximum log age in days
|
|
36
|
+
*/
|
|
37
|
+
setMaxLogAgeDays(days: number): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get maximum log age in days
|
|
40
|
+
*/
|
|
41
|
+
getMaxLogAgeDays(): number;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=LogRotator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogRotator.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/logging/LogRotator.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,gBAAgB,CAAS;gBAErB,OAAO,EAAE,MAAM;IAK3B;;OAEG;IACI,YAAY,IAAI,OAAO;IAK9B;;OAEG;IACI,MAAM,IAAI,IAAI;IA2BrB;;OAEG;IACI,cAAc,IAAI,IAAI;IA2B7B;;OAEG;IACH,OAAO,CAAC,eAAe;IAkCvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACI,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACI,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM3C;;OAEG;IACI,gBAAgB,IAAI,MAAM;CAGlC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.LogRotator = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const zlib = __importStar(require("zlib"));
|
|
40
|
+
/**
|
|
41
|
+
* LogRotator handles daily log rotation, optional compression, and cleanup
|
|
42
|
+
* of logs older than 30 days to prevent disk space issues
|
|
43
|
+
*/
|
|
44
|
+
class LogRotator {
|
|
45
|
+
constructor(logsDir) {
|
|
46
|
+
this.maxLogAgeDays = 30;
|
|
47
|
+
this.logsDir = logsDir;
|
|
48
|
+
this.lastRotationDate = this.getTodayDateString();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Check if logs should be rotated (new day)
|
|
52
|
+
*/
|
|
53
|
+
shouldRotate() {
|
|
54
|
+
const today = this.getTodayDateString();
|
|
55
|
+
return today !== this.lastRotationDate;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Perform log rotation
|
|
59
|
+
*/
|
|
60
|
+
rotate() {
|
|
61
|
+
try {
|
|
62
|
+
const today = this.getTodayDateString();
|
|
63
|
+
this.lastRotationDate = today;
|
|
64
|
+
// Get yesterday's log file
|
|
65
|
+
const yesterday = new Date();
|
|
66
|
+
yesterday.setDate(yesterday.getDate() - 1);
|
|
67
|
+
const yesterdayDateString = yesterday.toISOString().split('T')[0];
|
|
68
|
+
const yesterdayLogFile = path.join(this.logsDir, `app-${yesterdayDateString}.log`);
|
|
69
|
+
// Compress yesterday's log if it exists
|
|
70
|
+
if (fs.existsSync(yesterdayLogFile)) {
|
|
71
|
+
this.compressLogFile(yesterdayLogFile);
|
|
72
|
+
}
|
|
73
|
+
// Cleanup old logs
|
|
74
|
+
this.cleanupOldLogs();
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
// Silently fail - logging system should not crash the app
|
|
78
|
+
console.error('Log rotation failed:', err);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Cleanup logs older than configured days
|
|
83
|
+
*/
|
|
84
|
+
cleanupOldLogs() {
|
|
85
|
+
try {
|
|
86
|
+
if (!fs.existsSync(this.logsDir)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const files = fs.readdirSync(this.logsDir);
|
|
90
|
+
const now = Date.now();
|
|
91
|
+
files.forEach((file) => {
|
|
92
|
+
const filePath = path.join(this.logsDir, file);
|
|
93
|
+
const stats = fs.statSync(filePath);
|
|
94
|
+
const ageInDays = (now - stats.mtime.getTime()) / (1000 * 60 * 60 * 24);
|
|
95
|
+
if (ageInDays > this.maxLogAgeDays) {
|
|
96
|
+
try {
|
|
97
|
+
fs.unlinkSync(filePath);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.error(`Failed to delete old log file ${file}:`, err);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
console.error('Cleanup old logs failed:', err);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Compress a log file using gzip
|
|
111
|
+
*/
|
|
112
|
+
compressLogFile(filePath) {
|
|
113
|
+
try {
|
|
114
|
+
const compressedPath = `${filePath}.gz`;
|
|
115
|
+
// Don't compress if already compressed
|
|
116
|
+
if (fs.existsSync(compressedPath)) {
|
|
117
|
+
fs.unlinkSync(filePath);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const source = fs.createReadStream(filePath);
|
|
121
|
+
const destination = fs.createWriteStream(compressedPath);
|
|
122
|
+
const gzip = zlib.createGzip();
|
|
123
|
+
source
|
|
124
|
+
.pipe(gzip)
|
|
125
|
+
.pipe(destination)
|
|
126
|
+
.on('finish', () => {
|
|
127
|
+
try {
|
|
128
|
+
// Delete original file after successful compression
|
|
129
|
+
fs.unlinkSync(filePath);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
console.error('Failed to delete original log file:', err);
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
.on('error', (err) => {
|
|
136
|
+
console.error('Compression error:', err);
|
|
137
|
+
// Keep original file if compression fails
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
console.error('Log file compression failed:', err);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get today's date string in YYYY-MM-DD format
|
|
146
|
+
*/
|
|
147
|
+
getTodayDateString() {
|
|
148
|
+
return new Date().toISOString().split('T')[0];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get logs directory
|
|
152
|
+
*/
|
|
153
|
+
getLogsDir() {
|
|
154
|
+
return this.logsDir;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Set maximum log age in days
|
|
158
|
+
*/
|
|
159
|
+
setMaxLogAgeDays(days) {
|
|
160
|
+
if (days > 0) {
|
|
161
|
+
this.maxLogAgeDays = days;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get maximum log age in days
|
|
166
|
+
*/
|
|
167
|
+
getMaxLogAgeDays() {
|
|
168
|
+
return this.maxLogAgeDays;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.LogRotator = LogRotator;
|
|
172
|
+
//# sourceMappingURL=LogRotator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogRotator.js","sourceRoot":"","sources":["../../../src/infrastructure/logging/LogRotator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA6B;AAE7B;;;GAGG;AACH,MAAa,UAAU;IAKrB,YAAY,OAAe;QAHnB,kBAAa,GAAW,EAAE,CAAC;QAIjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,YAAY;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxC,OAAO,KAAK,KAAK,IAAI,CAAC,gBAAgB,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,MAAM;QACX,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxC,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;YAE9B,2BAA2B;YAC3B,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;YAC7B,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3C,MAAM,mBAAmB,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAClE,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAChC,IAAI,CAAC,OAAO,EACZ,OAAO,mBAAmB,MAAM,CACjC,CAAC;YAEF,wCAAwC;YACxC,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;Y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IAChD,CAAC;IAED;;OAEG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,gBAAgB,CAAC,IAAY;QAClC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;CACF;AAhJD,gCAgJC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
+
/**
|
|
3
|
+
* Logger singleton for application-wide logging
|
|
4
|
+
* Writes logs to ~/.project-hub/logs/ with automatic daily rotation
|
|
5
|
+
*/
|
|
6
|
+
export declare class Logger {
|
|
7
|
+
private static instance;
|
|
8
|
+
private logsDir;
|
|
9
|
+
private currentLogFile;
|
|
10
|
+
private logLevel;
|
|
11
|
+
private rotator;
|
|
12
|
+
private constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Get singleton instance of Logger
|
|
15
|
+
*/
|
|
16
|
+
static getInstance(): Logger;
|
|
17
|
+
/**
|
|
18
|
+
* Set the minimum log level to output
|
|
19
|
+
* @param level - The log level (debug, info, warn, error)
|
|
20
|
+
*/
|
|
21
|
+
setLogLevel(level: LogLevel): void;
|
|
22
|
+
/**
|
|
23
|
+
* Log debug message
|
|
24
|
+
*/
|
|
25
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Log info message
|
|
28
|
+
*/
|
|
29
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
30
|
+
/**
|
|
31
|
+
* Log warning message
|
|
32
|
+
*/
|
|
33
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
34
|
+
/**
|
|
35
|
+
* Log error message
|
|
36
|
+
*/
|
|
37
|
+
error(message: string, error?: Error | Record<string, unknown>): void;
|
|
38
|
+
/**
|
|
39
|
+
* Get logs directory path
|
|
40
|
+
*/
|
|
41
|
+
getLogsDir(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Get current log file path
|
|
44
|
+
*/
|
|
45
|
+
getCurrentLogFile(): string;
|
|
46
|
+
/**
|
|
47
|
+
* Rotate logs manually (useful for testing)
|
|
48
|
+
*/
|
|
49
|
+
rotateLogs(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Clean up old logs (older than 30 days)
|
|
52
|
+
*/
|
|
53
|
+
cleanupOldLogs(): void;
|
|
54
|
+
private shouldLog;
|
|
55
|
+
private log;
|
|
56
|
+
private ensureLogsDirectory;
|
|
57
|
+
private getLogFilePath;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/logging/Logger.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D;;;GAGG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAAa;IAE5B,OAAO;IAOP;;OAEG;WACW,WAAW,IAAI,MAAM;IAOnC;;;OAGG;IACI,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAIzC;;OAEG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMtE;;OAEG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMrE;;OAEG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAMrE;;OAEG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAgB5E;;OAEG;IACI,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACI,iBAAiB,IAAI,MAAM;IAIlC;;OAEG;IACI,UAAU,IAAI,IAAI;IAKzB;;OAEG;IACI,cAAc,IAAI,IAAI;IAM7B,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,GAAG;IAgCX,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,cAAc;CAKvB"}
|
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Logger = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const os = __importStar(require("os"));
|
|
40
|
+
const LogRotator_1 = require("./LogRotator");
|
|
41
|
+
/**
|
|
42
|
+
* Logger singleton for application-wide logging
|
|
43
|
+
* Writes logs to ~/.project-hub/logs/ with automatic daily rotation
|
|
44
|
+
*/
|
|
45
|
+
class Logger {
|
|
46
|
+
constructor() {
|
|
47
|
+
this.logLevel = 'info';
|
|
48
|
+
this.logsDir = path.join(os.homedir(), '.project-hub', 'logs');
|
|
49
|
+
this.currentLogFile = this.getLogFilePath();
|
|
50
|
+
this.rotator = new LogRotator_1.LogRotator(this.logsDir);
|
|
51
|
+
this.ensureLogsDirectory();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get singleton instance of Logger
|
|
55
|
+
*/
|
|
56
|
+
static getInstance() {
|
|
57
|
+
if (!Logger.instance) {
|
|
58
|
+
Logger.instance = new Logger();
|
|
59
|
+
}
|
|
60
|
+
return Logger.instance;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Set the minimum log level to output
|
|
64
|
+
* @param level - The log level (debug, info, warn, error)
|
|
65
|
+
*/
|
|
66
|
+
setLogLevel(level) {
|
|
67
|
+
this.logLevel = level;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Log debug message
|
|
71
|
+
*/
|
|
72
|
+
debug(message, context) {
|
|
73
|
+
if (this.shouldLog('debug')) {
|
|
74
|
+
this.log('DEBUG', message, context);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Log info message
|
|
79
|
+
*/
|
|
80
|
+
info(message, context) {
|
|
81
|
+
if (this.shouldLog('info')) {
|
|
82
|
+
this.log('INFO', message, context);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Log warning message
|
|
87
|
+
*/
|
|
88
|
+
warn(message, context) {
|
|
89
|
+
if (this.shouldLog('warn')) {
|
|
90
|
+
this.log('WARN', message, context);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Log error message
|
|
95
|
+
*/
|
|
96
|
+
error(message, error) {
|
|
97
|
+
if (this.shouldLog('error')) {
|
|
98
|
+
let context;
|
|
99
|
+
if (error instanceof Error) {
|
|
100
|
+
context = {
|
|
101
|
+
name: error.name,
|
|
102
|
+
message: error.message,
|
|
103
|
+
stack: error.stack,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
context = error;
|
|
108
|
+
}
|
|
109
|
+
this.log('ERROR', message, context);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get logs directory path
|
|
114
|
+
*/
|
|
115
|
+
getLogsDir() {
|
|
116
|
+
return this.logsDir;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get current log file path
|
|
120
|
+
*/
|
|
121
|
+
getCurrentLogFile() {
|
|
122
|
+
return this.currentLogFile;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Rotate logs manually (useful for testing)
|
|
126
|
+
*/
|
|
127
|
+
rotateLogs() {
|
|
128
|
+
this.rotator.rotate();
|
|
129
|
+
this.currentLogFile = this.getLogFilePath();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Clean up old logs (older than 30 days)
|
|
133
|
+
*/
|
|
134
|
+
cleanupOldLogs() {
|
|
135
|
+
this.rotator.cleanupOldLogs();
|
|
136
|
+
}
|
|
137
|
+
// Private methods
|
|
138
|
+
shouldLog(level) {
|
|
139
|
+
const levels = {
|
|
140
|
+
debug: 0,
|
|
141
|
+
info: 1,
|
|
142
|
+
warn: 2,
|
|
143
|
+
error: 3,
|
|
144
|
+
};
|
|
145
|
+
return levels[level] >= levels[this.logLevel];
|
|
146
|
+
}
|
|
147
|
+
log(level, message, context) {
|
|
148
|
+
try {
|
|
149
|
+
const timestamp = new Date().toISOString();
|
|
150
|
+
let logEntry = `[${timestamp}] [${level}] ${message}`;
|
|
151
|
+
if (context) {
|
|
152
|
+
logEntry += ` | ${JSON.stringify(context)}`;
|
|
153
|
+
}
|
|
154
|
+
logEntry += '\n';
|
|
155
|
+
// Ensure logs directory exists (in case of external deletion)
|
|
156
|
+
this.ensureLogsDirectory();
|
|
157
|
+
// Check if log rotation is needed
|
|
158
|
+
if (this.rotator.shouldRotate()) {
|
|
159
|
+
this.rotateLogs();
|
|
160
|
+
}
|
|
161
|
+
// Append to current log file
|
|
162
|
+
fs.appendFileSync(this.currentLogFile, logEntry, 'utf8');
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
// Silently fail if logging fails to not disrupt application
|
|
166
|
+
// In production, this might be sent to a monitoring service
|
|
167
|
+
console.error('Failed to write log:', err);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
ensureLogsDirectory() {
|
|
171
|
+
if (!fs.existsSync(this.logsDir)) {
|
|
172
|
+
fs.mkdirSync(this.logsDir, { recursive: true });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
getLogFilePath() {
|
|
176
|
+
const today = new Date();
|
|
177
|
+
const dateString = today.toISOString().split('T')[0]; // YYYY-MM-DD
|
|
178
|
+
return path.join(this.logsDir, `app-${dateString}.log`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.Logger = Logger;
|
|
182
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../src/infrastructure/logging/Logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,6CAA0C;AAI1C;;;GAGG;AACH,MAAa,MAAM;IAOjB;QAHQ,aAAQ,GAAa,MAAM,CAAC;QAIlC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,uBAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,CAAC,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;QACjC,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,KAAe;QAChC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAe,EAAE,OAAiC;QAC7D,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACtC,CAA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CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAEO,cAAc;QACpB,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa;QACnE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,UAAU,MAAM,CAAC,CAAC;IAC1D,CAAC;CACF;AAlKD,wBAkKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/logging/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LogRotator = exports.Logger = void 0;
|
|
4
|
+
var Logger_1 = require("./Logger");
|
|
5
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.Logger; } });
|
|
6
|
+
var LogRotator_1 = require("./LogRotator");
|
|
7
|
+
Object.defineProperty(exports, "LogRotator", { enumerable: true, get: function () { return LogRotator_1.LogRotator; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/logging/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4C;AAAnC,gGAAA,MAAM,OAAA;AACf,2CAA0C;AAAjC,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ProjectEntity {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
created_at: string;
|
|
6
|
+
last_opened: string | null;
|
|
7
|
+
is_favorite: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class ProjectRepository {
|
|
10
|
+
private db;
|
|
11
|
+
constructor();
|
|
12
|
+
findAll(): ProjectEntity[];
|
|
13
|
+
findById(id: string): ProjectEntity | undefined;
|
|
14
|
+
findByPath(path: string): ProjectEntity | undefined;
|
|
15
|
+
create(project: ProjectEntity): void;
|
|
16
|
+
update(project: ProjectEntity): void;
|
|
17
|
+
delete(id: string): void;
|
|
18
|
+
private mapRowToEntity;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ProjectRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/ProjectRepository.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,EAAE,CAAqB;;IAMxB,OAAO,IAAI,aAAa,EAAE;IAO1B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAO/C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAOnD,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAiBpC,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAiBpC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAM/B,OAAO,CAAC,cAAc;CAUvB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectRepository = void 0;
|
|
4
|
+
const DatabaseConnection_1 = require("../database/DatabaseConnection");
|
|
5
|
+
class ProjectRepository {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.db = DatabaseConnection_1.DatabaseConnection.getInstance();
|
|
8
|
+
}
|
|
9
|
+
findAll() {
|
|
10
|
+
const rawDb = this.db.getRawDatabase();
|
|
11
|
+
const stmt = rawDb.prepare('SELECT * FROM projects ORDER BY name ASC');
|
|
12
|
+
const results = stmt.all();
|
|
13
|
+
return results.map(this.mapRowToEntity);
|
|
14
|
+
}
|
|
15
|
+
findById(id) {
|
|
16
|
+
const rawDb = this.db.getRawDatabase();
|
|
17
|
+
const stmt = rawDb.prepare('SELECT * FROM projects WHERE id = ?');
|
|
18
|
+
const result = stmt.get(id);
|
|
19
|
+
return result ? this.mapRowToEntity(result) : undefined;
|
|
20
|
+
}
|
|
21
|
+
findByPath(path) {
|
|
22
|
+
const rawDb = this.db.getRawDatabase();
|
|
23
|
+
const stmt = rawDb.prepare('SELECT * FROM projects WHERE path = ?');
|
|
24
|
+
const result = stmt.get(path);
|
|
25
|
+
return result ? this.mapRowToEntity(result) : undefined;
|
|
26
|
+
}
|
|
27
|
+
create(project) {
|
|
28
|
+
const rawDb = this.db.getRawDatabase();
|
|
29
|
+
const stmt = rawDb.prepare(`
|
|
30
|
+
INSERT INTO projects (id, name, path, created_at, last_opened, is_favorite)
|
|
31
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
32
|
+
`);
|
|
33
|
+
stmt.run(project.id, project.name, project.path, project.created_at, project.last_opened, project.is_favorite ? 1 : 0);
|
|
34
|
+
}
|
|
35
|
+
update(project) {
|
|
36
|
+
const rawDb = this.db.getRawDatabase();
|
|
37
|
+
const stmt = rawDb.prepare(`
|
|
38
|
+
UPDATE projects
|
|
39
|
+
SET name = ?, path = ?, last_opened = ?, is_favorite = ?
|
|
40
|
+
WHERE id = ?
|
|
41
|
+
`);
|
|
42
|
+
stmt.run(project.name, project.path, project.last_opened, project.is_favorite ? 1 : 0, project.id);
|
|
43
|
+
}
|
|
44
|
+
delete(id) {
|
|
45
|
+
const rawDb = this.db.getRawDatabase();
|
|
46
|
+
const stmt = rawDb.prepare('DELETE FROM projects WHERE id = ?');
|
|
47
|
+
stmt.run(id);
|
|
48
|
+
}
|
|
49
|
+
mapRowToEntity(row) {
|
|
50
|
+
return {
|
|
51
|
+
id: row.id,
|
|
52
|
+
name: row.name,
|
|
53
|
+
path: row.path,
|
|
54
|
+
created_at: row.created_at,
|
|
55
|
+
last_opened: row.last_opened,
|
|
56
|
+
is_favorite: Boolean(row.is_favorite)
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.ProjectRepository = ProjectRepository;
|
|
61
|
+
//# sourceMappingURL=ProjectRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/ProjectRepository.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAWpE,MAAa,iBAAiB;IAG5B;QACE,IAAI,CAAC,EAAE,GAAG,uCAAkB,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC;IAEM,OAAO;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;QACvE,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAW,CAAC;QACpC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;IAEM,QAAQ,CAAC,EAAU;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,qCAAqC,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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3B,OAAO,CAAC,EAAE,CACX,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,EAAU;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,mCAAmC,CAAC,CAAC;QAChE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;IAEO,cAAc,CAAC,GAAQ;QAC7B,OAAO;YACL,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;SACtC,CAAC;IACJ,CAAC;CACF;AA9ED,8CA8EC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ProjectEntity } from './ProjectRepository';
|
|
2
|
+
import { TagEntity } from './TagRepository';
|
|
3
|
+
import { TechnologyEntity } from './TechnologyRepository';
|
|
4
|
+
export interface ProjectFilters {
|
|
5
|
+
name?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
is_favorite?: boolean;
|
|
8
|
+
tags?: string[];
|
|
9
|
+
technologies?: string[];
|
|
10
|
+
sort?: 'name' | 'created_at' | 'last_opened';
|
|
11
|
+
order?: 'ASC' | 'DESC';
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DetailedProject extends ProjectEntity {
|
|
16
|
+
tags: TagEntity[];
|
|
17
|
+
technologies: TechnologyEntity[];
|
|
18
|
+
}
|
|
19
|
+
export declare class QueryBuilder {
|
|
20
|
+
private db;
|
|
21
|
+
constructor();
|
|
22
|
+
findProjects(filters: ProjectFilters): DetailedProject[];
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=QueryBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryBuilder.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/QueryBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,aAAa,CAAC;IAC7C,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAClC;AAED,qBAAa,YAAY;IACvB,OAAO,CAAC,EAAE,CAAqB;;IAMxB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,EAAE;CAqGhE"}
|