@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
61 lines • 4.52 kB
JavaScript
// SPDX-License-Identifier: Apache-2.0
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); }
};
var ExplorerCommandDefinition_1;
import { inject, injectable } from 'tsyringe-neo';
import { InjectTokens } from '../../core/dependency-injection/inject-tokens.js';
import { patchInject } from '../../core/dependency-injection/container-helper.js';
import { BaseCommandDefinition } from './base-command-definition.js';
import { CommandBuilder, CommandGroup, Subcommand } from '../../core/command-path-builders/command-builder.js';
import { ExplorerCommand } from '../explorer.js';
import * as constants from '../../core/constants.js';
let ExplorerCommandDefinition = class ExplorerCommandDefinition extends BaseCommandDefinition {
static { ExplorerCommandDefinition_1 = this; }
logger;
explorerCommand;
constructor(logger, explorerCommand) {
super();
this.logger = logger;
this.explorerCommand = explorerCommand;
this.explorerCommand = patchInject(explorerCommand, InjectTokens.ExplorerCommand, this.constructor.name);
this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name);
}
static COMMAND_NAME = 'explorer';
static DESCRIPTION = 'Explorer Node operations for creating, modifying, and destroying resources.' +
'These commands require the presence of an existing deployment.';
static NODE_SUBCOMMAND_NAME = 'node';
static NODE_SUBCOMMAND_DESCRIPTION = 'List, create, manage, or destroy explorer node instances. ' +
'Operates on a single explorer node instance at a time.';
static NODE_ADD = 'add';
static NODE_DESTROY = 'destroy';
static NODE_UPGRADE = 'upgrade';
static ADD_COMMAND = `${ExplorerCommandDefinition_1.COMMAND_NAME} ${ExplorerCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${ExplorerCommandDefinition_1.NODE_ADD}`;
static DESTROY_COMMAND = `${ExplorerCommandDefinition_1.COMMAND_NAME} ${ExplorerCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${ExplorerCommandDefinition_1.NODE_DESTROY}`;
static UPGRADE_COMMAND = `${ExplorerCommandDefinition_1.COMMAND_NAME} ${ExplorerCommandDefinition_1.NODE_SUBCOMMAND_NAME} ${ExplorerCommandDefinition_1.NODE_UPGRADE}`;
getCommandDefinition() {
return new CommandBuilder(ExplorerCommandDefinition_1.COMMAND_NAME, ExplorerCommandDefinition_1.DESCRIPTION, this.logger)
.addCommandGroup(new CommandGroup(ExplorerCommandDefinition_1.NODE_SUBCOMMAND_NAME, ExplorerCommandDefinition_1.NODE_SUBCOMMAND_DESCRIPTION)
.addSubcommand(new Subcommand(ExplorerCommandDefinition_1.NODE_ADD, 'Adds and configures a new node instance.', this.explorerCommand, this.explorerCommand.add, ExplorerCommand.DEPLOY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))
.addSubcommand(new Subcommand(ExplorerCommandDefinition_1.NODE_DESTROY, 'Deletes the specified node from the deployment.', this.explorerCommand, this.explorerCommand.destroy, ExplorerCommand.DESTROY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))
.addSubcommand(new Subcommand(ExplorerCommandDefinition_1.NODE_UPGRADE, 'Upgrades the specified node in the deployment.', this.explorerCommand, this.explorerCommand.upgrade, ExplorerCommand.UPGRADE_FLAGS_LIST, [...constants.BASE_DEPENDENCIES])))
.build();
}
};
ExplorerCommandDefinition = ExplorerCommandDefinition_1 = __decorate([
injectable(),
__param(0, inject(InjectTokens.SoloLogger)),
__param(1, inject(InjectTokens.ExplorerCommand)),
__metadata("design:paramtypes", [Object, ExplorerCommand])
], ExplorerCommandDefinition);
export { ExplorerCommandDefinition };
//# sourceMappingURL=explorer-command-definition.js.map