UNPKG

@hashgraph/solo

Version:

An opinionated CLI tool to deploy and manage private Hedera Networks.

71 lines 6.57 kB
// 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 OneShotCommandDefinition_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 { DefaultOneShotCommand } from '../one-shot/default-one-shot.js'; import * as constants from '../../core/constants.js'; let OneShotCommandDefinition = class OneShotCommandDefinition extends BaseCommandDefinition { static { OneShotCommandDefinition_1 = this; } logger; oneShotCommand; constructor(logger, oneShotCommand) { super(); this.logger = logger; this.oneShotCommand = oneShotCommand; this.oneShotCommand = patchInject(oneShotCommand, InjectTokens.OneShotCommand, this.constructor.name); this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name); } static COMMAND_NAME = 'one-shot'; static DESCRIPTION = 'One Shot commands for new and returning users who need a preset environment type. ' + 'These commands use reasonable defaults to provide a single command out of box experience.'; static SINGLE_SUBCOMMAND_NAME = 'single'; static SINGLE_SUBCOMMAND_DESCRIPTION = 'Creates a uniquely named deployment with a single consensus node, ' + 'mirror node, block node, relay node, and explorer node.'; static MULTI_SUBCOMMAND_NAME = 'multi'; static MULTI_SUBCOMMAND_DESCRIPTION = 'Creates a uniquely named deployment with multiple consensus nodes, ' + 'mirror node, block node, relay node, and explorer node.'; static FALCON_SUBCOMMAND_NAME = 'falcon'; static FALCON_SUBCOMMAND_DESCRIPTION = 'Creates a uniquely named deployment with optional chart values override using --values-file.'; static SINGLE_DEPLOY = 'deploy'; static SINGLE_DESTROY = 'destroy'; static INFO_COMMAND_NAME = 'show'; static MULTIPLE_DEPLOY = 'deploy'; static MULTIPLE_DESTROY = 'destroy'; getCommandDefinition() { return new CommandBuilder(OneShotCommandDefinition_1.COMMAND_NAME, OneShotCommandDefinition_1.DESCRIPTION, this.logger) .addCommandGroup(new CommandGroup(OneShotCommandDefinition_1.SINGLE_SUBCOMMAND_NAME, OneShotCommandDefinition_1.SINGLE_SUBCOMMAND_DESCRIPTION) .addSubcommand(new Subcommand(OneShotCommandDefinition_1.SINGLE_DEPLOY, 'Deploys all required components for the selected one shot configuration.', this.oneShotCommand, this.oneShotCommand.deploy, DefaultOneShotCommand.DEPLOY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES, ...(constants.CONFIG.ENABLE_IMAGE_CACHE ? [constants.CRANE] : [])], true)) .addSubcommand(new Subcommand(OneShotCommandDefinition_1.SINGLE_DESTROY, 'Removes the deployed resources for the selected one shot configuration.', this.oneShotCommand, this.oneShotCommand.destroy, DefaultOneShotCommand.DESTROY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))) .addCommandGroup(new CommandGroup(OneShotCommandDefinition_1.MULTI_SUBCOMMAND_NAME, OneShotCommandDefinition_1.MULTI_SUBCOMMAND_DESCRIPTION) .addSubcommand(new Subcommand(OneShotCommandDefinition_1.MULTIPLE_DEPLOY, 'Deploys all required components for the selected multiple node one shot configuration.', this.oneShotCommand, this.oneShotCommand.deploy, DefaultOneShotCommand.MULTI_DEPLOY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES, ...(constants.CONFIG.ENABLE_IMAGE_CACHE ? [constants.CRANE] : [])], true)) .addSubcommand(new Subcommand(OneShotCommandDefinition_1.MULTIPLE_DESTROY, 'Removes the deployed resources for the selected multiple node one shot configuration.', this.oneShotCommand, this.oneShotCommand.destroy, DefaultOneShotCommand.DESTROY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))) .addCommandGroup(new CommandGroup(OneShotCommandDefinition_1.FALCON_SUBCOMMAND_NAME, OneShotCommandDefinition_1.FALCON_SUBCOMMAND_DESCRIPTION) .addSubcommand(new Subcommand(OneShotCommandDefinition_1.SINGLE_DEPLOY, 'Deploys all required components for the selected one shot configuration (with optional values file).', this.oneShotCommand, this.oneShotCommand.deployFalcon, DefaultOneShotCommand.FALCON_DEPLOY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES, ...(constants.CONFIG.ENABLE_IMAGE_CACHE ? [constants.CRANE] : [])], true)) .addSubcommand(new Subcommand(OneShotCommandDefinition_1.SINGLE_DESTROY, 'Removes the deployed resources for the selected one shot configuration (with optional values file).', this.oneShotCommand, this.oneShotCommand.destroyFalcon, DefaultOneShotCommand.FALCON_DESTROY_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))) .addCommandGroup(new CommandGroup(OneShotCommandDefinition_1.INFO_COMMAND_NAME, 'Display information about one-shot deployments.').addSubcommand(new Subcommand('deployment', 'Display information about the last one-shot deployment including name, versions, and deployed components.', this.oneShotCommand, this.oneShotCommand.info, DefaultOneShotCommand.INFO_FLAGS_LIST))) .build(); } }; OneShotCommandDefinition = OneShotCommandDefinition_1 = __decorate([ injectable(), __param(0, inject(InjectTokens.SoloLogger)), __param(1, inject(InjectTokens.OneShotCommand)), __metadata("design:paramtypes", [Object, DefaultOneShotCommand]) ], OneShotCommandDefinition); export { OneShotCommandDefinition }; //# sourceMappingURL=one-shot-command-definition.js.map