UNPKG

@hashgraph/solo

Version:

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

61 lines 4.58 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 CacheCommandDefinition_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 * as constants from '../../core/constants.js'; import { CacheCommand } from '../cache.js'; let CacheCommandDefinition = class CacheCommandDefinition extends BaseCommandDefinition { static { CacheCommandDefinition_1 = this; } logger; cacheCommand; constructor(logger, cacheCommand) { super(); this.logger = logger; this.cacheCommand = cacheCommand; this.cacheCommand = patchInject(cacheCommand, InjectTokens.CacheCommand, this.constructor.name); this.logger = patchInject(logger, InjectTokens.SoloLogger, this.constructor.name); } static COMMAND_NAME = 'cache'; static DESCRIPTION = 'Manage solo cached items.'; static IMAGE_SUBCOMMAND_NAME = 'image'; static IMAGE_PULL = 'pull'; static IMAGE_LOAD = 'load'; static IMAGE_LIST = 'list'; static IMAGE_CLEAR = 'clear'; static IMAGE_STATUS = 'status'; static IMAGE_PULL_COMMAND = `${CacheCommandDefinition_1.COMMAND_NAME} ${CacheCommandDefinition_1.IMAGE_SUBCOMMAND_NAME} ${CacheCommandDefinition_1.IMAGE_PULL}`; static IMAGE_LOAD_COMMAND = `${CacheCommandDefinition_1.COMMAND_NAME} ${CacheCommandDefinition_1.IMAGE_SUBCOMMAND_NAME} ${CacheCommandDefinition_1.IMAGE_LOAD}`; getCommandDefinition() { return new CommandBuilder(CacheCommandDefinition_1.COMMAND_NAME, CacheCommandDefinition_1.DESCRIPTION, this.logger) .addCommandGroup(new CommandGroup(CacheCommandDefinition_1.IMAGE_SUBCOMMAND_NAME, 'Manage image archives used by solo.') .addSubcommand(new Subcommand(CacheCommandDefinition_1.IMAGE_PULL, 'Pull and caches docker images used by solo, prerequisite for `solo cache image load`.', this.cacheCommand, this.cacheCommand.pull, CacheCommand.PULL_FLAGS_LIST, [...constants.BASE_DEPENDENCIES, constants.CRANE])) .addSubcommand(new Subcommand(CacheCommandDefinition_1.IMAGE_LOAD, 'Loads the images archive into a cluster. Pulling the images with `solo cache images pull` is a prerequisite.', this.cacheCommand, this.cacheCommand.load, CacheCommand.LOAD_FLAGS_LIST, [...constants.BASE_DEPENDENCIES, constants.CRANE])) .addSubcommand(new Subcommand(CacheCommandDefinition_1.IMAGE_LIST, 'Lists all cached image archives.', this.cacheCommand, this.cacheCommand.list, CacheCommand.LIST_FLAGS_LIST, [...constants.BASE_DEPENDENCIES])) .addSubcommand(new Subcommand(CacheCommandDefinition_1.IMAGE_CLEAR, 'Clears the image archives.', this.cacheCommand, this.cacheCommand.clear, CacheCommand.CLEAR_FLAGS_LIST, [...constants.BASE_DEPENDENCIES])) .addSubcommand(new Subcommand(CacheCommandDefinition_1.IMAGE_STATUS, 'Lists all images, displays data about them and all missing images.', this.cacheCommand, this.cacheCommand.status, CacheCommand.STATUS_FLAGS_LIST, [...constants.BASE_DEPENDENCIES]))) .build(); } }; CacheCommandDefinition = CacheCommandDefinition_1 = __decorate([ injectable(), __param(0, inject(InjectTokens.SoloLogger)), __param(1, inject(InjectTokens.CacheCommand)), __metadata("design:paramtypes", [Object, CacheCommand]) ], CacheCommandDefinition); export { CacheCommandDefinition }; //# sourceMappingURL=cache-command-definition.js.map