@base44-preview/cli 0.0.40-pr.388.e82c3e8 → 0.0.41-pr.379.099a4e6
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 +41 -7
- package/dist/cli/index.js.map +4 -4
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -231453,7 +231453,7 @@ import { join as join7 } from "node:path";
|
|
|
231453
231453
|
// package.json
|
|
231454
231454
|
var package_default = {
|
|
231455
231455
|
name: "base44",
|
|
231456
|
-
version: "0.0.
|
|
231456
|
+
version: "0.0.41",
|
|
231457
231457
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
231458
231458
|
type: "module",
|
|
231459
231459
|
bin: {
|
|
@@ -241845,13 +241845,19 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
241845
241845
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
241846
241846
|
var import_express3 = __toESM(require_express(), 1);
|
|
241847
241847
|
var import_multer = __toESM(require_multer(), 1);
|
|
241848
|
-
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
241848
|
+
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
241849
241849
|
import fs28 from "node:fs";
|
|
241850
241850
|
import path18 from "node:path";
|
|
241851
|
+
function createFileToken(fileUri) {
|
|
241852
|
+
return createHash("sha256").update(fileUri).digest("hex");
|
|
241853
|
+
}
|
|
241851
241854
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
241852
241855
|
const router = import_express3.Router({ mergeParams: true });
|
|
241853
241856
|
const parseBody = import_express3.json();
|
|
241857
|
+
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
241854
241858
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
241859
|
+
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
241860
|
+
const MAX_FILE_SIZE = 50 * 1024 * 1024;
|
|
241855
241861
|
const storage = import_multer.default.diskStorage({
|
|
241856
241862
|
destination: mediaFilesDir,
|
|
241857
241863
|
filename: (_req, file2, cb2) => {
|
|
@@ -241859,8 +241865,18 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
241859
241865
|
cb2(null, `${randomUUID4()}${ext}`);
|
|
241860
241866
|
}
|
|
241861
241867
|
});
|
|
241862
|
-
const
|
|
241868
|
+
const privateStorage = import_multer.default.diskStorage({
|
|
241869
|
+
destination: privateFilesDir,
|
|
241870
|
+
filename: (_req, file2, cb2) => {
|
|
241871
|
+
const ext = path18.extname(file2.originalname);
|
|
241872
|
+
cb2(null, `${randomUUID4()}${ext}`);
|
|
241873
|
+
}
|
|
241874
|
+
});
|
|
241863
241875
|
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
|
+
});
|
|
241864
241880
|
router.post("/Core/UploadFile", upload.single("file"), (req, res) => {
|
|
241865
241881
|
if (!req.file) {
|
|
241866
241882
|
res.status(400).json({ error: "No file uploaded" });
|
|
@@ -241869,7 +241885,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
241869
241885
|
const file_url = `${baseUrl}/media/${req.file.filename}`;
|
|
241870
241886
|
res.json({ file_url });
|
|
241871
241887
|
});
|
|
241872
|
-
router.post("/Core/UploadPrivateFile",
|
|
241888
|
+
router.post("/Core/UploadPrivateFile", privateUpload.single("file"), (req, res) => {
|
|
241873
241889
|
if (!req.file) {
|
|
241874
241890
|
res.status(400).json({ error: "No file uploaded" });
|
|
241875
241891
|
return;
|
|
@@ -241883,8 +241899,8 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
241883
241899
|
res.status(400).json({ error: "file_uri is required" });
|
|
241884
241900
|
return;
|
|
241885
241901
|
}
|
|
241886
|
-
const
|
|
241887
|
-
const signed_url = `${baseUrl}/media/${file_uri}?
|
|
241902
|
+
const token2 = createFileToken(file_uri);
|
|
241903
|
+
const signed_url = `${baseUrl}/media/private/${file_uri}?token=${token2}`;
|
|
241888
241904
|
res.json({ signed_url });
|
|
241889
241905
|
});
|
|
241890
241906
|
router.post("/Core/:endpointName", (req, res, next) => {
|
|
@@ -243653,6 +243669,24 @@ async function createDevServer(options8) {
|
|
|
243653
243669
|
const entityRoutes = createEntityRoutes(db2, devLogger, remoteProxy, (...args) => emitEntityEvent(...args));
|
|
243654
243670
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
243655
243671
|
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
|
+
});
|
|
243656
243690
|
app.use("/media", import_express4.default.static(mediaFilesDir));
|
|
243657
243691
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
243658
243692
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
@@ -248103,4 +248137,4 @@ export {
|
|
|
248103
248137
|
CLIExitError
|
|
248104
248138
|
};
|
|
248105
248139
|
|
|
248106
|
-
//# debugId=
|
|
248140
|
+
//# debugId=E2A1C79322A8941664756E2164756E21
|