@base44-preview/cli 0.0.41-pr.380.73b00fc → 0.0.41-pr.381.83d161e

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
@@ -231132,21 +231132,6 @@ var DeployFunctionsResponseSchema = exports_external.object({
231132
231132
  skipped: exports_external.array(exports_external.string()).optional().nullable(),
231133
231133
  errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
231134
231134
  });
231135
- var FunctionAutomationInfoSchema = exports_external.object({
231136
- name: exports_external.string(),
231137
- type: exports_external.string(),
231138
- is_active: exports_external.boolean()
231139
- });
231140
- var FunctionInfoSchema = exports_external.object({
231141
- name: exports_external.string(),
231142
- deployment_id: exports_external.string(),
231143
- entry: exports_external.string(),
231144
- files: exports_external.array(FunctionFileSchema),
231145
- automations: exports_external.array(FunctionAutomationInfoSchema)
231146
- });
231147
- var ListFunctionsResponseSchema = exports_external.object({
231148
- functions: exports_external.array(FunctionInfoSchema)
231149
- });
231150
231135
  var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
231151
231136
  var FunctionLogEntrySchema = exports_external.object({
231152
231137
  time: exports_external.string(),
@@ -231184,6 +231169,16 @@ async function deployFunctions(functions) {
231184
231169
  }
231185
231170
  return result.data;
231186
231171
  }
231172
+ async function deleteSingleFunction(name2) {
231173
+ const appClient = getAppClient();
231174
+ try {
231175
+ await appClient.delete(`backend-functions/${encodeURIComponent(name2)}`, {
231176
+ timeout: 60000
231177
+ });
231178
+ } catch (error48) {
231179
+ throw await ApiError.fromHttpError(error48, `deleting function "${name2}"`);
231180
+ }
231181
+ }
231187
231182
  function buildLogsQueryString(filters) {
231188
231183
  const params = new URLSearchParams;
231189
231184
  if (filters.since) {
@@ -231220,20 +231215,6 @@ async function fetchFunctionLogs(functionName, filters = {}) {
231220
231215
  }
231221
231216
  return result.data;
231222
231217
  }
231223
- async function listDeployedFunctions() {
231224
- const appClient = getAppClient();
231225
- let response;
231226
- try {
231227
- response = await appClient.get("backend-functions", { timeout: 30000 });
231228
- } catch (error48) {
231229
- throw await ApiError.fromHttpError(error48, "listing deployed functions");
231230
- }
231231
- const result = ListFunctionsResponseSchema.safeParse(await response.json());
231232
- if (!result.success) {
231233
- throw new SchemaValidationError("Invalid response from server", result.error);
231234
- }
231235
- return result.data;
231236
- }
231237
231218
  // src/core/resources/function/config.ts
231238
231219
  import { basename as basename2, dirname as dirname3, join as join5, relative } from "node:path";
231239
231220
  async function readFunctionConfig(configPath) {
@@ -240366,6 +240347,63 @@ function getEntitiesPushCommand(context) {
240366
240347
  }));
240367
240348
  }
240368
240349
 
240350
+ // src/cli/utils/parseNames.ts
240351
+ function parseNames(args) {
240352
+ return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
240353
+ }
240354
+
240355
+ // src/cli/commands/functions/delete.ts
240356
+ async function deleteFunctionsAction(names) {
240357
+ let deleted = 0;
240358
+ let notFound = 0;
240359
+ let errors4 = 0;
240360
+ let completed = 0;
240361
+ const total = names.length;
240362
+ for (const name2 of names) {
240363
+ R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
240364
+ try {
240365
+ await deleteSingleFunction(name2);
240366
+ R2.success(`${name2.padEnd(25)} deleted`);
240367
+ deleted++;
240368
+ } catch (error48) {
240369
+ if (error48 instanceof ApiError && error48.statusCode === 404) {
240370
+ R2.warn(`${name2.padEnd(25)} not found`);
240371
+ notFound++;
240372
+ } else {
240373
+ R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
240374
+ errors4++;
240375
+ }
240376
+ }
240377
+ completed++;
240378
+ }
240379
+ if (names.length === 1) {
240380
+ if (deleted)
240381
+ return { outroMessage: `Function "${names[0]}" deleted` };
240382
+ if (notFound)
240383
+ return { outroMessage: `Function "${names[0]}" not found` };
240384
+ return { outroMessage: `Failed to delete "${names[0]}"` };
240385
+ }
240386
+ const parts = [];
240387
+ if (deleted > 0)
240388
+ parts.push(`${deleted}/${total} deleted`);
240389
+ if (notFound > 0)
240390
+ parts.push(`${notFound} not found`);
240391
+ if (errors4 > 0)
240392
+ parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
240393
+ return { outroMessage: parts.join(", ") };
240394
+ }
240395
+ function getDeleteCommand(context) {
240396
+ return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
240397
+ await runCommand(() => {
240398
+ const names = parseNames(rawNames);
240399
+ if (names.length === 0) {
240400
+ throw new InvalidInputError("At least one function name is required");
240401
+ }
240402
+ return deleteFunctionsAction(names);
240403
+ }, { requireAuth: true }, context);
240404
+ });
240405
+ }
240406
+
240369
240407
  // src/cli/commands/functions/deploy.ts
240370
240408
  async function deployFunctionsAction() {
240371
240409
  const { functions } = await readProjectConfig();
@@ -240404,30 +240442,9 @@ function getDeployCommand(context) {
240404
240442
  });
240405
240443
  }
240406
240444
 
240407
- // src/cli/commands/functions/list.ts
240408
- async function listFunctionsAction() {
240409
- const { functions } = await listDeployedFunctions();
240410
- if (functions.length === 0) {
240411
- return { outroMessage: "No functions on remote" };
240412
- }
240413
- for (const fn of functions) {
240414
- const autoCount = fn.automations.length;
240415
- const autoLabel = autoCount > 0 ? theme.styles.dim(` (${autoCount} automation${autoCount > 1 ? "s" : ""})`) : "";
240416
- R2.message(` ${fn.name}${autoLabel}`);
240417
- }
240418
- return {
240419
- outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
240420
- };
240421
- }
240422
- function getListCommand(context) {
240423
- return new Command("list").description("List all deployed functions").action(async () => {
240424
- await runCommand(listFunctionsAction, { requireAuth: true }, context);
240425
- });
240426
- }
240427
-
240428
240445
  // src/cli/commands/functions/index.ts
240429
240446
  function getFunctionsCommand(context) {
240430
- return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
240447
+ return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context));
240431
240448
  }
240432
240449
 
240433
240450
  // src/cli/commands/project/create.ts
@@ -248158,4 +248175,4 @@ export {
248158
248175
  CLIExitError
248159
248176
  };
248160
248177
 
248161
- //# debugId=1CB047BBC03A3D1264756E2164756E21
248178
+ //# debugId=76EF0E044F070BC564756E2164756E21