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

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
@@ -238255,6 +238255,22 @@ var DeployFunctionsResponseSchema = exports_external.object({
238255
238255
  skipped: exports_external.array(exports_external.string()).optional().nullable(),
238256
238256
  errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
238257
238257
  });
238258
+ var FunctionInfoSchema = exports_external.object({
238259
+ name: exports_external.string(),
238260
+ deployment_id: exports_external.string(),
238261
+ entry: exports_external.string(),
238262
+ files: exports_external.array(FunctionFileSchema),
238263
+ automations: exports_external.array(AutomationSchema)
238264
+ }).transform((data) => ({
238265
+ name: data.name,
238266
+ deploymentId: data.deployment_id,
238267
+ entry: data.entry,
238268
+ files: data.files,
238269
+ automations: data.automations
238270
+ }));
238271
+ var ListFunctionsResponseSchema = exports_external.object({
238272
+ functions: exports_external.array(FunctionInfoSchema)
238273
+ });
238258
238274
  var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
238259
238275
  var FunctionLogEntrySchema = exports_external.object({
238260
238276
  time: exports_external.string(),
@@ -238328,6 +238344,20 @@ async function fetchFunctionLogs(functionName, filters = {}) {
238328
238344
  }
238329
238345
  return result.data;
238330
238346
  }
238347
+ async function listDeployedFunctions() {
238348
+ const appClient = getAppClient();
238349
+ let response;
238350
+ try {
238351
+ response = await appClient.get("backend-functions", { timeout: 30000 });
238352
+ } catch (error48) {
238353
+ throw await ApiError.fromHttpError(error48, "listing deployed functions");
238354
+ }
238355
+ const result = ListFunctionsResponseSchema.safeParse(await response.json());
238356
+ if (!result.success) {
238357
+ throw new SchemaValidationError("Invalid response from server", result.error);
238358
+ }
238359
+ return result.data;
238360
+ }
238331
238361
  // src/core/resources/function/config.ts
238332
238362
  import { basename as basename2, dirname as dirname3, join as join5, relative } from "node:path";
238333
238363
  async function readFunctionConfig(configPath) {
@@ -247638,10 +247668,36 @@ async function deployFunctionsAction() {
247638
247668
  }
247639
247669
  return { outroMessage: "Functions deployed to Base44" };
247640
247670
  }
247641
- function getFunctionsDeployCommand(context) {
247642
- return new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
247671
+ function getDeployCommand(context) {
247672
+ return new Command("deploy").description("Deploy local functions to Base44").action(async () => {
247643
247673
  await runCommand(deployFunctionsAction, { requireAuth: true }, context);
247644
- }));
247674
+ });
247675
+ }
247676
+
247677
+ // src/cli/commands/functions/list.ts
247678
+ async function listFunctionsAction() {
247679
+ const { functions } = await runTask("Fetching functions...", async () => listDeployedFunctions(), { errorMessage: "Failed to fetch functions" });
247680
+ if (functions.length === 0) {
247681
+ return { outroMessage: "No functions on remote" };
247682
+ }
247683
+ for (const fn of functions) {
247684
+ const automationCount = fn.automations.length;
247685
+ const automationLabel = automationCount > 0 ? theme.styles.dim(` (${automationCount} automation${automationCount > 1 ? "s" : ""})`) : "";
247686
+ R2.message(` ${fn.name}${automationLabel}`);
247687
+ }
247688
+ return {
247689
+ outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
247690
+ };
247691
+ }
247692
+ function getListCommand(context) {
247693
+ return new Command("list").description("List all deployed functions").action(async () => {
247694
+ await runCommand(listFunctionsAction, { requireAuth: true }, context);
247695
+ });
247696
+ }
247697
+
247698
+ // src/cli/commands/functions/index.ts
247699
+ function getFunctionsCommand(context) {
247700
+ return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
247645
247701
  }
247646
247702
 
247647
247703
  // src/cli/commands/project/create.ts
@@ -247887,7 +247943,7 @@ ${summaryLines.join(`
247887
247943
  }
247888
247944
  return { outroMessage: "App deployed successfully" };
247889
247945
  }
247890
- function getDeployCommand(context) {
247946
+ function getDeployCommand2(context) {
247891
247947
  return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
247892
247948
  await runCommand(() => deployAction({
247893
247949
  ...options,
@@ -251179,13 +251235,13 @@ function createProgram(context) {
251179
251235
  program2.addCommand(getLogoutCommand(context));
251180
251236
  program2.addCommand(getCreateCommand(context));
251181
251237
  program2.addCommand(getDashboardCommand(context));
251182
- program2.addCommand(getDeployCommand(context));
251238
+ program2.addCommand(getDeployCommand2(context));
251183
251239
  program2.addCommand(getLinkCommand(context));
251184
251240
  program2.addCommand(getEjectCommand(context));
251185
251241
  program2.addCommand(getEntitiesPushCommand(context));
251186
251242
  program2.addCommand(getAgentsCommand(context));
251187
251243
  program2.addCommand(getConnectorsCommand(context));
251188
- program2.addCommand(getFunctionsDeployCommand(context));
251244
+ program2.addCommand(getFunctionsCommand(context));
251189
251245
  program2.addCommand(getSecretsCommand(context));
251190
251246
  program2.addCommand(getSiteCommand(context));
251191
251247
  program2.addCommand(getTypesCommand(context));
@@ -255432,4 +255488,4 @@ export {
255432
255488
  CLIExitError
255433
255489
  };
255434
255490
 
255435
- //# debugId=3630160A15E12A6F64756E2164756E21
255491
+ //# debugId=B10E323387F5676964756E2164756E21