@base44-preview/cli 0.0.41-pr.380.3494f7e → 0.0.41-pr.381.02b09f5

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) {
@@ -240365,6 +240346,63 @@ function getEntitiesPushCommand(context) {
240365
240346
  }));
240366
240347
  }
240367
240348
 
240349
+ // src/cli/utils/parseNames.ts
240350
+ function parseNames(args) {
240351
+ return args.flatMap((arg) => arg.split(",")).map((n2) => n2.trim()).filter(Boolean);
240352
+ }
240353
+
240354
+ // src/cli/commands/functions/delete.ts
240355
+ async function deleteFunctionsAction(names) {
240356
+ let deleted = 0;
240357
+ let notFound = 0;
240358
+ let errors4 = 0;
240359
+ let completed = 0;
240360
+ const total = names.length;
240361
+ for (const name2 of names) {
240362
+ R2.step(theme.styles.dim(`[${completed + 1}/${total}] Deleting ${name2}...`));
240363
+ try {
240364
+ await deleteSingleFunction(name2);
240365
+ R2.success(`${name2.padEnd(25)} deleted`);
240366
+ deleted++;
240367
+ } catch (error48) {
240368
+ if (error48 instanceof ApiError && error48.statusCode === 404) {
240369
+ R2.warn(`${name2.padEnd(25)} not found`);
240370
+ notFound++;
240371
+ } else {
240372
+ R2.error(`${name2.padEnd(25)} error: ${error48 instanceof Error ? error48.message : String(error48)}`);
240373
+ errors4++;
240374
+ }
240375
+ }
240376
+ completed++;
240377
+ }
240378
+ if (names.length === 1) {
240379
+ if (deleted)
240380
+ return { outroMessage: `Function "${names[0]}" deleted` };
240381
+ if (notFound)
240382
+ return { outroMessage: `Function "${names[0]}" not found` };
240383
+ return { outroMessage: `Failed to delete "${names[0]}"` };
240384
+ }
240385
+ const parts = [];
240386
+ if (deleted > 0)
240387
+ parts.push(`${deleted}/${total} deleted`);
240388
+ if (notFound > 0)
240389
+ parts.push(`${notFound} not found`);
240390
+ if (errors4 > 0)
240391
+ parts.push(`${errors4} error${errors4 !== 1 ? "s" : ""}`);
240392
+ return { outroMessage: parts.join(", ") };
240393
+ }
240394
+ function getDeleteCommand(context) {
240395
+ return new Command("delete").description("Delete deployed functions").argument("<names...>", "Function names to delete").action(async (rawNames) => {
240396
+ await runCommand(() => {
240397
+ const names = parseNames(rawNames);
240398
+ if (names.length === 0) {
240399
+ throw new InvalidInputError("At least one function name is required");
240400
+ }
240401
+ return deleteFunctionsAction(names);
240402
+ }, { requireAuth: true }, context);
240403
+ });
240404
+ }
240405
+
240368
240406
  // src/cli/commands/functions/deploy.ts
240369
240407
  async function deployFunctionsAction() {
240370
240408
  const { functions } = await readProjectConfig();
@@ -240403,30 +240441,9 @@ function getDeployCommand(context) {
240403
240441
  });
240404
240442
  }
240405
240443
 
240406
- // src/cli/commands/functions/list.ts
240407
- async function listFunctionsAction() {
240408
- const { functions } = await listDeployedFunctions();
240409
- if (functions.length === 0) {
240410
- return { outroMessage: "No functions on remote" };
240411
- }
240412
- for (const fn of functions) {
240413
- const autoCount = fn.automations.length;
240414
- const autoLabel = autoCount > 0 ? theme.styles.dim(` (${autoCount} automation${autoCount > 1 ? "s" : ""})`) : "";
240415
- R2.message(` ${fn.name}${autoLabel}`);
240416
- }
240417
- return {
240418
- outroMessage: `${functions.length} function${functions.length !== 1 ? "s" : ""} on remote`
240419
- };
240420
- }
240421
- function getListCommand(context) {
240422
- return new Command("list").description("List all deployed functions").action(async () => {
240423
- await runCommand(listFunctionsAction, { requireAuth: true }, context);
240424
- });
240425
- }
240426
-
240427
240444
  // src/cli/commands/functions/index.ts
240428
240445
  function getFunctionsCommand(context) {
240429
- return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
240446
+ return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context));
240430
240447
  }
240431
240448
 
240432
240449
  // src/cli/commands/project/create.ts
@@ -248157,4 +248174,4 @@ export {
248157
248174
  CLIExitError
248158
248175
  };
248159
248176
 
248160
- //# debugId=3F388910E27CD6A764756E2164756E21
248177
+ //# debugId=1D09B6E5D2E89F0064756E2164756E21