// Error enhancements program .option( '--show-error-stack [json|string]', 'show JavaScript error stacks in the GraphQL result errors (recommended in development)', ) .option( '--extended-errors <string>', "a comma separated list of extended Postgres error fields to display in the GraphQL result. Recommended in development: 'hint,detail,errcode'. Default: none", (option: string) => option.split(',').filter(_ => _), );
program .command('generate') .option('-t, --tables <tables>', 'Comma delimited list of tables to generate schema from', list) .description('Generate Cube.js schema from DB tables schema') .action( (options) => generateSchema(options).catch(e => displayError(e.stack || e, { dbType: options.dbType })) ) .on('--help', () => { console.log(''); console.log('Examples:'); console.log(''); console.log(' $ cubejs generate -t orders,customers'); });
program.option("-s, --settings [settings]", "Overrides layout settings for given view types", (settings) => { const res = parseSettings(settings); if (res.error) { exitWithError(res.error); } return res.result; }, {} );
program .command('jobs') .description('List all completed jobs') .option('--completed', 'Show completed jobs') .option('--failed', 'Show failed jobs') .option('-l, --limit [limit]', 'Limit how many jobs to show') .action(function (options) { openConfig() return listJobs(queue, options.failed, options.completed, options.limit) .then(function() { queue.close() process.exit(0) }) .catch(handleDbError) })
program .command('purge') .description('Will remove all completed jobs') .option('--failed', 'Remove all failed jobs') .option('--new', 'Remove all new jobs') .action(function (options) { openConfig() return queue.purge(options.failed, options.new) .then(function () { queue.close() console.log('The queue was purged.') process.exit(0) }) .catch(handleDbError) })
function addFlag( optionString: string, description: string, parse?: (option: string) => mixed, ): AddFlagFn { program.option(optionString, description, parse); return addFlag; }
program .command('push [url]') .description('Push new job to the queue') .option('-m, --meta [meta]', 'JSON string with meta data. Default: \'{}\'') .action(function (url, options) { openConfig() return queue .addToQueue({ url: url, meta: JSON.parse(options.meta || '{}') }) .then(function (response) { queue.close() if (error.isError(response)) { console.error('Could not push to queue: %s', response.message) process.exit(1) } else { console.log('The job was created with ID ' + response.id) process.exit(0) } }) .catch(handleDbError) })
cli .command('listen') .alias('l') .description('start the server and listen for requests') .option('-H, --host <host>', 'host') .option('-p, --port <port>', 'port number', Polly.Defaults.port) .option( '-n, --api-namespace <namespace>', 'api namespace', Polly.Defaults.apiNamespace ) .option( '-d, --recordings-dir <path>', 'recordings directory', Polly.Defaults.recordingsDir ) .option( '-s, --recording-size-limit <limit>', 'recording size limit', Polly.Defaults.recordingSizeLimit ) .option('-q, --quiet', 'disable the logging') .action(function(options) { new Polly.Server(options).listen(); });
program .command('token') .option('-e, --expiry [expiry]', 'Token expiry. Set to 0 for no expiry', defaultExpiry) .option('-s, --secret [secret]', 'Cube.js app secret. Also can be set via environment variable CUBEJS_API_SECRET') .option('-p, --payload [values]', 'Payload. Example: -p foo=bar', collect, []) .description('Create JWT token') .action( (options) => token(options) .catch(e => displayError(e.stack || e)) ) .on('--help', () => { console.log(''); console.log('Examples:'); console.log(''); console.log(' $ cubejs token -e "1 day" -p foo=bar -p cool=true'); });
.option( '-e, --jwt-secret <string>', 'the secret to be used when creating and verifying JWTs. if none is provided auth will be disabled', .option( '--jwt-verify-algorithms <string>', 'a comma separated list of the names of the allowed jwt token algorithms', (option: string) => option.split(','), .option( '-A, --jwt-verify-audience <string>', "a comma separated list of JWT audiences that will be accepted; defaults to 'postgraphile'. To disable audience verification, set to ''.", (option: string) => option.split(',').filter(_ => _), .option( '--jwt-verify-clock-tolerance <number>', 'number of seconds to tolerate when checking the nbf and exp claims, to deal with small clock differences among different servers', parseFloat, .option('--jwt-verify-id <string>', 'the name of the allowed jwt token id') .option( '--jwt-verify-ignore-expiration', 'if `true` do not validate the expiration of the token defaults to `false`', .option( '--jwt-verify-ignore-not-before', 'if `true` do not validate the notBefore of the token defaults to `false`', .option(
program .command('create <name>') .option( '-d, --db-type <db-type>', 'Preconfigure for selected database.\n\t\t\t ' + 'Options: postgres, mysql, mongobi, athena, redshift, bigquery, mssql, clickhouse, snowflake, presto' ) .option('-t, --template <template>', 'App template. Options: express (default), serverless.') .description('Create new Cube.js app') .action( (projectName, options) => createApp(projectName, options) .catch(e => displayError(e.stack || e, { projectName, dbType: options.dbType })) ) .on('--help', () => { console.log(''); console.log('Examples:'); console.log(''); console.log(' $ cubejs create hello-world -d postgres'); });
// Deprecated program .option( '--token <identifier>', '[DEPRECATED] Use --jwt-token-identifier instead. This option will be removed in v5.', ) .option( '--secret <string>', '[DEPRECATED] Use --jwt-secret instead. This option will be removed in v5.', ) .option( '--jwt-audiences <string>', '[DEPRECATED] Use --jwt-verify-audience instead. This option will be removed in v5.', (option: string) => option.split(','), ) .option( '--legacy-functions-only', '[DEPRECATED] PostGraphile 4.1.0 introduced support for PostgreSQL functions than declare parameters with IN/OUT/INOUT or declare RETURNS TABLE(...); enable this flag to ignore these types of functions. This option will be removed in v5.', );
.option( '--plugins <string>', 'a list of PostGraphile server plugins (not Graphile Engine schema plugins) to load; if present, must be the _first_ option', .option( '-c, --connection <string>', "the PostgreSQL database name or connection string. If omitted, inferred from environmental variables (see https://www.postgresql.org/docs/current/static/libpq-envars.html). Examples: 'db', 'postgres:///db', 'postgres://user:password@domain:port/db?ssl=true'", .option( '-C, --owner-connection <string>', 'as `--connection`, but for a privileged user (e.g. for setting up watch fixtures, logical decoding, etc); defaults to the value from `--connection`', .option( '-s, --schema <string>', 'a Postgres schema to be introspected. Use commas to define multiple schemas', (option: string) => option.split(','), .option( '-S, --subscriptions', 'Enable GraphQL websocket transport support for subscriptions (you still need a subscriptions plugin currently)', .option( '-L, --live', '[EXPERIMENTAL] Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change). Implies --subscriptions', .option( '-w, --watch', 'automatically updates your GraphQL schema when your database schema changes (NOTE: requires DB superuser to install `postgraphile_watch` schema)',
export default function (program: program.CommanderStatic) { program.command('list') .description('list the servers') .option('-u, --username <username>', 'administration user name', DEFAULT_USERNAME) .option('-p, --password <password>', 'administration password', DEFAULT_PWD) .option('-h, --host <master-host>', 'master server host', DEFAULT_MASTER_HOST) .option('-P, --port <master-port>', 'master server port', DEFAULT_MASTER_PORT) .action(function (opts) { list(opts); }); }
cli .command('listen') .alias('l') .description('start the server and listen for requests') .option('-H, --host <host>', 'host') .option('-p, --port <port>', 'port number', Polly.Defaults.port) .option( '-n, --api-namespace <namespace>', 'api namespace', Polly.Defaults.apiNamespace ) .option( '-d, --recordings-dir <path>', 'recordings directory', Polly.Defaults.recordingsDir ) .option( '-s, --recording-size-limit <limit>', 'recording size limit', Polly.Defaults.recordingSizeLimit ) .option('-q, --quiet', 'disable the logging') .action(function(options) { new Polly.Server(options).listen(); });