@base44-preview/cli 0.0.45-pr.406.ed52e60 → 0.0.45-pr.419.e270ff0

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/README.md CHANGED
@@ -53,10 +53,14 @@ The CLI will guide you through project setup. For step-by-step tutorials, see th
53
53
  | [`whoami`](https://docs.base44.com/developers/references/cli/commands/whoami) | Display the current authenticated user |
54
54
  | [`agents pull`](https://docs.base44.com/developers/references/cli/commands/agents-pull) | Pull agents from Base44 to local files |
55
55
  | [`agents push`](https://docs.base44.com/developers/references/cli/commands/agents-push) | Push local agents to Base44 |
56
+ | [`connectors list-available`](https://docs.base44.com/developers/references/cli/commands/connectors-list-available) | List all available integration types |
56
57
  | [`connectors pull`](https://docs.base44.com/developers/references/cli/commands/connectors-pull) | Pull connectors from Base44 to local files |
57
58
  | [`connectors push`](https://docs.base44.com/developers/references/cli/commands/connectors-push) | Push local connectors to Base44 |
58
59
  | [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entities to Base44 |
59
- | [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
60
+ | `functions delete` | Delete deployed functions |
61
+ | [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy functions to Base44 |
62
+ | `functions list` | List all deployed functions |
63
+ | `functions pull` | Pull deployed functions from Base44 |
60
64
  | [`secrets list`](https://docs.base44.com/developers/references/cli/commands/secrets-list) | List project secret names |
61
65
  | [`secrets set`](https://docs.base44.com/developers/references/cli/commands/secrets-set) | Set one or more project secrets |
62
66
  | [`secrets delete`](https://docs.base44.com/developers/references/cli/commands/secrets-delete) | Delete a project secret |
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Deno Function Wrapper
3
+ *
4
+ * This script is executed by Deno to run user functions.
5
+ * It patches Deno.serve to inject a dynamic port before importing the user's function.
6
+ *
7
+ * Environment variables:
8
+ * - FUNCTION_PATH: Absolute path to the user's function entry file
9
+ * - FUNCTION_PORT: Port number for the function to listen on
10
+ * - FUNCTION_NAME: Name of the function (for logging)
11
+ */
12
+
13
+ // Make this file a module for top-level await support
14
+ export {};
15
+
16
+ const functionPath = Deno.env.get("FUNCTION_PATH");
17
+ const port = parseInt(Deno.env.get("FUNCTION_PORT") || "8000", 10);
18
+ const functionName = Deno.env.get("FUNCTION_NAME") || "unknown";
19
+
20
+ if (!functionPath) {
21
+ console.error("[wrapper] FUNCTION_PATH environment variable is required");
22
+ Deno.exit(1);
23
+ }
24
+
25
+ // Store the original Deno.serve
26
+ const originalServe = Deno.serve.bind(Deno);
27
+
28
+ // Patch Deno.serve to inject our port and add onListen callback
29
+ // @ts-expect-error - We're intentionally overriding Deno.serve
30
+ Deno.serve = (
31
+ optionsOrHandler:
32
+ | Deno.ServeOptions
33
+ | Deno.ServeHandler
34
+ | (Deno.ServeOptions & { handler: Deno.ServeHandler }),
35
+ maybeHandler?: Deno.ServeHandler,
36
+ ): Deno.HttpServer<Deno.NetAddr> => {
37
+ const onListen = () => {
38
+ // This message is used by FunctionManager to detect when the function is ready
39
+ console.log(`[${functionName}] Listening on http://localhost:${port}`);
40
+ };
41
+
42
+ // Handle the different Deno.serve signatures:
43
+ // 1. Deno.serve(handler)
44
+ // 2. Deno.serve(options, handler)
45
+ // 3. Deno.serve({ ...options, handler })
46
+ if (typeof optionsOrHandler === "function") {
47
+ // Signature: Deno.serve(handler)
48
+ return originalServe({ port, onListen }, optionsOrHandler);
49
+ }
50
+
51
+ if (maybeHandler) {
52
+ // Signature: Deno.serve(options, handler)
53
+ return originalServe({ ...optionsOrHandler, port, onListen }, maybeHandler);
54
+ }
55
+
56
+ // Signature: Deno.serve({ ...options, handler })
57
+ const options = optionsOrHandler as Deno.ServeOptions & {
58
+ handler: Deno.ServeHandler;
59
+ };
60
+ return originalServe({ ...options, port, onListen });
61
+ };
62
+
63
+ console.log(`[${functionName}] Starting function from ${functionPath}`);
64
+
65
+ // Dynamically import the user's function
66
+ // The function will call Deno.serve which is now patched to use our port
67
+ try {
68
+ await import(functionPath);
69
+ } catch (error) {
70
+ console.error(`[${functionName}] Failed to load function:`, error);
71
+ Deno.exit(1);
72
+ }
package/dist/cli/index.js CHANGED
@@ -179494,19 +179494,19 @@ var require_base64id = __commonJS((exports, module) => {
179494
179494
  /*!
179495
179495
  * base64id v0.1.0
179496
179496
  */
179497
- var crypto2 = __require("crypto");
179497
+ var crypto = __require("crypto");
179498
179498
  var Base64Id = function() {};
179499
179499
  Base64Id.prototype.getRandomBytes = function(bytes) {
179500
179500
  var BUFFER_SIZE = 4096;
179501
179501
  var self2 = this;
179502
179502
  bytes = bytes || 12;
179503
179503
  if (bytes > BUFFER_SIZE) {
179504
- return crypto2.randomBytes(bytes);
179504
+ return crypto.randomBytes(bytes);
179505
179505
  }
179506
179506
  var bytesInBuffer = parseInt(BUFFER_SIZE / bytes);
179507
179507
  var threshold = parseInt(bytesInBuffer * 0.85);
179508
179508
  if (!threshold) {
179509
- return crypto2.randomBytes(bytes);
179509
+ return crypto.randomBytes(bytes);
179510
179510
  }
179511
179511
  if (this.bytesBufferIndex == null) {
179512
179512
  this.bytesBufferIndex = -1;
@@ -179518,14 +179518,14 @@ var require_base64id = __commonJS((exports, module) => {
179518
179518
  if (this.bytesBufferIndex == -1 || this.bytesBufferIndex > threshold) {
179519
179519
  if (!this.isGeneratingBytes) {
179520
179520
  this.isGeneratingBytes = true;
179521
- crypto2.randomBytes(BUFFER_SIZE, function(err, bytes2) {
179521
+ crypto.randomBytes(BUFFER_SIZE, function(err, bytes2) {
179522
179522
  self2.bytesBuffer = bytes2;
179523
179523
  self2.bytesBufferIndex = 0;
179524
179524
  self2.isGeneratingBytes = false;
179525
179525
  });
179526
179526
  }
179527
179527
  if (this.bytesBufferIndex == -1) {
179528
- return crypto2.randomBytes(bytes);
179528
+ return crypto.randomBytes(bytes);
179529
179529
  }
179530
179530
  }
179531
179531
  var result = this.bytesBuffer.slice(bytes * this.bytesBufferIndex, bytes * (this.bytesBufferIndex + 1));
@@ -179539,7 +179539,7 @@ var require_base64id = __commonJS((exports, module) => {
179539
179539
  }
179540
179540
  this.sequenceNumber = this.sequenceNumber + 1 | 0;
179541
179541
  rand.writeInt32BE(this.sequenceNumber, 11);
179542
- if (crypto2.randomBytes) {
179542
+ if (crypto.randomBytes) {
179543
179543
  this.getRandomBytes(12).copy(rand);
179544
179544
  } else {
179545
179545
  [0, 4, 8].forEach(function(i5) {
@@ -238807,7 +238807,7 @@ function getTemplatesIndexPath() {
238807
238807
  return join8(ASSETS_DIR, "templates", "templates.json");
238808
238808
  }
238809
238809
  function getDenoWrapperPath() {
238810
- return join8(ASSETS_DIR, "deno-runtime", "main.js");
238810
+ return join8(ASSETS_DIR, "deno-runtime", "main.ts");
238811
238811
  }
238812
238812
  function ensureNpmAssets(sourceDir) {
238813
238813
  if (existsSync(ASSETS_DIR))
@@ -248819,7 +248819,7 @@ function getTypesCommand(context) {
248819
248819
  // src/cli/dev/dev-server/main.ts
248820
248820
  import { dirname as dirname14, join as join20 } from "node:path";
248821
248821
  var import_cors = __toESM(require_lib4(), 1);
248822
- var import_express6 = __toESM(require_express(), 1);
248822
+ var import_express4 = __toESM(require_express(), 1);
248823
248823
 
248824
248824
  // ../../node_modules/get-port/index.js
248825
248825
  import net from "node:net";
@@ -249177,36 +249177,6 @@ function createFunctionRouter(manager, logger) {
249177
249177
  // src/cli/dev/dev-server/db/database.ts
249178
249178
  var import_nedb = __toESM(require_nedb(), 1);
249179
249179
 
249180
- // ../../node_modules/nanoid/index.js
249181
- import { webcrypto as crypto } from "node:crypto";
249182
-
249183
- // ../../node_modules/nanoid/url-alphabet/index.js
249184
- var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
249185
-
249186
- // ../../node_modules/nanoid/index.js
249187
- var POOL_SIZE_MULTIPLIER = 128;
249188
- var pool;
249189
- var poolOffset;
249190
- function fillPool(bytes) {
249191
- if (!pool || pool.length < bytes) {
249192
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
249193
- crypto.getRandomValues(pool);
249194
- poolOffset = 0;
249195
- } else if (poolOffset + bytes > pool.length) {
249196
- crypto.getRandomValues(pool);
249197
- poolOffset = 0;
249198
- }
249199
- poolOffset += bytes;
249200
- }
249201
- function nanoid3(size = 21) {
249202
- fillPool(size |= 0);
249203
- let id2 = "";
249204
- for (let i5 = poolOffset - size;i5 < poolOffset; i5++) {
249205
- id2 += urlAlphabet[pool[i5] & 63];
249206
- }
249207
- return id2;
249208
- }
249209
-
249210
249180
  // src/cli/dev/dev-server/db/validator.ts
249211
249181
  var fieldTypes = [
249212
249182
  "string",
@@ -249353,63 +249323,18 @@ class Validator {
249353
249323
  }
249354
249324
 
249355
249325
  // src/cli/dev/dev-server/db/database.ts
249356
- var USER_COLLECTION = "user";
249357
-
249358
249326
  class Database {
249359
249327
  collections = new Map;
249360
249328
  schemas = new Map;
249361
249329
  validator = new Validator;
249362
- async load(entities) {
249363
- const userDataStore = new import_nedb.default;
249364
- this.collections.set(USER_COLLECTION, userDataStore);
249365
- const userInfo = await readAuth();
249366
- const now = new Date().toISOString().replace("Z", "000");
249367
- await userDataStore.insertAsync({
249368
- id: nanoid3(),
249369
- email: userInfo.email,
249370
- full_name: userInfo.name,
249371
- is_service: false,
249372
- is_verified: true,
249373
- disabled: null,
249374
- role: "admin",
249375
- collaborator_role: "editor",
249376
- created_date: now,
249377
- updated_date: now
249378
- });
249330
+ load(entities) {
249379
249331
  for (const entity2 of entities) {
249380
- const entityName = this.normalizeName(entity2.name);
249381
- const clonedEntity = structuredClone(entity2);
249382
- if (entityName === USER_COLLECTION) {
249383
- ["full_name", "email"].forEach((predefinedField) => {
249384
- if (predefinedField in clonedEntity.properties) {
249385
- throw new Error(`Error syncing entities: Invalid User schema: User schema cannot contain base fields: ${predefinedField}. These fields are built-in and managed by the system.`);
249386
- }
249387
- });
249388
- clonedEntity.properties.full_name = { type: "string" };
249389
- clonedEntity.properties.email = { type: "string" };
249390
- clonedEntity.properties.role = { type: "string" };
249391
- } else {
249392
- this.collections.set(entityName, new import_nedb.default);
249393
- }
249394
- this.schemas.set(entityName, clonedEntity);
249332
+ this.collections.set(entity2.name, new import_nedb.default);
249333
+ this.schemas.set(entity2.name, entity2);
249395
249334
  }
249396
- if (!this.schemas.has(USER_COLLECTION)) {
249397
- this.schemas.set(USER_COLLECTION, {
249398
- name: "User",
249399
- type: "object",
249400
- properties: {
249401
- full_name: { type: "string" },
249402
- email: { type: "string" },
249403
- role: { type: "string" }
249404
- }
249405
- });
249406
- }
249407
- }
249408
- hasCollection(name2) {
249409
- return this.collections.has(this.normalizeName(name2));
249410
249335
  }
249411
249336
  getCollection(name2) {
249412
- return this.collections.get(this.normalizeName(name2));
249337
+ return this.collections.get(name2);
249413
249338
  }
249414
249339
  getCollectionNames() {
249415
249340
  return Array.from(this.collections.keys());
@@ -249422,14 +249347,14 @@ class Database {
249422
249347
  this.schemas.clear();
249423
249348
  }
249424
249349
  validate(entityName, record2, partial2 = false) {
249425
- const schema9 = this.schemas.get(this.normalizeName(entityName));
249350
+ const schema9 = this.schemas.get(entityName);
249426
249351
  if (!schema9) {
249427
249352
  throw new Error(`Entity "${entityName}" not found`);
249428
249353
  }
249429
249354
  return this.validator.validate(record2, schema9, partial2);
249430
249355
  }
249431
249356
  prepareRecord(entityName, record2, partial2 = false) {
249432
- const schema9 = this.schemas.get(this.normalizeName(entityName));
249357
+ const schema9 = this.schemas.get(entityName);
249433
249358
  if (!schema9) {
249434
249359
  throw new Error(`Entity "${entityName}" not found`);
249435
249360
  }
@@ -249439,9 +249364,6 @@ class Database {
249439
249364
  }
249440
249365
  return this.validator.applyDefaults(filteredRecord, schema9);
249441
249366
  }
249442
- normalizeName(entityName) {
249443
- return entityName.toLowerCase();
249444
- }
249445
249367
  }
249446
249368
 
249447
249369
  // ../../node_modules/socket.io/wrapper.mjs
@@ -249476,42 +249398,40 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
249476
249398
  });
249477
249399
  }
249478
249400
 
249479
- // src/cli/dev/dev-server/routes/entities/entities-router.ts
249480
- var import_express3 = __toESM(require_express(), 1);
249481
-
249482
- // src/cli/dev/dev-server/routes/entities/entities-user-router.ts
249401
+ // src/cli/dev/dev-server/routes/entities.ts
249483
249402
  var import_express2 = __toESM(require_express(), 1);
249484
249403
 
249485
- // src/cli/dev/dev-server/routes/entities/utils.ts
249486
- function stripInternalFields(doc2) {
249487
- if (Array.isArray(doc2)) {
249488
- return doc2.map((d5) => stripInternalFields(d5));
249404
+ // ../../node_modules/nanoid/index.js
249405
+ import { webcrypto as crypto } from "node:crypto";
249406
+
249407
+ // ../../node_modules/nanoid/url-alphabet/index.js
249408
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
249409
+
249410
+ // ../../node_modules/nanoid/index.js
249411
+ var POOL_SIZE_MULTIPLIER = 128;
249412
+ var pool;
249413
+ var poolOffset;
249414
+ function fillPool(bytes) {
249415
+ if (!pool || pool.length < bytes) {
249416
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
249417
+ crypto.getRandomValues(pool);
249418
+ poolOffset = 0;
249419
+ } else if (poolOffset + bytes > pool.length) {
249420
+ crypto.getRandomValues(pool);
249421
+ poolOffset = 0;
249489
249422
  }
249490
- const { _id, ...rest } = doc2;
249491
- return rest;
249423
+ poolOffset += bytes;
249492
249424
  }
249493
-
249494
- // src/cli/dev/dev-server/routes/entities/entities-user-router.ts
249495
- async function createUserRouter(db2) {
249496
- const router = import_express2.Router({ mergeParams: true });
249497
- router.get("/:id", async (req, res) => {
249498
- let result;
249499
- if (req.params.id === "me") {
249500
- const userInfo = await readAuth();
249501
- result = await db2.getCollection("User")?.findOneAsync({ email: userInfo.email });
249502
- } else {
249503
- result = await db2.getCollection("User")?.findOneAsync({ id: req.params.id });
249504
- }
249505
- if (!result) {
249506
- res.status(404).json({ error: `User with id "${req.params.id}" not found` });
249507
- return;
249508
- }
249509
- res.json(stripInternalFields(result));
249510
- });
249511
- return router;
249425
+ function nanoid3(size = 21) {
249426
+ fillPool(size |= 0);
249427
+ let id2 = "";
249428
+ for (let i5 = poolOffset - size;i5 < poolOffset; i5++) {
249429
+ id2 += urlAlphabet[pool[i5] & 63];
249430
+ }
249431
+ return id2;
249512
249432
  }
249513
249433
 
249514
- // src/cli/dev/dev-server/routes/entities/entities-router.ts
249434
+ // src/cli/dev/dev-server/routes/entities.ts
249515
249435
  function parseSort(sort) {
249516
249436
  if (!sort) {
249517
249437
  return;
@@ -249534,9 +249454,16 @@ function parseFields(fields) {
249534
249454
  }
249535
249455
  return Object.keys(projection).length > 0 ? projection : undefined;
249536
249456
  }
249537
- async function createEntityRoutes(db2, logger, broadcast) {
249538
- const router = import_express3.Router({ mergeParams: true });
249539
- const parseBody = import_express3.json();
249457
+ function stripInternalFields(doc2) {
249458
+ if (Array.isArray(doc2)) {
249459
+ return doc2.map((d5) => stripInternalFields(d5));
249460
+ }
249461
+ const { _id, ...rest } = doc2;
249462
+ return rest;
249463
+ }
249464
+ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
249465
+ const router = import_express2.Router({ mergeParams: true });
249466
+ const parseBody = import_express2.json();
249540
249467
  function withCollection(handler) {
249541
249468
  return async (req, res) => {
249542
249469
  const collection = db2.getCollection(req.params.entityName);
@@ -249562,8 +249489,11 @@ async function createEntityRoutes(db2, logger, broadcast) {
249562
249489
  }
249563
249490
  broadcast(appId, entityName, createData(data));
249564
249491
  }
249565
- const userRouter = await createUserRouter(db2);
249566
- router.use("/User", userRouter);
249492
+ router.get("/User/:id", (req, res, next) => {
249493
+ logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
249494
+ req.url = req.originalUrl;
249495
+ remoteProxy(req, res, next);
249496
+ });
249567
249497
  router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
249568
249498
  const { entityName, id: id2 } = req.params;
249569
249499
  try {
@@ -249735,7 +249665,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
249735
249665
  }
249736
249666
 
249737
249667
  // src/cli/dev/dev-server/routes/integrations.ts
249738
- var import_express4 = __toESM(require_express(), 1);
249668
+ var import_express3 = __toESM(require_express(), 1);
249739
249669
  var import_multer = __toESM(require_multer(), 1);
249740
249670
  import { createHash, randomUUID as randomUUID4 } from "node:crypto";
249741
249671
  import fs28 from "node:fs";
@@ -249744,8 +249674,8 @@ function createFileToken(fileUri) {
249744
249674
  return createHash("sha256").update(fileUri).digest("hex");
249745
249675
  }
249746
249676
  function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
249747
- const router = import_express4.Router({ mergeParams: true });
249748
- const parseBody = import_express4.json();
249677
+ const router = import_express3.Router({ mergeParams: true });
249678
+ const parseBody = import_express3.json();
249749
249679
  const privateFilesDir = path18.join(mediaFilesDir, "private");
249750
249680
  fs28.mkdirSync(mediaFilesDir, { recursive: true });
249751
249681
  fs28.mkdirSync(privateFilesDir, { recursive: true });
@@ -249815,7 +249745,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
249815
249745
  return router;
249816
249746
  }
249817
249747
  function createCustomIntegrationRoutes(remoteProxy, logger) {
249818
- const router = import_express4.Router({ mergeParams: true });
249748
+ const router = import_express3.Router({ mergeParams: true });
249819
249749
  router.post("/:slug/:operationId", (req, res, next) => {
249820
249750
  logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
249821
249751
  req.url = req.originalUrl;
@@ -249824,18 +249754,6 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
249824
249754
  return router;
249825
249755
  }
249826
249756
 
249827
- // src/cli/dev/dev-server/routes/users.ts
249828
- var import_express5 = __toESM(require_express(), 1);
249829
- function createUsersRoutes() {
249830
- const router = import_express5.Router({ mergeParams: true });
249831
- const parseBody = import_express5.json();
249832
- router.post("/invite-user", parseBody, (req, _res, next) => {
249833
- console.log("invite-user", req.body);
249834
- next();
249835
- });
249836
- return router;
249837
- }
249838
-
249839
249757
  // src/cli/dev/dev-server/watcher.ts
249840
249758
  import { EventEmitter as EventEmitter4 } from "node:events";
249841
249759
  import { relative as relative6 } from "node:path";
@@ -251540,7 +251458,7 @@ async function createDevServer(options8) {
251540
251458
  const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
251541
251459
  const baseUrl = `http://localhost:${port}`;
251542
251460
  const { functions, entities, project: project2 } = await options8.loadResources();
251543
- const app = import_express6.default();
251461
+ const app = import_express4.default();
251544
251462
  const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
251545
251463
  target: BASE44_APP_URL,
251546
251464
  changeOrigin: true
@@ -251557,17 +251475,7 @@ async function createDevServer(options8) {
251557
251475
  }
251558
251476
  next();
251559
251477
  });
251560
- app.use((req, res, next) => {
251561
- const auth2 = req.headers.authorization;
251562
- if (!auth2 || !auth2.startsWith("Bearer ")) {
251563
- res.status(401).json({ error: "Unauthorized" });
251564
- return;
251565
- }
251566
- next();
251567
- });
251568
251478
  const devLogger = createDevLogger();
251569
- const usersRoutes = createUsersRoutes();
251570
- app.use("/api/apps/:appId/users", usersRoutes);
251571
251479
  const functionManager = new FunctionManager(functions, devLogger, options8.denoWrapperPath);
251572
251480
  const functionRoutes = createFunctionRouter(functionManager, devLogger);
251573
251481
  app.use("/api/apps/:appId/functions", functionRoutes);
@@ -251575,12 +251483,12 @@ async function createDevServer(options8) {
251575
251483
  R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
251576
251484
  }
251577
251485
  const db2 = new Database;
251578
- await db2.load(entities);
251486
+ db2.load(entities);
251579
251487
  if (db2.getCollectionNames().length > 0) {
251580
251488
  R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
251581
251489
  }
251582
251490
  let emitEntityEvent = () => {};
251583
- const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
251491
+ const entityRoutes = createEntityRoutes(db2, devLogger, remoteProxy, (...args) => emitEntityEvent(...args));
251584
251492
  app.use("/api/apps/:appId/entities", entityRoutes);
251585
251493
  const { path: mediaFilesDir } = await $dir();
251586
251494
  app.use("/media/private/:fileUri", (req, res, next) => {
@@ -251601,7 +251509,7 @@ async function createDevServer(options8) {
251601
251509
  }
251602
251510
  next();
251603
251511
  });
251604
- app.use("/media", import_express6.default.static(mediaFilesDir));
251512
+ app.use("/media", import_express4.default.static(mediaFilesDir));
251605
251513
  const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
251606
251514
  app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
251607
251515
  const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
@@ -251650,7 +251558,7 @@ async function createDevServer(options8) {
251650
251558
  if (previousEntityCount > 0) {
251651
251559
  devLogger.log("Entities directory changed, clearing data...");
251652
251560
  }
251653
- await db2.load(entities2);
251561
+ db2.load(entities2);
251654
251562
  if (db2.getCollectionNames().length > 0) {
251655
251563
  devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
251656
251564
  }
@@ -256052,4 +255960,4 @@ export {
256052
255960
  CLIExitError
256053
255961
  };
256054
255962
 
256055
- //# debugId=1D8798AB57E4532E64756E2164756E21
255963
+ //# debugId=8DF79D46442B07AB64756E2164756E21