@base44-preview/cli 0.0.50-pr.471.086f7c9 → 0.0.50-pr.475.145bd51
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 +243 -92
- package/dist/cli/index.js.map +11 -9
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -219926,7 +219926,8 @@ 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
|
|
219929
|
+
warn: source_default.yellow,
|
|
219930
|
+
info: source_default.cyan
|
|
219930
219931
|
},
|
|
219931
219932
|
format: {
|
|
219932
219933
|
errorContext(ctx) {
|
|
@@ -242594,27 +242595,11 @@ var EntityAutomationSchema = AutomationBaseSchema.extend({
|
|
|
242594
242595
|
entity_name: exports_external.string().min(1, "Entity name cannot be empty"),
|
|
242595
242596
|
event_types: exports_external.array(exports_external.enum(["create", "update", "delete"])).min(1, "At least one event type is required")
|
|
242596
242597
|
});
|
|
242597
|
-
var TriggerConditionSchema = exports_external.object({
|
|
242598
|
-
field: exports_external.string().min(1),
|
|
242599
|
-
operator: exports_external.string().min(1),
|
|
242600
|
-
value: exports_external.unknown()
|
|
242601
|
-
});
|
|
242602
|
-
var TriggerConditionsSchema = exports_external.object({
|
|
242603
|
-
conditions: exports_external.array(TriggerConditionSchema).min(1)
|
|
242604
|
-
});
|
|
242605
|
-
var ConnectorAutomationSchema = AutomationBaseSchema.extend({
|
|
242606
|
-
type: exports_external.literal("connector"),
|
|
242607
|
-
integration_type: exports_external.string().min(1, "Integration type cannot be empty"),
|
|
242608
|
-
events: exports_external.array(exports_external.string()).min(1, "At least one event is required"),
|
|
242609
|
-
resource_id: exports_external.string().nullable().optional(),
|
|
242610
|
-
trigger_conditions: TriggerConditionsSchema.nullable().optional()
|
|
242611
|
-
});
|
|
242612
242598
|
var AutomationSchema = exports_external.union([
|
|
242613
242599
|
ScheduledOneTimeSchema,
|
|
242614
242600
|
ScheduledCronSchema,
|
|
242615
242601
|
ScheduledSimpleSchema,
|
|
242616
|
-
EntityAutomationSchema
|
|
242617
|
-
ConnectorAutomationSchema
|
|
242602
|
+
EntityAutomationSchema
|
|
242618
242603
|
]);
|
|
242619
242604
|
var FunctionConfigSchema = exports_external.object({
|
|
242620
242605
|
name: FunctionNameSchema,
|
|
@@ -243259,6 +243244,7 @@ var package_default = {
|
|
|
243259
243244
|
typescript: "^5.7.2",
|
|
243260
243245
|
vitest: "^4.0.16",
|
|
243261
243246
|
yaml: "^2.8.2",
|
|
243247
|
+
qs: "^6.12.3",
|
|
243262
243248
|
zod: "^4.3.5"
|
|
243263
243249
|
},
|
|
243264
243250
|
engines: {
|
|
@@ -252771,9 +252757,12 @@ function getTypesCommand() {
|
|
|
252771
252757
|
return new Command("types").description("Manage TypeScript type generation").addCommand(getTypesGenerateCommand());
|
|
252772
252758
|
}
|
|
252773
252759
|
|
|
252760
|
+
// src/cli/commands/dev.ts
|
|
252761
|
+
import process21 from "node:process";
|
|
252762
|
+
|
|
252774
252763
|
// src/cli/dev/dev-server/main.ts
|
|
252775
252764
|
var import_cors = __toESM(require_lib4(), 1);
|
|
252776
|
-
var
|
|
252765
|
+
var import_express6 = __toESM(require_express(), 1);
|
|
252777
252766
|
import { dirname as dirname16, join as join23 } from "node:path";
|
|
252778
252767
|
|
|
252779
252768
|
// ../../node_modules/get-port/index.js
|
|
@@ -253459,15 +253448,200 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
|
253459
253448
|
});
|
|
253460
253449
|
}
|
|
253461
253450
|
|
|
253462
|
-
// src/cli/dev/dev-server/routes/
|
|
253463
|
-
var import_express3 = __toESM(require_express(), 1);
|
|
253464
|
-
|
|
253465
|
-
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
253451
|
+
// src/cli/dev/dev-server/routes/auth-router.ts
|
|
253466
253452
|
var import_express2 = __toESM(require_express(), 1);
|
|
253467
253453
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
253468
|
-
|
|
253454
|
+
import { randomInt } from "node:crypto";
|
|
253455
|
+
var LOCAL_DEV_SECRET = "LOCAL_DEV_SECRET";
|
|
253456
|
+
var generateCode = () => {
|
|
253457
|
+
return randomInt(1e5, 1e6).toString();
|
|
253458
|
+
};
|
|
253459
|
+
var createJwtToken = (email3) => {
|
|
253460
|
+
return import_jsonwebtoken.default.sign({ sub: email3 }, LOCAL_DEV_SECRET, {
|
|
253461
|
+
expiresIn: "360d"
|
|
253462
|
+
});
|
|
253463
|
+
};
|
|
253464
|
+
var UserRegiterSchema = object({
|
|
253465
|
+
id: string2(),
|
|
253466
|
+
email: email2(),
|
|
253467
|
+
otpCode: string2().length(6),
|
|
253468
|
+
password: string2().min(8),
|
|
253469
|
+
createdAt: number2().min(1)
|
|
253470
|
+
});
|
|
253471
|
+
function createAuthRouter(db2, logger2) {
|
|
253469
253472
|
const router = import_express2.Router({ mergeParams: true });
|
|
253473
|
+
const userRegitrPendingMap = new Map;
|
|
253470
253474
|
const parseBody = import_express2.json();
|
|
253475
|
+
router.post("/login", parseBody, async (req, res) => {
|
|
253476
|
+
const { email: email3, password: _password } = req.body;
|
|
253477
|
+
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
253478
|
+
if (result) {
|
|
253479
|
+
res.json({
|
|
253480
|
+
access_token: createJwtToken(email3),
|
|
253481
|
+
success: true,
|
|
253482
|
+
user: {}
|
|
253483
|
+
});
|
|
253484
|
+
return;
|
|
253485
|
+
}
|
|
253486
|
+
res.status(401).json({ error: "Unauthorized" });
|
|
253487
|
+
});
|
|
253488
|
+
router.post("/register", parseBody, async (req, res) => {
|
|
253489
|
+
const { email: email3, password } = req.body;
|
|
253490
|
+
if ((password || "").length < 8) {
|
|
253491
|
+
res.status(400).json({
|
|
253492
|
+
detail: "Password must be at least 8 characters long",
|
|
253493
|
+
error_type: "HTTPException",
|
|
253494
|
+
message: "Password must be at least 8 characters long",
|
|
253495
|
+
request_id: null,
|
|
253496
|
+
traceback: ""
|
|
253497
|
+
});
|
|
253498
|
+
return;
|
|
253499
|
+
}
|
|
253500
|
+
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: email3 });
|
|
253501
|
+
if (result) {
|
|
253502
|
+
res.status(400).json({
|
|
253503
|
+
detail: "A user with this email already exists",
|
|
253504
|
+
error_type: "HTTPException",
|
|
253505
|
+
message: "A user with this email already exists",
|
|
253506
|
+
request_id: null,
|
|
253507
|
+
traceback: ""
|
|
253508
|
+
});
|
|
253509
|
+
return;
|
|
253510
|
+
}
|
|
253511
|
+
const otpCode = generateCode();
|
|
253512
|
+
const id2 = nanoid3();
|
|
253513
|
+
userRegitrPendingMap.set(email3, {
|
|
253514
|
+
id: id2,
|
|
253515
|
+
email: email3,
|
|
253516
|
+
otpCode,
|
|
253517
|
+
password,
|
|
253518
|
+
createdAt: +Date.now()
|
|
253519
|
+
});
|
|
253520
|
+
logger2.log(theme.styles.info(`
|
|
253521
|
+
In order to complete registration use this verification code: ${otpCode}
|
|
253522
|
+
`));
|
|
253523
|
+
res.json({
|
|
253524
|
+
id: id2,
|
|
253525
|
+
message: "Registration successful. Please check your email for the verification code.",
|
|
253526
|
+
otp_expires_in_minutes: 10
|
|
253527
|
+
});
|
|
253528
|
+
});
|
|
253529
|
+
router.post("/verify-otp", parseBody, async (req, res) => {
|
|
253530
|
+
const { email: email3, otp_code } = req.body;
|
|
253531
|
+
const userData = userRegitrPendingMap.get(email3);
|
|
253532
|
+
if (userData && userData.otpCode === otp_code) {
|
|
253533
|
+
if (+Date.now() - userData.createdAt < 10 * 60 * 1000) {
|
|
253534
|
+
const collection = db2.getCollection(USER_COLLECTION);
|
|
253535
|
+
const now = getNowISOTimestamp();
|
|
253536
|
+
const nameFromEmailMatch = /^([^@]+)/.exec(email3);
|
|
253537
|
+
const fullName = nameFromEmailMatch ? nameFromEmailMatch[1] : email3;
|
|
253538
|
+
await collection?.insertAsync({
|
|
253539
|
+
id: userData.id,
|
|
253540
|
+
email: email3,
|
|
253541
|
+
full_name: fullName,
|
|
253542
|
+
is_service: false,
|
|
253543
|
+
is_verified: true,
|
|
253544
|
+
disabled: null,
|
|
253545
|
+
role: "user",
|
|
253546
|
+
collaborator_role: "editor",
|
|
253547
|
+
created_date: now,
|
|
253548
|
+
updated_date: now
|
|
253549
|
+
});
|
|
253550
|
+
res.json({
|
|
253551
|
+
id: userData.id,
|
|
253552
|
+
access_token: createJwtToken(email3),
|
|
253553
|
+
message: "Email verified successfully. You are now logged in.",
|
|
253554
|
+
success: true
|
|
253555
|
+
});
|
|
253556
|
+
} else {
|
|
253557
|
+
res.status(400).json({
|
|
253558
|
+
detail: "Verification code has expired",
|
|
253559
|
+
error_type: "HTTPException",
|
|
253560
|
+
message: "Verification code has expired",
|
|
253561
|
+
request_id: null,
|
|
253562
|
+
traceback: ""
|
|
253563
|
+
});
|
|
253564
|
+
}
|
|
253565
|
+
} else {
|
|
253566
|
+
const appId = req.params.appId;
|
|
253567
|
+
res.status(500).json({
|
|
253568
|
+
detail: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
253569
|
+
error_type: "ObjectNotFoundError",
|
|
253570
|
+
message: `{'email': '${email3}', 'app_id': '${appId}}'} -> Object not found`,
|
|
253571
|
+
request_id: null,
|
|
253572
|
+
traceback: ""
|
|
253573
|
+
});
|
|
253574
|
+
}
|
|
253575
|
+
});
|
|
253576
|
+
return router;
|
|
253577
|
+
}
|
|
253578
|
+
|
|
253579
|
+
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
253580
|
+
var import_express4 = __toESM(require_express(), 1);
|
|
253581
|
+
|
|
253582
|
+
// src/cli/dev/dev-server/db/entity-queries.ts
|
|
253583
|
+
function parseSort(sort) {
|
|
253584
|
+
if (!sort) {
|
|
253585
|
+
return;
|
|
253586
|
+
}
|
|
253587
|
+
if (sort.startsWith("-")) {
|
|
253588
|
+
return { [sort.slice(1)]: -1 };
|
|
253589
|
+
}
|
|
253590
|
+
return { [sort]: 1 };
|
|
253591
|
+
}
|
|
253592
|
+
function parseFields(fields) {
|
|
253593
|
+
if (!fields) {
|
|
253594
|
+
return;
|
|
253595
|
+
}
|
|
253596
|
+
const projection = {};
|
|
253597
|
+
for (const field of fields.split(",")) {
|
|
253598
|
+
const trimmed = field.trim();
|
|
253599
|
+
if (trimmed) {
|
|
253600
|
+
projection[trimmed] = 1;
|
|
253601
|
+
}
|
|
253602
|
+
}
|
|
253603
|
+
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
253604
|
+
}
|
|
253605
|
+
var queryEntity = async (collection, reqQuery) => {
|
|
253606
|
+
const { sort, limit, skip: skip2, fields, q: q13 } = reqQuery;
|
|
253607
|
+
let query = {};
|
|
253608
|
+
if (q13 && typeof q13 === "string") {
|
|
253609
|
+
try {
|
|
253610
|
+
query = JSON.parse(q13);
|
|
253611
|
+
} catch {
|
|
253612
|
+
throw new InvalidInputError("Invalid query parameter 'q'");
|
|
253613
|
+
}
|
|
253614
|
+
}
|
|
253615
|
+
let cursor3 = collection.findAsync(query);
|
|
253616
|
+
const sortObj = parseSort(sort);
|
|
253617
|
+
if (sortObj) {
|
|
253618
|
+
cursor3 = cursor3.sort(sortObj);
|
|
253619
|
+
}
|
|
253620
|
+
if (skip2) {
|
|
253621
|
+
const skipNum = Number.parseInt(skip2, 10);
|
|
253622
|
+
if (!Number.isNaN(skipNum)) {
|
|
253623
|
+
cursor3 = cursor3.skip(skipNum);
|
|
253624
|
+
}
|
|
253625
|
+
}
|
|
253626
|
+
if (limit) {
|
|
253627
|
+
const limitNum = Number.parseInt(limit, 10);
|
|
253628
|
+
if (!Number.isNaN(limitNum)) {
|
|
253629
|
+
cursor3 = cursor3.limit(limitNum);
|
|
253630
|
+
}
|
|
253631
|
+
}
|
|
253632
|
+
const projection = parseFields(fields);
|
|
253633
|
+
if (projection) {
|
|
253634
|
+
cursor3 = cursor3.projection(projection);
|
|
253635
|
+
}
|
|
253636
|
+
return cursor3;
|
|
253637
|
+
};
|
|
253638
|
+
|
|
253639
|
+
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
253640
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
253641
|
+
var import_jsonwebtoken2 = __toESM(require_jsonwebtoken(), 1);
|
|
253642
|
+
function createUserRouter(db2, logger2) {
|
|
253643
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
253644
|
+
const parseBody = import_express3.json();
|
|
253471
253645
|
function withAuth(handler) {
|
|
253472
253646
|
return async (req, res) => {
|
|
253473
253647
|
const auth2 = req.headers.authorization;
|
|
@@ -253476,7 +253650,7 @@ function createUserRouter(db2, logger2) {
|
|
|
253476
253650
|
return;
|
|
253477
253651
|
}
|
|
253478
253652
|
try {
|
|
253479
|
-
const { payload } =
|
|
253653
|
+
const { payload } = import_jsonwebtoken2.default.decode(auth2.replace("Bearer ", ""), { complete: true }) ?? {};
|
|
253480
253654
|
const result = await db2.getCollection(USER_COLLECTION)?.findOneAsync({ email: payload?.sub });
|
|
253481
253655
|
if (!result) {
|
|
253482
253656
|
res.status(404).json({ error: "Unable to read data for the current user" });
|
|
@@ -253509,6 +253683,28 @@ function createUserRouter(db2, logger2) {
|
|
|
253509
253683
|
...req.body
|
|
253510
253684
|
});
|
|
253511
253685
|
}));
|
|
253686
|
+
router.get("/", withAuth(async (req, res, currentUser) => {
|
|
253687
|
+
const collection = db2.getCollection(USER_COLLECTION);
|
|
253688
|
+
if (!collection) {
|
|
253689
|
+
res.status(404).json({ error: `Entity "${USER_COLLECTION}" not found` });
|
|
253690
|
+
return;
|
|
253691
|
+
}
|
|
253692
|
+
try {
|
|
253693
|
+
if (currentUser.role === "admin") {
|
|
253694
|
+
const result = await queryEntity(collection, req.query);
|
|
253695
|
+
res.json(stripInternalFields(result));
|
|
253696
|
+
} else {
|
|
253697
|
+
res.json([stripInternalFields(currentUser)]);
|
|
253698
|
+
}
|
|
253699
|
+
} catch (error48) {
|
|
253700
|
+
if (error48 instanceof InvalidInputError) {
|
|
253701
|
+
res.status(400).json({ error: error48.message });
|
|
253702
|
+
} else {
|
|
253703
|
+
logger2.error(`Error in GET /${USER_COLLECTION}:`, error48);
|
|
253704
|
+
res.status(500).json({ error: "Internal server error" });
|
|
253705
|
+
}
|
|
253706
|
+
}
|
|
253707
|
+
}));
|
|
253512
253708
|
router.post("/bulk", async (_req, res) => {
|
|
253513
253709
|
res.json({});
|
|
253514
253710
|
});
|
|
@@ -253558,31 +253754,9 @@ function createUserRouter(db2, logger2) {
|
|
|
253558
253754
|
}
|
|
253559
253755
|
|
|
253560
253756
|
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
253561
|
-
function parseSort(sort) {
|
|
253562
|
-
if (!sort) {
|
|
253563
|
-
return;
|
|
253564
|
-
}
|
|
253565
|
-
if (sort.startsWith("-")) {
|
|
253566
|
-
return { [sort.slice(1)]: -1 };
|
|
253567
|
-
}
|
|
253568
|
-
return { [sort]: 1 };
|
|
253569
|
-
}
|
|
253570
|
-
function parseFields(fields) {
|
|
253571
|
-
if (!fields) {
|
|
253572
|
-
return;
|
|
253573
|
-
}
|
|
253574
|
-
const projection = {};
|
|
253575
|
-
for (const field of fields.split(",")) {
|
|
253576
|
-
const trimmed = field.trim();
|
|
253577
|
-
if (trimmed) {
|
|
253578
|
-
projection[trimmed] = 1;
|
|
253579
|
-
}
|
|
253580
|
-
}
|
|
253581
|
-
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
253582
|
-
}
|
|
253583
253757
|
async function createEntityRoutes(db2, logger2, broadcast) {
|
|
253584
|
-
const router =
|
|
253585
|
-
const parseBody =
|
|
253758
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
253759
|
+
const parseBody = import_express4.json();
|
|
253586
253760
|
function withCollection(handler) {
|
|
253587
253761
|
return async (req, res) => {
|
|
253588
253762
|
const collection = db2.getCollection(req.params.entityName);
|
|
@@ -253627,42 +253801,14 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
253627
253801
|
router.get("/:entityName", withCollection(async (req, res, collection) => {
|
|
253628
253802
|
const { entityName } = req.params;
|
|
253629
253803
|
try {
|
|
253630
|
-
|
|
253631
|
-
let query = {};
|
|
253632
|
-
if (q13 && typeof q13 === "string") {
|
|
253633
|
-
try {
|
|
253634
|
-
query = JSON.parse(q13);
|
|
253635
|
-
} catch {
|
|
253636
|
-
res.status(400).json({ error: "Invalid query parameter 'q'" });
|
|
253637
|
-
return;
|
|
253638
|
-
}
|
|
253639
|
-
}
|
|
253640
|
-
let cursor3 = collection.findAsync(query);
|
|
253641
|
-
const sortObj = parseSort(sort);
|
|
253642
|
-
if (sortObj) {
|
|
253643
|
-
cursor3 = cursor3.sort(sortObj);
|
|
253644
|
-
}
|
|
253645
|
-
if (skip2) {
|
|
253646
|
-
const skipNum = Number.parseInt(skip2, 10);
|
|
253647
|
-
if (!Number.isNaN(skipNum)) {
|
|
253648
|
-
cursor3 = cursor3.skip(skipNum);
|
|
253649
|
-
}
|
|
253650
|
-
}
|
|
253651
|
-
if (limit) {
|
|
253652
|
-
const limitNum = Number.parseInt(limit, 10);
|
|
253653
|
-
if (!Number.isNaN(limitNum)) {
|
|
253654
|
-
cursor3 = cursor3.limit(limitNum);
|
|
253655
|
-
}
|
|
253656
|
-
}
|
|
253657
|
-
const projection = parseFields(fields);
|
|
253658
|
-
if (projection) {
|
|
253659
|
-
cursor3 = cursor3.projection(projection);
|
|
253660
|
-
}
|
|
253661
|
-
const docs = await cursor3;
|
|
253662
|
-
res.json(stripInternalFields(docs));
|
|
253804
|
+
res.json(stripInternalFields(await queryEntity(collection, req.query)));
|
|
253663
253805
|
} catch (error48) {
|
|
253664
|
-
|
|
253665
|
-
|
|
253806
|
+
if (error48 instanceof InvalidInputError) {
|
|
253807
|
+
res.status(400).json({ error: error48.message });
|
|
253808
|
+
} else {
|
|
253809
|
+
logger2.error(`Error in GET /${entityName}:`, error48);
|
|
253810
|
+
res.status(500).json({ error: "Internal server error" });
|
|
253811
|
+
}
|
|
253666
253812
|
}
|
|
253667
253813
|
}));
|
|
253668
253814
|
router.post("/:entityName", parseBody, withCollection(async (req, res, collection) => {
|
|
@@ -253781,7 +253927,7 @@ async function createEntityRoutes(db2, logger2, broadcast) {
|
|
|
253781
253927
|
}
|
|
253782
253928
|
|
|
253783
253929
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
253784
|
-
var
|
|
253930
|
+
var import_express5 = __toESM(require_express(), 1);
|
|
253785
253931
|
var import_multer = __toESM(require_multer(), 1);
|
|
253786
253932
|
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
253787
253933
|
import fs28 from "node:fs";
|
|
@@ -253790,8 +253936,8 @@ function createFileToken(fileUri) {
|
|
|
253790
253936
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
253791
253937
|
}
|
|
253792
253938
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
253793
|
-
const router =
|
|
253794
|
-
const parseBody =
|
|
253939
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
253940
|
+
const parseBody = import_express5.json();
|
|
253795
253941
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
253796
253942
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
253797
253943
|
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
@@ -253861,7 +254007,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger2) {
|
|
|
253861
254007
|
return router;
|
|
253862
254008
|
}
|
|
253863
254009
|
function createCustomIntegrationRoutes(remoteProxy, logger2) {
|
|
253864
|
-
const router =
|
|
254010
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
253865
254011
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
253866
254012
|
logger2.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
253867
254013
|
req.url = req.originalUrl;
|
|
@@ -255574,7 +255720,7 @@ async function createDevServer(options8) {
|
|
|
255574
255720
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
255575
255721
|
const baseUrl = `http://localhost:${port}`;
|
|
255576
255722
|
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
255577
|
-
const app =
|
|
255723
|
+
const app = import_express6.default();
|
|
255578
255724
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
255579
255725
|
target: BASE44_APP_URL,
|
|
255580
255726
|
changeOrigin: true
|
|
@@ -255606,6 +255752,8 @@ async function createDevServer(options8) {
|
|
|
255606
255752
|
let emitEntityEvent = () => {};
|
|
255607
255753
|
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
255608
255754
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
255755
|
+
const authRouter = createAuthRouter(db2, devLogger);
|
|
255756
|
+
app.use("/api/apps/:appId/auth", authRouter);
|
|
255609
255757
|
const { path: mediaFilesDir } = await $dir();
|
|
255610
255758
|
app.use("/media/private/:fileUri", (req, res, next) => {
|
|
255611
255759
|
const { fileUri } = req.params;
|
|
@@ -255625,13 +255773,15 @@ async function createDevServer(options8) {
|
|
|
255625
255773
|
}
|
|
255626
255774
|
next();
|
|
255627
255775
|
});
|
|
255628
|
-
app.use("/media",
|
|
255776
|
+
app.use("/media", import_express6.default.static(mediaFilesDir));
|
|
255629
255777
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
255630
255778
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
255631
255779
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
255632
255780
|
app.use("/api/apps/:appId/integrations/custom", customIntegrationRoutes);
|
|
255633
255781
|
app.use((req, res, next) => {
|
|
255634
|
-
|
|
255782
|
+
if (!req.originalUrl.endsWith("analytics/track/batch")) {
|
|
255783
|
+
devLogger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
255784
|
+
}
|
|
255635
255785
|
remoteProxy(req, res, next);
|
|
255636
255786
|
});
|
|
255637
255787
|
const server = await new Promise((resolve8, reject) => {
|
|
@@ -255702,6 +255852,7 @@ async function devAction({ log }, options8) {
|
|
|
255702
255852
|
const { port: resolvedPort } = await createDevServer({
|
|
255703
255853
|
log,
|
|
255704
255854
|
port,
|
|
255855
|
+
cwd: process21.cwd(),
|
|
255705
255856
|
denoWrapperPath: getDenoWrapperPath(),
|
|
255706
255857
|
loadResources: async () => {
|
|
255707
255858
|
const { functions, entities, project: project2 } = await readProjectConfig();
|
|
@@ -260209,4 +260360,4 @@ export {
|
|
|
260209
260360
|
CLIExitError
|
|
260210
260361
|
};
|
|
260211
260362
|
|
|
260212
|
-
//# debugId=
|
|
260363
|
+
//# debugId=7F65D5426750E8BD64756E2164756E21
|