@minecraft-docker/mcctl-api 1.9.0 → 1.11.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/dist/app.d.ts.map +1 -1
- package/dist/app.js +5 -0
- package/dist/app.js.map +1 -1
- package/dist/routes/audit-logs.d.ts +10 -0
- package/dist/routes/audit-logs.d.ts.map +1 -0
- package/dist/routes/audit-logs.js +188 -0
- package/dist/routes/audit-logs.js.map +1 -0
- package/dist/routes/servers/config.d.ts +10 -0
- package/dist/routes/servers/config.d.ts.map +1 -0
- package/dist/routes/servers/config.js +208 -0
- package/dist/routes/servers/config.js.map +1 -0
- package/dist/schemas/audit-log.d.ts +180 -0
- package/dist/schemas/audit-log.d.ts.map +1 -0
- package/dist/schemas/audit-log.js +152 -0
- package/dist/schemas/audit-log.js.map +1 -0
- package/dist/schemas/config.d.ts +88 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/config.js +78 -0
- package/dist/schemas/config.js.map +1 -0
- package/dist/services/ConfigService.d.ts +38 -0
- package/dist/services/ConfigService.d.ts.map +1 -0
- package/dist/services/ConfigService.js +247 -0
- package/dist/services/ConfigService.js.map +1 -0
- package/dist/services/audit-log-service.d.ts +41 -0
- package/dist/services/audit-log-service.d.ts.map +1 -0
- package/dist/services/audit-log-service.js +259 -0
- package/dist/services/audit-log-service.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Mapping between API field names and config.env variable names
|
|
5
|
+
*/
|
|
6
|
+
const CONFIG_FIELD_MAP = {
|
|
7
|
+
motd: 'MOTD',
|
|
8
|
+
maxPlayers: 'MAX_PLAYERS',
|
|
9
|
+
difficulty: 'DIFFICULTY',
|
|
10
|
+
gameMode: 'GAMEMODE',
|
|
11
|
+
pvp: 'PVP',
|
|
12
|
+
viewDistance: 'VIEW_DISTANCE',
|
|
13
|
+
spawnProtection: 'SPAWN_PROTECTION',
|
|
14
|
+
memory: 'MEMORY',
|
|
15
|
+
useAikarFlags: 'USE_AIKAR_FLAGS',
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Fields that require a server restart to take effect
|
|
19
|
+
*/
|
|
20
|
+
const RESTART_REQUIRED_FIELDS = [
|
|
21
|
+
'memory',
|
|
22
|
+
'useAikarFlags',
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* Parse config.env file content into key-value pairs
|
|
26
|
+
*/
|
|
27
|
+
function parseEnvFile(content) {
|
|
28
|
+
const result = new Map();
|
|
29
|
+
const lines = content.split('\n');
|
|
30
|
+
for (const line of lines) {
|
|
31
|
+
// Skip empty lines and comments
|
|
32
|
+
const trimmed = line.trim();
|
|
33
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
// Parse KEY=VALUE
|
|
37
|
+
const eqIndex = line.indexOf('=');
|
|
38
|
+
if (eqIndex > 0) {
|
|
39
|
+
const key = line.substring(0, eqIndex).trim();
|
|
40
|
+
const value = line.substring(eqIndex + 1).trim();
|
|
41
|
+
result.set(key, value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Convert env value to appropriate type for API response
|
|
48
|
+
*/
|
|
49
|
+
function parseEnvValue(key, value) {
|
|
50
|
+
if (value === undefined) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
switch (key) {
|
|
54
|
+
case 'maxPlayers':
|
|
55
|
+
case 'viewDistance':
|
|
56
|
+
case 'spawnProtection':
|
|
57
|
+
const num = parseInt(value, 10);
|
|
58
|
+
return isNaN(num) ? undefined : num;
|
|
59
|
+
case 'pvp':
|
|
60
|
+
case 'useAikarFlags':
|
|
61
|
+
return value.toLowerCase() === 'true';
|
|
62
|
+
case 'difficulty':
|
|
63
|
+
const lowerDiff = value.toLowerCase();
|
|
64
|
+
if (['peaceful', 'easy', 'normal', 'hard'].includes(lowerDiff)) {
|
|
65
|
+
return lowerDiff;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
case 'gameMode':
|
|
69
|
+
const lowerMode = value.toLowerCase();
|
|
70
|
+
if (['survival', 'creative', 'adventure', 'spectator'].includes(lowerMode)) {
|
|
71
|
+
return lowerMode;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
case 'motd':
|
|
75
|
+
case 'memory':
|
|
76
|
+
return value;
|
|
77
|
+
default:
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Convert API value to env file format
|
|
83
|
+
*/
|
|
84
|
+
function formatEnvValue(key, value) {
|
|
85
|
+
if (value === undefined || value === null) {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
switch (key) {
|
|
89
|
+
case 'pvp':
|
|
90
|
+
case 'useAikarFlags':
|
|
91
|
+
return value ? 'true' : 'false';
|
|
92
|
+
case 'difficulty':
|
|
93
|
+
case 'gameMode':
|
|
94
|
+
return String(value).toLowerCase();
|
|
95
|
+
default:
|
|
96
|
+
return String(value);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Update config.env file while preserving comments and structure
|
|
101
|
+
*/
|
|
102
|
+
function updateEnvFile(content, updates) {
|
|
103
|
+
const lines = content.split('\n');
|
|
104
|
+
const result = [];
|
|
105
|
+
const updatedKeys = new Set();
|
|
106
|
+
for (const line of lines) {
|
|
107
|
+
const trimmed = line.trim();
|
|
108
|
+
// Preserve empty lines and comments
|
|
109
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
110
|
+
result.push(line);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
// Check if this line has a key we want to update
|
|
114
|
+
const eqIndex = line.indexOf('=');
|
|
115
|
+
if (eqIndex > 0) {
|
|
116
|
+
const key = line.substring(0, eqIndex).trim();
|
|
117
|
+
if (updates.has(key)) {
|
|
118
|
+
const newValue = updates.get(key);
|
|
119
|
+
result.push(`${key}=${newValue}`);
|
|
120
|
+
updatedKeys.add(key);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
result.push(line);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
result.push(line);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Add any new keys that weren't in the original file
|
|
131
|
+
for (const [key, value] of updates) {
|
|
132
|
+
if (!updatedKeys.has(key)) {
|
|
133
|
+
// Find appropriate section or add at end
|
|
134
|
+
result.push(`${key}=${value}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return result.join('\n');
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* ConfigService - Manages server configuration files
|
|
141
|
+
*/
|
|
142
|
+
export class ConfigService {
|
|
143
|
+
platformPath;
|
|
144
|
+
constructor(platformPath) {
|
|
145
|
+
this.platformPath = platformPath;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Get the path to a server's config.env file
|
|
149
|
+
*/
|
|
150
|
+
getConfigPath(serverName) {
|
|
151
|
+
return join(this.platformPath, 'servers', serverName, 'config.env');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Check if a server's configuration exists
|
|
155
|
+
*/
|
|
156
|
+
configExists(serverName) {
|
|
157
|
+
return existsSync(this.getConfigPath(serverName));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Read server configuration from config.env
|
|
161
|
+
*/
|
|
162
|
+
getConfig(serverName) {
|
|
163
|
+
const configPath = this.getConfigPath(serverName);
|
|
164
|
+
if (!existsSync(configPath)) {
|
|
165
|
+
throw new Error(`Server configuration not found: ${serverName}`);
|
|
166
|
+
}
|
|
167
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
168
|
+
const envMap = parseEnvFile(content);
|
|
169
|
+
const config = {};
|
|
170
|
+
for (const [apiKey, envKey] of Object.entries(CONFIG_FIELD_MAP)) {
|
|
171
|
+
const value = envMap.get(envKey);
|
|
172
|
+
const parsedValue = parseEnvValue(apiKey, value);
|
|
173
|
+
if (parsedValue !== undefined) {
|
|
174
|
+
config[apiKey] = parsedValue;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return config;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Update server configuration in config.env
|
|
181
|
+
* Returns information about what was changed
|
|
182
|
+
*/
|
|
183
|
+
updateConfig(serverName, updates) {
|
|
184
|
+
const configPath = this.getConfigPath(serverName);
|
|
185
|
+
if (!existsSync(configPath)) {
|
|
186
|
+
throw new Error(`Server configuration not found: ${serverName}`);
|
|
187
|
+
}
|
|
188
|
+
// Read current configuration
|
|
189
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
190
|
+
const currentConfig = this.getConfig(serverName);
|
|
191
|
+
// Prepare updates
|
|
192
|
+
const envUpdates = new Map();
|
|
193
|
+
const changedFields = [];
|
|
194
|
+
let restartRequired = false;
|
|
195
|
+
for (const [apiKey, value] of Object.entries(updates)) {
|
|
196
|
+
if (value === undefined) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
const typedKey = apiKey;
|
|
200
|
+
const envKey = CONFIG_FIELD_MAP[typedKey];
|
|
201
|
+
if (!envKey) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
// Check if value actually changed
|
|
205
|
+
const currentValue = currentConfig[typedKey];
|
|
206
|
+
if (currentValue !== value) {
|
|
207
|
+
changedFields.push(apiKey);
|
|
208
|
+
envUpdates.set(envKey, formatEnvValue(typedKey, value));
|
|
209
|
+
// Check if this field requires restart
|
|
210
|
+
if (RESTART_REQUIRED_FIELDS.includes(typedKey)) {
|
|
211
|
+
restartRequired = true;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Only write if there are changes
|
|
216
|
+
if (changedFields.length > 0) {
|
|
217
|
+
const updatedContent = updateEnvFile(content, envUpdates);
|
|
218
|
+
writeFileSync(configPath, updatedContent, 'utf-8');
|
|
219
|
+
}
|
|
220
|
+
// Read back the updated configuration
|
|
221
|
+
const newConfig = this.getConfig(serverName);
|
|
222
|
+
return {
|
|
223
|
+
config: newConfig,
|
|
224
|
+
changedFields,
|
|
225
|
+
restartRequired,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get the world name from server configuration
|
|
230
|
+
*/
|
|
231
|
+
getWorldName(serverName) {
|
|
232
|
+
const configPath = this.getConfigPath(serverName);
|
|
233
|
+
if (!existsSync(configPath)) {
|
|
234
|
+
return 'world'; // Default world name
|
|
235
|
+
}
|
|
236
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
237
|
+
const envMap = parseEnvFile(content);
|
|
238
|
+
return envMap.get('LEVEL') || 'world';
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Create a ConfigService instance
|
|
243
|
+
*/
|
|
244
|
+
export function createConfigService(platformPath) {
|
|
245
|
+
return new ConfigService(platformPath);
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=ConfigService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.js","sourceRoot":"","sources":["../../src/services/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B;;GAEG;AACH,MAAM,gBAAgB,GAAuC;IAC3D,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,YAAY;IACxB,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,KAAK;IACV,YAAY,EAAE,eAAe;IAC7B,eAAe,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2
|
+
import type { AuditLogEntry, AuditLogListQuery, AuditLogListResponse, AuditLogStatsResponse, AuditLogDetailResponse, AuditLogPurgeResponse } from '../schemas/audit-log.js';
|
|
3
|
+
/**
|
|
4
|
+
* Event listeners for new audit log entries (SSE support)
|
|
5
|
+
*/
|
|
6
|
+
type AuditLogListener = (log: AuditLogEntry) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Get or create the audit log repository singleton
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAuditLogRepository(): SqliteAuditLogRepository;
|
|
11
|
+
/**
|
|
12
|
+
* Get audit logs list with filtering and pagination
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAuditLogs(query: AuditLogListQuery): Promise<AuditLogListResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Get audit log statistics
|
|
17
|
+
*/
|
|
18
|
+
export declare function getAuditLogStats(): Promise<AuditLogStatsResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Get single audit log with related logs
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAuditLogById(id: string): Promise<AuditLogDetailResponse | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Purge audit logs older than a given date
|
|
25
|
+
*/
|
|
26
|
+
export declare function purgeAuditLogs(before: string, dryRun?: boolean): Promise<AuditLogPurgeResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Subscribe to new audit log events
|
|
29
|
+
*/
|
|
30
|
+
export declare function subscribeAuditLogs(listener: AuditLogListener): () => void;
|
|
31
|
+
/**
|
|
32
|
+
* Notify all listeners of a new audit log entry
|
|
33
|
+
* Called by routes that create audit log entries
|
|
34
|
+
*/
|
|
35
|
+
export declare function notifyNewAuditLog(entry: AuditLogEntry): void;
|
|
36
|
+
/**
|
|
37
|
+
* Close the repository (for graceful shutdown)
|
|
38
|
+
*/
|
|
39
|
+
export declare function closeAuditLogRepository(): void;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=audit-log-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log-service.d.ts","sourceRoot":"","sources":["../../src/services/audit-log-service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EAKzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,aAAa,EAEb,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAOjC;;GAEG;AACH,KAAK,gBAAgB,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,IAAI,CAAC;AAGrD;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,wBAAwB,CAMhE;AAyFD;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CA6B1F;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAoDvE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CA8BxF;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,qBAAqB,CAAC,CAsBhC;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,IAAI,CAKzE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAQ5D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAK9C"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { SqliteAuditLogRepository, AuditActionEnum, } from '@minecraft-docker/shared';
|
|
3
|
+
import { config } from '../config/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Singleton instance of the audit log repository
|
|
6
|
+
*/
|
|
7
|
+
let repository = null;
|
|
8
|
+
const listeners = new Set();
|
|
9
|
+
/**
|
|
10
|
+
* Get or create the audit log repository singleton
|
|
11
|
+
*/
|
|
12
|
+
export function getAuditLogRepository() {
|
|
13
|
+
if (!repository) {
|
|
14
|
+
const dbPath = join(config.mcctlRoot, 'audit.db');
|
|
15
|
+
repository = new SqliteAuditLogRepository(dbPath);
|
|
16
|
+
}
|
|
17
|
+
return repository;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Convert AuditLog entity to API response entry
|
|
21
|
+
*/
|
|
22
|
+
function toEntry(log) {
|
|
23
|
+
const json = log.toJSON();
|
|
24
|
+
return {
|
|
25
|
+
id: json.id,
|
|
26
|
+
action: json.action,
|
|
27
|
+
actor: json.actor,
|
|
28
|
+
targetType: json.targetType,
|
|
29
|
+
targetName: json.targetName,
|
|
30
|
+
details: json.details,
|
|
31
|
+
status: json.status,
|
|
32
|
+
errorMessage: json.errorMessage ?? null,
|
|
33
|
+
timestamp: json.timestamp,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Convert AuditLog entity to brief entry
|
|
38
|
+
*/
|
|
39
|
+
function toBrief(log) {
|
|
40
|
+
const json = log.toJSON();
|
|
41
|
+
return {
|
|
42
|
+
id: json.id,
|
|
43
|
+
action: json.action,
|
|
44
|
+
targetName: json.targetName,
|
|
45
|
+
timestamp: json.timestamp,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parse sort parameter
|
|
50
|
+
*/
|
|
51
|
+
function parseSortOrder(sort) {
|
|
52
|
+
if (sort === 'timestamp:asc')
|
|
53
|
+
return 'asc';
|
|
54
|
+
return 'desc';
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Build query options from request query parameters
|
|
58
|
+
*/
|
|
59
|
+
function buildQueryOptions(query) {
|
|
60
|
+
const options = {};
|
|
61
|
+
if (query.action) {
|
|
62
|
+
// Take first action for now (port interface only supports single action)
|
|
63
|
+
const firstAction = query.action.split(',')[0]?.trim();
|
|
64
|
+
if (firstAction && Object.values(AuditActionEnum).includes(firstAction)) {
|
|
65
|
+
options.action = firstAction;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (query.actor) {
|
|
69
|
+
options.actor = query.actor;
|
|
70
|
+
}
|
|
71
|
+
if (query.targetType) {
|
|
72
|
+
options.targetType = query.targetType;
|
|
73
|
+
}
|
|
74
|
+
if (query.targetName) {
|
|
75
|
+
options.targetName = query.targetName;
|
|
76
|
+
}
|
|
77
|
+
if (query.status === 'success' || query.status === 'failure') {
|
|
78
|
+
options.status = query.status;
|
|
79
|
+
}
|
|
80
|
+
if (query.from) {
|
|
81
|
+
options.from = new Date(query.from);
|
|
82
|
+
}
|
|
83
|
+
if (query.to) {
|
|
84
|
+
options.to = new Date(query.to);
|
|
85
|
+
}
|
|
86
|
+
options.limit = query.limit ?? 50;
|
|
87
|
+
options.offset = query.offset ?? 0;
|
|
88
|
+
return options;
|
|
89
|
+
}
|
|
90
|
+
// ============================================================
|
|
91
|
+
// Service Functions
|
|
92
|
+
// ============================================================
|
|
93
|
+
/**
|
|
94
|
+
* Get audit logs list with filtering and pagination
|
|
95
|
+
*/
|
|
96
|
+
export async function getAuditLogs(query) {
|
|
97
|
+
const repo = getAuditLogRepository();
|
|
98
|
+
const options = buildQueryOptions(query);
|
|
99
|
+
// Get logs and total count
|
|
100
|
+
const [logs, total] = await Promise.all([
|
|
101
|
+
repo.findAll(options),
|
|
102
|
+
repo.count(options),
|
|
103
|
+
]);
|
|
104
|
+
// If sort is ascending, reverse the default DESC results
|
|
105
|
+
const sortOrder = parseSortOrder(query.sort);
|
|
106
|
+
const sortedLogs = sortOrder === 'asc' ? [...logs].reverse() : logs;
|
|
107
|
+
return {
|
|
108
|
+
logs: sortedLogs.map(toEntry),
|
|
109
|
+
total,
|
|
110
|
+
limit: options.limit ?? 50,
|
|
111
|
+
offset: options.offset ?? 0,
|
|
112
|
+
filters: {
|
|
113
|
+
action: query.action ?? null,
|
|
114
|
+
actor: query.actor ?? null,
|
|
115
|
+
targetType: query.targetType ?? null,
|
|
116
|
+
targetName: query.targetName ?? null,
|
|
117
|
+
status: query.status ?? null,
|
|
118
|
+
from: query.from ?? null,
|
|
119
|
+
to: query.to ?? null,
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get audit log statistics
|
|
125
|
+
*/
|
|
126
|
+
export async function getAuditLogStats() {
|
|
127
|
+
const repo = getAuditLogRepository();
|
|
128
|
+
// Get total count
|
|
129
|
+
const total = await repo.count();
|
|
130
|
+
// Get counts by action
|
|
131
|
+
const byAction = {};
|
|
132
|
+
for (const action of Object.values(AuditActionEnum)) {
|
|
133
|
+
const count = await repo.count({ action });
|
|
134
|
+
if (count > 0) {
|
|
135
|
+
byAction[action] = count;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Get counts by status
|
|
139
|
+
const [successCount, failureCount] = await Promise.all([
|
|
140
|
+
repo.count({ status: 'success' }),
|
|
141
|
+
repo.count({ status: 'failure' }),
|
|
142
|
+
]);
|
|
143
|
+
// Get all logs for actor aggregation (limited to recent)
|
|
144
|
+
const recentLogs = await repo.findAll({ limit: 1000 });
|
|
145
|
+
// Aggregate by actor
|
|
146
|
+
const byActor = {};
|
|
147
|
+
for (const log of recentLogs) {
|
|
148
|
+
const actor = log.actor;
|
|
149
|
+
byActor[actor] = (byActor[actor] ?? 0) + 1;
|
|
150
|
+
}
|
|
151
|
+
// Get recent activity (last 10)
|
|
152
|
+
const recentActivity = await repo.findAll({ limit: 10 });
|
|
153
|
+
// Get oldest and newest entries
|
|
154
|
+
const allLogs = await repo.findAll({ limit: 1 });
|
|
155
|
+
const oldestLogs = await repo.findAll({});
|
|
156
|
+
const newestEntry = allLogs.length > 0 ? allLogs[0].timestamp.toISOString() : null;
|
|
157
|
+
const oldestEntry = oldestLogs.length > 0 ? oldestLogs[oldestLogs.length - 1].timestamp.toISOString() : null;
|
|
158
|
+
return {
|
|
159
|
+
total,
|
|
160
|
+
byAction,
|
|
161
|
+
byStatus: {
|
|
162
|
+
success: successCount,
|
|
163
|
+
failure: failureCount,
|
|
164
|
+
},
|
|
165
|
+
byActor,
|
|
166
|
+
recentActivity: recentActivity.map(toEntry),
|
|
167
|
+
oldestEntry,
|
|
168
|
+
newestEntry,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get single audit log with related logs
|
|
173
|
+
*/
|
|
174
|
+
export async function getAuditLogById(id) {
|
|
175
|
+
const repo = getAuditLogRepository();
|
|
176
|
+
// Find the log by ID
|
|
177
|
+
const allLogs = await repo.findAll({});
|
|
178
|
+
const log = allLogs.find(l => l.id === id);
|
|
179
|
+
if (!log) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
// Get related logs (same target, same actor)
|
|
183
|
+
const [sameTarget, sameActor] = await Promise.all([
|
|
184
|
+
repo.findByTarget(log.targetType, log.targetName),
|
|
185
|
+
repo.findByActor(log.actor),
|
|
186
|
+
]);
|
|
187
|
+
return {
|
|
188
|
+
log: toEntry(log),
|
|
189
|
+
relatedLogs: {
|
|
190
|
+
sameTarget: sameTarget
|
|
191
|
+
.filter(l => l.id !== id)
|
|
192
|
+
.slice(0, 10)
|
|
193
|
+
.map(toBrief),
|
|
194
|
+
sameActor: sameActor
|
|
195
|
+
.filter(l => l.id !== id)
|
|
196
|
+
.slice(0, 10)
|
|
197
|
+
.map(toBrief),
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Purge audit logs older than a given date
|
|
203
|
+
*/
|
|
204
|
+
export async function purgeAuditLogs(before, dryRun = false) {
|
|
205
|
+
const repo = getAuditLogRepository();
|
|
206
|
+
const beforeDate = new Date(before);
|
|
207
|
+
if (dryRun) {
|
|
208
|
+
// Count logs that would be deleted
|
|
209
|
+
const count = await repo.count({ to: beforeDate });
|
|
210
|
+
return {
|
|
211
|
+
deleted: count,
|
|
212
|
+
dryRun: true,
|
|
213
|
+
message: `${count} audit log entries would be deleted before ${before}`,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
// Actually delete
|
|
217
|
+
const deleted = await repo.deleteOlderThan(beforeDate);
|
|
218
|
+
return {
|
|
219
|
+
deleted,
|
|
220
|
+
dryRun: false,
|
|
221
|
+
message: `${deleted} audit log entries deleted before ${before}`,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
// ============================================================
|
|
225
|
+
// SSE Support
|
|
226
|
+
// ============================================================
|
|
227
|
+
/**
|
|
228
|
+
* Subscribe to new audit log events
|
|
229
|
+
*/
|
|
230
|
+
export function subscribeAuditLogs(listener) {
|
|
231
|
+
listeners.add(listener);
|
|
232
|
+
return () => {
|
|
233
|
+
listeners.delete(listener);
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Notify all listeners of a new audit log entry
|
|
238
|
+
* Called by routes that create audit log entries
|
|
239
|
+
*/
|
|
240
|
+
export function notifyNewAuditLog(entry) {
|
|
241
|
+
for (const listener of listeners) {
|
|
242
|
+
try {
|
|
243
|
+
listener(entry);
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
// Ignore listener errors
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Close the repository (for graceful shutdown)
|
|
252
|
+
*/
|
|
253
|
+
export function closeAuditLogRepository() {
|
|
254
|
+
if (repository) {
|
|
255
|
+
repository.close();
|
|
256
|
+
repository = null;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=audit-log-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log-service.js","sourceRoot":"","sources":["../../src/services/audit-log-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM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kBAAkB;IAClB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAEvD,OAAO;QACL,OAAO;QACP,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,GAAG,OAAO,qCAAqC,MAAM,EAAE;KACjE,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,cAAc;AACd,+DAA+D;AAE/D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA0B;IAC3D,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,OAAO,GAAG,EAAE;QACV,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC7B,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QAAC,MAAM,CAAC;YACP,yBAAyB;QAC3B,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,IAAI,UAAU,EAAE,CAAC;QACf,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,UAAU,GAAG,IAAI,CAAC;IACpB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minecraft-docker/mcctl-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "REST API server for managing Docker Minecraft servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@fastify/helmet": "^12.0.1",
|
|
52
52
|
"@fastify/swagger": "^9.6.1",
|
|
53
53
|
"@fastify/swagger-ui": "^5.2.4",
|
|
54
|
-
"@minecraft-docker/shared": "^1.
|
|
54
|
+
"@minecraft-docker/shared": "^1.11.0",
|
|
55
55
|
"@sinclair/typebox": "^0.34.48",
|
|
56
56
|
"bcrypt": "^6.0.0",
|
|
57
57
|
"dotenv": "^16.4.7",
|