@base44-preview/cli 0.0.44-pr.380.ca88494 → 0.0.44-pr.381.3470954

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
@@ -238308,6 +238308,16 @@ async function deployFunctions(functions) {
238308
238308
  }
238309
238309
  return result.data;
238310
238310
  }
238311
+ async function deleteSingleFunction(name2) {
238312
+ const appClient = getAppClient();
238313
+ try {
238314
+ await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
238315
+ timeout: 60000
238316
+ });
238317
+ } catch (error48) {
238318
+ throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
238319
+ }
238320
+ }
238311
238321
  function buildLogsQueryString(filters) {
238312
238322
  const params = new URLSearchParams;
238313
238323
  if (filters.since) {
@@ -247636,6 +247646,59 @@ function getEntitiesPushCommand(context) {
247636
247646
  }));
247637
247647
  }
247638
247648
 
247649
+ // src/cli/commands/functions/delete.ts
247650
+ async function deleteFunctionsAction(names) {
247651
+ let deleted = 0;
247652
+ let notFound = 0;
247653
+ let errors5 = 0;
247654
+ for (const name2 of names) {
247655
+ try {
247656
+ await runTask(`Deleting ${name2}...`, () => deleteSingleFunction(name2), {
247657
+ successMessage: `${name2} deleted`,
247658
+ errorMessage: `Failed to delete ${name2}`
247659
+ });
247660
+ deleted++;
247661
+ } catch (error48) {
247662
+ if (error48 instanceof ApiError && error48.statusCode === 404) {
247663
+ notFound++;
247664
+ } else {
247665
+ errors5++;
247666
+ }
247667
+ }
247668
+ }
247669
+ if (names.length === 1) {
247670
+ if (deleted)
247671
+ return { outroMessage: `Function "${names[0]}" deleted` };
247672
+ if (notFound)
247673
+ return { outroMessage: `Function "${names[0]}" not found` };
247674
+ return { outroMessage: `Failed to delete "${names[0]}"` };
247675
+ }
247676
+ const total = names.length;
247677
+ const parts = [];
247678
+ if (deleted > 0)
247679
+ parts.push(`${deleted}/${total} deleted`);
247680
+ if (notFound > 0)
247681
+ parts.push(`${notFound} not found`);
247682
+ if (errors5 > 0)
247683
+ parts.push(`${errors5} error${errors5 !== 1 ? "s" : ""}`);
247684
+ return { outroMessage: parts.join(", ") };
247685
+ }
247686
+ function parseNames(args) {
247687
+ return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
247688
+ }
247689
+ function validateNames(command) {
247690
+ const names = parseNames(command.args);
247691
+ if (names.length === 0) {
247692
+ command.error("At least one function name is required");
247693
+ }
247694
+ }
247695
+ function getDeleteCommand(context) {
247696
+ return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").hook("preAction", validateNames).action(async (rawNames) => {
247697
+ const names = parseNames(rawNames);
247698
+ await runCommand(() => deleteFunctionsAction(names), { requireAuth: true }, context);
247699
+ });
247700
+ }
247701
+
247639
247702
  // src/cli/commands/functions/deploy.ts
247640
247703
  async function deployFunctionsAction() {
247641
247704
  const { functions } = await readProjectConfig();
@@ -247697,7 +247760,7 @@ function getListCommand(context) {
247697
247760
 
247698
247761
  // src/cli/commands/functions/index.ts
247699
247762
  function getFunctionsCommand(context) {
247700
- return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
247763
+ return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context)).addCommand(getListCommand(context));
247701
247764
  }
247702
247765
 
247703
247766
  // src/cli/commands/project/create.ts
@@ -255488,4 +255551,4 @@ export {
255488
255551
  CLIExitError
255489
255552
  };
255490
255553
 
255491
- //# debugId=B10E323387F5676964756E2164756E21
255554
+ //# debugId=2742D86806A6F2DB64756E2164756E21