@base44-preview/cli 0.0.41-pr.380.73b00fc → 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 +71 -55
- package/dist/cli/index.js.map +8 -7
- package/package.json +85 -86
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) {
|
|
@@ -231500,10 +231481,10 @@ var package_default = {
|
|
|
231500
231481
|
dev: "./bin/dev.ts",
|
|
231501
231482
|
start: "./bin/run.js",
|
|
231502
231483
|
clean: "rm -rf dist && mkdir -p dist",
|
|
231503
|
-
lint: "biome check src tests",
|
|
231504
|
-
"lint:fix": "biome check --write src tests",
|
|
231505
231484
|
test: "vitest run",
|
|
231506
231485
|
"test:watch": "vitest",
|
|
231486
|
+
lint: "cd ../.. && bun run lint",
|
|
231487
|
+
"lint:fix": "cd ../.. && bun run lint:fix",
|
|
231507
231488
|
"build:binaries": "bun run infra/build-binaries.ts",
|
|
231508
231489
|
"package:binaries": "bun run infra/package-binaries.ts"
|
|
231509
231490
|
},
|
|
@@ -231519,7 +231500,6 @@ var package_default = {
|
|
|
231519
231500
|
url: "https://github.com/base44/cli"
|
|
231520
231501
|
},
|
|
231521
231502
|
devDependencies: {
|
|
231522
|
-
"@biomejs/biome": "^2.0.0",
|
|
231523
231503
|
"@clack/prompts": "^1.0.1",
|
|
231524
231504
|
"@seald-io/nedb": "^4.1.2",
|
|
231525
231505
|
"@types/bun": "^1.2.15",
|
|
@@ -240366,6 +240346,63 @@ function getEntitiesPushCommand(context) {
|
|
|
240366
240346
|
}));
|
|
240367
240347
|
}
|
|
240368
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
|
+
|
|
240369
240406
|
// src/cli/commands/functions/deploy.ts
|
|
240370
240407
|
async function deployFunctionsAction() {
|
|
240371
240408
|
const { functions } = await readProjectConfig();
|
|
@@ -240404,30 +240441,9 @@ function getDeployCommand(context) {
|
|
|
240404
240441
|
});
|
|
240405
240442
|
}
|
|
240406
240443
|
|
|
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
240444
|
// src/cli/commands/functions/index.ts
|
|
240429
240445
|
function getFunctionsCommand(context) {
|
|
240430
|
-
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(
|
|
240446
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getDeleteCommand(context));
|
|
240431
240447
|
}
|
|
240432
240448
|
|
|
240433
240449
|
// src/cli/commands/project/create.ts
|
|
@@ -248158,4 +248174,4 @@ export {
|
|
|
248158
248174
|
CLIExitError
|
|
248159
248175
|
};
|
|
248160
248176
|
|
|
248161
|
-
//# debugId=
|
|
248177
|
+
//# debugId=1D09B6E5D2E89F0064756E2164756E21
|