UNPKG

convex

Version:

Client for the Convex Cloud

40 lines (38 loc) 1.44 kB
import { oneoffContext } from "../bundler/context.js"; import { deploymentSelectionWithinProjectFromOptions, loadSelectedDeploymentCredentials, } from "./lib/api.js"; import { Command, Option } from "@commander-js/extra-typings"; import { actionDescription } from "./lib/command.js"; import { functionSpecForDeployment } from "./lib/functionSpec.js"; import { getDeploymentSelection } from "./lib/deploymentSelection.js"; export const functionSpec = new Command("function-spec") .summary("List function metadata from your deployment") .description( "List argument and return values to your Convex functions.\n\n" + "By default, this inspects your dev deployment.", ) .allowExcessArguments(false) .addOption(new Option("--file", "Output as JSON to a file.")) .addDeploymentSelectionOptions( actionDescription("Read function metadata from"), ) .showHelpAfterError() .action(async (options) => { const ctx = await oneoffContext(options); const deploymentSelection = await getDeploymentSelection(ctx, options); const selectionWithinProject = deploymentSelectionWithinProjectFromOptions(options); const { adminKey, url: deploymentUrl } = await loadSelectedDeploymentCredentials( ctx, deploymentSelection, selectionWithinProject, ); await functionSpecForDeployment(ctx, { deploymentUrl, adminKey, file: !!options.file, }); });