@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,180 @@
|
|
|
1
|
+
import { Static } from '@sinclair/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* Audit log action enum values (matches AuditActionEnum from shared)
|
|
4
|
+
*/
|
|
5
|
+
export declare const AuditActionSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"server.create">, import("@sinclair/typebox").TLiteral<"server.delete">, import("@sinclair/typebox").TLiteral<"server.start">, import("@sinclair/typebox").TLiteral<"server.stop">, import("@sinclair/typebox").TLiteral<"server.restart">, import("@sinclair/typebox").TLiteral<"player.whitelist.add">, import("@sinclair/typebox").TLiteral<"player.whitelist.remove">, import("@sinclair/typebox").TLiteral<"player.ban">, import("@sinclair/typebox").TLiteral<"player.unban">, import("@sinclair/typebox").TLiteral<"player.op">, import("@sinclair/typebox").TLiteral<"player.deop">, import("@sinclair/typebox").TLiteral<"player.kick">, import("@sinclair/typebox").TLiteral<"audit.purge">]>;
|
|
6
|
+
/**
|
|
7
|
+
* Audit log status
|
|
8
|
+
*/
|
|
9
|
+
export declare const AuditStatusSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"success">, import("@sinclair/typebox").TLiteral<"failure">]>;
|
|
10
|
+
/**
|
|
11
|
+
* Single audit log entry
|
|
12
|
+
*/
|
|
13
|
+
export declare const AuditLogEntrySchema: import("@sinclair/typebox").TObject<{
|
|
14
|
+
id: import("@sinclair/typebox").TString;
|
|
15
|
+
action: import("@sinclair/typebox").TString;
|
|
16
|
+
actor: import("@sinclair/typebox").TString;
|
|
17
|
+
targetType: import("@sinclair/typebox").TString;
|
|
18
|
+
targetName: import("@sinclair/typebox").TString;
|
|
19
|
+
details: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>, import("@sinclair/typebox").TNull]>;
|
|
20
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"success">, import("@sinclair/typebox").TLiteral<"failure">]>;
|
|
21
|
+
errorMessage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
22
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Brief audit log entry (for related logs)
|
|
26
|
+
*/
|
|
27
|
+
export declare const AuditLogBriefSchema: import("@sinclair/typebox").TObject<{
|
|
28
|
+
id: import("@sinclair/typebox").TString;
|
|
29
|
+
action: import("@sinclair/typebox").TString;
|
|
30
|
+
targetName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
31
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* GET /api/audit-logs query parameters
|
|
35
|
+
*/
|
|
36
|
+
export declare const AuditLogListQuerySchema: import("@sinclair/typebox").TObject<{
|
|
37
|
+
action: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
38
|
+
actor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
+
targetType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
40
|
+
targetName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
41
|
+
status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
42
|
+
from: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
43
|
+
to: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
44
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
45
|
+
offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
46
|
+
sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* GET /api/audit-logs/:id params
|
|
50
|
+
*/
|
|
51
|
+
export declare const AuditLogIdParamsSchema: import("@sinclair/typebox").TObject<{
|
|
52
|
+
id: import("@sinclair/typebox").TString;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* DELETE /api/audit-logs request body
|
|
56
|
+
*/
|
|
57
|
+
export declare const AuditLogPurgeRequestSchema: import("@sinclair/typebox").TObject<{
|
|
58
|
+
before: import("@sinclair/typebox").TString;
|
|
59
|
+
dryRun: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Filters applied in the response
|
|
63
|
+
*/
|
|
64
|
+
export declare const AuditLogFiltersSchema: import("@sinclair/typebox").TObject<{
|
|
65
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
66
|
+
actor: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
67
|
+
targetType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
68
|
+
targetName: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
69
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
70
|
+
from: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
71
|
+
to: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* GET /api/audit-logs response
|
|
75
|
+
*/
|
|
76
|
+
export declare const AuditLogListResponseSchema: import("@sinclair/typebox").TObject<{
|
|
77
|
+
logs: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
78
|
+
id: import("@sinclair/typebox").TString;
|
|
79
|
+
action: import("@sinclair/typebox").TString;
|
|
80
|
+
actor: import("@sinclair/typebox").TString;
|
|
81
|
+
targetType: import("@sinclair/typebox").TString;
|
|
82
|
+
targetName: import("@sinclair/typebox").TString;
|
|
83
|
+
details: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>, import("@sinclair/typebox").TNull]>;
|
|
84
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"success">, import("@sinclair/typebox").TLiteral<"failure">]>;
|
|
85
|
+
errorMessage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
86
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
87
|
+
}>>;
|
|
88
|
+
total: import("@sinclair/typebox").TNumber;
|
|
89
|
+
limit: import("@sinclair/typebox").TNumber;
|
|
90
|
+
offset: import("@sinclair/typebox").TNumber;
|
|
91
|
+
filters: import("@sinclair/typebox").TObject<{
|
|
92
|
+
action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
93
|
+
actor: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
94
|
+
targetType: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
95
|
+
targetName: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
96
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
97
|
+
from: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
98
|
+
to: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
99
|
+
}>;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* GET /api/audit-logs/stats response
|
|
103
|
+
*/
|
|
104
|
+
export declare const AuditLogStatsResponseSchema: import("@sinclair/typebox").TObject<{
|
|
105
|
+
total: import("@sinclair/typebox").TNumber;
|
|
106
|
+
byAction: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber>;
|
|
107
|
+
byStatus: import("@sinclair/typebox").TObject<{
|
|
108
|
+
success: import("@sinclair/typebox").TNumber;
|
|
109
|
+
failure: import("@sinclair/typebox").TNumber;
|
|
110
|
+
}>;
|
|
111
|
+
byActor: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber>;
|
|
112
|
+
recentActivity: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
113
|
+
id: import("@sinclair/typebox").TString;
|
|
114
|
+
action: import("@sinclair/typebox").TString;
|
|
115
|
+
actor: import("@sinclair/typebox").TString;
|
|
116
|
+
targetType: import("@sinclair/typebox").TString;
|
|
117
|
+
targetName: import("@sinclair/typebox").TString;
|
|
118
|
+
details: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>, import("@sinclair/typebox").TNull]>;
|
|
119
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"success">, import("@sinclair/typebox").TLiteral<"failure">]>;
|
|
120
|
+
errorMessage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
121
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
122
|
+
}>>;
|
|
123
|
+
oldestEntry: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
124
|
+
newestEntry: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
125
|
+
}>;
|
|
126
|
+
/**
|
|
127
|
+
* GET /api/audit-logs/:id response
|
|
128
|
+
*/
|
|
129
|
+
export declare const AuditLogDetailResponseSchema: import("@sinclair/typebox").TObject<{
|
|
130
|
+
log: import("@sinclair/typebox").TObject<{
|
|
131
|
+
id: import("@sinclair/typebox").TString;
|
|
132
|
+
action: import("@sinclair/typebox").TString;
|
|
133
|
+
actor: import("@sinclair/typebox").TString;
|
|
134
|
+
targetType: import("@sinclair/typebox").TString;
|
|
135
|
+
targetName: import("@sinclair/typebox").TString;
|
|
136
|
+
details: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>, import("@sinclair/typebox").TNull]>;
|
|
137
|
+
status: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"success">, import("@sinclair/typebox").TLiteral<"failure">]>;
|
|
138
|
+
errorMessage: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
|
139
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
140
|
+
}>;
|
|
141
|
+
relatedLogs: import("@sinclair/typebox").TObject<{
|
|
142
|
+
sameTarget: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
143
|
+
id: import("@sinclair/typebox").TString;
|
|
144
|
+
action: import("@sinclair/typebox").TString;
|
|
145
|
+
targetName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
146
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
147
|
+
}>>;
|
|
148
|
+
sameActor: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
149
|
+
id: import("@sinclair/typebox").TString;
|
|
150
|
+
action: import("@sinclair/typebox").TString;
|
|
151
|
+
targetName: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
152
|
+
timestamp: import("@sinclair/typebox").TString;
|
|
153
|
+
}>>;
|
|
154
|
+
}>;
|
|
155
|
+
}>;
|
|
156
|
+
/**
|
|
157
|
+
* DELETE /api/audit-logs response
|
|
158
|
+
*/
|
|
159
|
+
export declare const AuditLogPurgeResponseSchema: import("@sinclair/typebox").TObject<{
|
|
160
|
+
deleted: import("@sinclair/typebox").TNumber;
|
|
161
|
+
dryRun: import("@sinclair/typebox").TBoolean;
|
|
162
|
+
message: import("@sinclair/typebox").TString;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* Error response schema (reused)
|
|
166
|
+
*/
|
|
167
|
+
export declare const ErrorResponseSchema: import("@sinclair/typebox").TObject<{
|
|
168
|
+
error: import("@sinclair/typebox").TString;
|
|
169
|
+
message: import("@sinclair/typebox").TString;
|
|
170
|
+
}>;
|
|
171
|
+
export type AuditLogEntry = Static<typeof AuditLogEntrySchema>;
|
|
172
|
+
export type AuditLogBrief = Static<typeof AuditLogBriefSchema>;
|
|
173
|
+
export type AuditLogListQuery = Static<typeof AuditLogListQuerySchema>;
|
|
174
|
+
export type AuditLogIdParams = Static<typeof AuditLogIdParamsSchema>;
|
|
175
|
+
export type AuditLogPurgeRequest = Static<typeof AuditLogPurgeRequestSchema>;
|
|
176
|
+
export type AuditLogListResponse = Static<typeof AuditLogListResponseSchema>;
|
|
177
|
+
export type AuditLogStatsResponse = Static<typeof AuditLogStatsResponseSchema>;
|
|
178
|
+
export type AuditLogDetailResponse = Static<typeof AuditLogDetailResponseSchema>;
|
|
179
|
+
export type AuditLogPurgeResponse = Static<typeof AuditLogPurgeResponseSchema>;
|
|
180
|
+
//# sourceMappingURL=audit-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.d.ts","sourceRoot":"","sources":["../../src/schemas/audit-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,kvBAc5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB,wIAG5B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;EAU9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;EAK9B,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;EAWlC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;EAEjC,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;EAGrC,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;EAQhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;EAMrC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;EAWtC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;EAMvC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;EAItC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;EAG9B,CAAC;AAMH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACvE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACrE,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC7E,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC7E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACjF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Audit Log Schemas
|
|
4
|
+
// ============================================================
|
|
5
|
+
/**
|
|
6
|
+
* Audit log action enum values (matches AuditActionEnum from shared)
|
|
7
|
+
*/
|
|
8
|
+
export const AuditActionSchema = Type.Union([
|
|
9
|
+
Type.Literal('server.create'),
|
|
10
|
+
Type.Literal('server.delete'),
|
|
11
|
+
Type.Literal('server.start'),
|
|
12
|
+
Type.Literal('server.stop'),
|
|
13
|
+
Type.Literal('server.restart'),
|
|
14
|
+
Type.Literal('player.whitelist.add'),
|
|
15
|
+
Type.Literal('player.whitelist.remove'),
|
|
16
|
+
Type.Literal('player.ban'),
|
|
17
|
+
Type.Literal('player.unban'),
|
|
18
|
+
Type.Literal('player.op'),
|
|
19
|
+
Type.Literal('player.deop'),
|
|
20
|
+
Type.Literal('player.kick'),
|
|
21
|
+
Type.Literal('audit.purge'),
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* Audit log status
|
|
25
|
+
*/
|
|
26
|
+
export const AuditStatusSchema = Type.Union([
|
|
27
|
+
Type.Literal('success'),
|
|
28
|
+
Type.Literal('failure'),
|
|
29
|
+
]);
|
|
30
|
+
/**
|
|
31
|
+
* Single audit log entry
|
|
32
|
+
*/
|
|
33
|
+
export const AuditLogEntrySchema = Type.Object({
|
|
34
|
+
id: Type.String(),
|
|
35
|
+
action: Type.String(),
|
|
36
|
+
actor: Type.String(),
|
|
37
|
+
targetType: Type.String(),
|
|
38
|
+
targetName: Type.String(),
|
|
39
|
+
details: Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()]),
|
|
40
|
+
status: AuditStatusSchema,
|
|
41
|
+
errorMessage: Type.Optional(Type.Union([Type.String(), Type.Null()])),
|
|
42
|
+
timestamp: Type.String({ format: 'date-time' }),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Brief audit log entry (for related logs)
|
|
46
|
+
*/
|
|
47
|
+
export const AuditLogBriefSchema = Type.Object({
|
|
48
|
+
id: Type.String(),
|
|
49
|
+
action: Type.String(),
|
|
50
|
+
targetName: Type.Optional(Type.String()),
|
|
51
|
+
timestamp: Type.String({ format: 'date-time' }),
|
|
52
|
+
});
|
|
53
|
+
// ============================================================
|
|
54
|
+
// Query Schemas
|
|
55
|
+
// ============================================================
|
|
56
|
+
/**
|
|
57
|
+
* GET /api/audit-logs query parameters
|
|
58
|
+
*/
|
|
59
|
+
export const AuditLogListQuerySchema = Type.Object({
|
|
60
|
+
action: Type.Optional(Type.String({ description: 'Action filter (comma-separated for multiple)' })),
|
|
61
|
+
actor: Type.Optional(Type.String({ description: 'Actor filter (e.g., cli:local, api:admin)' })),
|
|
62
|
+
targetType: Type.Optional(Type.String({ description: 'Target type filter (server, player)' })),
|
|
63
|
+
targetName: Type.Optional(Type.String({ description: 'Target name filter (partial match)' })),
|
|
64
|
+
status: Type.Optional(Type.String({ description: 'Status filter (success, failure)' })),
|
|
65
|
+
from: Type.Optional(Type.String({ format: 'date-time', description: 'Start date (ISO 8601)' })),
|
|
66
|
+
to: Type.Optional(Type.String({ format: 'date-time', description: 'End date (ISO 8601)' })),
|
|
67
|
+
limit: Type.Optional(Type.Number({ minimum: 1, maximum: 200, default: 50, description: 'Page size (max: 200)' })),
|
|
68
|
+
offset: Type.Optional(Type.Number({ minimum: 0, default: 0, description: 'Offset for pagination' })),
|
|
69
|
+
sort: Type.Optional(Type.String({ default: 'timestamp:desc', description: 'Sort order (timestamp:asc, timestamp:desc)' })),
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* GET /api/audit-logs/:id params
|
|
73
|
+
*/
|
|
74
|
+
export const AuditLogIdParamsSchema = Type.Object({
|
|
75
|
+
id: Type.String({ description: 'Audit log entry ID' }),
|
|
76
|
+
});
|
|
77
|
+
// ============================================================
|
|
78
|
+
// Request Schemas
|
|
79
|
+
// ============================================================
|
|
80
|
+
/**
|
|
81
|
+
* DELETE /api/audit-logs request body
|
|
82
|
+
*/
|
|
83
|
+
export const AuditLogPurgeRequestSchema = Type.Object({
|
|
84
|
+
before: Type.String({ format: 'date-time', description: 'Delete logs before this date (ISO 8601)' }),
|
|
85
|
+
dryRun: Type.Optional(Type.Boolean({ default: false, description: 'If true, only count logs to be deleted' })),
|
|
86
|
+
});
|
|
87
|
+
// ============================================================
|
|
88
|
+
// Response Schemas
|
|
89
|
+
// ============================================================
|
|
90
|
+
/**
|
|
91
|
+
* Filters applied in the response
|
|
92
|
+
*/
|
|
93
|
+
export const AuditLogFiltersSchema = Type.Object({
|
|
94
|
+
action: Type.Union([Type.String(), Type.Null()]),
|
|
95
|
+
actor: Type.Union([Type.String(), Type.Null()]),
|
|
96
|
+
targetType: Type.Union([Type.String(), Type.Null()]),
|
|
97
|
+
targetName: Type.Union([Type.String(), Type.Null()]),
|
|
98
|
+
status: Type.Union([Type.String(), Type.Null()]),
|
|
99
|
+
from: Type.Union([Type.String(), Type.Null()]),
|
|
100
|
+
to: Type.Union([Type.String(), Type.Null()]),
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* GET /api/audit-logs response
|
|
104
|
+
*/
|
|
105
|
+
export const AuditLogListResponseSchema = Type.Object({
|
|
106
|
+
logs: Type.Array(AuditLogEntrySchema),
|
|
107
|
+
total: Type.Number(),
|
|
108
|
+
limit: Type.Number(),
|
|
109
|
+
offset: Type.Number(),
|
|
110
|
+
filters: AuditLogFiltersSchema,
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* GET /api/audit-logs/stats response
|
|
114
|
+
*/
|
|
115
|
+
export const AuditLogStatsResponseSchema = Type.Object({
|
|
116
|
+
total: Type.Number(),
|
|
117
|
+
byAction: Type.Record(Type.String(), Type.Number()),
|
|
118
|
+
byStatus: Type.Object({
|
|
119
|
+
success: Type.Number(),
|
|
120
|
+
failure: Type.Number(),
|
|
121
|
+
}),
|
|
122
|
+
byActor: Type.Record(Type.String(), Type.Number()),
|
|
123
|
+
recentActivity: Type.Array(AuditLogEntrySchema),
|
|
124
|
+
oldestEntry: Type.Union([Type.String({ format: 'date-time' }), Type.Null()]),
|
|
125
|
+
newestEntry: Type.Union([Type.String({ format: 'date-time' }), Type.Null()]),
|
|
126
|
+
});
|
|
127
|
+
/**
|
|
128
|
+
* GET /api/audit-logs/:id response
|
|
129
|
+
*/
|
|
130
|
+
export const AuditLogDetailResponseSchema = Type.Object({
|
|
131
|
+
log: AuditLogEntrySchema,
|
|
132
|
+
relatedLogs: Type.Object({
|
|
133
|
+
sameTarget: Type.Array(AuditLogBriefSchema),
|
|
134
|
+
sameActor: Type.Array(AuditLogBriefSchema),
|
|
135
|
+
}),
|
|
136
|
+
});
|
|
137
|
+
/**
|
|
138
|
+
* DELETE /api/audit-logs response
|
|
139
|
+
*/
|
|
140
|
+
export const AuditLogPurgeResponseSchema = Type.Object({
|
|
141
|
+
deleted: Type.Number(),
|
|
142
|
+
dryRun: Type.Boolean(),
|
|
143
|
+
message: Type.String(),
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Error response schema (reused)
|
|
147
|
+
*/
|
|
148
|
+
export const ErrorResponseSchema = Type.Object({
|
|
149
|
+
error: Type.String(),
|
|
150
|
+
message: Type.String(),
|
|
151
|
+
});
|
|
152
|
+
//# sourceMappingURL=audit-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.js","sourceRoot":"","sources":["../../src/schemas/audit-log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,mBAAmB,CAAC;AAEjD,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1C,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IAC3B,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IAC9B,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC,YAAY,C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C7C,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;IACpB,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Static } from '@sinclair/typebox';
|
|
2
|
+
/**
|
|
3
|
+
* Game difficulty levels
|
|
4
|
+
*/
|
|
5
|
+
export declare const DifficultySchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"peaceful">, import("@sinclair/typebox").TLiteral<"easy">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"hard">]>;
|
|
6
|
+
/**
|
|
7
|
+
* Game mode options
|
|
8
|
+
*/
|
|
9
|
+
export declare const GameModeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"survival">, import("@sinclair/typebox").TLiteral<"creative">, import("@sinclair/typebox").TLiteral<"adventure">, import("@sinclair/typebox").TLiteral<"spectator">]>;
|
|
10
|
+
/**
|
|
11
|
+
* Server configuration values (from config.env)
|
|
12
|
+
*/
|
|
13
|
+
export declare const ServerConfigSchema: import("@sinclair/typebox").TObject<{
|
|
14
|
+
motd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
15
|
+
maxPlayers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
16
|
+
difficulty: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"peaceful">, import("@sinclair/typebox").TLiteral<"easy">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"hard">]>>;
|
|
17
|
+
gameMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"survival">, import("@sinclair/typebox").TLiteral<"creative">, import("@sinclair/typebox").TLiteral<"adventure">, import("@sinclair/typebox").TLiteral<"spectator">]>>;
|
|
18
|
+
pvp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
19
|
+
viewDistance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
20
|
+
spawnProtection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
21
|
+
memory: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
22
|
+
useAikarFlags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Request schema for updating server configuration
|
|
26
|
+
*/
|
|
27
|
+
export declare const UpdateServerConfigRequestSchema: import("@sinclair/typebox").TObject<{
|
|
28
|
+
motd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
29
|
+
maxPlayers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
30
|
+
difficulty: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"peaceful">, import("@sinclair/typebox").TLiteral<"easy">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"hard">]>>;
|
|
31
|
+
gameMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"survival">, import("@sinclair/typebox").TLiteral<"creative">, import("@sinclair/typebox").TLiteral<"adventure">, import("@sinclair/typebox").TLiteral<"spectator">]>>;
|
|
32
|
+
pvp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
33
|
+
viewDistance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
34
|
+
spawnProtection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
35
|
+
memory: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
36
|
+
useAikarFlags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Response schema for getting server configuration
|
|
40
|
+
*/
|
|
41
|
+
export declare const ServerConfigResponseSchema: import("@sinclair/typebox").TObject<{
|
|
42
|
+
config: import("@sinclair/typebox").TObject<{
|
|
43
|
+
motd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
44
|
+
maxPlayers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
45
|
+
difficulty: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"peaceful">, import("@sinclair/typebox").TLiteral<"easy">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"hard">]>>;
|
|
46
|
+
gameMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"survival">, import("@sinclair/typebox").TLiteral<"creative">, import("@sinclair/typebox").TLiteral<"adventure">, import("@sinclair/typebox").TLiteral<"spectator">]>>;
|
|
47
|
+
pvp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
48
|
+
viewDistance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
49
|
+
spawnProtection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
50
|
+
memory: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
51
|
+
useAikarFlags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
52
|
+
}>;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Response schema for updating server configuration
|
|
56
|
+
*/
|
|
57
|
+
export declare const UpdateServerConfigResponseSchema: import("@sinclair/typebox").TObject<{
|
|
58
|
+
success: import("@sinclair/typebox").TBoolean;
|
|
59
|
+
config: import("@sinclair/typebox").TObject<{
|
|
60
|
+
motd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
61
|
+
maxPlayers: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
62
|
+
difficulty: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"peaceful">, import("@sinclair/typebox").TLiteral<"easy">, import("@sinclair/typebox").TLiteral<"normal">, import("@sinclair/typebox").TLiteral<"hard">]>>;
|
|
63
|
+
gameMode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"survival">, import("@sinclair/typebox").TLiteral<"creative">, import("@sinclair/typebox").TLiteral<"adventure">, import("@sinclair/typebox").TLiteral<"spectator">]>>;
|
|
64
|
+
pvp: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
65
|
+
viewDistance: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
66
|
+
spawnProtection: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
67
|
+
memory: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
68
|
+
useAikarFlags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
69
|
+
}>;
|
|
70
|
+
restartRequired: import("@sinclair/typebox").TBoolean;
|
|
71
|
+
changedFields: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Response schema for world reset operation
|
|
75
|
+
*/
|
|
76
|
+
export declare const WorldResetResponseSchema: import("@sinclair/typebox").TObject<{
|
|
77
|
+
success: import("@sinclair/typebox").TBoolean;
|
|
78
|
+
message: import("@sinclair/typebox").TString;
|
|
79
|
+
worldName: import("@sinclair/typebox").TString;
|
|
80
|
+
}>;
|
|
81
|
+
export type Difficulty = Static<typeof DifficultySchema>;
|
|
82
|
+
export type GameMode = Static<typeof GameModeSchema>;
|
|
83
|
+
export type ServerConfig = Static<typeof ServerConfigSchema>;
|
|
84
|
+
export type UpdateServerConfigRequest = Static<typeof UpdateServerConfigRequestSchema>;
|
|
85
|
+
export type ServerConfigResponse = Static<typeof ServerConfigResponseSchema>;
|
|
86
|
+
export type UpdateServerConfigResponse = Static<typeof UpdateServerConfigResponseSchema>;
|
|
87
|
+
export type WorldResetResponse = Static<typeof WorldResetResponseSchema>;
|
|
88
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/schemas/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMjD;;GAEG;AACH,eAAO,MAAM,gBAAgB,oOAK3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,gPAKzB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;EAa7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;EAa1C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;EAErC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;EAK3C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;EAInC,CAAC;AAMH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AACrD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC7D,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACvF,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC7E,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,OAAO,gCAAgC,CAAC,CAAC;AACzF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Type } from '@sinclair/typebox';
|
|
2
|
+
// ============================================================
|
|
3
|
+
// Server Configuration Schemas
|
|
4
|
+
// ============================================================
|
|
5
|
+
/**
|
|
6
|
+
* Game difficulty levels
|
|
7
|
+
*/
|
|
8
|
+
export const DifficultySchema = Type.Union([
|
|
9
|
+
Type.Literal('peaceful'),
|
|
10
|
+
Type.Literal('easy'),
|
|
11
|
+
Type.Literal('normal'),
|
|
12
|
+
Type.Literal('hard'),
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Game mode options
|
|
16
|
+
*/
|
|
17
|
+
export const GameModeSchema = Type.Union([
|
|
18
|
+
Type.Literal('survival'),
|
|
19
|
+
Type.Literal('creative'),
|
|
20
|
+
Type.Literal('adventure'),
|
|
21
|
+
Type.Literal('spectator'),
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* Server configuration values (from config.env)
|
|
25
|
+
*/
|
|
26
|
+
export const ServerConfigSchema = Type.Object({
|
|
27
|
+
// Server Properties (hot-reload capable)
|
|
28
|
+
motd: Type.Optional(Type.String({ description: 'Message of the day' })),
|
|
29
|
+
maxPlayers: Type.Optional(Type.Number({ minimum: 1, maximum: 1000, description: 'Maximum player count' })),
|
|
30
|
+
difficulty: Type.Optional(DifficultySchema),
|
|
31
|
+
gameMode: Type.Optional(GameModeSchema),
|
|
32
|
+
pvp: Type.Optional(Type.Boolean({ description: 'Enable PvP combat' })),
|
|
33
|
+
viewDistance: Type.Optional(Type.Number({ minimum: 2, maximum: 32, description: 'View distance in chunks' })),
|
|
34
|
+
spawnProtection: Type.Optional(Type.Number({ minimum: 0, maximum: 100, description: 'Spawn protection radius' })),
|
|
35
|
+
// Performance Settings (restart required)
|
|
36
|
+
memory: Type.Optional(Type.String({ pattern: '^\\d+[MG]$', description: 'JVM memory allocation (e.g., 4G)' })),
|
|
37
|
+
useAikarFlags: Type.Optional(Type.Boolean({ description: 'Use Aikar JVM flags for optimization' })),
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Request schema for updating server configuration
|
|
41
|
+
*/
|
|
42
|
+
export const UpdateServerConfigRequestSchema = Type.Object({
|
|
43
|
+
// Server Properties (hot-reload capable)
|
|
44
|
+
motd: Type.Optional(Type.String({ minLength: 0, maxLength: 500 })),
|
|
45
|
+
maxPlayers: Type.Optional(Type.Number({ minimum: 1, maximum: 1000 })),
|
|
46
|
+
difficulty: Type.Optional(DifficultySchema),
|
|
47
|
+
gameMode: Type.Optional(GameModeSchema),
|
|
48
|
+
pvp: Type.Optional(Type.Boolean()),
|
|
49
|
+
viewDistance: Type.Optional(Type.Number({ minimum: 2, maximum: 32 })),
|
|
50
|
+
spawnProtection: Type.Optional(Type.Number({ minimum: 0, maximum: 100 })),
|
|
51
|
+
// Performance Settings (restart required)
|
|
52
|
+
memory: Type.Optional(Type.String({ pattern: '^\\d+[MG]$' })),
|
|
53
|
+
useAikarFlags: Type.Optional(Type.Boolean()),
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Response schema for getting server configuration
|
|
57
|
+
*/
|
|
58
|
+
export const ServerConfigResponseSchema = Type.Object({
|
|
59
|
+
config: ServerConfigSchema,
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Response schema for updating server configuration
|
|
63
|
+
*/
|
|
64
|
+
export const UpdateServerConfigResponseSchema = Type.Object({
|
|
65
|
+
success: Type.Boolean(),
|
|
66
|
+
config: ServerConfigSchema,
|
|
67
|
+
restartRequired: Type.Boolean({ description: 'Whether server restart is needed to apply changes' }),
|
|
68
|
+
changedFields: Type.Array(Type.String(), { description: 'List of fields that were changed' }),
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Response schema for world reset operation
|
|
72
|
+
*/
|
|
73
|
+
export const WorldResetResponseSchema = Type.Object({
|
|
74
|
+
success: Type.Boolean(),
|
|
75
|
+
message: Type.String(),
|
|
76
|
+
worldName: Type.String(),
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/schemas/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,mBAAmB,CAAC;AAEjD,+DAA+D;AAC/D,+BAA+B;AAC/B,+DAA+D;AAE/D;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC;IACvC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACzB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;CAC1B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC5C,yCAAyC;IACzC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC,CAAC;IACvE,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC,CAAC;IAC1G,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC3C,QAAQ,EAAE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;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ServerConfig, UpdateServerConfigRequest } from '../schemas/config.js';
|
|
2
|
+
/**
|
|
3
|
+
* ConfigService - Manages server configuration files
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigService {
|
|
6
|
+
private readonly platformPath;
|
|
7
|
+
constructor(platformPath: string);
|
|
8
|
+
/**
|
|
9
|
+
* Get the path to a server's config.env file
|
|
10
|
+
*/
|
|
11
|
+
private getConfigPath;
|
|
12
|
+
/**
|
|
13
|
+
* Check if a server's configuration exists
|
|
14
|
+
*/
|
|
15
|
+
configExists(serverName: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Read server configuration from config.env
|
|
18
|
+
*/
|
|
19
|
+
getConfig(serverName: string): ServerConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Update server configuration in config.env
|
|
22
|
+
* Returns information about what was changed
|
|
23
|
+
*/
|
|
24
|
+
updateConfig(serverName: string, updates: UpdateServerConfigRequest): {
|
|
25
|
+
config: ServerConfig;
|
|
26
|
+
changedFields: string[];
|
|
27
|
+
restartRequired: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Get the world name from server configuration
|
|
31
|
+
*/
|
|
32
|
+
getWorldName(serverName: string): string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a ConfigService instance
|
|
36
|
+
*/
|
|
37
|
+
export declare function createConfigService(platformPath: string): ConfigService;
|
|
38
|
+
//# sourceMappingURL=ConfigService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../src/services/ConfigService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAgKpF;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,YAAY,EAAE,MAAM;IAIhC;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAIzC;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY;IAuB3C;;;OAGG;IACH,YAAY,CACV,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,yBAAyB,GACjC;QACD,MAAM,EAAE,YAAY,CAAC;QACrB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;KAC1B;IAyDD;;OAEG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CAYzC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAEvE"}
|