@base44-preview/cli 0.0.41-pr.379.099a4e6 → 0.0.41-pr.380.3494f7e
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 +69 -49
- package/dist/cli/index.js.map +11 -9
- package/package.json +85 -86
package/dist/cli/index.js
CHANGED
|
@@ -231132,6 +231132,21 @@ 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
|
+
});
|
|
231135
231150
|
var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
|
|
231136
231151
|
var FunctionLogEntrySchema = exports_external.object({
|
|
231137
231152
|
time: exports_external.string(),
|
|
@@ -231205,6 +231220,20 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
231205
231220
|
}
|
|
231206
231221
|
return result.data;
|
|
231207
231222
|
}
|
|
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
|
+
}
|
|
231208
231237
|
// src/core/resources/function/config.ts
|
|
231209
231238
|
import { basename as basename2, dirname as dirname3, join as join5, relative } from "node:path";
|
|
231210
231239
|
async function readFunctionConfig(configPath) {
|
|
@@ -231471,10 +231500,10 @@ var package_default = {
|
|
|
231471
231500
|
dev: "./bin/dev.ts",
|
|
231472
231501
|
start: "./bin/run.js",
|
|
231473
231502
|
clean: "rm -rf dist && mkdir -p dist",
|
|
231474
|
-
lint: "biome check src tests",
|
|
231475
|
-
"lint:fix": "biome check --write src tests",
|
|
231476
231503
|
test: "vitest run",
|
|
231477
231504
|
"test:watch": "vitest",
|
|
231505
|
+
lint: "cd ../.. && bun run lint",
|
|
231506
|
+
"lint:fix": "cd ../.. && bun run lint:fix",
|
|
231478
231507
|
"build:binaries": "bun run infra/build-binaries.ts",
|
|
231479
231508
|
"package:binaries": "bun run infra/package-binaries.ts"
|
|
231480
231509
|
},
|
|
@@ -231490,7 +231519,6 @@ var package_default = {
|
|
|
231490
231519
|
url: "https://github.com/base44/cli"
|
|
231491
231520
|
},
|
|
231492
231521
|
devDependencies: {
|
|
231493
|
-
"@biomejs/biome": "^2.0.0",
|
|
231494
231522
|
"@clack/prompts": "^1.0.1",
|
|
231495
231523
|
"@seald-io/nedb": "^4.1.2",
|
|
231496
231524
|
"@types/bun": "^1.2.15",
|
|
@@ -240369,10 +240397,36 @@ async function deployFunctionsAction() {
|
|
|
240369
240397
|
}
|
|
240370
240398
|
return { outroMessage: "Functions deployed to Base44" };
|
|
240371
240399
|
}
|
|
240372
|
-
function
|
|
240373
|
-
return new Command("
|
|
240400
|
+
function getDeployCommand(context) {
|
|
240401
|
+
return new Command("deploy").description("Deploy local functions to Base44").action(async () => {
|
|
240374
240402
|
await runCommand(deployFunctionsAction, { requireAuth: true }, context);
|
|
240375
|
-
})
|
|
240403
|
+
});
|
|
240404
|
+
}
|
|
240405
|
+
|
|
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
|
+
// src/cli/commands/functions/index.ts
|
|
240428
|
+
function getFunctionsCommand(context) {
|
|
240429
|
+
return new Command("functions").description("Manage backend functions").addCommand(getDeployCommand(context)).addCommand(getListCommand(context));
|
|
240376
240430
|
}
|
|
240377
240431
|
|
|
240378
240432
|
// src/cli/commands/project/create.ts
|
|
@@ -240614,7 +240668,7 @@ ${summaryLines.join(`
|
|
|
240614
240668
|
}
|
|
240615
240669
|
return { outroMessage: "App deployed successfully" };
|
|
240616
240670
|
}
|
|
240617
|
-
function
|
|
240671
|
+
function getDeployCommand2(context) {
|
|
240618
240672
|
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
240619
240673
|
await runCommand(() => deployAction({
|
|
240620
240674
|
...options,
|
|
@@ -241845,19 +241899,13 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
241845
241899
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
241846
241900
|
var import_express3 = __toESM(require_express(), 1);
|
|
241847
241901
|
var import_multer = __toESM(require_multer(), 1);
|
|
241848
|
-
import {
|
|
241902
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
241849
241903
|
import fs28 from "node:fs";
|
|
241850
241904
|
import path18 from "node:path";
|
|
241851
|
-
function createFileToken(fileUri) {
|
|
241852
|
-
return createHash("sha256").update(fileUri).digest("hex");
|
|
241853
|
-
}
|
|
241854
241905
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
241855
241906
|
const router = import_express3.Router({ mergeParams: true });
|
|
241856
241907
|
const parseBody = import_express3.json();
|
|
241857
|
-
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
241858
241908
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
241859
|
-
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
241860
|
-
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
241861
241909
|
const storage = import_multer.default.diskStorage({
|
|
241862
241910
|
destination: mediaFilesDir,
|
|
241863
241911
|
filename: (_req, file2, cb2) => {
|
|
@@ -241865,18 +241913,8 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
241865
241913
|
cb2(null, `${randomUUID4()}${ext}`);
|
|
241866
241914
|
}
|
|
241867
241915
|
});
|
|
241868
|
-
const
|
|
241869
|
-
destination: privateFilesDir,
|
|
241870
|
-
filename: (_req, file2, cb2) => {
|
|
241871
|
-
const ext = path18.extname(file2.originalname);
|
|
241872
|
-
cb2(null, `${randomUUID4()}${ext}`);
|
|
241873
|
-
}
|
|
241874
|
-
});
|
|
241916
|
+
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
241875
241917
|
const upload = import_multer.default({ storage, limits: { fileSize: MAX_FILE_SIZE } });
|
|
241876
|
-
const privateUpload = import_multer.default({
|
|
241877
|
-
storage: privateStorage,
|
|
241878
|
-
limits: { fileSize: MAX_FILE_SIZE }
|
|
241879
|
-
});
|
|
241880
241918
|
router.post("/Core/UploadFile", upload.single("file"), (req, res) => {
|
|
241881
241919
|
if (!req.file) {
|
|
241882
241920
|
res.status(400).json({ error: "No file uploaded" });
|
|
@@ -241885,7 +241923,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
241885
241923
|
const file_url = `${baseUrl}/media/${req.file.filename}`;
|
|
241886
241924
|
res.json({ file_url });
|
|
241887
241925
|
});
|
|
241888
|
-
router.post("/Core/UploadPrivateFile",
|
|
241926
|
+
router.post("/Core/UploadPrivateFile", upload.single("file"), (req, res) => {
|
|
241889
241927
|
if (!req.file) {
|
|
241890
241928
|
res.status(400).json({ error: "No file uploaded" });
|
|
241891
241929
|
return;
|
|
@@ -241899,8 +241937,8 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
241899
241937
|
res.status(400).json({ error: "file_uri is required" });
|
|
241900
241938
|
return;
|
|
241901
241939
|
}
|
|
241902
|
-
const
|
|
241903
|
-
const signed_url = `${baseUrl}/media
|
|
241940
|
+
const signature = randomUUID4();
|
|
241941
|
+
const signed_url = `${baseUrl}/media/${file_uri}?signature=${signature}`;
|
|
241904
241942
|
res.json({ signed_url });
|
|
241905
241943
|
});
|
|
241906
241944
|
router.post("/Core/:endpointName", (req, res, next) => {
|
|
@@ -243669,24 +243707,6 @@ async function createDevServer(options8) {
|
|
|
243669
243707
|
const entityRoutes = createEntityRoutes(db2, devLogger, remoteProxy, (...args) => emitEntityEvent(...args));
|
|
243670
243708
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
243671
243709
|
const { path: mediaFilesDir } = await $dir();
|
|
243672
|
-
app.use("/media/private/:fileUri", (req, res, next) => {
|
|
243673
|
-
const { fileUri } = req.params;
|
|
243674
|
-
const token2 = req.query.token;
|
|
243675
|
-
if (!token2) {
|
|
243676
|
-
res.status(401).json({ error: "Missing token" });
|
|
243677
|
-
return;
|
|
243678
|
-
}
|
|
243679
|
-
const expectedToken = createFileToken(fileUri);
|
|
243680
|
-
if (token2 !== expectedToken) {
|
|
243681
|
-
res.status(400).json({
|
|
243682
|
-
error: "InvalidJWT",
|
|
243683
|
-
message: "signature verification failed",
|
|
243684
|
-
statusCode: "400"
|
|
243685
|
-
});
|
|
243686
|
-
return;
|
|
243687
|
-
}
|
|
243688
|
-
next();
|
|
243689
|
-
});
|
|
243690
243710
|
app.use("/media", import_express4.default.static(mediaFilesDir));
|
|
243691
243711
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
243692
243712
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
@@ -243885,13 +243905,13 @@ function createProgram(context) {
|
|
|
243885
243905
|
program2.addCommand(getLogoutCommand(context));
|
|
243886
243906
|
program2.addCommand(getCreateCommand(context));
|
|
243887
243907
|
program2.addCommand(getDashboardCommand(context));
|
|
243888
|
-
program2.addCommand(
|
|
243908
|
+
program2.addCommand(getDeployCommand2(context));
|
|
243889
243909
|
program2.addCommand(getLinkCommand(context));
|
|
243890
243910
|
program2.addCommand(getEjectCommand(context));
|
|
243891
243911
|
program2.addCommand(getEntitiesPushCommand(context));
|
|
243892
243912
|
program2.addCommand(getAgentsCommand(context));
|
|
243893
243913
|
program2.addCommand(getConnectorsCommand(context));
|
|
243894
|
-
program2.addCommand(
|
|
243914
|
+
program2.addCommand(getFunctionsCommand(context));
|
|
243895
243915
|
program2.addCommand(getSecretsCommand(context));
|
|
243896
243916
|
program2.addCommand(getSiteCommand(context));
|
|
243897
243917
|
program2.addCommand(getTypesCommand(context));
|
|
@@ -248137,4 +248157,4 @@ export {
|
|
|
248137
248157
|
CLIExitError
|
|
248138
248158
|
};
|
|
248139
248159
|
|
|
248140
|
-
//# debugId=
|
|
248160
|
+
//# debugId=3F388910E27CD6A764756E2164756E21
|