@base44-preview/cli 0.0.44-pr.419.4194a5c → 0.0.45-pr.406.7acd6ec
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 +1 -5
- package/dist/cli/index.js +123 -33
- package/dist/cli/index.js.map +9 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,14 +53,10 @@ 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 |
|
|
57
56
|
| [`connectors pull`](https://docs.base44.com/developers/references/cli/commands/connectors-pull) | Pull connectors from Base44 to local files |
|
|
58
57
|
| [`connectors push`](https://docs.base44.com/developers/references/cli/commands/connectors-push) | Push local connectors to Base44 |
|
|
59
58
|
| [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entities to Base44 |
|
|
60
|
-
| `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 |
|
|
59
|
+
| [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
|
|
64
60
|
| [`secrets list`](https://docs.base44.com/developers/references/cli/commands/secrets-list) | List project secret names |
|
|
65
61
|
| [`secrets set`](https://docs.base44.com/developers/references/cli/commands/secrets-set) | Set one or more project secrets |
|
|
66
62
|
| [`secrets delete`](https://docs.base44.com/developers/references/cli/commands/secrets-delete) | Delete a project secret |
|
package/dist/cli/index.js
CHANGED
|
@@ -238710,7 +238710,7 @@ import { join as join8 } from "node:path";
|
|
|
238710
238710
|
// package.json
|
|
238711
238711
|
var package_default = {
|
|
238712
238712
|
name: "base44",
|
|
238713
|
-
version: "0.0.
|
|
238713
|
+
version: "0.0.45",
|
|
238714
238714
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
238715
238715
|
type: "module",
|
|
238716
238716
|
bin: {
|
|
@@ -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
|
|
248822
|
+
var import_express6 = __toESM(require_express(), 1);
|
|
248823
248823
|
|
|
248824
248824
|
// ../../node_modules/get-port/index.js
|
|
248825
248825
|
import net from "node:net";
|
|
@@ -249323,18 +249323,47 @@ class Validator {
|
|
|
249323
249323
|
}
|
|
249324
249324
|
|
|
249325
249325
|
// src/cli/dev/dev-server/db/database.ts
|
|
249326
|
+
var USER_COLLECTION = "user";
|
|
249327
|
+
|
|
249326
249328
|
class Database {
|
|
249327
249329
|
collections = new Map;
|
|
249328
249330
|
schemas = new Map;
|
|
249329
249331
|
validator = new Validator;
|
|
249330
249332
|
load(entities) {
|
|
249333
|
+
this.collections.set(USER_COLLECTION, new import_nedb.default);
|
|
249331
249334
|
for (const entity2 of entities) {
|
|
249332
|
-
this.
|
|
249333
|
-
this.
|
|
249335
|
+
const entityName = this.normalizeName(entity2.name);
|
|
249336
|
+
this.collections.set(entityName, new import_nedb.default);
|
|
249337
|
+
const clonedEntity = structuredClone(entity2);
|
|
249338
|
+
if (entityName === USER_COLLECTION) {
|
|
249339
|
+
["full_name", "email"].forEach((predefinedField) => {
|
|
249340
|
+
if (predefinedField in clonedEntity.properties) {
|
|
249341
|
+
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.`);
|
|
249342
|
+
}
|
|
249343
|
+
});
|
|
249344
|
+
clonedEntity.properties.full_name = { type: "string" };
|
|
249345
|
+
clonedEntity.properties.email = { type: "string" };
|
|
249346
|
+
clonedEntity.properties.role = { type: "string" };
|
|
249347
|
+
}
|
|
249348
|
+
this.schemas.set(entityName, clonedEntity);
|
|
249349
|
+
}
|
|
249350
|
+
if (!this.schemas.has(USER_COLLECTION)) {
|
|
249351
|
+
this.schemas.set(USER_COLLECTION, {
|
|
249352
|
+
name: "User",
|
|
249353
|
+
type: "object",
|
|
249354
|
+
properties: {
|
|
249355
|
+
full_name: { type: "string" },
|
|
249356
|
+
email: { type: "string" },
|
|
249357
|
+
role: { type: "string" }
|
|
249358
|
+
}
|
|
249359
|
+
});
|
|
249334
249360
|
}
|
|
249335
249361
|
}
|
|
249362
|
+
hasCollection(name2) {
|
|
249363
|
+
return this.collections.has(this.normalizeName(name2));
|
|
249364
|
+
}
|
|
249336
249365
|
getCollection(name2) {
|
|
249337
|
-
return this.collections.get(name2);
|
|
249366
|
+
return this.collections.get(this.normalizeName(name2));
|
|
249338
249367
|
}
|
|
249339
249368
|
getCollectionNames() {
|
|
249340
249369
|
return Array.from(this.collections.keys());
|
|
@@ -249347,14 +249376,14 @@ class Database {
|
|
|
249347
249376
|
this.schemas.clear();
|
|
249348
249377
|
}
|
|
249349
249378
|
validate(entityName, record2, partial2 = false) {
|
|
249350
|
-
const schema9 = this.schemas.get(entityName);
|
|
249379
|
+
const schema9 = this.schemas.get(this.normalizeName(entityName));
|
|
249351
249380
|
if (!schema9) {
|
|
249352
249381
|
throw new Error(`Entity "${entityName}" not found`);
|
|
249353
249382
|
}
|
|
249354
249383
|
return this.validator.validate(record2, schema9, partial2);
|
|
249355
249384
|
}
|
|
249356
249385
|
prepareRecord(entityName, record2, partial2 = false) {
|
|
249357
|
-
const schema9 = this.schemas.get(entityName);
|
|
249386
|
+
const schema9 = this.schemas.get(this.normalizeName(entityName));
|
|
249358
249387
|
if (!schema9) {
|
|
249359
249388
|
throw new Error(`Entity "${entityName}" not found`);
|
|
249360
249389
|
}
|
|
@@ -249364,6 +249393,9 @@ class Database {
|
|
|
249364
249393
|
}
|
|
249365
249394
|
return this.validator.applyDefaults(filteredRecord, schema9);
|
|
249366
249395
|
}
|
|
249396
|
+
normalizeName(entityName) {
|
|
249397
|
+
return entityName.toLowerCase();
|
|
249398
|
+
}
|
|
249367
249399
|
}
|
|
249368
249400
|
|
|
249369
249401
|
// ../../node_modules/socket.io/wrapper.mjs
|
|
@@ -249398,8 +249430,8 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
|
|
|
249398
249430
|
});
|
|
249399
249431
|
}
|
|
249400
249432
|
|
|
249401
|
-
// src/cli/dev/dev-server/routes/entities.ts
|
|
249402
|
-
var
|
|
249433
|
+
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
249434
|
+
var import_express3 = __toESM(require_express(), 1);
|
|
249403
249435
|
|
|
249404
249436
|
// ../../node_modules/nanoid/index.js
|
|
249405
249437
|
import { webcrypto as crypto } from "node:crypto";
|
|
@@ -249431,7 +249463,53 @@ function nanoid3(size = 21) {
|
|
|
249431
249463
|
return id2;
|
|
249432
249464
|
}
|
|
249433
249465
|
|
|
249434
|
-
// src/cli/dev/dev-server/routes/entities.ts
|
|
249466
|
+
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
249467
|
+
var import_express2 = __toESM(require_express(), 1);
|
|
249468
|
+
|
|
249469
|
+
// src/cli/dev/dev-server/routes/entities/utils.ts
|
|
249470
|
+
function stripInternalFields(doc2) {
|
|
249471
|
+
if (Array.isArray(doc2)) {
|
|
249472
|
+
return doc2.map((d5) => stripInternalFields(d5));
|
|
249473
|
+
}
|
|
249474
|
+
const { _id, ...rest } = doc2;
|
|
249475
|
+
return rest;
|
|
249476
|
+
}
|
|
249477
|
+
|
|
249478
|
+
// src/cli/dev/dev-server/routes/entities/entities-user-router.ts
|
|
249479
|
+
async function createUserRouter(db2) {
|
|
249480
|
+
const userInfo = await readAuth();
|
|
249481
|
+
const meEntity = await db2.getCollection("User")?.findOneAsync({ email: userInfo.email });
|
|
249482
|
+
let idMe = meEntity?.id;
|
|
249483
|
+
if (!idMe) {
|
|
249484
|
+
const now = new Date().toISOString().replace("Z", "000");
|
|
249485
|
+
idMe = nanoid3();
|
|
249486
|
+
await db2.getCollection("User")?.insertAsync({
|
|
249487
|
+
id: idMe,
|
|
249488
|
+
email: userInfo.email,
|
|
249489
|
+
full_name: userInfo.name,
|
|
249490
|
+
is_service: false,
|
|
249491
|
+
is_verified: true,
|
|
249492
|
+
disabled: null,
|
|
249493
|
+
role: "admin",
|
|
249494
|
+
collaborator_role: "editor",
|
|
249495
|
+
created_date: now,
|
|
249496
|
+
updated_date: now
|
|
249497
|
+
});
|
|
249498
|
+
}
|
|
249499
|
+
const router = import_express2.Router({ mergeParams: true });
|
|
249500
|
+
router.get("/:id", async (req, res) => {
|
|
249501
|
+
const id2 = req.params.id === "me" ? idMe : req.params.id;
|
|
249502
|
+
const result = await db2.getCollection("User")?.findOneAsync({ id: id2 });
|
|
249503
|
+
if (!result) {
|
|
249504
|
+
res.status(404).json({ error: `User with id "${req.params.id}" not found` });
|
|
249505
|
+
return;
|
|
249506
|
+
}
|
|
249507
|
+
res.json(stripInternalFields(result));
|
|
249508
|
+
});
|
|
249509
|
+
return router;
|
|
249510
|
+
}
|
|
249511
|
+
|
|
249512
|
+
// src/cli/dev/dev-server/routes/entities/entities-router.ts
|
|
249435
249513
|
function parseSort(sort) {
|
|
249436
249514
|
if (!sort) {
|
|
249437
249515
|
return;
|
|
@@ -249454,16 +249532,9 @@ function parseFields(fields) {
|
|
|
249454
249532
|
}
|
|
249455
249533
|
return Object.keys(projection).length > 0 ? projection : undefined;
|
|
249456
249534
|
}
|
|
249457
|
-
function
|
|
249458
|
-
|
|
249459
|
-
|
|
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();
|
|
249535
|
+
async function createEntityRoutes(db2, logger, broadcast) {
|
|
249536
|
+
const router = import_express3.Router({ mergeParams: true });
|
|
249537
|
+
const parseBody = import_express3.json();
|
|
249467
249538
|
function withCollection(handler) {
|
|
249468
249539
|
return async (req, res) => {
|
|
249469
249540
|
const collection = db2.getCollection(req.params.entityName);
|
|
@@ -249489,11 +249560,8 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249489
249560
|
}
|
|
249490
249561
|
broadcast(appId, entityName, createData(data));
|
|
249491
249562
|
}
|
|
249492
|
-
|
|
249493
|
-
|
|
249494
|
-
req.url = req.originalUrl;
|
|
249495
|
-
remoteProxy(req, res, next);
|
|
249496
|
-
});
|
|
249563
|
+
const userRouter = await createUserRouter(db2);
|
|
249564
|
+
router.use("/User", userRouter);
|
|
249497
249565
|
router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
|
|
249498
249566
|
const { entityName, id: id2 } = req.params;
|
|
249499
249567
|
try {
|
|
@@ -249665,7 +249733,7 @@ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
|
|
|
249665
249733
|
}
|
|
249666
249734
|
|
|
249667
249735
|
// src/cli/dev/dev-server/routes/integrations.ts
|
|
249668
|
-
var
|
|
249736
|
+
var import_express4 = __toESM(require_express(), 1);
|
|
249669
249737
|
var import_multer = __toESM(require_multer(), 1);
|
|
249670
249738
|
import { createHash, randomUUID as randomUUID4 } from "node:crypto";
|
|
249671
249739
|
import fs28 from "node:fs";
|
|
@@ -249674,8 +249742,8 @@ function createFileToken(fileUri) {
|
|
|
249674
249742
|
return createHash("sha256").update(fileUri).digest("hex");
|
|
249675
249743
|
}
|
|
249676
249744
|
function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
249677
|
-
const router =
|
|
249678
|
-
const parseBody =
|
|
249745
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
249746
|
+
const parseBody = import_express4.json();
|
|
249679
249747
|
const privateFilesDir = path18.join(mediaFilesDir, "private");
|
|
249680
249748
|
fs28.mkdirSync(mediaFilesDir, { recursive: true });
|
|
249681
249749
|
fs28.mkdirSync(privateFilesDir, { recursive: true });
|
|
@@ -249745,7 +249813,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
|
|
|
249745
249813
|
return router;
|
|
249746
249814
|
}
|
|
249747
249815
|
function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
249748
|
-
const router =
|
|
249816
|
+
const router = import_express4.Router({ mergeParams: true });
|
|
249749
249817
|
router.post("/:slug/:operationId", (req, res, next) => {
|
|
249750
249818
|
logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
|
|
249751
249819
|
req.url = req.originalUrl;
|
|
@@ -249754,6 +249822,18 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
|
|
|
249754
249822
|
return router;
|
|
249755
249823
|
}
|
|
249756
249824
|
|
|
249825
|
+
// src/cli/dev/dev-server/routes/users.ts
|
|
249826
|
+
var import_express5 = __toESM(require_express(), 1);
|
|
249827
|
+
function createUsersRoutes() {
|
|
249828
|
+
const router = import_express5.Router({ mergeParams: true });
|
|
249829
|
+
const parseBody = import_express5.json();
|
|
249830
|
+
router.post("/invite-user", parseBody, (req, _res, next) => {
|
|
249831
|
+
console.log("invite-user", req.body);
|
|
249832
|
+
next();
|
|
249833
|
+
});
|
|
249834
|
+
return router;
|
|
249835
|
+
}
|
|
249836
|
+
|
|
249757
249837
|
// src/cli/dev/dev-server/watcher.ts
|
|
249758
249838
|
import { EventEmitter as EventEmitter4 } from "node:events";
|
|
249759
249839
|
import { relative as relative6 } from "node:path";
|
|
@@ -251458,7 +251538,7 @@ async function createDevServer(options8) {
|
|
|
251458
251538
|
const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
|
|
251459
251539
|
const baseUrl = `http://localhost:${port}`;
|
|
251460
251540
|
const { functions, entities, project: project2 } = await options8.loadResources();
|
|
251461
|
-
const app =
|
|
251541
|
+
const app = import_express6.default();
|
|
251462
251542
|
const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
|
|
251463
251543
|
target: BASE44_APP_URL,
|
|
251464
251544
|
changeOrigin: true
|
|
@@ -251475,7 +251555,17 @@ async function createDevServer(options8) {
|
|
|
251475
251555
|
}
|
|
251476
251556
|
next();
|
|
251477
251557
|
});
|
|
251558
|
+
app.use((req, res, next) => {
|
|
251559
|
+
const auth2 = req.headers.authorization;
|
|
251560
|
+
if (!auth2 || !auth2.startsWith("Bearer ")) {
|
|
251561
|
+
res.status(401).json({ error: "Unauthorized" });
|
|
251562
|
+
return;
|
|
251563
|
+
}
|
|
251564
|
+
next();
|
|
251565
|
+
});
|
|
251478
251566
|
const devLogger = createDevLogger();
|
|
251567
|
+
const usersRoutes = createUsersRoutes();
|
|
251568
|
+
app.use("/api/apps/:appId/users", usersRoutes);
|
|
251479
251569
|
const functionManager = new FunctionManager(functions, devLogger, options8.denoWrapperPath);
|
|
251480
251570
|
const functionRoutes = createFunctionRouter(functionManager, devLogger);
|
|
251481
251571
|
app.use("/api/apps/:appId/functions", functionRoutes);
|
|
@@ -251488,7 +251578,7 @@ async function createDevServer(options8) {
|
|
|
251488
251578
|
R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
|
|
251489
251579
|
}
|
|
251490
251580
|
let emitEntityEvent = () => {};
|
|
251491
|
-
const entityRoutes = createEntityRoutes(db2, devLogger,
|
|
251581
|
+
const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
|
|
251492
251582
|
app.use("/api/apps/:appId/entities", entityRoutes);
|
|
251493
251583
|
const { path: mediaFilesDir } = await $dir();
|
|
251494
251584
|
app.use("/media/private/:fileUri", (req, res, next) => {
|
|
@@ -251509,7 +251599,7 @@ async function createDevServer(options8) {
|
|
|
251509
251599
|
}
|
|
251510
251600
|
next();
|
|
251511
251601
|
});
|
|
251512
|
-
app.use("/media",
|
|
251602
|
+
app.use("/media", import_express6.default.static(mediaFilesDir));
|
|
251513
251603
|
const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
|
|
251514
251604
|
app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
|
|
251515
251605
|
const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
|
|
@@ -255960,4 +256050,4 @@ export {
|
|
|
255960
256050
|
CLIExitError
|
|
255961
256051
|
};
|
|
255962
256052
|
|
|
255963
|
-
//# debugId=
|
|
256053
|
+
//# debugId=A178BD03C903D32B64756E2164756E21
|