@rockset/cli
Version:
Official Rockset CLI
55 lines (53 loc) • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const core_2 = require("@rockset/core");
const base_command_1 = require("../../base-command");
const prompts = require("prompts");
const chalk = require("chalk");
const helper_1 = require("@rockset/core/dist/helper");
let DownloadQueryLambda = /** @class */ (() => {
class DownloadQueryLambda extends base_command_1.RockCommand {
async run() {
const { flags } = await this.parse(DownloadQueryLambda);
const downloadLambdas = () => core_2.main.downloadQueryLambdas({
onWriteLambda: (lambda) => {
this.log(chalk `Downloaded lambda {green ${lambda.fullName}}`);
},
onNoOp: () => this.log('No lambdas found.'),
onDuplicateLambdas: (duplicates) => {
this.warn(`Your filesystem is case-insensitive, and we have found multiple Query Lambdas that map to the same path. Skipping all of the following Query Lambdas.
${helper_1.prettyPrint(duplicates)}
Please delete or rename Query Lambdas that are duplicates before re-attempting to download them.
`);
},
});
if (flags.yes) {
await downloadLambdas();
}
else {
const { c } = (await prompts({
type: 'confirm',
name: 'c',
initial: false,
message: `WARNING: This will overwrite all Query Lambda objects downloaded to the current project, and can result in loss of work. Are you sure?`,
}));
if (c) {
await downloadLambdas();
}
}
}
}
DownloadQueryLambda.flags = {
help: core_1.Flags.help({ char: 'h' }),
yes: core_1.Flags.boolean({
char: 'y',
default: false,
description: 'bypass the safety checks, and automatically engage in dangerous actions',
}),
};
DownloadQueryLambda.description = `download Query Lambda entities from Rockset to your local project
Note: For operating systems that are case insensitive (eg. MacOS and Windows), it is possible that two different Query Lambdas from the server will be associated with the same paths on disk. This command will skip Query Lambdas that would otherwise overwrite each other.`;
return DownloadQueryLambda;
})();
exports.default = DownloadQueryLambda;