UNPKG

@wocker/ws

Version:

Docker workspace for web projects

77 lines (76 loc) 3.88 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExperimentalController = void 0; const core_1 = require("@wocker/core"); let ExperimentalController = class ExperimentalController { constructor(appService) { this.appService = appService; } enable(feature) { if (!feature) { throw new core_1.UsageException("Feature name is required. Usage: wocker experimental:enable <feature-name>\n"); } if (!this.appService.experimentalFeatures.includes(feature)) { const availableFeatures = this.appService.experimentalFeatures.join(", "); throw new core_1.UsageException(`Unknown experimental feature: "${feature}"\nAvailable features: ${availableFeatures}`); } this.appService.setMeta(`experimental.${feature}`, "enabled"); this.appService.save(); } disable(feature) { if (!feature) { throw new core_1.UsageException("Feature name is required. Usage: wocker experimental:disable <feature-name>\n"); } if (!this.appService.experimentalFeatures.includes(feature)) { const availableFeatures = this.appService.experimentalFeatures.join(", "); throw new core_1.UsageException(`Unknown experimental feature: "${feature}"\nAvailable features: ${availableFeatures}`); } this.appService.unsetMeta(`experimental.${feature}`); this.appService.save(); } getFeatures() { return this.appService.experimentalFeatures; } }; exports.ExperimentalController = ExperimentalController; __decorate([ (0, core_1.Command)("experimental:enable [feature]"), (0, core_1.Description)("Enable experimental features"), __param(0, (0, core_1.Param)("feature")), __param(0, (0, core_1.Description)("Name of the feature to enable")), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], ExperimentalController.prototype, "enable", null); __decorate([ (0, core_1.Command)("experimental:disable [feature]"), (0, core_1.Description)("Disable experimental features"), __param(0, (0, core_1.Param)("feature")), __param(0, (0, core_1.Description)("Name of the feature to disable")), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0) ], ExperimentalController.prototype, "disable", null); __decorate([ (0, core_1.Completion)("feature"), __metadata("design:type", Function), __metadata("design:paramtypes", []), __metadata("design:returntype", Array) ], ExperimentalController.prototype, "getFeatures", null); exports.ExperimentalController = ExperimentalController = __decorate([ (0, core_1.Controller)(), (0, core_1.Description)("Manage experimental features"), __metadata("design:paramtypes", [core_1.AppConfigService]) ], ExperimentalController);