UNPKG

convex

Version:

Client for the Convex Cloud

79 lines (78 loc) 3.32 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var logs_exports = {}; __export(logs_exports, { logs: () => logs }); module.exports = __toCommonJS(logs_exports); var import_extra_typings = require("@commander-js/extra-typings"); var import_chalk = __toESM(require("chalk"), 1); var import_context = require("../bundler/context.js"); var import_api = require("./lib/api.js"); var import_command = require("./lib/command.js"); var import_logs = require("./lib/logs.js"); var import_utils = require("./lib/utils/utils.js"); const logs = new import_extra_typings.Command("logs").summary("Watch logs from your deployment").description( "Stream function logs from your Convex deployment.\nBy default, this streams from your project's dev deployment." ).option( "--history [n]", "Show `n` most recent logs. Defaults to showing all available logs.", import_utils.parseInteger ).option( "--success", "Print a log line for every successful function execution", false ).addDeploymentSelectionOptions((0, import_command.actionDescription)("Watch logs from")).showHelpAfterError().action(async (cmdOptions) => { const ctx = import_context.oneoffContext; const deploymentSelection = (0, import_api.deploymentSelectionFromOptions)(cmdOptions); const credentials = await (0, import_api.fetchDeploymentCredentialsProvisionProd)( ctx, deploymentSelection ); if (cmdOptions.prod) { (0, import_context.logMessage)( ctx, import_chalk.default.yellow( `Watching logs for production deployment ${credentials.deploymentName || ""}...` ) ); } else { (0, import_context.logMessage)( ctx, import_chalk.default.yellow( `Watching logs for dev deployment ${credentials.deploymentName || ""}...` ) ); } await (0, import_logs.watchLogs)(ctx, credentials.url, credentials.adminKey, "stdout", { history: cmdOptions.history, success: cmdOptions.success }); }); //# sourceMappingURL=logs.js.map