@base44-preview/cli 0.0.44-pr.406.b97f4ba → 0.0.44-pr.407.17e027d

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
@@ -247614,7 +247614,7 @@ async function getTemplateById(templateId) {
247614
247614
  function validateNonInteractiveFlags(command) {
247615
247615
  const { path: path17 } = command.opts();
247616
247616
  if (path17 && !command.args.length) {
247617
- command.error("Non-interactive mode requires all flags: --name, --path");
247617
+ command.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
247618
247618
  }
247619
247619
  }
247620
247620
  async function createInteractive(options) {
@@ -247662,6 +247662,7 @@ async function createInteractive(options) {
247662
247662
  });
247663
247663
  }
247664
247664
  async function createNonInteractive(options) {
247665
+ R2.info(`Creating a new project at ${resolve2(options.path)}`);
247665
247666
  const template2 = await getTemplateById(options.template ?? DEFAULT_TEMPLATE_ID);
247666
247667
  return await executeCreate({
247667
247668
  template: template2,
@@ -247763,7 +247764,14 @@ async function executeCreate({
247763
247764
  return { outroMessage: "Your project is set up and ready to use" };
247764
247765
  }
247765
247766
  function getCreateCommand(context) {
247766
- return new Command("create").description("Create a new Base44 project").addArgument(new Argument("name", "Project name").argOptional()).option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--no-skills", "Skip AI agent skills installation").hook("preAction", validateNonInteractiveFlags).action(async (name2, options) => {
247767
+ return new Command("create").description("Create a new Base44 project").addArgument(new Argument("name", "Project name").argOptional()).option("-p, --path <path>", "Path where to create the project").option("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
247768
+ Examples:
247769
+ $ base44 create my-app Creates a base44 project at ./my-app
247770
+ $ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
247771
+ $ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(async (name2, options) => {
247772
+ if (name2 && !options.path) {
247773
+ options.path = `./${import_kebabCase.default(name2)}`;
247774
+ }
247767
247775
  const isNonInteractive = !!(options.name ?? name2) && !!options.path;
247768
247776
  if (isNonInteractive) {
247769
247777
  await runCommand(() => createNonInteractive({ name: options.name ?? name2, ...options }), { requireAuth: true, requireAppConfig: false }, context);
@@ -248424,7 +248432,7 @@ function getTypesCommand(context) {
248424
248432
  // src/cli/dev/dev-server/main.ts
248425
248433
  import { dirname as dirname13, join as join18 } from "node:path";
248426
248434
  var import_cors = __toESM(require_lib4(), 1);
248427
- var import_express6 = __toESM(require_express(), 1);
248435
+ var import_express4 = __toESM(require_express(), 1);
248428
248436
 
248429
248437
  // ../../node_modules/get-port/index.js
248430
248438
  import net from "node:net";
@@ -248784,14 +248792,11 @@ var import_nedb = __toESM(require_nedb(), 1);
248784
248792
 
248785
248793
  class Database {
248786
248794
  collections = new Map;
248787
- initCollections(names) {
248788
- for (const name2 of names) {
248789
- this.collections.set(name2, new import_nedb.default);
248795
+ load(entities) {
248796
+ for (const entity2 of entities) {
248797
+ this.collections.set(entity2.name, new import_nedb.default);
248790
248798
  }
248791
248799
  }
248792
- hasCollection(name2) {
248793
- return this.collections.has(name2);
248794
- }
248795
248800
  getCollection(name2) {
248796
248801
  return this.collections.get(name2);
248797
248802
  }
@@ -248838,8 +248843,8 @@ function broadcastEntityEvent(io6, appId, entityName, event) {
248838
248843
  });
248839
248844
  }
248840
248845
 
248841
- // src/cli/dev/dev-server/routes/entities/entities-router.ts
248842
- var import_express3 = __toESM(require_express(), 1);
248846
+ // src/cli/dev/dev-server/routes/entities.ts
248847
+ var import_express2 = __toESM(require_express(), 1);
248843
248848
 
248844
248849
  // ../../node_modules/nanoid/index.js
248845
248850
  import { webcrypto as crypto } from "node:crypto";
@@ -248871,52 +248876,7 @@ function nanoid3(size = 21) {
248871
248876
  return id2;
248872
248877
  }
248873
248878
 
248874
- // src/cli/dev/dev-server/routes/entities/entities-user-router.ts
248875
- var import_express2 = __toESM(require_express(), 1);
248876
-
248877
- // src/cli/dev/dev-server/routes/entities/utils.ts
248878
- function stripInternalFields(doc2) {
248879
- if (Array.isArray(doc2)) {
248880
- return doc2.map((d5) => stripInternalFields(d5));
248881
- }
248882
- const { _id, ...rest } = doc2;
248883
- return rest;
248884
- }
248885
-
248886
- // src/cli/dev/dev-server/routes/entities/entities-user-router.ts
248887
- async function createUserRouter(db2) {
248888
- if (!db2.hasCollection("User")) {
248889
- db2.initCollections(["User"]);
248890
- }
248891
- const userInfo = await readAuth();
248892
- const now = new Date().toISOString().replace("Z", "000");
248893
- const idMe = nanoid3();
248894
- await db2.getCollection("User")?.insertAsync({
248895
- id: idMe,
248896
- email: userInfo.email,
248897
- full_name: userInfo.name,
248898
- is_service: false,
248899
- is_verified: true,
248900
- disabled: null,
248901
- role: "admin",
248902
- collaborator_role: "editor",
248903
- created_date: now,
248904
- updated_date: now
248905
- });
248906
- const router = import_express2.Router({ mergeParams: true });
248907
- router.get("/:id", async (req, res) => {
248908
- const id2 = req.params.id === "me" ? idMe : req.params.id;
248909
- const result = await db2.getCollection("User")?.findOneAsync({ id: id2 });
248910
- if (!result) {
248911
- res.status(404).json({ error: `User with id "${req.params.id}" not found` });
248912
- return;
248913
- }
248914
- res.json(stripInternalFields(result));
248915
- });
248916
- return router;
248917
- }
248918
-
248919
- // src/cli/dev/dev-server/routes/entities/entities-router.ts
248879
+ // src/cli/dev/dev-server/routes/entities.ts
248920
248880
  function parseSort(sort) {
248921
248881
  if (!sort) {
248922
248882
  return;
@@ -248939,9 +248899,16 @@ function parseFields(fields) {
248939
248899
  }
248940
248900
  return Object.keys(projection).length > 0 ? projection : undefined;
248941
248901
  }
248942
- async function createEntityRoutes(db2, logger, broadcast) {
248943
- const router = import_express3.Router({ mergeParams: true });
248944
- const parseBody = import_express3.json();
248902
+ function stripInternalFields(doc2) {
248903
+ if (Array.isArray(doc2)) {
248904
+ return doc2.map((d5) => stripInternalFields(d5));
248905
+ }
248906
+ const { _id, ...rest } = doc2;
248907
+ return rest;
248908
+ }
248909
+ function createEntityRoutes(db2, logger, remoteProxy, broadcast) {
248910
+ const router = import_express2.Router({ mergeParams: true });
248911
+ const parseBody = import_express2.json();
248945
248912
  function withCollection(handler) {
248946
248913
  return async (req, res) => {
248947
248914
  const collection = db2.getCollection(req.params.entityName);
@@ -248967,8 +248934,11 @@ async function createEntityRoutes(db2, logger, broadcast) {
248967
248934
  }
248968
248935
  broadcast(appId, entityName, createData(data));
248969
248936
  }
248970
- const userRouter = await createUserRouter(db2);
248971
- router.use("/User", userRouter);
248937
+ router.get("/User/:id", (req, res, next) => {
248938
+ logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
248939
+ req.url = req.originalUrl;
248940
+ remoteProxy(req, res, next);
248941
+ });
248972
248942
  router.get("/:entityName/:id", withCollection(async (req, res, collection) => {
248973
248943
  const { entityName, id: id2 } = req.params;
248974
248944
  try {
@@ -249119,7 +249089,7 @@ async function createEntityRoutes(db2, logger, broadcast) {
249119
249089
  }
249120
249090
 
249121
249091
  // src/cli/dev/dev-server/routes/integrations.ts
249122
- var import_express4 = __toESM(require_express(), 1);
249092
+ var import_express3 = __toESM(require_express(), 1);
249123
249093
  var import_multer = __toESM(require_multer(), 1);
249124
249094
  import { createHash, randomUUID as randomUUID4 } from "node:crypto";
249125
249095
  import fs28 from "node:fs";
@@ -249128,8 +249098,8 @@ function createFileToken(fileUri) {
249128
249098
  return createHash("sha256").update(fileUri).digest("hex");
249129
249099
  }
249130
249100
  function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
249131
- const router = import_express4.Router({ mergeParams: true });
249132
- const parseBody = import_express4.json();
249101
+ const router = import_express3.Router({ mergeParams: true });
249102
+ const parseBody = import_express3.json();
249133
249103
  const privateFilesDir = path18.join(mediaFilesDir, "private");
249134
249104
  fs28.mkdirSync(mediaFilesDir, { recursive: true });
249135
249105
  fs28.mkdirSync(privateFilesDir, { recursive: true });
@@ -249199,7 +249169,7 @@ function createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, logger) {
249199
249169
  return router;
249200
249170
  }
249201
249171
  function createCustomIntegrationRoutes(remoteProxy, logger) {
249202
- const router = import_express4.Router({ mergeParams: true });
249172
+ const router = import_express3.Router({ mergeParams: true });
249203
249173
  router.post("/:slug/:operationId", (req, res, next) => {
249204
249174
  logger.warn(`"${req.originalUrl}" is not supported in local development, passing call to production`);
249205
249175
  req.url = req.originalUrl;
@@ -249208,18 +249178,6 @@ function createCustomIntegrationRoutes(remoteProxy, logger) {
249208
249178
  return router;
249209
249179
  }
249210
249180
 
249211
- // src/cli/dev/dev-server/routes/users.ts
249212
- var import_express5 = __toESM(require_express(), 1);
249213
- function createUsersRoutes() {
249214
- const router = import_express5.Router({ mergeParams: true });
249215
- const parseBody = import_express5.json();
249216
- router.post("/invite-user", parseBody, (req, _res, next) => {
249217
- console.log("invite-user", req.body);
249218
- next();
249219
- });
249220
- return router;
249221
- }
249222
-
249223
249181
  // src/cli/dev/dev-server/watcher.ts
249224
249182
  import { EventEmitter as EventEmitter4 } from "node:events";
249225
249183
  import { relative as relative6 } from "node:path";
@@ -250924,7 +250882,7 @@ async function createDevServer(options8) {
250924
250882
  const port = userPort ?? await getPorts({ port: DEFAULT_PORT });
250925
250883
  const baseUrl = `http://localhost:${port}`;
250926
250884
  const { functions, entities, project: project2 } = await options8.loadResources();
250927
- const app = import_express6.default();
250885
+ const app = import_express4.default();
250928
250886
  const remoteProxy = import_http_proxy_middleware2.createProxyMiddleware({
250929
250887
  target: BASE44_APP_URL,
250930
250888
  changeOrigin: true
@@ -250941,17 +250899,7 @@ async function createDevServer(options8) {
250941
250899
  }
250942
250900
  next();
250943
250901
  });
250944
- app.use((req, res, next) => {
250945
- const auth2 = req.headers.authorization;
250946
- if (!auth2 || !auth2.startsWith("Bearer ")) {
250947
- res.status(401).json({ error: "Unauthorized" });
250948
- return;
250949
- }
250950
- next();
250951
- });
250952
250902
  const devLogger = createDevLogger();
250953
- const usersRoutes = createUsersRoutes();
250954
- app.use("/api/apps/:appId/users", usersRoutes);
250955
250903
  const functionManager = new FunctionManager(functions, devLogger, options8.denoWrapperPath);
250956
250904
  const functionRoutes = createFunctionRouter(functionManager, devLogger);
250957
250905
  app.use("/api/apps/:appId/functions", functionRoutes);
@@ -250959,12 +250907,12 @@ async function createDevServer(options8) {
250959
250907
  R2.info(`Loaded functions: ${functionManager.getFunctionNames().join(", ")}`);
250960
250908
  }
250961
250909
  const db2 = new Database;
250962
- db2.initCollections(entities.map((entity2) => entity2.name));
250910
+ db2.load(entities);
250963
250911
  if (db2.getCollectionNames().length > 0) {
250964
250912
  R2.info(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
250965
250913
  }
250966
250914
  let emitEntityEvent = () => {};
250967
- const entityRoutes = await createEntityRoutes(db2, devLogger, (...args) => emitEntityEvent(...args));
250915
+ const entityRoutes = createEntityRoutes(db2, devLogger, remoteProxy, (...args) => emitEntityEvent(...args));
250968
250916
  app.use("/api/apps/:appId/entities", entityRoutes);
250969
250917
  const { path: mediaFilesDir } = await $dir();
250970
250918
  app.use("/media/private/:fileUri", (req, res, next) => {
@@ -250985,7 +250933,7 @@ async function createDevServer(options8) {
250985
250933
  }
250986
250934
  next();
250987
250935
  });
250988
- app.use("/media", import_express6.default.static(mediaFilesDir));
250936
+ app.use("/media", import_express4.default.static(mediaFilesDir));
250989
250937
  const integrationRoutes = createIntegrationRoutes(mediaFilesDir, baseUrl, remoteProxy, devLogger);
250990
250938
  app.use("/api/apps/:appId/integration-endpoints", integrationRoutes);
250991
250939
  const customIntegrationRoutes = createCustomIntegrationRoutes(remoteProxy, devLogger);
@@ -251034,7 +250982,7 @@ async function createDevServer(options8) {
251034
250982
  if (previousEntityCount > 0) {
251035
250983
  devLogger.log("Entities directory changed, clearing data...");
251036
250984
  }
251037
- db2.initCollections(entities2.map((entity2) => entity2.name));
250985
+ db2.load(entities2);
251038
250986
  if (db2.getCollectionNames().length > 0) {
251039
250987
  devLogger.log(`Loaded entities: ${db2.getCollectionNames().join(", ")}`);
251040
250988
  }
@@ -255435,4 +255383,4 @@ export {
255435
255383
  CLIExitError
255436
255384
  };
255437
255385
 
255438
- //# debugId=6ACA581A680E964E64756E2164756E21
255386
+ //# debugId=AB8EFABD4507C31564756E2164756E21