@uofx/cli 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -3
- package/THIRD-PARTY-NOTICES.txt +84 -2
- package/dist/application/dtos/config/index.js +22 -0
- package/dist/application/dtos/config/request/index.js +19 -0
- package/dist/application/dtos/config/request/set-config.request.dto.js +3 -0
- package/dist/application/dtos/config/response/get-config.response.dto.js +8 -0
- package/dist/application/dtos/config/response/index.js +21 -0
- package/dist/application/dtos/dev/index.js +24 -0
- package/dist/application/dtos/dev/request/generate-component.request.dto.js +3 -0
- package/dist/application/dtos/dev/request/index.js +25 -0
- package/dist/application/dtos/dev/request/install-template.request.dto.js +3 -0
- package/dist/application/dtos/dev/request/new-project.request.dto.js +3 -0
- package/dist/application/dtos/dev/request/publish-plugin.request.dto.js +3 -0
- package/dist/application/dtos/dev/request/uninstall-template.request.dto.js +3 -0
- package/dist/application/dtos/dev/response/generate-component.response.dto.js +3 -0
- package/dist/application/dtos/dev/response/index.js +24 -0
- package/dist/application/dtos/dev/response/new-project.response.dto.js +3 -0
- package/dist/application/dtos/dev/response/publish-plugin.response.dto.js +3 -0
- package/dist/application/dtos/dev/response/template-info.response.dto.js +3 -0
- package/dist/application/dtos/env/index.js +24 -0
- package/dist/application/dtos/{request → env/request}/index.js +1 -3
- package/dist/application/dtos/env/request/list-running-instances.request.dto.js +3 -0
- package/dist/application/dtos/{response → env/response}/index.js +1 -1
- package/dist/application/dtos/env/response/list-running-instances.response.dto.js +3 -0
- package/dist/application/dtos/index.js +9 -2
- package/dist/application/dtos/logs/index.js +22 -0
- package/dist/application/dtos/logs/request/index.js +18 -0
- package/dist/application/dtos/logs/response/index.js +18 -0
- package/dist/application/index.js +1 -0
- package/dist/application/services/env/environment-validator.service.js +120 -0
- package/dist/application/services/env/index.js +11 -0
- package/dist/application/services/env/instance-cleanup.service.js +79 -0
- package/dist/application/services/index.js +21 -0
- package/dist/application/use-cases/config/get-all-config.use-case.js +54 -0
- package/dist/application/use-cases/config/get-config.use-case.js +7 -17
- package/dist/application/use-cases/config/index.js +23 -0
- package/dist/application/use-cases/config/set-config.use-case.js +49 -3
- package/dist/application/use-cases/dev/generate-component.use-case.js +138 -0
- package/dist/application/use-cases/dev/index.js +28 -0
- package/dist/application/use-cases/dev/install-template.use-case.js +60 -0
- package/dist/application/use-cases/dev/list-templates.use-case.js +45 -0
- package/dist/application/use-cases/dev/new-project.use-case.js +130 -0
- package/dist/application/use-cases/dev/publish-plugin.use-case.js +243 -0
- package/dist/application/use-cases/dev/uninstall-template.use-case.js +50 -0
- package/dist/application/use-cases/{instance → env}/delete-instance.use-case.js +2 -2
- package/dist/application/use-cases/{credentials → env}/get-credentials.use-case.js +1 -1
- package/dist/application/use-cases/{instance → env}/index.js +11 -0
- package/dist/application/use-cases/{instance → env}/install-instance.use-case.js +25 -136
- package/dist/application/use-cases/env/list-running-instances.use-case.js +47 -0
- package/dist/application/use-cases/{setup → env}/setup-environment.use-case.js +35 -4
- package/dist/application/use-cases/{instance → env}/start-instance.use-case.js +53 -41
- package/dist/application/use-cases/index.js +9 -6
- package/dist/application/use-cases/logs/index.js +21 -0
- package/dist/cli.js +175 -26
- package/dist/constants/defaults.js +8 -1
- package/dist/constants/oci-artifacts.js +4 -0
- package/dist/constants/paths.js +0 -4
- package/dist/constants/timeouts.js +5 -0
- package/dist/di/modules/application.module.js +13 -44
- package/dist/di/modules/config.module.js +19 -0
- package/dist/di/modules/dev.module.js +45 -0
- package/dist/di/modules/env.module.js +42 -0
- package/dist/di/modules/index.js +30 -0
- package/dist/di/modules/infrastructure.module.js +65 -82
- package/dist/di/modules/logs.module.js +15 -0
- package/dist/di/modules/presentation.module.js +18 -7
- package/dist/di/tokens.js +42 -30
- package/dist/domain/entities/credentials-resolver.entity.js +4 -1
- package/dist/domain/entities/credentials.entity.js +2 -5
- package/dist/domain/entities/delete-instance-validation.entity.js +4 -1
- package/dist/domain/entities/deployment-parameters.entity.js +11 -8
- package/dist/domain/entities/index.js +5 -1
- package/dist/domain/entities/instance-list-aggregator.entity.js +2 -2
- package/dist/domain/entities/instance-metadata.entity.js +2 -3
- package/dist/domain/entities/instance.entity.js +2 -1
- package/dist/domain/entities/log-filter.entity.js +6 -6
- package/dist/domain/entities/template-info.entity.js +63 -0
- package/dist/{infrastructure/utils/error-formatter.util.js → domain/errors/error-utils.js} +1 -1
- package/dist/domain/errors/index.js +19 -0
- package/dist/domain/index.js +6 -0
- package/dist/domain/interfaces/index.js +21 -0
- package/dist/domain/ports/dotnet-publisher.port.js +9 -0
- package/dist/{infrastructure/http/interfaces/http-client.interface.js → domain/ports/file-system.port.js} +1 -1
- package/dist/domain/ports/http-client.port.js +3 -0
- package/dist/domain/ports/index.js +10 -0
- package/dist/domain/ports/logger.port.js +3 -3
- package/dist/domain/ports/progress.port.js +10 -0
- package/dist/domain/ports/project-scaffolder.port.js +9 -0
- package/dist/domain/ports/schematics-runner.port.js +9 -0
- package/dist/domain/ports/template-manager.port.js +9 -0
- package/dist/domain/ports/wsl-setup.port.js +3 -0
- package/dist/domain/types/index.js +1 -0
- package/dist/domain/value-objects/acr-credentials.value-object.js +13 -1
- package/dist/domain/value-objects/chart-version.value-object.js +20 -3
- package/dist/domain/value-objects/config-log-level.value-object.js +2 -1
- package/dist/domain/value-objects/index.js +3 -1
- package/dist/domain/value-objects/instance-name.value-object.js +6 -3
- package/dist/domain/value-objects/jwt-key.value-object.js +27 -5
- package/dist/domain/value-objects/mssql-password.value-object.js +27 -5
- package/dist/domain/value-objects/output-path.value-object.js +85 -0
- package/dist/domain/value-objects/rsa-key-pair.value-object.js +29 -3
- package/dist/index.js +6 -1
- package/dist/infrastructure/config/{app-config.service.js → app-config.adapter.js} +29 -17
- package/dist/infrastructure/config/{config-validator.js → config-validator.util.js} +1 -1
- package/dist/infrastructure/config/index.js +14 -0
- package/dist/infrastructure/config/interfaces/index.js +3 -0
- package/dist/infrastructure/config/{crypto.service.js → services/crypto.service.js} +4 -1
- package/dist/infrastructure/config/services/index.js +9 -0
- package/dist/infrastructure/deployment/deployment.adapter.js +5 -5
- package/dist/infrastructure/deployment/index.js +9 -0
- package/dist/infrastructure/deployment/interfaces/index.js +3 -0
- package/dist/infrastructure/deployment/services/acr-credential-manager.service.js +18 -7
- package/dist/infrastructure/deployment/services/app-manager.service.js +3 -3
- package/dist/infrastructure/deployment/services/base-helm-deployment.service.js +13 -5
- package/dist/infrastructure/deployment/services/helm-registry.service.js +10 -3
- package/dist/infrastructure/deployment/services/index.js +35 -0
- package/dist/infrastructure/deployment/services/infra-manager.service.js +19 -15
- package/dist/infrastructure/deployment/services/k8s-job-runner.service.js +24 -6
- package/dist/infrastructure/deployment/services/mssql-database-init.service.js +75 -11
- package/dist/infrastructure/deployment/services/mssql-helm-deployment.service.js +17 -5
- package/dist/infrastructure/deployment/services/mssql-storage.service.js +5 -1
- package/dist/infrastructure/deployment/services/mssql-user-manager.service.js +7 -3
- package/dist/infrastructure/deployment/services/oci-artifact.service.js +8 -3
- package/dist/infrastructure/deployment/services/secret-manager.service.js +14 -5
- package/dist/infrastructure/deployment/services/service-manager.service.js +1 -1
- package/dist/infrastructure/deployment/services/version-compatibility.service.js +9 -5
- package/dist/infrastructure/dotnet/dotnet-publisher.adapter.js +143 -0
- package/dist/infrastructure/dotnet/index.js +9 -0
- package/dist/infrastructure/environment/index.js +11 -0
- package/dist/infrastructure/environment/interfaces/index.js +3 -0
- package/dist/infrastructure/{platform-detector.js → environment/platform-detector.util.js} +1 -1
- package/dist/infrastructure/environment/services/hardware-info.service.js +8 -8
- package/dist/infrastructure/environment/services/index.js +11 -0
- package/dist/infrastructure/errors/{error-handler.js → error-handler.adapter.js} +17 -17
- package/dist/infrastructure/errors/index.js +5 -21
- package/dist/infrastructure/execution/builders/base-command.builder.js +32 -11
- package/dist/infrastructure/execution/builders/index.js +26 -0
- package/dist/infrastructure/execution/builders/wsl-command.builder.js +39 -1
- package/dist/infrastructure/execution/command-builder.util.js +94 -0
- package/dist/infrastructure/execution/environments/index.js +23 -0
- package/dist/infrastructure/execution/environments/wsl-execution.environment.js +22 -7
- package/dist/infrastructure/execution/index.js +1 -2
- package/dist/infrastructure/execution/services/command-executor.service.js +389 -0
- package/dist/infrastructure/execution/services/index.js +8 -0
- package/dist/infrastructure/execution/{script-executor.service.js → services/script-executor.service.js} +12 -15
- package/dist/infrastructure/filesystem/filesystem.adapter.js +86 -0
- package/dist/infrastructure/filesystem/index.js +23 -0
- package/dist/infrastructure/http/{http-client.service.js → http-client.adapter.js} +20 -13
- package/dist/infrastructure/http/index.js +1 -1
- package/dist/infrastructure/interceptors/decorators/index.js +23 -0
- package/dist/infrastructure/interceptors/index.js +2 -2
- package/dist/infrastructure/interceptors/interceptor.factory.js +3 -3
- package/dist/infrastructure/interceptors/interfaces/index.js +3 -0
- package/dist/infrastructure/interceptors/services/index.js +6 -0
- package/dist/infrastructure/interceptors/{logging.interceptor.js → services/logging-interceptor.service.js} +4 -4
- package/dist/infrastructure/logger/services/file-log-reader.repository.js +1 -1
- package/dist/infrastructure/logger/services/file-log-writer.repository.js +1 -1
- package/dist/infrastructure/persistence/instance-metadata.adapter.js +2 -1
- package/dist/infrastructure/persistence/services/file-system-config.repository.js +10 -4
- package/dist/infrastructure/persistence/services/file-system-instance.repository.js +2 -2
- package/dist/infrastructure/platforms/index.js +18 -0
- package/dist/infrastructure/platforms/windows/index.js +13 -0
- package/dist/infrastructure/platforms/windows/interfaces/index.js +3 -0
- package/dist/infrastructure/platforms/windows/parsers/index.js +9 -0
- package/dist/infrastructure/platforms/windows/services/index.js +33 -0
- package/dist/infrastructure/platforms/windows/services/microk8s.service.js +28 -10
- package/dist/infrastructure/platforms/windows/services/rootfs-manager.service.js +7 -3
- package/dist/infrastructure/platforms/windows/services/windows-features.service.js +22 -8
- package/dist/infrastructure/platforms/windows/services/windows-info.service.js +10 -6
- package/dist/infrastructure/platforms/windows/services/wsl-config.service.js +15 -6
- package/dist/infrastructure/platforms/windows/services/wsl-info.service.js +12 -12
- package/dist/infrastructure/platforms/windows/services/wsl-instance-inspection.service.js +3 -3
- package/dist/infrastructure/platforms/windows/services/wsl-instance-lifecycle.service.js +76 -22
- package/dist/infrastructure/platforms/windows/services/wsl-updater.service.js +20 -15
- package/dist/infrastructure/platforms/windows/services/wslconfig-parser.service.js +3 -3
- package/dist/infrastructure/platforms/windows/wsl-instance-manager.adapter.js +8 -3
- package/dist/infrastructure/platforms/windows/wsl-setup.adapter.js +100 -0
- package/dist/infrastructure/schematics/index.js +11 -0
- package/dist/infrastructure/schematics/project-scaffolder.adapter.js +314 -0
- package/dist/infrastructure/schematics/schematics-runner.adapter.js +175 -0
- package/dist/infrastructure/template/index.js +25 -0
- package/dist/infrastructure/template/interfaces/index.js +22 -0
- package/dist/infrastructure/template/interfaces/template-downloader.interface.js +6 -0
- package/dist/infrastructure/template/interfaces/template-registry.interface.js +6 -0
- package/dist/infrastructure/template/services/index.js +24 -0
- package/dist/infrastructure/template/services/template-downloader.service.js +319 -0
- package/dist/infrastructure/template/services/template-registry.service.js +175 -0
- package/dist/infrastructure/template/template-manager.adapter.js +196 -0
- package/dist/infrastructure/utils/index.js +23 -0
- package/dist/infrastructure/utils/input-validator.util.js +7 -6
- package/dist/presentation/controllers/base.controller.js +36 -0
- package/dist/presentation/controllers/{config.controller.js → config/config.controller.js} +17 -62
- package/dist/presentation/controllers/config/index.js +21 -0
- package/dist/presentation/controllers/dev/dev.controller.js +202 -0
- package/dist/presentation/controllers/dev/index.js +23 -0
- package/dist/presentation/controllers/dev/template.controller.js +158 -0
- package/dist/presentation/controllers/{credentials.controller.js → env/credentials.controller.js} +8 -14
- package/dist/presentation/controllers/env/index.js +23 -0
- package/dist/presentation/controllers/{instance.controller.js → env/instance.controller.js} +35 -92
- package/dist/presentation/controllers/{setup.controller.js → env/setup.controller.js} +33 -66
- package/dist/presentation/controllers/index.js +9 -5
- package/dist/presentation/controllers/logs/index.js +21 -0
- package/dist/presentation/controllers/{logs.controller.js → logs/logs.controller.js} +8 -14
- package/dist/presentation/interfaces/index.js +21 -0
- package/dist/presentation/prompts/acr-credentials.prompt.js +37 -9
- package/dist/presentation/ui/constants/index.js +23 -0
- package/dist/presentation/ui/interaction.service.js +4 -4
- package/dist/presentation/ui/interfaces/cli-progress.interface.js +0 -6
- package/dist/presentation/ui/interfaces/index.js +6 -0
- package/package.json +6 -1
- package/dist/application/dtos/request/set-config.request.dto.js +0 -16
- package/dist/infrastructure/errors/error-handler.interface.js +0 -3
- package/dist/infrastructure/execution/command-builder.js +0 -252
- package/dist/infrastructure/execution/command-executor.service.js +0 -230
- /package/dist/application/dtos/{request → config/request}/get-config.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/delete-instance.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/get-credentials.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/install-instance.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/list-charts.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/setup-environment.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/start-instance.request.dto.js +0 -0
- /package/dist/application/dtos/{request → env/request}/stop-instance.request.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/credentials.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/delete-instance.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/install-instance.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/instance-list.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/instance-status.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/setup-result.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/start-instance.response.dto.js +0 -0
- /package/dist/application/dtos/{response → env/response}/stop-instance.response.dto.js +0 -0
- /package/dist/application/dtos/{request → logs/request}/show-logs.request.dto.js +0 -0
- /package/dist/application/dtos/{response → logs/response}/show-logs.response.dto.js +0 -0
- /package/dist/application/use-cases/{instance → env}/list-charts.use-case.js +0 -0
- /package/dist/application/use-cases/{instance → env}/list-instances.use-case.js +0 -0
- /package/dist/application/use-cases/{instance → env}/stop-instance.use-case.js +0 -0
- /package/dist/{infrastructure → domain}/errors/app-error.js +0 -0
- /package/dist/{infrastructure → domain}/errors/exit-codes.js +0 -0
- /package/dist/infrastructure/config/{app-config.interface.js → interfaces/app-config.interface.js} +0 -0
- /package/dist/{domain → infrastructure/interceptors}/decorators/sensitive.decorator.js +0 -0
- /package/dist/infrastructure/interceptors/{interceptor.interface.js → interfaces/interceptor.interface.js} +0 -0
package/dist/presentation/controllers/{credentials.controller.js → env/credentials.controller.js}
RENAMED
|
@@ -14,18 +14,18 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CredentialsController = void 0;
|
|
16
16
|
const tsyringe_1 = require("tsyringe");
|
|
17
|
-
const tokens_1 = require("
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const tokens_1 = require("../../../di/tokens");
|
|
18
|
+
const use_cases_1 = require("../../../application/use-cases");
|
|
19
|
+
const base_controller_1 = require("../../controllers/base.controller");
|
|
20
20
|
/**
|
|
21
21
|
* Credentials Controller
|
|
22
22
|
*
|
|
23
23
|
* 處理憑證相關的 CLI 命令
|
|
24
24
|
*/
|
|
25
|
-
let CredentialsController = class CredentialsController {
|
|
25
|
+
let CredentialsController = class CredentialsController extends base_controller_1.BaseController {
|
|
26
26
|
constructor(getCredentialsUseCase, output) {
|
|
27
|
+
super(output);
|
|
27
28
|
this.getCredentialsUseCase = getCredentialsUseCase;
|
|
28
|
-
this.output = output;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* 取得實例憑證
|
|
@@ -33,7 +33,7 @@ let CredentialsController = class CredentialsController {
|
|
|
33
33
|
* @param reveal - 是否顯示完整憑證
|
|
34
34
|
*/
|
|
35
35
|
async get(name, reveal = false) {
|
|
36
|
-
|
|
36
|
+
await this.executeAction('Failed to retrieve credentials', async () => {
|
|
37
37
|
const credentials = await this.getCredentialsUseCase.execute({ name });
|
|
38
38
|
if (!credentials) {
|
|
39
39
|
this.output
|
|
@@ -69,13 +69,7 @@ let CredentialsController = class CredentialsController {
|
|
|
69
69
|
.item('bullet', 'Do not share passwords in plain text')
|
|
70
70
|
.newline()
|
|
71
71
|
.render();
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
this.output
|
|
75
|
-
.error(`Failed to retrieve credentials: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
76
|
-
.render();
|
|
77
|
-
throw error;
|
|
78
|
-
}
|
|
72
|
+
});
|
|
79
73
|
}
|
|
80
74
|
/**
|
|
81
75
|
* 遮罩密碼 - 僅顯示後 4 碼
|
|
@@ -100,6 +94,6 @@ exports.CredentialsController = CredentialsController = __decorate([
|
|
|
100
94
|
(0, tsyringe_1.injectable)(),
|
|
101
95
|
__param(0, (0, tsyringe_1.inject)(tokens_1.TOKENS.GetCredentialsUseCase)),
|
|
102
96
|
__param(1, (0, tsyringe_1.inject)(tokens_1.TOKENS.IOutputPort)),
|
|
103
|
-
__metadata("design:paramtypes", [
|
|
97
|
+
__metadata("design:paramtypes", [use_cases_1.GetCredentialsUseCase, Object])
|
|
104
98
|
], CredentialsController);
|
|
105
99
|
//# sourceMappingURL=credentials.controller.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Env 指令群組 Controllers
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./instance.controller"), exports);
|
|
21
|
+
__exportStar(require("./setup.controller"), exports);
|
|
22
|
+
__exportStar(require("./credentials.controller"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -14,28 +14,24 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.InstanceController = void 0;
|
|
16
16
|
const tsyringe_1 = require("tsyringe");
|
|
17
|
-
const tokens_1 = require("
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const delete_instance_use_case_1 = require("../../application/use-cases/instance/delete-instance.use-case");
|
|
22
|
-
const list_instances_use_case_1 = require("../../application/use-cases/instance/list-instances.use-case");
|
|
23
|
-
const list_charts_use_case_1 = require("../../application/use-cases/instance/list-charts.use-case");
|
|
24
|
-
const error_formatter_util_1 = require("../../infrastructure/utils/error-formatter.util");
|
|
17
|
+
const tokens_1 = require("../../../di/tokens");
|
|
18
|
+
const use_cases_1 = require("../../../application/use-cases");
|
|
19
|
+
const errors_1 = require("../../../domain/errors");
|
|
20
|
+
const base_controller_1 = require("../../controllers/base.controller");
|
|
25
21
|
/**
|
|
26
22
|
* Instance Controller
|
|
27
23
|
*
|
|
28
24
|
* 處理實例相關的 CLI 命令
|
|
29
25
|
*/
|
|
30
|
-
let InstanceController = class InstanceController {
|
|
26
|
+
let InstanceController = class InstanceController extends base_controller_1.BaseController {
|
|
31
27
|
constructor(installUseCase, startUseCase, stopUseCase, deleteUseCase, listUseCase, listChartsUseCase, output, interaction) {
|
|
28
|
+
super(output);
|
|
32
29
|
this.installUseCase = installUseCase;
|
|
33
30
|
this.startUseCase = startUseCase;
|
|
34
31
|
this.stopUseCase = stopUseCase;
|
|
35
32
|
this.deleteUseCase = deleteUseCase;
|
|
36
33
|
this.listUseCase = listUseCase;
|
|
37
34
|
this.listChartsUseCase = listChartsUseCase;
|
|
38
|
-
this.output = output;
|
|
39
35
|
this.interaction = interaction;
|
|
40
36
|
output.resetIndent();
|
|
41
37
|
}
|
|
@@ -43,12 +39,13 @@ let InstanceController = class InstanceController {
|
|
|
43
39
|
* 安裝新實例
|
|
44
40
|
*/
|
|
45
41
|
async install(options) {
|
|
46
|
-
|
|
42
|
+
await this.executeAction('Installation failed', async () => {
|
|
47
43
|
const request = {
|
|
48
44
|
name: options.name,
|
|
49
45
|
chartVersion: options.chartVersion,
|
|
50
46
|
pullSecretPath: options.pullSecret,
|
|
51
47
|
rootfsPath: options.rootfs,
|
|
48
|
+
skipNorthwind: !options.northwind,
|
|
52
49
|
};
|
|
53
50
|
this.output
|
|
54
51
|
.info(`Installing instance: ${request.name}`)
|
|
@@ -64,38 +61,19 @@ let InstanceController = class InstanceController {
|
|
|
64
61
|
.info('To view credentials, run:')
|
|
65
62
|
.item('bullet', `uofx env list credentials --name ${result.instanceName} --reveal`)
|
|
66
63
|
.render();
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
this.output
|
|
70
|
-
.error(`Installation failed: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
71
|
-
.render();
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
64
|
+
});
|
|
74
65
|
}
|
|
75
66
|
/**
|
|
76
67
|
* 啟動實例
|
|
77
68
|
*/
|
|
78
69
|
async start(name, options) {
|
|
79
|
-
|
|
80
|
-
// 檢查其他運行中的實例
|
|
81
|
-
const otherRunning = await this.startUseCase.listOtherRunningInstances(name);
|
|
82
|
-
if (otherRunning.length > 0) {
|
|
83
|
-
const otherName = otherRunning[0];
|
|
84
|
-
this.output
|
|
85
|
-
.newline()
|
|
86
|
-
.warning(`Another instance is already running: ${otherName}`)
|
|
87
|
-
.flush();
|
|
88
|
-
const shouldStop = await this.interaction.confirm(`Do you want to stop "${otherName}" and start "${name}"?`, false);
|
|
89
|
-
if (!shouldStop) {
|
|
90
|
-
this.output.info('Start cancelled').render();
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
this.output.info(`Stopping ${otherName}...`).flush();
|
|
94
|
-
await this.startUseCase.stopInstance(otherName, this.output);
|
|
95
|
-
this.output.success(`${otherName} stopped`).flush();
|
|
96
|
-
}
|
|
70
|
+
await this.executeAction('Start failed', async () => {
|
|
97
71
|
this.output.newline().flush();
|
|
98
|
-
const result = await this.startUseCase.execute({ name, waitForReady: true }, this.output);
|
|
72
|
+
const result = await this.startUseCase.execute({ name, waitForReady: true, resolveConflicts: true }, this.output);
|
|
73
|
+
// 使用者取消啟動
|
|
74
|
+
if (!result.success) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
99
77
|
this.output.newline();
|
|
100
78
|
if (result.alreadyRunning) {
|
|
101
79
|
this.output.success(`Instance '${result.instanceName}' is already running`);
|
|
@@ -112,13 +90,7 @@ let InstanceController = class InstanceController {
|
|
|
112
90
|
.item('bullet', `uofx env list credentials --name ${name} --reveal`);
|
|
113
91
|
}
|
|
114
92
|
this.output.render();
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
this.output
|
|
118
|
-
.error(`Start failed: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
119
|
-
.render();
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
93
|
+
});
|
|
122
94
|
}
|
|
123
95
|
/**
|
|
124
96
|
* 顯示連線資訊
|
|
@@ -153,7 +125,7 @@ let InstanceController = class InstanceController {
|
|
|
153
125
|
* 停止實例
|
|
154
126
|
*/
|
|
155
127
|
async stop(name, options) {
|
|
156
|
-
|
|
128
|
+
await this.executeAction('Stop failed', async () => {
|
|
157
129
|
const force = options?.force || false;
|
|
158
130
|
this.output
|
|
159
131
|
.info(`Stopping instance: ${name}`)
|
|
@@ -171,24 +143,22 @@ let InstanceController = class InstanceController {
|
|
|
171
143
|
this.output
|
|
172
144
|
.success(`Instance ${name} stopped`)
|
|
173
145
|
.render();
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
146
|
+
}, (error) => {
|
|
176
147
|
this.output
|
|
177
|
-
.error(`Stop failed: ${(0,
|
|
148
|
+
.error(`Stop failed: ${(0, errors_1.formatErrorMessage)(error)}`)
|
|
178
149
|
.newline()
|
|
179
150
|
.section('Troubleshooting')
|
|
180
151
|
.item('bullet', `Try force stop: uofx env stop --name ${name} --force`)
|
|
181
152
|
.item('bullet', 'Check WSL status: wsl --list --verbose')
|
|
182
153
|
.item('bullet', `Manually terminate: wsl --terminate uofx-${name}`)
|
|
183
154
|
.render();
|
|
184
|
-
|
|
185
|
-
}
|
|
155
|
+
});
|
|
186
156
|
}
|
|
187
157
|
/**
|
|
188
158
|
* 刪除實例
|
|
189
159
|
*/
|
|
190
160
|
async delete(name, force = false) {
|
|
191
|
-
|
|
161
|
+
await this.executeAction('Deletion failed', async () => {
|
|
192
162
|
// 取得實例詳細資訊
|
|
193
163
|
const details = await this.deleteUseCase.getInstanceDetails(name);
|
|
194
164
|
if (!details) {
|
|
@@ -245,23 +215,21 @@ let InstanceController = class InstanceController {
|
|
|
245
215
|
.info('Use "uofx env install --name <name>" to create a new instance.');
|
|
246
216
|
}
|
|
247
217
|
this.output.render();
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
218
|
+
}, (error) => {
|
|
250
219
|
this.output
|
|
251
|
-
.error(`Deletion failed: ${(0,
|
|
220
|
+
.error(`Deletion failed: ${(0, errors_1.formatErrorMessage)(error)}`)
|
|
252
221
|
.newline()
|
|
253
222
|
.section('If the instance is corrupted, try manual cleanup')
|
|
254
223
|
.item('bullet', `wsl --unregister uofx-${name}`)
|
|
255
224
|
.item('bullet', 'Delete the instance folder manually')
|
|
256
225
|
.render();
|
|
257
|
-
|
|
258
|
-
}
|
|
226
|
+
});
|
|
259
227
|
}
|
|
260
228
|
/**
|
|
261
229
|
* 列出所有實例
|
|
262
230
|
*/
|
|
263
231
|
async list() {
|
|
264
|
-
|
|
232
|
+
await this.executeAction('Failed to list instances', async () => {
|
|
265
233
|
const result = await this.listUseCase.execute();
|
|
266
234
|
if (result.instances.length === 0) {
|
|
267
235
|
this.output
|
|
@@ -286,19 +254,13 @@ let InstanceController = class InstanceController {
|
|
|
286
254
|
.newline()
|
|
287
255
|
.info(`Total: ${result.instances.length} instances`)
|
|
288
256
|
.render();
|
|
289
|
-
}
|
|
290
|
-
catch (error) {
|
|
291
|
-
this.output
|
|
292
|
-
.error(`Failed to list instances: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
293
|
-
.render();
|
|
294
|
-
throw error;
|
|
295
|
-
}
|
|
257
|
+
});
|
|
296
258
|
}
|
|
297
259
|
/**
|
|
298
260
|
* 列出可用的 Chart 版本
|
|
299
261
|
*/
|
|
300
262
|
async listCharts() {
|
|
301
|
-
|
|
263
|
+
await this.executeAction('Failed to query chart versions', async () => {
|
|
302
264
|
const versions = await this.listChartsUseCase.execute({ chartName: 'uofx' });
|
|
303
265
|
if (versions.length === 0) {
|
|
304
266
|
this.output
|
|
@@ -311,7 +273,7 @@ let InstanceController = class InstanceController {
|
|
|
311
273
|
.section('Available UOFX Chart Versions')
|
|
312
274
|
.table(['VERSION', 'TYPE', 'STATUS'], versions.map((v, i) => [
|
|
313
275
|
v.toString(),
|
|
314
|
-
|
|
276
|
+
v.getType(),
|
|
315
277
|
i === 0 ? 'Latest' : '',
|
|
316
278
|
]))
|
|
317
279
|
.newline()
|
|
@@ -320,26 +282,7 @@ let InstanceController = class InstanceController {
|
|
|
320
282
|
.info('Use the following command to install a specific version:')
|
|
321
283
|
.item('bullet', 'uofx env install --name <name> --chart-version <version>')
|
|
322
284
|
.render();
|
|
323
|
-
}
|
|
324
|
-
catch (error) {
|
|
325
|
-
this.output
|
|
326
|
-
.error(`Failed to query chart versions: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
327
|
-
.render();
|
|
328
|
-
throw error;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* 判斷版本類型 (Beta/Stable)
|
|
333
|
-
*/
|
|
334
|
-
getVersionType(version) {
|
|
335
|
-
const parts = version.split('.');
|
|
336
|
-
if (parts.length >= 3) {
|
|
337
|
-
const patch = parts[2];
|
|
338
|
-
if (patch.startsWith('2')) {
|
|
339
|
-
return 'Beta';
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return 'Stable';
|
|
285
|
+
});
|
|
343
286
|
}
|
|
344
287
|
};
|
|
345
288
|
exports.InstanceController = InstanceController;
|
|
@@ -353,11 +296,11 @@ exports.InstanceController = InstanceController = __decorate([
|
|
|
353
296
|
__param(5, (0, tsyringe_1.inject)(tokens_1.TOKENS.ListChartsUseCase)),
|
|
354
297
|
__param(6, (0, tsyringe_1.inject)(tokens_1.TOKENS.IOutputPort)),
|
|
355
298
|
__param(7, (0, tsyringe_1.inject)(tokens_1.TOKENS.IUserInteractionPort)),
|
|
356
|
-
__metadata("design:paramtypes", [
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
299
|
+
__metadata("design:paramtypes", [use_cases_1.InstallInstanceUseCase,
|
|
300
|
+
use_cases_1.StartInstanceUseCase,
|
|
301
|
+
use_cases_1.StopInstanceUseCase,
|
|
302
|
+
use_cases_1.DeleteInstanceUseCase,
|
|
303
|
+
use_cases_1.ListInstancesUseCase,
|
|
304
|
+
use_cases_1.ListChartsUseCase, Object, Object])
|
|
362
305
|
], InstanceController);
|
|
363
306
|
//# sourceMappingURL=instance.controller.js.map
|
|
@@ -14,33 +14,30 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SetupController = void 0;
|
|
16
16
|
const tsyringe_1 = require("tsyringe");
|
|
17
|
-
const tokens_1 = require("
|
|
18
|
-
const
|
|
19
|
-
const runtime_environment_port_1 = require("
|
|
20
|
-
const
|
|
17
|
+
const tokens_1 = require("../../../di/tokens");
|
|
18
|
+
const use_cases_1 = require("../../../application/use-cases");
|
|
19
|
+
const runtime_environment_port_1 = require("../../../domain/ports/runtime-environment.port");
|
|
20
|
+
const base_controller_1 = require("../../controllers/base.controller");
|
|
21
21
|
/**
|
|
22
22
|
* Setup Controller
|
|
23
23
|
*
|
|
24
24
|
* 處理環境設定相關的 CLI 命令
|
|
25
25
|
*/
|
|
26
|
-
let SetupController = class SetupController {
|
|
27
|
-
constructor(setupUseCase, output
|
|
26
|
+
let SetupController = class SetupController extends base_controller_1.BaseController {
|
|
27
|
+
constructor(setupUseCase, output) {
|
|
28
|
+
super(output);
|
|
28
29
|
this.setupUseCase = setupUseCase;
|
|
29
|
-
this.output = output;
|
|
30
|
-
this.wslInfo = wslInfo;
|
|
31
|
-
this.wslUpdater = wslUpdater;
|
|
32
|
-
this.runtimeEnvironment = runtimeEnvironment;
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
35
32
|
* 執行環境檢查
|
|
36
33
|
*/
|
|
37
34
|
async setup(_options) {
|
|
38
|
-
|
|
35
|
+
await this.executeAction('Environment check failed', async () => {
|
|
39
36
|
this.output
|
|
40
37
|
.item('arrow', 'Checking system environment...')
|
|
41
38
|
.newline()
|
|
42
39
|
.flush();
|
|
43
|
-
const result = await this.setupUseCase.execute();
|
|
40
|
+
const result = await this.setupUseCase.execute(this.output);
|
|
44
41
|
// 顯示作業系統資訊
|
|
45
42
|
this.output
|
|
46
43
|
.section('Checking Operating System')
|
|
@@ -56,48 +53,30 @@ let SetupController = class SetupController {
|
|
|
56
53
|
.item('bullet', `Version: ${result.runtimeInfo.version}`);
|
|
57
54
|
if (result.runtimeInfo.isInstalled) {
|
|
58
55
|
this.output.success('Runtime installed');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
// 執行更新
|
|
68
|
-
if (updateReq.needsUpdate) {
|
|
69
|
-
const { needsRestart } = await this.wslUpdater.installWsl('update', this.output);
|
|
70
|
-
if (needsRestart) {
|
|
71
|
-
this.output
|
|
72
|
-
.newline()
|
|
73
|
-
.info('Please restart your computer and run "uofx env setup" again.')
|
|
74
|
-
.render();
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// 設定預設版本
|
|
79
|
-
if (updateReq.needsDefaultVersion) {
|
|
80
|
-
await this.wslUpdater.setDefaultVersion(this.output);
|
|
81
|
-
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.output.error('Runtime not installed');
|
|
59
|
+
}
|
|
60
|
+
// 處理 WSL 設定結果
|
|
61
|
+
if (result.wslSetup) {
|
|
62
|
+
if (result.wslSetup.action === 'installed') {
|
|
63
|
+
if (result.wslSetup.needsRestart) {
|
|
82
64
|
this.output
|
|
83
65
|
.newline()
|
|
84
|
-
.
|
|
66
|
+
.info('Please restart your computer and run "uofx env setup" again.')
|
|
85
67
|
.render();
|
|
86
|
-
return;
|
|
87
68
|
}
|
|
88
69
|
else {
|
|
89
|
-
|
|
90
|
-
|
|
70
|
+
this.output
|
|
71
|
+
.newline()
|
|
72
|
+
.success('WSL installation completed. You can now continue with setup.')
|
|
73
|
+
.info('Run "uofx env setup" again to verify the installation.')
|
|
74
|
+
.render();
|
|
91
75
|
}
|
|
76
|
+
return;
|
|
92
77
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.output.error('Runtime not installed').newline().render();
|
|
96
|
-
// 詢問使用者是否要安裝 WSL
|
|
97
|
-
const shouldInstall = await this.wslUpdater.promptWslInstall(this.output);
|
|
98
|
-
if (shouldInstall) {
|
|
99
|
-
const { needsRestart } = await this.wslUpdater.installWsl('install', this.output);
|
|
100
|
-
if (needsRestart) {
|
|
78
|
+
if (result.wslSetup.action === 'updated') {
|
|
79
|
+
if (result.wslSetup.needsRestart) {
|
|
101
80
|
this.output
|
|
102
81
|
.newline()
|
|
103
82
|
.info('Please restart your computer and run "uofx env setup" again.')
|
|
@@ -106,8 +85,7 @@ let SetupController = class SetupController {
|
|
|
106
85
|
else {
|
|
107
86
|
this.output
|
|
108
87
|
.newline()
|
|
109
|
-
.success('WSL
|
|
110
|
-
.info('Run "uofx env setup" again to verify the installation.')
|
|
88
|
+
.success('WSL setup completed.')
|
|
111
89
|
.render();
|
|
112
90
|
}
|
|
113
91
|
return;
|
|
@@ -115,19 +93,17 @@ let SetupController = class SetupController {
|
|
|
115
93
|
}
|
|
116
94
|
this.output.newline();
|
|
117
95
|
// 顯示記憶體資訊
|
|
118
|
-
const memoryInfo = await this.runtimeEnvironment.getMemoryAvailability();
|
|
119
96
|
this.output.section('Checking Remaining Memory');
|
|
120
|
-
for (const detail of memoryInfo.details) {
|
|
97
|
+
for (const detail of result.memoryInfo.details) {
|
|
121
98
|
const suffix = detail.suffix ? ` (${detail.suffix})` : '';
|
|
122
99
|
this.output.item('bullet', `${detail.label}: ${detail.valueGB.toFixed(2)} GB${suffix}`);
|
|
123
100
|
}
|
|
124
|
-
|
|
125
|
-
if (memoryOk) {
|
|
101
|
+
if (result.memoryInfo.isSufficient) {
|
|
126
102
|
this.output.success('Memory sufficient for UOFX');
|
|
127
103
|
}
|
|
128
104
|
else {
|
|
129
105
|
this.output
|
|
130
|
-
.warning(`Available memory (${memoryInfo.availableGB.toFixed(2)} GB) is below recommended ${runtime_environment_port_1.UOFX_REQUIRED_MEMORY_GB} GB`)
|
|
106
|
+
.warning(`Available memory (${result.memoryInfo.availableGB.toFixed(2)} GB) is below recommended ${runtime_environment_port_1.UOFX_REQUIRED_MEMORY_GB} GB`)
|
|
131
107
|
.newline()
|
|
132
108
|
.info('Insufficient memory may cause:')
|
|
133
109
|
.item('bullet', 'Kubernetes pods failing to start')
|
|
@@ -158,7 +134,7 @@ let SetupController = class SetupController {
|
|
|
158
134
|
this.output.error('Registry not accessible');
|
|
159
135
|
}
|
|
160
136
|
// 計算是否有警告
|
|
161
|
-
const hasWarnings = !
|
|
137
|
+
const hasWarnings = !result.memoryInfo.isSufficient;
|
|
162
138
|
// 總結
|
|
163
139
|
this.output
|
|
164
140
|
.newline()
|
|
@@ -189,13 +165,7 @@ let SetupController = class SetupController {
|
|
|
189
165
|
.newline();
|
|
190
166
|
}
|
|
191
167
|
this.output.render();
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
this.output
|
|
195
|
-
.error(`Environment check failed: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
196
|
-
.render();
|
|
197
|
-
throw error;
|
|
198
|
-
}
|
|
168
|
+
});
|
|
199
169
|
}
|
|
200
170
|
};
|
|
201
171
|
exports.SetupController = SetupController;
|
|
@@ -203,9 +173,6 @@ exports.SetupController = SetupController = __decorate([
|
|
|
203
173
|
(0, tsyringe_1.injectable)(),
|
|
204
174
|
__param(0, (0, tsyringe_1.inject)(tokens_1.TOKENS.SetupEnvironmentUseCase)),
|
|
205
175
|
__param(1, (0, tsyringe_1.inject)(tokens_1.TOKENS.IOutputPort)),
|
|
206
|
-
|
|
207
|
-
__param(3, (0, tsyringe_1.inject)(tokens_1.TOKENS.Internal.WslUpdaterService)),
|
|
208
|
-
__param(4, (0, tsyringe_1.inject)(tokens_1.TOKENS.IRuntimeEnvironmentPort)),
|
|
209
|
-
__metadata("design:paramtypes", [setup_environment_use_case_1.SetupEnvironmentUseCase, Object, Object, Object, Object])
|
|
176
|
+
__metadata("design:paramtypes", [use_cases_1.SetupEnvironmentUseCase, Object])
|
|
210
177
|
], SetupController);
|
|
211
178
|
//# sourceMappingURL=setup.controller.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Presentation Controllers
|
|
4
|
+
* 按指令群組組織
|
|
4
5
|
*/
|
|
5
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
7
|
if (k2 === undefined) k2 = k;
|
|
@@ -17,9 +18,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
19
|
};
|
|
19
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
|
|
21
|
-
__exportStar(require("./
|
|
22
|
-
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
|
|
21
|
+
// Env 指令群組 (instance, setup, credentials)
|
|
22
|
+
__exportStar(require("./env"), exports);
|
|
23
|
+
// Config 指令群組
|
|
24
|
+
__exportStar(require("./config"), exports);
|
|
25
|
+
// Logs 指令群組
|
|
26
|
+
__exportStar(require("./logs"), exports);
|
|
27
|
+
// Dev 指令群組
|
|
28
|
+
__exportStar(require("./dev"), exports);
|
|
25
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Logs 指令群組 Controllers
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./logs.controller"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -14,24 +14,24 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LogsController = void 0;
|
|
16
16
|
const tsyringe_1 = require("tsyringe");
|
|
17
|
-
const tokens_1 = require("
|
|
18
|
-
const
|
|
19
|
-
const
|
|
17
|
+
const tokens_1 = require("../../../di/tokens");
|
|
18
|
+
const use_cases_1 = require("../../../application/use-cases");
|
|
19
|
+
const base_controller_1 = require("../../controllers/base.controller");
|
|
20
20
|
/**
|
|
21
21
|
* Logs Controller
|
|
22
22
|
*
|
|
23
23
|
* 處理日誌相關的 CLI 命令
|
|
24
24
|
*/
|
|
25
|
-
let LogsController = class LogsController {
|
|
25
|
+
let LogsController = class LogsController extends base_controller_1.BaseController {
|
|
26
26
|
constructor(showLogsUseCase, output) {
|
|
27
|
+
super(output);
|
|
27
28
|
this.showLogsUseCase = showLogsUseCase;
|
|
28
|
-
this.output = output;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* 顯示日志
|
|
32
32
|
*/
|
|
33
33
|
async show(options) {
|
|
34
|
-
|
|
34
|
+
await this.executeAction('Failed to show logs', async () => {
|
|
35
35
|
const request = {
|
|
36
36
|
lines: options.lines || 50,
|
|
37
37
|
level: options.level,
|
|
@@ -43,13 +43,7 @@ let LogsController = class LogsController {
|
|
|
43
43
|
};
|
|
44
44
|
const result = await this.showLogsUseCase.execute(request);
|
|
45
45
|
this.formatAndDisplayLogs(result);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
this.output
|
|
49
|
-
.error(`Failed to show logs: ${(0, error_formatter_util_1.formatErrorMessage)(error)}`)
|
|
50
|
-
.render();
|
|
51
|
-
throw error;
|
|
52
|
-
}
|
|
46
|
+
});
|
|
53
47
|
}
|
|
54
48
|
/**
|
|
55
49
|
* 格式化並顯示日誌
|
|
@@ -98,6 +92,6 @@ exports.LogsController = LogsController = __decorate([
|
|
|
98
92
|
(0, tsyringe_1.injectable)(),
|
|
99
93
|
__param(0, (0, tsyringe_1.inject)(tokens_1.TOKENS.ShowLogsUseCase)),
|
|
100
94
|
__param(1, (0, tsyringe_1.inject)(tokens_1.TOKENS.IOutputPort)),
|
|
101
|
-
__metadata("design:paramtypes", [
|
|
95
|
+
__metadata("design:paramtypes", [use_cases_1.ShowLogsUseCase, Object])
|
|
102
96
|
], LogsController);
|
|
103
97
|
//# sourceMappingURL=logs.controller.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Presentation 層介面匯出
|
|
19
|
+
*/
|
|
20
|
+
__exportStar(require("./cli-options.interface"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|