@base44-preview/cli 0.0.35-pr.279.c8698e9 → 0.0.35-pr.279.eaf0d5c

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 CHANGED
@@ -226152,6 +226152,9 @@ class Database {
226152
226152
  getCollection(name2) {
226153
226153
  return this.collections.get(name2);
226154
226154
  }
226155
+ getCollectionNames() {
226156
+ return Array.from(this.collections.keys());
226157
+ }
226155
226158
  }
226156
226159
 
226157
226160
  // node_modules/socket.io/wrapper.mjs
@@ -226314,13 +226317,13 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
226314
226317
  cursor3 = cursor3.sort(sortObj);
226315
226318
  }
226316
226319
  if (skip2) {
226317
- const skipNum = parseInt(skip2, 10);
226320
+ const skipNum = Number.parseInt(skip2, 10);
226318
226321
  if (!Number.isNaN(skipNum)) {
226319
226322
  cursor3 = cursor3.skip(skipNum);
226320
226323
  }
226321
226324
  }
226322
226325
  if (limit) {
226323
- const limitNum = parseInt(limit, 10);
226326
+ const limitNum = Number.parseInt(limit, 10);
226324
226327
  if (!Number.isNaN(limitNum)) {
226325
226328
  cursor3 = cursor3.limit(limitNum);
226326
226329
  }
@@ -226354,7 +226357,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
226354
226357
  };
226355
226358
  const inserted = stripInternalFields(await collection.insertAsync(record2));
226356
226359
  emit(appId, entityName, "create", inserted);
226357
- res.status(201).json(stripInternalFields(inserted));
226360
+ res.status(201).json(inserted);
226358
226361
  } catch (error48) {
226359
226362
  logger.error(`Error in POST /${entityName}:`, error48);
226360
226363
  res.status(500).json({ error: "Internal server error" });
@@ -226394,7 +226397,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
226394
226397
  res.status(404).json({ error: `Entity "${entityName}" not found` });
226395
226398
  return;
226396
226399
  }
226397
- const { id: _id, created_date, ...body } = req.body;
226400
+ const { id: _id, created_date: _created_date, ...body } = req.body;
226398
226401
  try {
226399
226402
  const updateData = {
226400
226403
  ...body,
@@ -226430,14 +226433,14 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
226430
226433
  if (doc2) {
226431
226434
  emit(appId, entityName, "delete", stripInternalFields(doc2));
226432
226435
  }
226433
- res.json({ deleted: numRemoved });
226436
+ res.json({ success: true });
226434
226437
  } catch (error48) {
226435
226438
  logger.error(`Error in DELETE /${entityName}/${id2}:`, error48);
226436
226439
  res.status(500).json({ error: "Internal server error" });
226437
226440
  }
226438
226441
  });
226439
226442
  router.delete("/:entityName", parseBody, async (req, res) => {
226440
- const { appId, entityName } = req.params;
226443
+ const { entityName } = req.params;
226441
226444
  const collection = db2.getCollection(entityName);
226442
226445
  if (!collection) {
226443
226446
  res.status(404).json({ error: `Entity "${entityName}" not found` });
@@ -226445,12 +226448,8 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
226445
226448
  }
226446
226449
  try {
226447
226450
  const query = req.body || {};
226448
- const docs = await collection.findAsync(query);
226449
226451
  const numRemoved = await collection.removeAsync(query, { multi: true });
226450
- for (const doc2 of docs) {
226451
- emit(appId, entityName, "delete", doc2);
226452
- }
226453
- res.json({ deleted: numRemoved });
226452
+ res.json({ success: true, deleted: numRemoved });
226454
226453
  } catch (error48) {
226455
226454
  logger.error(`Error in DELETE /${entityName}:`, error48);
226456
226455
  res.status(500).json({ error: "Internal server error" });
@@ -226491,6 +226490,9 @@ async function createDevServer(options8) {
226491
226490
  app.use("/api/apps/:appId/functions", functionRoutes);
226492
226491
  }
226493
226492
  const db2 = new Database(entities);
226493
+ if (db2.getCollectionNames().length > 0) {
226494
+ R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
226495
+ }
226494
226496
  let emitEntityEvent = () => {};
226495
226497
  const entityRoutes = createEntityRoutes(db2, devLogger, remoteProxy, (...args) => emitEntityEvent(...args));
226496
226498
  app.use("/api/apps/:appId/entities", entityRoutes);
@@ -230899,4 +230901,4 @@ export {
230899
230901
  CLIExitError
230900
230902
  };
230901
230903
 
230902
- //# debugId=D773996C341F187664756E2164756E21
230904
+ //# debugId=A3CA6D4CCBA3DDBE64756E2164756E21