@base44-preview/cli 0.0.50-pr.475.c453156 → 0.0.50-pr.477.43f5b00
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 +76 -273
- package/dist/cli/index.js.map +9 -11
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -219926,8 +219926,7 @@ var theme = {
|
|
|
219926
219926
|
bold: source_default.bold,
|
|
219927
219927
|
dim: source_default.dim,
|
|
219928
219928
|
error: source_default.red,
|
|
219929
|
-
warn: source_default.yellow
|
|
219930
|
-
info: source_default.cyan
|
|
219929
|
+
warn: source_default.yellow
|
|
219931
219930
|
},
|
|
219932
219931
|
format: {
|
|
219933
219932
|
errorContext(ctx) {
|
|
@@ -243244,7 +243243,6 @@ var package_default = {
|
|
|
243244
243243
|
typescript: "^5.7.2",
|
|
243245
243244
|
vitest: "^4.0.16",
|
|
243246
243245
|
yaml: "^2.8.2",
|
|
243247
|
-
qs: "^6.12.3",
|
|
243248
243246
|
zod: "^4.3.5"
|
|
243249
243247
|
},
|
|
243250
243248
|
engines: {
|
|
@@ -252757,12 +252755,9 @@ function getTypesCommand() {
|
|
|
252757
252755
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
252758
252756
|
}
|
|
252759
252757
|
|
|
252760
|
-
// src/cli/commands/dev.ts
|
|
252761
|
-
import process21 from "node:process";
|
|
252762
|
-
|
|
252763
252758
|
// src/cli/dev/dev-server/main.ts
|
|
252764
252759
|
var import_cors = __toESM(require_lib4(), 1);
|
|
252765
|
-
var
|
|
252760
|
+
var import_express5 = __toESM(require_express(), 1);
|
|
252766
252761
|
import { dirname as dirname16, join as join23 } from "node:path";
|
|
252767
252762
|
|
|
252768
252763
|
// ../../node_modules/get-port/index.js
|
|
@@ -253321,9 +253316,7 @@ class Validator {
|
|
|
253321
253316
|
}
|
|
253322
253317
|
|
|
253323
253318
|
// src/cli/dev/dev-server/db/database.ts
|
|
253324
|
-
var PRIVATE_COLLECTION_PREFIX = "$";
|
|
253325
253319
|
var USER_COLLECTION = "user";
|
|
253326
|
-
var PRIVATE_USER_COLLECTION = PRIVATE_COLLECTION_PREFIX + USER_COLLECTION;
|
|
253327
253320
|
|
|
253328
253321
|
class Database {
|
|
253329
253322
|
collections = new Map;
|
|
@@ -253345,7 +253338,6 @@ class Database {
|
|
|
253345
253338
|
this.schemas.set(USER_COLLECTION, this.buildUserSchema(userEntity));
|
|
253346
253339
|
const collection = new import_nedb.default;
|
|
253347
253340
|
this.collections.set(USER_COLLECTION, collection);
|
|
253348
|
-
this.collections.set(PRIVATE_USER_COLLECTION, new import_nedb.default);
|
|
253349
253341
|
const userInfo = await readAuth();
|
|
253350
253342
|
const now = getNowISOTimestamp();
|
|
253351
253343
|
await collection.insertAsync({
|
|
@@ -253387,9 +253379,7 @@ class Database {
|
|
|
253387
253379
|
return this.collections.get(this.normalizeName(name2));
|
|
253388
253380
|
}
|
|
253389
253381
|
getCollectionNames() {
|
|
253390
|
-
return Array.from(this.collections.keys())
|
|
253391
|
-
return !name2.startsWith(PRIVATE_COLLECTION_PREFIX);
|
|
253392
|
-
});
|
|
253382
|
+
return Array.from(this.collections.keys());
|
|
253393
253383
|
}
|
|
253394
253384
|
dropAll() {
|
|
253395
253385
|
for (const collection of this.collections.values()) {
|
|
@@ -253453,225 +253443,15 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
|
253453
253443
|
});
|
|
253454
253444
|
}
|
|
253455
253445
|
|
|
253456
|
-
// src/cli/dev/dev-server/routes/auth-router.ts
|
|
253457
|
-
var import_express2 = __toESM(require_express(), 1);
|
|
253458
|
-
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
253459
|
-
import { randomInt } from "node:crypto";
|
|
253460
|
-
var LOCAL_DEV_SECRET = "LOCAL_DEV_SECRET";
|
|
253461
|
-
var generateCode = () => {
|
|
253462
|
-
return randomInt(1e5, 1e6).toString();
|
|
253463
|
-
};
|
|
253464
|
-
var createJwtToken = (email3) => {
|
|
253465
|
-
return import_jsonwebtoken.default.sign({ sub: email3 }, LOCAL_DEV_SECRET, {
|
|
253466
|
-
expiresIn: "360d"
|
|
253467
|
-
});
|
|
253468
|
-
};
|
|
253469
|
-
var LoginBody = object({ email: email2(), password: string2() });
|
|
253470
|
-
var VerifyOtpBody = object({ email: email2(), otp_code: string2() });
|
|
253471
|
-
function createAuthRouter(db2, logger2) {
|
|
253472
|
-
const router = import_express2.Router({ mergeParams: true });
|
|
253473
|
-
const parseBody = import_express2.json();
|
|
253474
|
-
router.post("/login", parseBody, async (req, res) => {
|
|
253475
|
-
const { email: email3, password } = LoginBody.parse(req.body);
|
|
253476
|
-
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
253477
|
-
if (result) {
|
|
253478
|
-
const privateUserData = await db2.getCollection(PRIVATE_USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
253479
|
-
if (result.role === "admin" || privateUserData?.password === password) {
|
|
253480
|
-
res.json({
|
|
253481
|
-
access_token: createJwtToken(email3),
|
|
253482
|
-
success: true,
|
|
253483
|
-
user: {}
|
|
253484
|
-
});
|
|
253485
|
-
} else {
|
|
253486
|
-
res.status(400).json({
|
|
253487
|
-
detail: "Invalid email or password",
|
|
253488
|
-
error_type: "HTTPException",
|
|
253489
|
-
message: "Invalid email or password",
|
|
253490
|
-
request_id: null,
|
|
253491
|
-
traceback: ""
|
|
253492
|
-
});
|
|
253493
|
-
}
|
|
253494
|
-
return;
|
|
253495
|
-
}
|
|
253496
|
-
res.status(401).json({ error: "Unauthorized" });
|
|
253497
|
-
});
|
|
253498
|
-
router.post("/register", parseBody, async (req, res) => {
|
|
253499
|
-
const { email: email3, password } = LoginBody.parse(req.body);
|
|
253500
|
-
if ((password || "").length < 8) {
|
|
253501
|
-
res.status(400).json({
|
|
253502
|
-
detail: "Password must be at least 8 characters long",
|
|
253503
|
-
error_type: "HTTPException",
|
|
253504
|
-
message: "Password must be at least 8 characters long",
|
|
253505
|
-
request_id: null,
|
|
253506
|
-
traceback: ""
|
|
253507
|
-
});
|
|
253508
|
-
return;
|
|
253509
|
-
}
|
|
253510
|
-
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
253511
|
-
if (result) {
|
|
253512
|
-
res.status(400).json({
|
|
253513
|
-
detail: "A user with this email already exists",
|
|
253514
|
-
error_type: "HTTPException",
|
|
253515
|
-
message: "A user with this email already exists",
|
|
253516
|
-
request_id: null,
|
|
253517
|
-
traceback: ""
|
|
253518
|
-
});
|
|
253519
|
-
return;
|
|
253520
|
-
}
|
|
253521
|
-
const privateUserCollection = db2.getCollection(PRIVATE_USER_COLLECTION);
|
|
253522
|
-
const privateUserData = await privateUserCollection?.findOneAsync({
|
|
253523
|
-
email: email3
|
|
253524
|
-
});
|
|
253525
|
-
const otpCode = generateCode();
|
|
253526
|
-
const id2 = privateUserData ? privateUserData.id : nanoid3();
|
|
253527
|
-
if (!privateUserData) {
|
|
253528
|
-
await privateUserCollection?.insertAsync({
|
|
253529
|
-
id: id2,
|
|
253530
|
-
email: email3,
|
|
253531
|
-
otpCode,
|
|
253532
|
-
password,
|
|
253533
|
-
createdAt: Date.now()
|
|
253534
|
-
});
|
|
253535
|
-
} else {
|
|
253536
|
-
await privateUserCollection?.updateAsync({
|
|
253537
|
-
email: email3
|
|
253538
|
-
}, {
|
|
253539
|
-
$set: { otpCode }
|
|
253540
|
-
});
|
|
253541
|
-
}
|
|
253542
|
-
logger2.log(theme.styles.info(`
|
|
253543
|
-
In order to complete registration use this verification code: ${otpCode}
|
|
253544
|
-
`));
|
|
253545
|
-
res.json({
|
|
253546
|
-
id: id2,
|
|
253547
|
-
message: "Registration successful. Please check your email for the verification code.",
|
|
253548
|
-
otp_expires_in_minutes: 10
|
|
253549
|
-
});
|
|
253550
|
-
});
|
|
253551
|
-
router.post("/verify-otp", parseBody, async (req, res) => {
|
|
253552
|
-
const { email: email3, otp_code } = VerifyOtpBody.parse(req.body);
|
|
253553
|
-
const privateUserCollection = db2.getCollection(PRIVATE_USER_COLLECTION);
|
|
253554
|
-
const privateUserData = await privateUserCollection?.findOneAsync({
|
|
253555
|
-
email: email3
|
|
253556
|
-
});
|
|
253557
|
-
if (privateUserData && privateUserData.otpCode === otp_code) {
|
|
253558
|
-
if (+Date.now() - privateUserData.createdAt < 10 * 60 * 1000) {
|
|
253559
|
-
await privateUserCollection?.updateAsync({
|
|
253560
|
-
email: email3
|
|
253561
|
-
}, {
|
|
253562
|
-
$unset: { otpCode: true }
|
|
253563
|
-
});
|
|
253564
|
-
const collection = db2.getCollection(USER_COLLECTION);
|
|
253565
|
-
const now = getNowISOTimestamp();
|
|
253566
|
-
const nameFromEmailMatch = /^([^@]+)/.exec(email3);
|
|
253567
|
-
const fullName = nameFromEmailMatch ? nameFromEmailMatch[1] : email3;
|
|
253568
|
-
await collection?.insertAsync({
|
|
253569
|
-
id: privateUserData.id,
|
|
253570
|
-
email: email3,
|
|
253571
|
-
full_name: fullName,
|
|
253572
|
-
is_service: false,
|
|
253573
|
-
is_verified: true,
|
|
253574
|
-
disabled: null,
|
|
253575
|
-
role: "user",
|
|
253576
|
-
collaborator_role: "editor",
|
|
253577
|
-
created_date: now,
|
|
253578
|
-
updated_date: now
|
|
253579
|
-
});
|
|
253580
|
-
res.json({
|
|
253581
|
-
id: privateUserData.id,
|
|
253582
|
-
access_token: createJwtToken(email3),
|
|
253583
|
-
message: "Email verified successfully. You are now logged in.",
|
|
253584
|
-
success: true
|
|
253585
|
-
});
|
|
253586
|
-
} else {
|
|
253587
|
-
res.status(400).json({
|
|
253588
|
-
detail: "Verification code has expired",
|
|
253589
|
-
error_type: "HTTPException",
|
|
253590
|
-
message: "Verification code has expired",
|
|
253591
|
-
request_id: null,
|
|
253592
|
-
traceback: ""
|
|
253593
|
-
});
|
|
253594
|
-
}
|
|
253595
|
-
} else {
|
|
253596
|
-
const appId = req.params.appId;
|
|
253597
|
-
res.status(500).json({
|
|
253598
|
-
detail: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
253599
|
-
error_type: "ObjectNotFoundError",
|
|
253600
|
-
message: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
253601
|
-
request_id: null,
|
|
253602
|
-
traceback: ""
|
|
253603
|
-
});
|
|
253604
|
-
}
|
|
253605
|
-
});
|
|
253606
|
-
return router;
|
|
253607
|
-
}
|
|
253608
|
-
|
|
253609
253446
|
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
253610
|
-
var
|
|
253611
|
-
|
|
253612
|
-
// src/cli/dev/dev-server/db/entity-queries.ts
|
|
253613
|
-
function parseSort(sort) {
|
|
253614
|
-
if (!sort) {
|
|
253615
|
-
return;
|
|
253616
|
-
}
|
|
253617
|
-
if (sort.startsWith("-")) {
|
|
253618
|
-
return { [sort.slice(1)]: -1 };
|
|
253619
|
-
}
|
|
253620
|
-
return { [sort]: 1 };
|
|
253621
|
-
}
|
|
253622
|
-
function parseFields(fields) {
|
|
253623
|
-
if (!fields) {
|
|
253624
|
-
return;
|
|
253625
|
-
}
|
|
253626
|
-
const projection = {};
|
|
253627
|
-
for (const field of fields.split(",")) {
|
|
253628
|
-
const trimmed = field.trim();
|
|
253629
|
-
if (trimmed) {
|
|
253630
|
-
projection[trimmed] = 1;
|
|
253631
|
-
}
|
|
253632
|
-
}
|
|
253633
|
-
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
253634
|
-
}
|
|
253635
|
-
var queryEntity = async (collection, reqQuery) => {
|
|
253636
|
-
const { sort, limit, skip: skip2, fields, q: q13 } = reqQuery;
|
|
253637
|
-
let query = {};
|
|
253638
|
-
if (q13 && typeof q13 === "string") {
|
|
253639
|
-
try {
|
|
253640
|
-
query = JSON.parse(q13);
|
|
253641
|
-
} catch {
|
|
253642
|
-
throw new InvalidInputError("Invalid query parameter 'q'");
|
|
253643
|
-
}
|
|
253644
|
-
}
|
|
253645
|
-
let cursor3 = collection.findAsync(query);
|
|
253646
|
-
const sortObj = parseSort(sort);
|
|
253647
|
-
if (sortObj) {
|
|
253648
|
-
cursor3 = cursor3.sort(sortObj);
|
|
253649
|
-
}
|
|
253650
|
-
if (skip2) {
|
|
253651
|
-
const skipNum = Number.parseInt(skip2, 10);
|
|
253652
|
-
if (!Number.isNaN(skipNum)) {
|
|
253653
|
-
cursor3 = cursor3.skip(skipNum);
|
|
253654
|
-
}
|
|
253655
|
-
}
|
|
253656
|
-
if (limit) {
|
|
253657
|
-
const limitNum = Number.parseInt(limit, 10);
|
|
253658
|
-
if (!Number.isNaN(limitNum)) {
|
|
253659
|
-
cursor3 = cursor3.limit(limitNum);
|
|
253660
|
-
}
|
|
253661
|
-
}
|
|
253662
|
-
const projection = parseFields(fields);
|
|
253663
|
-
if (projection) {
|
|
253664
|
-
cursor3 = cursor3.projection(projection);
|
|
253665
|
-
}
|
|
253666
|
-
return cursor3;
|
|
253667
|
-
};
|
|
253447
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
253668
253448
|
|
|
253669
253449
|
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
253670
|
-
var
|
|
253671
|
-
var
|
|
253450
|
+
var import_express2 = __toESM(require_express(), 1);
|
|
253451
|
+
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
253672
253452
|
function createUserRouter(db2, logger2) {
|
|
253673
|
-
const router =
|
|
253674
|
-
const parseBody =
|
|
253453
|
+
const router = import_express2.Router({ mergeParams: true });
|
|
253454
|
+
const parseBody = import_express2.json();
|
|
253675
253455
|
function withAuth(handler) {
|
|
253676
253456
|
return async (req, res) => {
|
|
253677
253457
|
const auth2 = req.headers.authorization;
|
|
@@ -253680,7 +253460,7 @@ function createUserRouter(db2, logger2) {
|
|
|
253680
253460
|
return;
|
|
253681
253461
|
}
|
|
253682
253462
|
try {
|
|
253683
|
-
const { payload } =
|
|
253463
|
+
const { payload } = import_jsonwebtoken.default.decode(auth2.replace("Bearer ", ""), { complete: true }) ?? {};
|
|
253684
253464
|
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: payload?.sub });
|
|
253685
253465
|
if (!result) {
|
|
253686
253466
|
res.status(404).json({ error: "Unable to read data for the current user" });
|
|
@@ -253713,28 +253493,6 @@ function createUserRouter(db2, logger2) {
|
|
|
253713
253493
|
...req.body
|
|
253714
253494
|
});
|
|
253715
253495
|
}));
|
|
253716
|
-
router.get("/", withAuth(async (req, res, currentUser) => {
|
|
253717
|
-
const collection = db2.getCollection(USER_COLLECTION);
|
|
253718
|
-
if (!collection) {
|
|
253719
|
-
res.status(404).json({ error: `Entity "${USER_COLLECTION}" not found` });
|
|
253720
|
-
return;
|
|
253721
|
-
}
|
|
253722
|
-
try {
|
|
253723
|
-
if (currentUser.role === "admin") {
|
|
253724
|
-
const result = await queryEntity(collection, req.query);
|
|
253725
|
-
res.json(stripInternalFields(result));
|
|
253726
|
-
} else {
|
|
253727
|
-
res.json([stripInternalFields(currentUser)]);
|
|
253728
|
-
}
|
|
253729
|
-
} catch (error48) {
|
|
253730
|
-
if (error48 instanceof InvalidInputError) {
|
|
253731
|
-
res.status(400).json({ error: error48.message });
|
|
253732
|
-
} else {
|
|
253733
|
-
logger2.error(`Error in GET /${USER_COLLECTION}:`, error48);
|
|
253734
|
-
res.status(500).json({ error: "Internal server error" });
|
|
253735
|
-
}
|
|
253736
|
-
}
|
|
253737
|
-
}));
|
|
253738
253496
|
router.post("/bulk", async (_req, res) => {
|
|
253739
253497
|
res.json({});
|
|
253740
253498
|
});
|
|
@@ -253784,9 +253542,31 @@ function createUserRouter(db2, logger2) {
|
|
|
253784
253542
|
}
|
|
253785
253543
|
|
|
253786
253544
|
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
253545
|
+
function parseSort(sort) {
|
|
253546
|
+
if (!sort) {
|
|
253547
|
+
return;
|
|
253548
|
+
}
|
|
253549
|
+
if (sort.startsWith("-")) {
|
|
253550
|
+
return { [sort.slice(1)]: -1 };
|
|
253551
|
+
}
|
|
253552
|
+
return { [sort]: 1 };
|
|
253553
|
+
}
|
|
253554
|
+
function parseFields(fields) {
|
|
253555
|
+
if (!fields) {
|
|
253556
|
+
return;
|
|
253557
|
+
}
|
|
253558
|
+
const projection = {};
|
|
253559
|
+
for (const field of fields.split(",")) {
|
|
253560
|
+
const trimmed = field.trim();
|
|
253561
|
+
if (trimmed) {
|
|
253562
|
+
projection[trimmed] = 1;
|
|
253563
|
+
}
|
|
253564
|
+
}
|
|
253565
|
+
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
253566
|
+
}
|
|
253787
253567
|
async function createEntityRoutes(db2, logger2, broadcast) {
|
|
253788
|
-
const router =
|
|
253789
|
-
const parseBody =
|
|
253568
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
253569
|
+
const parseBody = import_express3.json();
|
|
253790
253570
|
function withCollection(handler) {
|
|
253791
253571
|
return async (req, res) => {
|
|
253792
253572
|
const collection = db2.getCollection(req.params.entityName);
|
|
@@ -253831,14 +253611,42 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
253831
253611
|
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
253832
253612
|
const { entityName } = req.params;
|
|
253833
253613
|
try {
|
|
253834
|
-
|
|
253835
|
-
|
|
253836
|
-
if (
|
|
253837
|
-
|
|
253838
|
-
|
|
253839
|
-
|
|
253840
|
-
|
|
253614
|
+
const { sort, limit, skip: skip2, fields, q: q13 } = req.query;
|
|
253615
|
+
let query = {};
|
|
253616
|
+
if (q13 && typeof q13 === "string") {
|
|
253617
|
+
try {
|
|
253618
|
+
query = JSON.parse(q13);
|
|
253619
|
+
} catch {
|
|
253620
|
+
res.status(400).json({ error: "Invalid query parameter 'q'" });
|
|
253621
|
+
return;
|
|
253622
|
+
}
|
|
253623
|
+
}
|
|
253624
|
+
let cursor3 = collection.findAsync(query);
|
|
253625
|
+
const sortObj = parseSort(sort);
|
|
253626
|
+
if (sortObj) {
|
|
253627
|
+
cursor3 = cursor3.sort(sortObj);
|
|
253628
|
+
}
|
|
253629
|
+
if (skip2) {
|
|
253630
|
+
const skipNum = Number.parseInt(skip2, 10);
|
|
253631
|
+
if (!Number.isNaN(skipNum)) {
|
|
253632
|
+
cursor3 = cursor3.skip(skipNum);
|
|
253633
|
+
}
|
|
253634
|
+
}
|
|
253635
|
+
if (limit) {
|
|
253636
|
+
const limitNum = Number.parseInt(limit, 10);
|
|
253637
|
+
if (!Number.isNaN(limitNum)) {
|
|
253638
|
+
cursor3 = cursor3.limit(limitNum);
|
|
253639
|
+
}
|
|
253841
253640
|
}
|
|
253641
|
+
const projection = parseFields(fields);
|
|
253642
|
+
if (projection) {
|
|
253643
|
+
cursor3 = cursor3.projection(projection);
|
|
253644
|
+
}
|
|
253645
|
+
const docs = await cursor3;
|
|
253646
|
+
res.json(stripInternalFields(docs));
|
|
253647
|
+
} catch (error48) {
|
|
253648
|
+
logger2.error(`Error in GET /${entityName}:`, error48);
|
|
253649
|
+
res.status(500).json({ error: "Internal server error" });
|
|
253842
253650
|
}
|
|
253843
253651
|
}));
|
|
253844
253652
|
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
@@ -253957,7 +253765,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
253957
253765
|
}
|
|
253958
253766
|
|
|
253959
253767
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
253960
|
-
var
|
|
253768
|
+
var import_express4 = __toESM(require_express(), 1);
|
|
253961
253769
|
var import_multer = __toESM(require_multer(), 1);
|
|
253962
253770
|
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
253963
253771
|
import fs28 from "node:fs";
|
|
@@ -253966,8 +253774,8 @@ function createFileToken(fileUri) {
|
|
|
253966
253774
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
253967
253775
|
}
|
|
253968
253776
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
253969
|
-
const router =
|
|
253970
|
-
const parseBody =
|
|
253777
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
253778
|
+
const parseBody = import_express4.json();
|
|
253971
253779
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
253972
253780
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
253973
253781
|
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
@@ -254037,7 +253845,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
|
254037
253845
|
return router;
|
|
254038
253846
|
}
|
|
254039
253847
|
function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
254040
|
-
const router =
|
|
253848
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
254041
253849
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
254042
253850
|
logger2.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
254043
253851
|
req.url = req.originalUrl;
|
|
@@ -255750,7 +255558,7 @@ async function createDevServer(options8) {
|
|
|
255750
255558
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
255751
255559
|
const baseUrl = `http://localhost:${port}`;
|
|
255752
255560
|
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
255753
|
-
const app =
|
|
255561
|
+
const app = import_express5.default();
|
|
255754
255562
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
255755
255563
|
target: BASE44_APP_URL,
|
|
255756
255564
|
changeOrigin: true
|
|
@@ -255782,8 +255590,6 @@ async function createDevServer(options8) {
|
|
|
255782
255590
|
let emitEntityEvent = () => {};
|
|
255783
255591
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
255784
255592
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
255785
|
-
const authRouter = createAuthRouter(db2, devLogger);
|
|
255786
|
-
app.use("/api/apps/:appId/auth", authRouter);
|
|
255787
255593
|
const { path: mediaFilesDir } = await $dir();
|
|
255788
255594
|
app.use("/media/private/:fileUri", (req, res, next) => {
|
|
255789
255595
|
const { fileUri } = req.params;
|
|
@@ -255803,15 +255609,13 @@ async function createDevServer(options8) {
|
|
|
255803
255609
|
}
|
|
255804
255610
|
next();
|
|
255805
255611
|
});
|
|
255806
|
-
app.use("/media",
|
|
255612
|
+
app.use("/media", import_express5.default.static(mediaFilesDir));
|
|
255807
255613
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
255808
255614
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
255809
255615
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
255810
255616
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
255811
255617
|
app.use((req, res, next) => {
|
|
255812
|
-
|
|
255813
|
-
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
255814
|
-
}
|
|
255618
|
+
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
255815
255619
|
remoteProxy(req, res, next);
|
|
255816
255620
|
});
|
|
255817
255621
|
const server = await new Promise((resolve8, reject) => {
|
|
@@ -255882,7 +255686,6 @@ async function devAction({ log }, options8) {
|
|
|
255882
255686
|
const { port: resolvedPort } = await createDevServer({
|
|
255883
255687
|
log,
|
|
255884
255688
|
port,
|
|
255885
|
-
cwd: process21.cwd(),
|
|
255886
255689
|
denoWrapperPath: getDenoWrapperPath(),
|
|
255887
255690
|
loadResources: async () => {
|
|
255888
255691
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -260390,4 +260193,4 @@ export {
|
|
|
260390
260193
|
CLIExitError
|
|
260391
260194
|
};
|
|
260392
260195
|
|
|
260393
|
-
//# debugId=
|
|
260196
|
+
//# debugId=CBBBAC71F12A75D664756E2164756E21
|