Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// TODO(yorke): implement log(msg) switch on logLevel with chalk colored output
log(msg: string, logLevel: string = 'info') {
if (logLevel === 'info') {
console.debug(msg)
} else if (logLevel === 'error') {
console.error(msg)
}
}
}
// tslint:disable-next-line:max-classes-per-file
export abstract class BaseCommand extends LocalCommand {
static flags = {
...LocalCommand.flags,
privateKey: flags.string({ hidden: true }),
node: flags.string({ char: 'n', hidden: true }),
}
// This specifies whether the node needs to be synced before the command
// can be run. In most cases, this should be `true`, so that's the default.
// For commands that don't require the node is synced, add the following line
// to its definition:
// requireSynced = false
public requireSynced: boolean = true
private _web3: Web3 | null = null
private _kit: ContractKit | null = null
// This is required since we wrap the provider with a debug provider and
// there is no way to unwrap the provider afterwards.
// We need access to the original provider, so that, we can close it.
private _originalProvider: any | null = null
import { SnapshotManager } from "@arkecosystem/core-snapshots";
import { flags } from "@oclif/command";
import _cliProgress from "cli-progress";
import { setUpLite } from "../utils";
import { BaseCommand } from "./command";
export class RestoreCommand extends BaseCommand {
public static description: string = "import data from specified snapshot";
public static flags = {
...BaseCommand.flags,
blocks: flags.string({
description: "blocks to import, correlates to folder name",
required: true,
}),
codec: flags.string({
description: "codec name, default is msg-lite binary",
}),
truncate: flags.boolean({
description: "empty all tables before running import",
}),
skipRestartRound: flags.boolean({
description: "skip revert to current round",
}),
signatureVerify: flags.boolean({
description: "signature verification",
}),
};
public async run(): Promise {
// tslint:disable-next-line:no-shadowed-variable
const { flags } = this.parse(RestoreCommand);
this.log(JSON.stringify(reaction));
this.exit(0);
}
this.log('Your reaction has been created.');
this.exit(0);
} catch (error) {
this.error(error || 'A Stream CLI error has occurred.', {
exit: 1,
});
}
}
}
ReactionCreate.flags = {
channel: flags.string({
char: 'c',
description: 'The unique identifier for the channel.',
required: false,
}),
type: flags.string({
char: 't',
description: 'The type of channel.',
options: ['livestream', 'messaging', 'gaming', 'commerce', 'team'],
required: false,
}),
message: flags.string({
char: 'c',
description: 'The unique identifier for the message.',
required: false,
}),
reaction: flags.string({
serveSwaggerUI,
SwaggerUIOpts,
DocExpansion,
} from '../common/swagger-ui';
export default class SwaggerUI extends Command {
public static description = 'serve or bundle a Swagger UI instance';
public static examples = ['$ openapi swagger-ui', '$ openapi swagger-ui ./openapi.yml'];
public static flags = {
...commonFlags.help(),
...commonFlags.serverOpts(),
...commonFlags.servers(),
...commonFlags.swaggerUIOpts(),
bundle: flags.string({
char: 'B',
description: 'bundle a static site to directory',
helpValue: 'outDir',
}),
proxy: flags.boolean({
description: 'set up a proxy for the api to avoid CORS issues',
exclusive: ['bundle'],
}),
};
public static args = [
{
name: 'definition',
description: 'input definition file',
},
];
'disposition-action': flags.string({
description: 'A disposition action to filter by',
options: [
'permanently_delete',
'remove_retention'
]
}),
'disposition-after': flags.string({
description: 'A date to filter retention policies that complete after a certain time',
parse: input => BoxCommand.normalizeDateString(input),
}),
'disposition-before': flags.string({
description: 'A date to filter retention policies that complete before a certain time',
parse: input => BoxCommand.normalizeDateString(input),
}),
'file-id': flags.string({ description: 'A file id to filter the file version retentions by' }),
'file-version-id': flags.string({ description: 'A file version id to filter the file version retentions by' }),
'policy-id': flags.string({ description: 'A policy id to filter the file version retentions by' })
};
module.exports = RetentionPoliciesListVersionRetentionCommand;
}
}
}
Log.flags = {
channel: flags.string({
char: 'c',
description: 'The channel ID you wish to log.',
required: false,
}),
type: flags.string({
char: 't',
description: 'The type of channel.',
required: false,
}),
event: flags.string({
char: 'e',
description: 'The type of event you want to listen on.',
options: [
'all',
'user.status.changed',
'user.watching.start',
'user.watching.stop',
'user.updated',
'typing.start',
'typing.stop',
'message.new',
'message.updated',
'message.deleted',
'message.seen',
'message.reaction',
'member.added',
config: flags.string({
char: "c",
description: "Path to your Apollo config file"
}),
header: flags.string({
multiple: true,
parse: header => {
const separatorIndex = header.indexOf(":");
const key = header.substring(0, separatorIndex).trim();
const value = header.substring(separatorIndex + 1).trim();
return JSON.stringify({ [key]: value });
},
description:
"Additional header to send to server for introspectionQuery. May be used multiple times to add multiple headers. NOTE: The `--endpoint` flag is REQUIRED if using the `--header` flag."
}),
endpoint: flags.string({
description: "The url of your service"
}),
key: flags.string({
description: "The API key for the Apollo Engine service",
default: () => process.env.ENGINE_API_KEY
}),
engine: flags.string({
description: "Reporting URL for a custom Apollo Engine deployment",
hidden: true
}),
frontend: flags.string({
description: "URL for a custom Apollo Engine frontend",
hidden: true
})
};
channel: flags.string({
char: 'c',
description: 'The unique identifier for the channel you want to query.',
required: false,
}),
type: flags.string({
char: 't',
description: 'Type of channel.',
required: false,
}),
filter: flags.string({
char: 'f',
description: 'Filters to apply to the query.',
required: false,
}),
sort: flags.string({
char: 's',
description: 'Sort to apply to the query.',
required: false,
}),
json: flags.boolean({
char: 'j',
description:
'Output results in JSON. When not specified, returns output in a human friendly format.',
required: false,
}),
};
ChannelQuery.description = 'Queries all channels.';
module.exports.ChannelQuery = ChannelQuery;
required: true,
options: ["cost", "speed", "balanced"]
}),
invocations: flags.integer({
char: "i",
description: "the number of invocations to run for each configuration",
required: false,
default: 100
}),
payload: flags.string({
char: "e",
description: "the JSON payload to send to the function",
required: false,
default: "{}"
}),
file: flags.string({
char: "f",
description: "file that contains the JSON payload to send to the function",
required: false,
exclusive: ["payload"]
}),
balancedWeight: flags.string({
char: "w",
description:
'the trade-off between cost and time, 0.0 is equivalent to "speed" strategy, 1.0 is equivalent to "cost" strategy',
required: false,
parse: x => parseFloat(x)
}),
powerValues: flags.string({
char: "v",
description:
"comma-separated list of power values to be tested, e.g. 128,256,512,1024",
import * as inquirer from 'inquirer';
import { join, resolve } from 'path';
import { loadJson, loadPackageJson, runCommand, schematicsCommandBuilder } from '../utils/schematics-command-builder';
import { Prepare } from './prepare';
export class LibraryToApplication extends Command {
static aliases = ['library-to-application', 'lib-to-app', 'lib2app'];
static description = 'Linking the library to the application, based on the Rucken template';
static flags = {
type: flags.string({ char: 't', description: 'Type(s) of applications.', multiple: true, options: ['frontend', 'nestjs', 'all'] }),
lib: flags.string({ description: 'The name of the library.' }),
frontendLib: flags.string({ description: 'The name of the frontend library.' }),
nestjsLib: flags.string({ description: 'The name of the nestjs library.' }),
app: flags.string({ description: 'The name of the application.' }),
frontendApp: flags.string({ description: 'The name of the frontend application.' }),
nestjsApp: flags.string({ description: 'The name of the nestjs application.' }),
frontendTemplate: flags.string({ description: 'Frontend library generator', default: '@rucken/schematics:rucken-lib-to-app' }),
nestjsTemplate: flags.string({ description: 'Linking the library to the backend application on NestJS', default: '@rucken/schematics:rucken-lib-nestjs-to-app' }),
workspace: flags.string({ char: 'w', description: 'The workspace directory name.' }),
help: flags.help({ char: 'h' })
};
static args = [{ name: 'name' }];
async run() {
process.setMaxListeners(0);
require('events').EventEmitter.defaultMaxListeners = 100;
const { args, flags } = this.parse(LibraryToApplication);
const workspace = flags.workspace;
const packageJson: any = loadPackageJson(join(workspace || process.cwd(), 'package.json'));
const angularJson: any = loadJson(join(workspace || process.cwd(), 'angular.json'));