@base44-preview/cli 0.0.35-pr.279.ea914f7 → 0.0.35-pr.279.f20437b
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 +14 -11
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -226243,6 +226243,9 @@ function parseFields(fields) {
|
|
|
226243
226243
|
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
226244
226244
|
}
|
|
226245
226245
|
function stripInternalFields(doc2) {
|
|
226246
|
+
if (Array.isArray(doc2)) {
|
|
226247
|
+
return doc2.map((d5) => stripInternalFields(d5));
|
|
226248
|
+
}
|
|
226246
226249
|
const { _id, ...rest } = doc2;
|
|
226247
226250
|
return rest;
|
|
226248
226251
|
}
|
|
@@ -226264,7 +226267,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226264
226267
|
}
|
|
226265
226268
|
broadcast(appId, entityName, createData(data));
|
|
226266
226269
|
}
|
|
226267
|
-
router.get("/User
|
|
226270
|
+
router.get("/User/:id", (req, res, next) => {
|
|
226268
226271
|
req.url = req.originalUrl;
|
|
226269
226272
|
remoteProxy(req, res, next);
|
|
226270
226273
|
});
|
|
@@ -226311,13 +226314,13 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226311
226314
|
cursor3 = cursor3.sort(sortObj);
|
|
226312
226315
|
}
|
|
226313
226316
|
if (skip2) {
|
|
226314
|
-
const skipNum = parseInt(skip2, 10);
|
|
226317
|
+
const skipNum = Number.parseInt(skip2, 10);
|
|
226315
226318
|
if (!Number.isNaN(skipNum)) {
|
|
226316
226319
|
cursor3 = cursor3.skip(skipNum);
|
|
226317
226320
|
}
|
|
226318
226321
|
}
|
|
226319
226322
|
if (limit) {
|
|
226320
|
-
const limitNum = parseInt(limit, 10);
|
|
226323
|
+
const limitNum = Number.parseInt(limit, 10);
|
|
226321
226324
|
if (!Number.isNaN(limitNum)) {
|
|
226322
226325
|
cursor3 = cursor3.limit(limitNum);
|
|
226323
226326
|
}
|
|
@@ -226327,7 +226330,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226327
226330
|
cursor3 = cursor3.projection(projection);
|
|
226328
226331
|
}
|
|
226329
226332
|
const docs = await cursor3;
|
|
226330
|
-
res.json(docs
|
|
226333
|
+
res.json(stripInternalFields(docs));
|
|
226331
226334
|
} catch (error48) {
|
|
226332
226335
|
logger.error(`Error in GET /${entityName}:`, error48);
|
|
226333
226336
|
res.status(500).json({ error: "Internal server error" });
|
|
@@ -226349,9 +226352,9 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226349
226352
|
created_date: now,
|
|
226350
226353
|
updated_date: now
|
|
226351
226354
|
};
|
|
226352
|
-
const inserted = await collection.insertAsync(record2);
|
|
226355
|
+
const inserted = stripInternalFields(await collection.insertAsync(record2));
|
|
226353
226356
|
emit(appId, entityName, "create", inserted);
|
|
226354
|
-
res.status(201).json(
|
|
226357
|
+
res.status(201).json(inserted);
|
|
226355
226358
|
} catch (error48) {
|
|
226356
226359
|
logger.error(`Error in POST /${entityName}:`, error48);
|
|
226357
226360
|
res.status(500).json({ error: "Internal server error" });
|
|
@@ -226376,7 +226379,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226376
226379
|
created_date: now,
|
|
226377
226380
|
updated_date: now
|
|
226378
226381
|
}));
|
|
226379
|
-
const inserted = (await collection.insertAsync(records))
|
|
226382
|
+
const inserted = stripInternalFields(await collection.insertAsync(records));
|
|
226380
226383
|
emit(appId, entityName, "create", inserted);
|
|
226381
226384
|
res.status(201).json(inserted);
|
|
226382
226385
|
} catch (error48) {
|
|
@@ -226391,7 +226394,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226391
226394
|
res.status(404).json({ error: `Entity "${entityName}" not found` });
|
|
226392
226395
|
return;
|
|
226393
226396
|
}
|
|
226394
|
-
const { id: _id, created_date, ...body } = req.body;
|
|
226397
|
+
const { id: _id, created_date: _created_date, ...body } = req.body;
|
|
226395
226398
|
try {
|
|
226396
226399
|
const updateData = {
|
|
226397
226400
|
...body,
|
|
@@ -226402,7 +226405,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226402
226405
|
res.status(404).json({ error: `Record with id "${id2}" not found` });
|
|
226403
226406
|
return;
|
|
226404
226407
|
}
|
|
226405
|
-
const updated =
|
|
226408
|
+
const updated = stripInternalFields(result.affectedDocuments);
|
|
226406
226409
|
emit(appId, entityName, "update", updated);
|
|
226407
226410
|
res.json(updated);
|
|
226408
226411
|
} catch (error48) {
|
|
@@ -226425,7 +226428,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
226425
226428
|
return;
|
|
226426
226429
|
}
|
|
226427
226430
|
if (doc2) {
|
|
226428
|
-
emit(appId, entityName, "delete", doc2);
|
|
226431
|
+
emit(appId, entityName, "delete", stripInternalFields(doc2));
|
|
226429
226432
|
}
|
|
226430
226433
|
res.json({ deleted: numRemoved });
|
|
226431
226434
|
} catch (error48) {
|
|
@@ -230896,4 +230899,4 @@ export {
|
|
|
230896
230899
|
CLIExitError
|
|
230897
230900
|
};
|
|
230898
230901
|
|
|
230899
|
-
//# debugId=
|
|
230902
|
+
//# debugId=633703126AE92AEB64756E2164756E21
|