@minecraft-docker/shared 1.6.1 → 1.6.2
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/application/ports/inbound/IWorldManagementUseCase.d.ts +41 -0
- package/dist/application/ports/inbound/IWorldManagementUseCase.d.ts.map +1 -1
- package/dist/application/ports/inbound/index.d.ts +1 -1
- package/dist/application/ports/inbound/index.d.ts.map +1 -1
- package/dist/application/ports/index.d.ts +2 -2
- package/dist/application/ports/index.d.ts.map +1 -1
- package/dist/application/ports/outbound/IModSourcePort.d.ts +71 -0
- package/dist/application/ports/outbound/IModSourcePort.d.ts.map +1 -0
- package/dist/application/ports/outbound/IModSourcePort.js +19 -0
- package/dist/application/ports/outbound/IModSourcePort.js.map +1 -0
- package/dist/application/ports/outbound/IPromptPort.d.ts +12 -0
- package/dist/application/ports/outbound/IPromptPort.d.ts.map +1 -1
- package/dist/application/ports/outbound/IServiceManagerPort.d.ts +115 -0
- package/dist/application/ports/outbound/IServiceManagerPort.d.ts.map +1 -0
- package/dist/application/ports/outbound/IServiceManagerPort.js +2 -0
- package/dist/application/ports/outbound/IServiceManagerPort.js.map +1 -0
- package/dist/application/ports/outbound/IShellPort.d.ts +10 -2
- package/dist/application/ports/outbound/IShellPort.d.ts.map +1 -1
- package/dist/application/ports/outbound/IUserRepository.d.ts +42 -0
- package/dist/application/ports/outbound/IUserRepository.d.ts.map +1 -0
- package/dist/application/ports/outbound/IUserRepository.js +2 -0
- package/dist/application/ports/outbound/IUserRepository.js.map +1 -0
- package/dist/application/ports/outbound/IWorldRepository.d.ts +19 -0
- package/dist/application/ports/outbound/IWorldRepository.d.ts.map +1 -1
- package/dist/application/ports/outbound/index.d.ts +4 -1
- package/dist/application/ports/outbound/index.d.ts.map +1 -1
- package/dist/application/use-cases/CreateServerUseCase.d.ts.map +1 -1
- package/dist/application/use-cases/CreateServerUseCase.js +2 -3
- package/dist/application/use-cases/CreateServerUseCase.js.map +1 -1
- package/dist/application/use-cases/DeleteServerUseCase.js +5 -5
- package/dist/application/use-cases/DeleteServerUseCase.js.map +1 -1
- package/dist/application/use-cases/WorldManagementUseCase.d.ts +18 -1
- package/dist/application/use-cases/WorldManagementUseCase.d.ts.map +1 -1
- package/dist/application/use-cases/WorldManagementUseCase.js +332 -0
- package/dist/application/use-cases/WorldManagementUseCase.js.map +1 -1
- package/dist/docker/index.d.ts +14 -0
- package/dist/docker/index.d.ts.map +1 -1
- package/dist/docker/index.js +26 -1
- package/dist/docker/index.js.map +1 -1
- package/dist/domain/entities/User.d.ts +77 -0
- package/dist/domain/entities/User.d.ts.map +1 -0
- package/dist/domain/entities/User.js +121 -0
- package/dist/domain/entities/User.js.map +1 -0
- package/dist/domain/entities/World.d.ts +7 -1
- package/dist/domain/entities/World.d.ts.map +1 -1
- package/dist/domain/entities/World.js +14 -1
- package/dist/domain/entities/World.js.map +1 -1
- package/dist/domain/entities/index.d.ts +1 -0
- package/dist/domain/entities/index.d.ts.map +1 -1
- package/dist/domain/entities/index.js +1 -0
- package/dist/domain/entities/index.js.map +1 -1
- package/dist/domain/index.d.ts +2 -2
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +4 -2
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/mod/ModDependency.d.ts +18 -0
- package/dist/domain/mod/ModDependency.d.ts.map +1 -0
- package/dist/domain/mod/ModDependency.js +5 -0
- package/dist/domain/mod/ModDependency.js.map +1 -0
- package/dist/domain/mod/ModFile.d.ts +27 -0
- package/dist/domain/mod/ModFile.d.ts.map +1 -0
- package/dist/domain/mod/ModFile.js +5 -0
- package/dist/domain/mod/ModFile.js.map +1 -0
- package/dist/domain/mod/ModProject.d.ts +36 -0
- package/dist/domain/mod/ModProject.d.ts.map +1 -0
- package/dist/domain/mod/ModProject.js +5 -0
- package/dist/domain/mod/ModProject.js.map +1 -0
- package/dist/domain/mod/ModSearchResult.d.ts +18 -0
- package/dist/domain/mod/ModSearchResult.d.ts.map +1 -0
- package/dist/domain/mod/ModSearchResult.js +5 -0
- package/dist/domain/mod/ModSearchResult.js.map +1 -0
- package/dist/domain/mod/ModVersion.d.ts +36 -0
- package/dist/domain/mod/ModVersion.d.ts.map +1 -0
- package/dist/domain/mod/ModVersion.js +5 -0
- package/dist/domain/mod/ModVersion.js.map +1 -0
- package/dist/domain/mod/index.d.ts +11 -0
- package/dist/domain/mod/index.d.ts.map +1 -0
- package/dist/domain/mod/index.js +6 -0
- package/dist/domain/mod/index.js.map +1 -0
- package/dist/domain/mod/types.d.ts +43 -0
- package/dist/domain/mod/types.d.ts.map +1 -0
- package/dist/domain/mod/types.js +6 -0
- package/dist/domain/mod/types.js.map +1 -0
- package/dist/domain/value-objects/ProcessInfo.d.ts +99 -0
- package/dist/domain/value-objects/ProcessInfo.d.ts.map +1 -0
- package/dist/domain/value-objects/ProcessInfo.js +171 -0
- package/dist/domain/value-objects/ProcessInfo.js.map +1 -0
- package/dist/domain/value-objects/Role.d.ts +41 -0
- package/dist/domain/value-objects/Role.d.ts.map +1 -0
- package/dist/domain/value-objects/Role.js +66 -0
- package/dist/domain/value-objects/Role.js.map +1 -0
- package/dist/domain/value-objects/ServerType.d.ts +1 -0
- package/dist/domain/value-objects/ServerType.d.ts.map +1 -1
- package/dist/domain/value-objects/ServerType.js +8 -0
- package/dist/domain/value-objects/ServerType.js.map +1 -1
- package/dist/domain/value-objects/ServiceStatus.d.ts +64 -0
- package/dist/domain/value-objects/ServiceStatus.d.ts.map +1 -0
- package/dist/domain/value-objects/ServiceStatus.js +99 -0
- package/dist/domain/value-objects/ServiceStatus.js.map +1 -0
- package/dist/domain/value-objects/UserId.d.ts +21 -0
- package/dist/domain/value-objects/UserId.d.ts.map +1 -0
- package/dist/domain/value-objects/UserId.js +43 -0
- package/dist/domain/value-objects/UserId.js.map +1 -0
- package/dist/domain/value-objects/Username.d.ts +16 -0
- package/dist/domain/value-objects/Username.d.ts.map +1 -0
- package/dist/domain/value-objects/Username.js +46 -0
- package/dist/domain/value-objects/Username.js.map +1 -0
- package/dist/domain/value-objects/index.d.ts +5 -0
- package/dist/domain/value-objects/index.d.ts.map +1 -1
- package/dist/domain/value-objects/index.js +7 -0
- package/dist/domain/value-objects/index.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/adapters/ApiPromptAdapter.d.ts +115 -0
- package/dist/infrastructure/adapters/ApiPromptAdapter.d.ts.map +1 -0
- package/dist/infrastructure/adapters/ApiPromptAdapter.js +268 -0
- package/dist/infrastructure/adapters/ApiPromptAdapter.js.map +1 -0
- package/dist/infrastructure/adapters/ServerRepository.js +3 -3
- package/dist/infrastructure/adapters/ServerRepository.js.map +1 -1
- package/dist/infrastructure/adapters/ShellAdapter.d.ts +4 -2
- package/dist/infrastructure/adapters/ShellAdapter.d.ts.map +1 -1
- package/dist/infrastructure/adapters/ShellAdapter.js +15 -5
- package/dist/infrastructure/adapters/ShellAdapter.js.map +1 -1
- package/dist/infrastructure/adapters/SqliteUserRepository.d.ts +70 -0
- package/dist/infrastructure/adapters/SqliteUserRepository.d.ts.map +1 -0
- package/dist/infrastructure/adapters/SqliteUserRepository.js +149 -0
- package/dist/infrastructure/adapters/SqliteUserRepository.js.map +1 -0
- package/dist/infrastructure/adapters/WorldRepository.d.ts +12 -0
- package/dist/infrastructure/adapters/WorldRepository.d.ts.map +1 -1
- package/dist/infrastructure/adapters/WorldRepository.js +73 -3
- package/dist/infrastructure/adapters/WorldRepository.js.map +1 -1
- package/dist/infrastructure/adapters/YamlUserRepository.d.ts +67 -0
- package/dist/infrastructure/adapters/YamlUserRepository.d.ts.map +1 -0
- package/dist/infrastructure/adapters/YamlUserRepository.js +161 -0
- package/dist/infrastructure/adapters/YamlUserRepository.js.map +1 -0
- package/dist/infrastructure/adapters/index.d.ts +3 -0
- package/dist/infrastructure/adapters/index.d.ts.map +1 -1
- package/dist/infrastructure/adapters/index.js +3 -0
- package/dist/infrastructure/adapters/index.js.map +1 -1
- package/dist/infrastructure/config/Pm2EcosystemConfig.d.ts +192 -0
- package/dist/infrastructure/config/Pm2EcosystemConfig.d.ts.map +1 -0
- package/dist/infrastructure/config/Pm2EcosystemConfig.js +48 -0
- package/dist/infrastructure/config/Pm2EcosystemConfig.js.map +1 -0
- package/dist/infrastructure/config/index.d.ts +6 -0
- package/dist/infrastructure/config/index.d.ts.map +1 -0
- package/dist/infrastructure/config/index.js +6 -0
- package/dist/infrastructure/config/index.js.map +1 -0
- package/dist/infrastructure/factories/ModSourceFactory.d.ts +73 -0
- package/dist/infrastructure/factories/ModSourceFactory.d.ts.map +1 -0
- package/dist/infrastructure/factories/ModSourceFactory.js +98 -0
- package/dist/infrastructure/factories/ModSourceFactory.js.map +1 -0
- package/dist/infrastructure/factories/index.d.ts +5 -0
- package/dist/infrastructure/factories/index.d.ts.map +1 -0
- package/dist/infrastructure/factories/index.js +5 -0
- package/dist/infrastructure/factories/index.js.map +1 -0
- package/dist/infrastructure/index.d.ts +1 -0
- package/dist/infrastructure/index.d.ts.map +1 -1
- package/dist/infrastructure/index.js +1 -0
- package/dist/infrastructure/index.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UserId Value Object
|
|
3
|
+
* Represents a validated UUID-based user identifier
|
|
4
|
+
*/
|
|
5
|
+
export class UserId {
|
|
6
|
+
_value;
|
|
7
|
+
static UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
8
|
+
constructor(_value) {
|
|
9
|
+
this._value = _value;
|
|
10
|
+
Object.freeze(this);
|
|
11
|
+
}
|
|
12
|
+
get value() {
|
|
13
|
+
return this._value;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create a UserId from an existing UUID string
|
|
17
|
+
*/
|
|
18
|
+
static create(value) {
|
|
19
|
+
const trimmed = value.trim().toLowerCase();
|
|
20
|
+
if (!trimmed) {
|
|
21
|
+
throw new Error('User ID cannot be empty');
|
|
22
|
+
}
|
|
23
|
+
if (!UserId.UUID_REGEX.test(trimmed)) {
|
|
24
|
+
throw new Error('User ID must be a valid UUID format');
|
|
25
|
+
}
|
|
26
|
+
return new UserId(trimmed);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Generate a new random UserId
|
|
30
|
+
*/
|
|
31
|
+
static generate() {
|
|
32
|
+
// Use crypto.randomUUID() for UUID v4 generation
|
|
33
|
+
const uuid = crypto.randomUUID();
|
|
34
|
+
return new UserId(uuid.toLowerCase());
|
|
35
|
+
}
|
|
36
|
+
equals(other) {
|
|
37
|
+
return this._value === other._value;
|
|
38
|
+
}
|
|
39
|
+
toString() {
|
|
40
|
+
return this._value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=UserId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserId.js","sourceRoot":"","sources":["../../../src/domain/value-objects/UserId.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,MAAM;IAIoB;IAH7B,MAAM,CAAU,UAAU,GAChC,4EAA4E,CAAC;IAE/E,YAAqC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,KAAa;QACzB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAE3C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ;QACb,iDAAiD;QACjD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACjC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC;IACtC,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Username Value Object
|
|
3
|
+
* Represents a validated username (3-50 characters, alphanumeric + underscore)
|
|
4
|
+
*/
|
|
5
|
+
export declare class Username {
|
|
6
|
+
private readonly _value;
|
|
7
|
+
private static readonly MIN_LENGTH;
|
|
8
|
+
private static readonly MAX_LENGTH;
|
|
9
|
+
private static readonly PATTERN;
|
|
10
|
+
private constructor();
|
|
11
|
+
get value(): string;
|
|
12
|
+
static create(value: string): Username;
|
|
13
|
+
equals(other: Username): boolean;
|
|
14
|
+
toString(): string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Username.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Username.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/Username.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,QAAQ;IAMC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAL3C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAK;IACvC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAM;IAExC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAEpD,OAAO;IAIP,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ;IAiCtC,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAKhC,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Username Value Object
|
|
3
|
+
* Represents a validated username (3-50 characters, alphanumeric + underscore)
|
|
4
|
+
*/
|
|
5
|
+
export class Username {
|
|
6
|
+
_value;
|
|
7
|
+
static MIN_LENGTH = 3;
|
|
8
|
+
static MAX_LENGTH = 50;
|
|
9
|
+
// Alphanumeric characters and underscores only
|
|
10
|
+
static PATTERN = /^[a-zA-Z0-9_]+$/;
|
|
11
|
+
constructor(_value) {
|
|
12
|
+
this._value = _value;
|
|
13
|
+
Object.freeze(this);
|
|
14
|
+
}
|
|
15
|
+
get value() {
|
|
16
|
+
return this._value;
|
|
17
|
+
}
|
|
18
|
+
static create(value) {
|
|
19
|
+
const trimmed = value.trim();
|
|
20
|
+
if (!trimmed) {
|
|
21
|
+
throw new Error('Username cannot be empty');
|
|
22
|
+
}
|
|
23
|
+
if (trimmed.length < Username.MIN_LENGTH) {
|
|
24
|
+
throw new Error(`Username must be at least ${Username.MIN_LENGTH} characters`);
|
|
25
|
+
}
|
|
26
|
+
if (trimmed.length > Username.MAX_LENGTH) {
|
|
27
|
+
throw new Error(`Username cannot exceed ${Username.MAX_LENGTH} characters`);
|
|
28
|
+
}
|
|
29
|
+
if (!Username.PATTERN.test(trimmed)) {
|
|
30
|
+
throw new Error('Username must contain only alphanumeric characters and underscores');
|
|
31
|
+
}
|
|
32
|
+
// Username must start with a letter
|
|
33
|
+
if (!/^[a-zA-Z]/.test(trimmed)) {
|
|
34
|
+
throw new Error('Username must start with a letter');
|
|
35
|
+
}
|
|
36
|
+
return new Username(trimmed);
|
|
37
|
+
}
|
|
38
|
+
equals(other) {
|
|
39
|
+
// Case-insensitive comparison for usernames
|
|
40
|
+
return this._value.toLowerCase() === other._value.toLowerCase();
|
|
41
|
+
}
|
|
42
|
+
toString() {
|
|
43
|
+
return this._value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Username.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Username.js","sourceRoot":"","sources":["../../../src/domain/value-objects/Username.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAMkB;IAL7B,MAAM,CAAU,UAAU,GAAG,CAAC,CAAC;IAC/B,MAAM,CAAU,UAAU,GAAG,EAAE,CAAC;IACxC,+CAA+C;IACvC,MAAM,CAAU,OAAO,GAAG,iBAAiB,CAAC;IAEpD,YAAqC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QACjD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,KAAa;QACzB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAE7B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,CAAC,UAAU,aAAa,CAC9D,CAAC;QACJ,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,CAAC,UAAU,aAAa,CAC3D,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAC;QACJ,CAAC;QAED,oCAAoC;QACpC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,KAAe;QACpB,4CAA4C;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;IAClE,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC"}
|
|
@@ -3,4 +3,9 @@ export { ServerType, ServerTypeEnum, type ServerTypeInfo } from './ServerType.js
|
|
|
3
3
|
export { McVersion } from './McVersion.js';
|
|
4
4
|
export { Memory } from './Memory.js';
|
|
5
5
|
export { WorldOptions, WorldSetupType, type WorldOptionsData } from './WorldOptions.js';
|
|
6
|
+
export { UserId } from './UserId.js';
|
|
7
|
+
export { Username } from './Username.js';
|
|
8
|
+
export { Role, RoleEnum } from './Role.js';
|
|
9
|
+
export { ServiceStatus, ServiceStatusEnum } from './ServiceStatus.js';
|
|
10
|
+
export { ProcessInfo, type ProcessInfoData, type ProcessMetrics } from './ProcessInfo.js';
|
|
6
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/domain/value-objects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGxF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -3,4 +3,11 @@ export { ServerType, ServerTypeEnum } from './ServerType.js';
|
|
|
3
3
|
export { McVersion } from './McVersion.js';
|
|
4
4
|
export { Memory } from './Memory.js';
|
|
5
5
|
export { WorldOptions, WorldSetupType } from './WorldOptions.js';
|
|
6
|
+
// User-related value objects
|
|
7
|
+
export { UserId } from './UserId.js';
|
|
8
|
+
export { Username } from './Username.js';
|
|
9
|
+
export { Role, RoleEnum } from './Role.js';
|
|
10
|
+
// Service management value objects
|
|
11
|
+
export { ServiceStatus, ServiceStatusEnum } from './ServiceStatus.js';
|
|
12
|
+
export { ProcessInfo } from './ProcessInfo.js';
|
|
6
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/value-objects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAyB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/value-objects/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAyB,MAAM,mBAAmB,CAAC;AAExF,6BAA6B;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,mCAAmC;AACnC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,WAAW,EAA6C,MAAM,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { type ContainerStatus, type HealthStatus, type ServerInfo, type RouterInfo, type AvahiInfo, type PlatformStatus, type McctlConfig, type ServerType as LegacyServerType, type ServerConfig as LegacyServerConfig, type EnvConfig, type LockStatus, type WorldLock as LegacyWorldLock, type BackupInfo, type BackupStatus, type PlayerInfo, type CommandResult, type ContainerStats, type PlayerListResult, type DetailedServerInfo, type RouterDetailInfo, type RouteInfo, } from './types/index.js';
|
|
2
2
|
export { Paths, Config, colors, log, getPackageRoot } from './utils/index.js';
|
|
3
3
|
export { checkDocker, checkDockerCompose, getContainerStatus, getContainerHealth, containerExists, getContainerHostname, getMcContainers, getRunningMcContainers, getServerInfo, getRouterInfo, getAvahiStatus, getPlatformStatus, startContainer, stopContainer, getContainerLogs, execScript, execScriptInteractive, getContainerStats, getContainerUptime, getOnlinePlayers, getDetailedServerInfo, getDetailedServerInfoWithPlayers, getRouterDetailInfo, formatBytes, } from './docker/index.js';
|
|
4
|
-
export { ServerName, ServerType, ServerTypeEnum, type ServerTypeInfo, McVersion, Memory, WorldOptions, WorldSetupType, type WorldOptionsData, Server, ServerStatus, type ServerConfig, World, WorldLockStatus, type WorldLock, } from './domain/index.js';
|
|
4
|
+
export { ServerName, ServerType, ServerTypeEnum, type ServerTypeInfo, McVersion, Memory, WorldOptions, WorldSetupType, type WorldOptionsData, UserId, Username, Role, RoleEnum, ServiceStatus, ServiceStatusEnum, ProcessInfo, type ProcessInfoData, type ProcessMetrics, Server, ServerStatus, type ServerConfig, World, WorldLockStatus, type WorldLock, User, type UserData, } from './domain/index.js';
|
|
5
|
+
export type { ModSideSupport, ModProjectType, ModVersionType, ModDependencyType, ModSearchIndex, ModSearchOptions, ModVersionOptions, ModProject, ModVersion, ModFile, ModFileHashes, ModDependency, ModSearchResult, } from './domain/mod/index.js';
|
|
6
|
+
export { ModSourceFactory } from './infrastructure/factories/index.js';
|
|
5
7
|
export * from './application/index.js';
|
|
6
8
|
export * from './infrastructure/index.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,IAAI,gBAAgB,EACnC,KAAK,YAAY,IAAI,kBAAkB,EACvC,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,IAAI,eAAe,EACjC,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,aAAa,EAElB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,SAAS,GACf,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG9E,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,qBAAqB,EAErB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gCAAgC,EAChC,mBAAmB,EACnB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAEL,UAAU,EACV,UAAU,EACV,cAAc,EACd,KAAK,cAAc,EACnB,SAAS,EACT,MAAM,EACN,YAAY,EACZ,cAAc,EACd,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf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Y,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAGvE,cAAc,wBAAwB,CAAC;AAGvC,cAAc,2BAA2B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,13 @@ getContainerStats, getContainerUptime, getOnlinePlayers, getDetailedServerInfo,
|
|
|
7
7
|
// Re-export domain layer (Value Objects and Entities)
|
|
8
8
|
export {
|
|
9
9
|
// Value Objects
|
|
10
|
-
ServerName, ServerType, ServerTypeEnum, McVersion, Memory, WorldOptions, WorldSetupType,
|
|
10
|
+
ServerName, ServerType, ServerTypeEnum, McVersion, Memory, WorldOptions, WorldSetupType, UserId, Username, Role, RoleEnum,
|
|
11
|
+
// Service management value objects
|
|
12
|
+
ServiceStatus, ServiceStatusEnum, ProcessInfo,
|
|
11
13
|
// Entities
|
|
12
|
-
Server, ServerStatus, World, WorldLockStatus, } from './domain/index.js';
|
|
14
|
+
Server, ServerStatus, World, WorldLockStatus, User, } from './domain/index.js';
|
|
15
|
+
// Re-export ModSourceFactory
|
|
16
|
+
export { ModSourceFactory } from './infrastructure/factories/index.js';
|
|
13
17
|
// Re-export application layer (ports and use-cases)
|
|
14
18
|
export * from './application/index.js';
|
|
15
19
|
// Re-export infrastructure layer (adapters)
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0BA,sBAAsB;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9E,6BAA6B;AAC7B,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,qBAAqB;AACrB,yBAAyB;AACzB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gCAAgC,EAChC,mBAAmB,EACnB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,sDAAsD;AACtD,OAAO;AACL,gBAAgB;AAChB,UAAU,EACV,UAAU,EACV,cAAc,EAEd,SAAS,EACT,MAAM,EACN,YAAY,EACZ,cAAc;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA0BA,sBAAsB;AACtB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9E,6BAA6B;AAC7B,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,qBAAqB;AACrB,yBAAyB;AACzB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,gCAAgC,EAChC,mBAAmB,EACnB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,sDAAsD;AACtD,OAAO;AACL,gBAAgB;AAChB,UAAU,EACV,UAAU,EACV,cAAc,EAEd,SAAS,EACT,MAAM,EACN,YAAY,EACZ,cAAc,EAEd,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,QAAQ;AACR,mCAAmC;AACnC,aAAa,EACb,iBAAiB,EACjB,WAAW;AAGX,WAAW;AACX,MAAM,EACN,YAAY,EAEZ,KAAK,EACL,eAAe,EAEf,IAAI,GAEL,MAAM,mBAAmB,CAAC;AAmB3B,6BAA6B;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAEvE,oDAAoD;AACpD,cAAc,wBAAwB,CAAC;AAEvC,4CAA4C;AAC5C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ServerName, ServerType, McVersion, Memory, WorldOptions, Server, World } from '../../domain/index.js';
|
|
2
|
+
import type { IPromptPort, TextPromptOptions, SelectPromptOptions, ConfirmPromptOptions, PasswordPromptOptions, Spinner } from '../../application/ports/outbound/IPromptPort.js';
|
|
3
|
+
import type { WorldWithServerStatus } from '../../application/ports/outbound/IWorldRepository.js';
|
|
4
|
+
/**
|
|
5
|
+
* World setup types for API options
|
|
6
|
+
*/
|
|
7
|
+
export type WorldSetupType = 'new' | 'existing' | 'download';
|
|
8
|
+
/**
|
|
9
|
+
* Options for ApiPromptAdapter
|
|
10
|
+
* Pre-configured values that would normally be collected via interactive prompts
|
|
11
|
+
*/
|
|
12
|
+
export interface ApiPromptOptions {
|
|
13
|
+
/** Server name (e.g., "myserver") */
|
|
14
|
+
serverName?: string;
|
|
15
|
+
/** Server type (e.g., "PAPER", "FORGE") */
|
|
16
|
+
serverType?: string;
|
|
17
|
+
/** Minecraft version (e.g., "1.21.1", "LATEST") */
|
|
18
|
+
mcVersion?: string;
|
|
19
|
+
/** Memory allocation (e.g., "4G", "2048M") */
|
|
20
|
+
memory?: string;
|
|
21
|
+
/** World setup type */
|
|
22
|
+
worldSetup?: WorldSetupType;
|
|
23
|
+
/** World name for existing world */
|
|
24
|
+
worldName?: string;
|
|
25
|
+
/** World seed for new world */
|
|
26
|
+
worldSeed?: string;
|
|
27
|
+
/** World download URL */
|
|
28
|
+
worldDownloadUrl?: string;
|
|
29
|
+
/** Password value for password prompts */
|
|
30
|
+
password?: string;
|
|
31
|
+
/** Default value for confirm prompts (defaults to true) */
|
|
32
|
+
confirmValue?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Message types for collected output
|
|
36
|
+
*/
|
|
37
|
+
export type MessageType = 'intro' | 'outro' | 'success' | 'error' | 'warn' | 'info' | 'note';
|
|
38
|
+
/**
|
|
39
|
+
* Collected message
|
|
40
|
+
*/
|
|
41
|
+
export interface CollectedMessage {
|
|
42
|
+
type: MessageType;
|
|
43
|
+
message: string;
|
|
44
|
+
title?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Error thrown when API mode operation is not supported
|
|
48
|
+
*/
|
|
49
|
+
export declare class ApiModeError extends Error {
|
|
50
|
+
constructor(message: string);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* ApiPromptAdapter
|
|
54
|
+
* Implements IPromptPort for API/non-interactive contexts.
|
|
55
|
+
* Returns pre-configured values instead of interactive prompts.
|
|
56
|
+
*
|
|
57
|
+
* Usage:
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const adapter = new ApiPromptAdapter({
|
|
60
|
+
* serverName: 'myserver',
|
|
61
|
+
* serverType: 'PAPER',
|
|
62
|
+
* mcVersion: '1.21.1',
|
|
63
|
+
* memory: '4G',
|
|
64
|
+
* worldSetup: 'new',
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Use with UseCase
|
|
68
|
+
* const useCase = new CreateServerUseCase(adapter, shell, serverRepo);
|
|
69
|
+
* await useCase.execute({ mode: 'cli' }); // Uses pre-configured values
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare class ApiPromptAdapter implements IPromptPort {
|
|
73
|
+
private readonly options;
|
|
74
|
+
private readonly messages;
|
|
75
|
+
constructor(options: ApiPromptOptions);
|
|
76
|
+
intro(message: string): void;
|
|
77
|
+
outro(message: string): void;
|
|
78
|
+
text(options: TextPromptOptions): Promise<string>;
|
|
79
|
+
select<T>(options: SelectPromptOptions<T>): Promise<T>;
|
|
80
|
+
confirm(_options: ConfirmPromptOptions): Promise<boolean>;
|
|
81
|
+
password(_options: PasswordPromptOptions): Promise<string>;
|
|
82
|
+
promptServerName(): Promise<ServerName>;
|
|
83
|
+
promptServerType(): Promise<ServerType>;
|
|
84
|
+
promptMcVersion(_serverType: ServerType): Promise<McVersion>;
|
|
85
|
+
promptMemory(): Promise<Memory>;
|
|
86
|
+
promptWorldOptions(): Promise<WorldOptions>;
|
|
87
|
+
promptServerSelection(servers: Server[]): Promise<Server>;
|
|
88
|
+
promptWorldSelection(worlds: World[]): Promise<World>;
|
|
89
|
+
promptExistingWorldSelection(worlds: WorldWithServerStatus[]): Promise<World | null>;
|
|
90
|
+
spinner(): Spinner;
|
|
91
|
+
success(message: string): void;
|
|
92
|
+
error(message: string): void;
|
|
93
|
+
warn(message: string): void;
|
|
94
|
+
info(message: string): void;
|
|
95
|
+
note(message: string, title?: string): void;
|
|
96
|
+
isCancel(_value: unknown): boolean;
|
|
97
|
+
handleCancel(): never;
|
|
98
|
+
/**
|
|
99
|
+
* Get all collected messages
|
|
100
|
+
*/
|
|
101
|
+
getMessages(): CollectedMessage[];
|
|
102
|
+
/**
|
|
103
|
+
* Clear collected messages
|
|
104
|
+
*/
|
|
105
|
+
clearMessages(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Resolve text prompt value from options based on message context
|
|
108
|
+
*/
|
|
109
|
+
private resolveTextValue;
|
|
110
|
+
/**
|
|
111
|
+
* Resolve select prompt value from options based on message context
|
|
112
|
+
*/
|
|
113
|
+
private resolveSelectValue;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=ApiPromptAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiPromptAdapter.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/adapters/ApiPromptAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EAC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I,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ3C,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IAKlC,YAAY,IAAI,KAAK;IAQrB;;OAEG;IACH,WAAW,IAAI,gBAAgB,EAAE;IAIjC;;OAEG;IACH,aAAa,IAAI,IAAI;IAQrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA4BxB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAkB3B"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { ServerName, ServerType, McVersion, Memory, WorldOptions, } from '../../domain/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Error thrown when API mode operation is not supported
|
|
4
|
+
*/
|
|
5
|
+
export class ApiModeError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'ApiModeError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* ApiPromptAdapter
|
|
13
|
+
* Implements IPromptPort for API/non-interactive contexts.
|
|
14
|
+
* Returns pre-configured values instead of interactive prompts.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const adapter = new ApiPromptAdapter({
|
|
19
|
+
* serverName: 'myserver',
|
|
20
|
+
* serverType: 'PAPER',
|
|
21
|
+
* mcVersion: '1.21.1',
|
|
22
|
+
* memory: '4G',
|
|
23
|
+
* worldSetup: 'new',
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Use with UseCase
|
|
27
|
+
* const useCase = new CreateServerUseCase(adapter, shell, serverRepo);
|
|
28
|
+
* await useCase.execute({ mode: 'cli' }); // Uses pre-configured values
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export class ApiPromptAdapter {
|
|
32
|
+
options;
|
|
33
|
+
messages = [];
|
|
34
|
+
constructor(options) {
|
|
35
|
+
this.options = options;
|
|
36
|
+
}
|
|
37
|
+
// ========================================
|
|
38
|
+
// Basic Prompts
|
|
39
|
+
// ========================================
|
|
40
|
+
intro(message) {
|
|
41
|
+
this.messages.push({ type: 'intro', message });
|
|
42
|
+
}
|
|
43
|
+
outro(message) {
|
|
44
|
+
this.messages.push({ type: 'outro', message });
|
|
45
|
+
}
|
|
46
|
+
async text(options) {
|
|
47
|
+
// Try to match the prompt message to a known option
|
|
48
|
+
const value = this.resolveTextValue(options.message);
|
|
49
|
+
if (value !== undefined) {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
throw new ApiModeError(`Value for prompt "${options.message}" is required in API mode. ` +
|
|
53
|
+
'Please provide the appropriate option when creating ApiPromptAdapter.');
|
|
54
|
+
}
|
|
55
|
+
async select(options) {
|
|
56
|
+
// Try to match based on message context
|
|
57
|
+
const value = this.resolveSelectValue(options.message);
|
|
58
|
+
if (value !== undefined) {
|
|
59
|
+
// Verify the value is in the options list
|
|
60
|
+
const found = options.options.find((opt) => {
|
|
61
|
+
if (typeof opt.value === 'string') {
|
|
62
|
+
return opt.value.toLowerCase() === String(value).toLowerCase();
|
|
63
|
+
}
|
|
64
|
+
return opt.value === value;
|
|
65
|
+
});
|
|
66
|
+
if (found) {
|
|
67
|
+
return found.value;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Return first option as fallback if available
|
|
71
|
+
if (options.options.length > 0 && options.initialValue !== undefined) {
|
|
72
|
+
return options.initialValue;
|
|
73
|
+
}
|
|
74
|
+
throw new ApiModeError(`Selection for prompt "${options.message}" is required in API mode.`);
|
|
75
|
+
}
|
|
76
|
+
async confirm(_options) {
|
|
77
|
+
// Default to true in API mode unless explicitly configured
|
|
78
|
+
return this.options.confirmValue ?? true;
|
|
79
|
+
}
|
|
80
|
+
async password(_options) {
|
|
81
|
+
if (this.options.password !== undefined) {
|
|
82
|
+
return this.options.password;
|
|
83
|
+
}
|
|
84
|
+
throw new ApiModeError('Password is required in API mode.');
|
|
85
|
+
}
|
|
86
|
+
// ========================================
|
|
87
|
+
// Domain-Specific Prompts
|
|
88
|
+
// ========================================
|
|
89
|
+
async promptServerName() {
|
|
90
|
+
if (!this.options.serverName) {
|
|
91
|
+
throw new ApiModeError('serverName is required in API mode');
|
|
92
|
+
}
|
|
93
|
+
return ServerName.create(this.options.serverName);
|
|
94
|
+
}
|
|
95
|
+
async promptServerType() {
|
|
96
|
+
if (!this.options.serverType) {
|
|
97
|
+
throw new ApiModeError('serverType is required in API mode');
|
|
98
|
+
}
|
|
99
|
+
return ServerType.create(this.options.serverType);
|
|
100
|
+
}
|
|
101
|
+
async promptMcVersion(_serverType) {
|
|
102
|
+
if (!this.options.mcVersion) {
|
|
103
|
+
throw new ApiModeError('mcVersion is required in API mode');
|
|
104
|
+
}
|
|
105
|
+
return McVersion.create(this.options.mcVersion);
|
|
106
|
+
}
|
|
107
|
+
async promptMemory() {
|
|
108
|
+
if (!this.options.memory) {
|
|
109
|
+
throw new ApiModeError('memory is required in API mode');
|
|
110
|
+
}
|
|
111
|
+
return Memory.create(this.options.memory);
|
|
112
|
+
}
|
|
113
|
+
async promptWorldOptions() {
|
|
114
|
+
if (!this.options.worldSetup) {
|
|
115
|
+
throw new ApiModeError('worldSetup is required in API mode');
|
|
116
|
+
}
|
|
117
|
+
switch (this.options.worldSetup) {
|
|
118
|
+
case 'new':
|
|
119
|
+
return WorldOptions.newWorld(this.options.worldSeed);
|
|
120
|
+
case 'existing':
|
|
121
|
+
if (!this.options.worldName) {
|
|
122
|
+
throw new ApiModeError('worldName is required when worldSetup is "existing"');
|
|
123
|
+
}
|
|
124
|
+
return WorldOptions.existingWorld(this.options.worldName);
|
|
125
|
+
case 'download':
|
|
126
|
+
if (!this.options.worldDownloadUrl) {
|
|
127
|
+
throw new ApiModeError('worldDownloadUrl is required when worldSetup is "download"');
|
|
128
|
+
}
|
|
129
|
+
return WorldOptions.downloadWorld(this.options.worldDownloadUrl);
|
|
130
|
+
default:
|
|
131
|
+
throw new ApiModeError(`Invalid worldSetup: ${this.options.worldSetup}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async promptServerSelection(servers) {
|
|
135
|
+
if (!this.options.serverName) {
|
|
136
|
+
throw new ApiModeError('serverName is required in API mode for server selection');
|
|
137
|
+
}
|
|
138
|
+
const server = servers.find((s) => s.name.value.toLowerCase() === this.options.serverName.toLowerCase());
|
|
139
|
+
if (!server) {
|
|
140
|
+
throw new ApiModeError(`Server '${this.options.serverName}' not found`);
|
|
141
|
+
}
|
|
142
|
+
return server;
|
|
143
|
+
}
|
|
144
|
+
async promptWorldSelection(worlds) {
|
|
145
|
+
if (!this.options.worldName) {
|
|
146
|
+
throw new ApiModeError('worldName is required in API mode for world selection');
|
|
147
|
+
}
|
|
148
|
+
const world = worlds.find((w) => w.name.toLowerCase() === this.options.worldName.toLowerCase());
|
|
149
|
+
if (!world) {
|
|
150
|
+
throw new ApiModeError(`World '${this.options.worldName}' not found`);
|
|
151
|
+
}
|
|
152
|
+
return world;
|
|
153
|
+
}
|
|
154
|
+
async promptExistingWorldSelection(worlds) {
|
|
155
|
+
// If no worldName is configured, return null (no selection)
|
|
156
|
+
if (!this.options.worldName) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
const worldEntry = worlds.find((w) => w.world.name.toLowerCase() === this.options.worldName.toLowerCase());
|
|
160
|
+
if (!worldEntry) {
|
|
161
|
+
throw new ApiModeError(`World '${this.options.worldName}' not found`);
|
|
162
|
+
}
|
|
163
|
+
// In API mode, we don't warn about stopped servers - caller should check
|
|
164
|
+
return worldEntry.world;
|
|
165
|
+
}
|
|
166
|
+
// ========================================
|
|
167
|
+
// Status Display
|
|
168
|
+
// ========================================
|
|
169
|
+
spinner() {
|
|
170
|
+
// Return a no-op spinner for API mode
|
|
171
|
+
return {
|
|
172
|
+
start: (_message) => { },
|
|
173
|
+
stop: (_message) => { },
|
|
174
|
+
message: (_message) => { },
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
success(message) {
|
|
178
|
+
this.messages.push({ type: 'success', message });
|
|
179
|
+
}
|
|
180
|
+
error(message) {
|
|
181
|
+
this.messages.push({ type: 'error', message });
|
|
182
|
+
}
|
|
183
|
+
warn(message) {
|
|
184
|
+
this.messages.push({ type: 'warn', message });
|
|
185
|
+
}
|
|
186
|
+
info(message) {
|
|
187
|
+
this.messages.push({ type: 'info', message });
|
|
188
|
+
}
|
|
189
|
+
note(message, title) {
|
|
190
|
+
this.messages.push({ type: 'note', message, title });
|
|
191
|
+
}
|
|
192
|
+
// ========================================
|
|
193
|
+
// Utility
|
|
194
|
+
// ========================================
|
|
195
|
+
isCancel(_value) {
|
|
196
|
+
// In API mode, there's no user interaction to cancel
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
handleCancel() {
|
|
200
|
+
throw new ApiModeError('Cancel not supported in API mode');
|
|
201
|
+
}
|
|
202
|
+
// ========================================
|
|
203
|
+
// API-specific methods
|
|
204
|
+
// ========================================
|
|
205
|
+
/**
|
|
206
|
+
* Get all collected messages
|
|
207
|
+
*/
|
|
208
|
+
getMessages() {
|
|
209
|
+
return [...this.messages];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Clear collected messages
|
|
213
|
+
*/
|
|
214
|
+
clearMessages() {
|
|
215
|
+
this.messages.length = 0;
|
|
216
|
+
}
|
|
217
|
+
// ========================================
|
|
218
|
+
// Private Helpers
|
|
219
|
+
// ========================================
|
|
220
|
+
/**
|
|
221
|
+
* Resolve text prompt value from options based on message context
|
|
222
|
+
*/
|
|
223
|
+
resolveTextValue(message) {
|
|
224
|
+
const lowerMessage = message.toLowerCase();
|
|
225
|
+
if (lowerMessage.includes('server name')) {
|
|
226
|
+
return this.options.serverName;
|
|
227
|
+
}
|
|
228
|
+
if (lowerMessage.includes('version')) {
|
|
229
|
+
return this.options.mcVersion;
|
|
230
|
+
}
|
|
231
|
+
if (lowerMessage.includes('memory')) {
|
|
232
|
+
return this.options.memory;
|
|
233
|
+
}
|
|
234
|
+
if (lowerMessage.includes('world') && lowerMessage.includes('name')) {
|
|
235
|
+
return this.options.worldName;
|
|
236
|
+
}
|
|
237
|
+
if (lowerMessage.includes('seed')) {
|
|
238
|
+
return this.options.worldSeed;
|
|
239
|
+
}
|
|
240
|
+
if (lowerMessage.includes('url')) {
|
|
241
|
+
return this.options.worldDownloadUrl;
|
|
242
|
+
}
|
|
243
|
+
if (lowerMessage.includes('password')) {
|
|
244
|
+
return this.options.password;
|
|
245
|
+
}
|
|
246
|
+
return undefined;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Resolve select prompt value from options based on message context
|
|
250
|
+
*/
|
|
251
|
+
resolveSelectValue(message) {
|
|
252
|
+
const lowerMessage = message.toLowerCase();
|
|
253
|
+
if (lowerMessage.includes('server type') || lowerMessage.includes('type')) {
|
|
254
|
+
return this.options.serverType;
|
|
255
|
+
}
|
|
256
|
+
if (lowerMessage.includes('version')) {
|
|
257
|
+
return this.options.mcVersion;
|
|
258
|
+
}
|
|
259
|
+
if (lowerMessage.includes('memory')) {
|
|
260
|
+
return this.options.memory;
|
|
261
|
+
}
|
|
262
|
+
if (lowerMessage.includes('world') && lowerMessage.includes('setup')) {
|
|
263
|
+
return this.options.worldSetup;
|
|
264
|
+
}
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=ApiPromptAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiPromptAdapter.js","sourceRoot":"","sources":["../../../src/infrastructure/adapters/ApiPromptAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAyD/B;;GAEG;AACH,MA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AAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACrE,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACjC,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -2,7 +2,7 @@ import { readdir, readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { Paths } from '../../utils/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { execCommandAsync } from '../../docker/index.js';
|
|
6
6
|
import { Server, ServerStatus, ServerName, ServerType, McVersion, Memory, WorldOptions, } from '../../domain/index.js';
|
|
7
7
|
/**
|
|
8
8
|
* ServerRepository
|
|
@@ -87,12 +87,12 @@ export class ServerRepository {
|
|
|
87
87
|
async getStatus(name) {
|
|
88
88
|
try {
|
|
89
89
|
const containerName = `mc-${name}`;
|
|
90
|
-
const result = await
|
|
90
|
+
const result = await execCommandAsync('docker', [
|
|
91
91
|
'inspect',
|
|
92
92
|
'-f',
|
|
93
93
|
'{{.State.Status}}',
|
|
94
94
|
containerName,
|
|
95
|
-
]
|
|
95
|
+
]);
|
|
96
96
|
if (result.code !== 0) {
|
|
97
97
|
return ServerStatus.STOPPED;
|
|
98
98
|
}
|