@base44-preview/cli 0.0.41-pr.394.651c0cf → 0.0.41-pr.394.740d654

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -247899,7 +247899,16 @@ async function getAllFunctionNames() {
247899
247899
  const { functions } = await readProjectConfig();
247900
247900
  return functions.map((fn) => fn.name);
247901
247901
  }
247902
+ function validateLimit(limit) {
247903
+ if (limit === undefined)
247904
+ return;
247905
+ const n2 = Number.parseInt(limit, 10);
247906
+ if (Number.isNaN(n2) || n2 < 1 || n2 > 1000) {
247907
+ throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
247908
+ }
247909
+ }
247902
247910
  async function logsAction(options) {
247911
+ validateLimit(options.limit);
247903
247912
  const specifiedFunctions = parseFunctionNames(options.function);
247904
247913
  const allProjectFunctions = await getAllFunctionNames();
247905
247914
  const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions;
@@ -247916,13 +247925,7 @@ async function logsAction(options) {
247916
247925
  return { outroMessage: "Fetched logs", stdout: logsOutput };
247917
247926
  }
247918
247927
  function getLogsCommand(context) {
247919
- return new Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time (ISO format)", normalizeDatetime).option("--until <datetime>", "Show logs until this time (ISO format)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)", (v) => {
247920
- const n2 = Number.parseInt(v, 10);
247921
- if (Number.isNaN(n2) || n2 < 1 || n2 > 1000) {
247922
- throw new InvalidArgumentError(`Invalid limit: "${v}". Must be a number between 1 and 1000.`);
247923
- }
247924
- return v;
247925
- }).addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).action(async (options) => {
247928
+ return new Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time (ISO format)", normalizeDatetime).option("--until <datetime>", "Show logs until this time (ISO format)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).action(async (options) => {
247926
247929
  await runCommand(() => logsAction(options), { requireAuth: true }, context);
247927
247930
  });
247928
247931
  }
@@ -247988,19 +247991,18 @@ function parseEntries(entries) {
247988
247991
  }
247989
247992
  return secrets;
247990
247993
  }
247991
- function validateInput(command) {
247992
- const entries = command.args;
247993
- const { envFile } = command.opts();
247994
+ function validateInput(entries, options) {
247994
247995
  const hasEntries = entries.length > 0;
247995
- const hasEnvFile = Boolean(envFile);
247996
+ const hasEnvFile = Boolean(options.envFile);
247996
247997
  if (!hasEntries && !hasEnvFile) {
247997
- command.error("Provide KEY=VALUE pairs or use --env-file. Example: base44 secrets set KEY1=VALUE1 KEY2=VALUE2");
247998
+ throw new InvalidInputError("Provide KEY=VALUE pairs or use --env-file. Example: base44 secrets set KEY1=VALUE1 KEY2=VALUE2");
247998
247999
  }
247999
248000
  if (hasEntries && hasEnvFile) {
248000
- command.error("Provide KEY=VALUE pairs or --env-file, but not both.");
248001
+ throw new InvalidInputError("Provide KEY=VALUE pairs or --env-file, but not both.");
248001
248002
  }
248002
248003
  }
248003
248004
  async function setSecretsAction(entries, options) {
248005
+ validateInput(entries, options);
248004
248006
  let secrets;
248005
248007
  if (options.envFile) {
248006
248008
  secrets = await parseEnvFile(resolve3(options.envFile));
@@ -248023,7 +248025,7 @@ async function setSecretsAction(entries, options) {
248023
248025
  };
248024
248026
  }
248025
248027
  function getSecretsSetCommand(context) {
248026
- return new Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").hook("preAction", validateInput).action(async (entries, options) => {
248028
+ return new Command("set").description("Set one or more secrets (KEY=VALUE format)").argument("[entries...]", "KEY=VALUE pairs (e.g. KEY1=VALUE1 KEY2=VALUE2)").option("--env-file <path>", "Path to .env file").action(async (entries, options) => {
248027
248029
  await runCommand(() => setSecretsAction(entries, options), { requireAuth: true }, context);
248028
248030
  });
248029
248031
  }
@@ -255142,4 +255144,4 @@ export {
255142
255144
  CLIExitError
255143
255145
  };
255144
255146
 
255145
- //# debugId=46E1FE346B46A74664756E2164756E21
255147
+ //# debugId=4CD570882C8562B364756E2164756E21