@base44-preview/cli 0.1.3-pr.563.b1a3390 → 0.1.3-pr.563.e8db973

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.
@@ -6,6 +6,8 @@
6
6
  "name": "<%= name %>"<% if (description) { %>,
7
7
  "description": "<%= description %>"<% } %>,
8
8
 
9
+ "visibility": "public",
10
+
9
11
  // Site/hosting configuration for the client application
10
12
  // Docs: https://docs.base44.com/configuration/hosting
11
13
  "site": {
@@ -4,7 +4,9 @@
4
4
 
5
5
  {
6
6
  "name": "<%= name %>"<% if (description) { %>,
7
- "description": "<%= description %>"<% } %>
7
+ "description": "<%= description %>"<% } %>,
8
+
9
+ "visibility": "public"
8
10
 
9
11
  // Site/hosting configuration
10
12
  // Docs: https://docs.base44.com/configuration/hosting
package/dist/cli/index.js CHANGED
@@ -218279,6 +218279,7 @@ var CONFIG_FILE_EXTENSION = "jsonc";
218279
218279
  var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
218280
218280
  var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
218281
218281
  var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
218282
+ var BACKEND_FILE_GLOB = "**/*.{js,ts,json,jsonc}";
218282
218283
  var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
218283
218284
  var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
218284
218285
  var PROJECT_CONFIG_PATTERNS = [
@@ -233819,6 +233820,9 @@ class ApiError extends SystemError {
233819
233820
  }
233820
233821
  ];
233821
233822
  }
233823
+ if (statusCode && statusCode < 500) {
233824
+ return [];
233825
+ }
233822
233826
  return [{ message: "Check your network connection and try again" }];
233823
233827
  }
233824
233828
  static getReasonHints(parsedResponse) {
@@ -236040,11 +236044,13 @@ var PluginMetadataSchema = exports_external.object({
236040
236044
  var PluginReferenceSchema = exports_external.object({
236041
236045
  source: exports_external.string().min(1, "Plugin source cannot be empty")
236042
236046
  });
236047
+ var VISIBILITY_LEVELS = ["public", "private", "workspace"];
236043
236048
  var ProjectConfigSchema = exports_external.object({
236044
236049
  name: exports_external.string({
236045
236050
  error: "App name cannot be empty"
236046
236051
  }).min(1, "App name cannot be empty"),
236047
236052
  description: exports_external.string().optional(),
236053
+ visibility: exports_external.enum(VISIBILITY_LEVELS).optional(),
236048
236054
  site: SiteConfigSchema.optional(),
236049
236055
  entitiesDir: exports_external.string().optional().default("entities"),
236050
236056
  functionsDir: exports_external.string().optional().default("functions"),
@@ -241839,6 +241845,11 @@ var PublishedUrlResponseSchema = exports_external.object({
241839
241845
  });
241840
241846
 
241841
241847
  // src/core/project/api.ts
241848
+ var PUBLIC_SETTINGS = {
241849
+ public: "public_without_login",
241850
+ private: "private_with_login",
241851
+ workspace: "workspace_with_login"
241852
+ };
241842
241853
  async function createProject(projectName, description) {
241843
241854
  let response;
241844
241855
  try {
@@ -241847,7 +241858,7 @@ async function createProject(projectName, description) {
241847
241858
  name: projectName,
241848
241859
  user_description: description ?? `Backend for '${projectName}'`,
241849
241860
  is_managed_source_code: false,
241850
- public_settings: "public_without_login"
241861
+ public_settings: PUBLIC_SETTINGS.public
241851
241862
  }
241852
241863
  });
241853
241864
  } catch (error48) {
@@ -241861,6 +241872,18 @@ async function createProject(projectName, description) {
241861
241872
  projectId: result.data.id
241862
241873
  };
241863
241874
  }
241875
+ async function setAppVisibility(visibility) {
241876
+ if (!visibility)
241877
+ return;
241878
+ const { id } = getAppContext();
241879
+ try {
241880
+ await base44Client.put(`api/apps/${id}`, {
241881
+ json: { public_settings: PUBLIC_SETTINGS[visibility] }
241882
+ });
241883
+ } catch (error48) {
241884
+ throw await ApiError.fromHttpError(error48, "updating app visibility");
241885
+ }
241886
+ }
241864
241887
  async function listProjects() {
241865
241888
  let response;
241866
241889
  try {
@@ -243564,7 +243587,7 @@ async function readSharedFiles(functionsDir) {
243564
243587
  if (!await pathExists(sharedDir)) {
243565
243588
  return [];
243566
243589
  }
243567
- return globby("**/*.{js,ts,json}", { cwd: sharedDir, absolute: true });
243590
+ return globby(BACKEND_FILE_GLOB, { cwd: sharedDir, absolute: true });
243568
243591
  }
243569
243592
  async function readFunctionConfig(configPath) {
243570
243593
  const parsed = await readJsonFile(configPath);
@@ -243583,7 +243606,7 @@ async function readFunction(configPath, sharedFiles) {
243583
243606
  hints: [{ message: "Check the 'entry' field in your function config" }]
243584
243607
  });
243585
243608
  }
243586
- const filePaths = await globby("**/*.{js,ts,json}", {
243609
+ const filePaths = await globby(BACKEND_FILE_GLOB, {
243587
243610
  cwd: functionDir,
243588
243611
  absolute: true
243589
243612
  });
@@ -243615,7 +243638,7 @@ async function readAllFunctions(functionsDir) {
243615
243638
  const functionsFromConfig = await Promise.all(configFiles.map((configPath) => readFunction(configPath, sharedFiles)));
243616
243639
  const functionsWithoutConfig = await Promise.all(entryFilesWithoutConfig.map(async (entryFile) => {
243617
243640
  const functionDir = dirname6(entryFile);
243618
- const filePaths = await globby("**/*.{js,ts,json}", {
243641
+ const filePaths = await globby(BACKEND_FILE_GLOB, {
243619
243642
  cwd: functionDir,
243620
243643
  absolute: true
243621
243644
  });
@@ -244238,10 +244261,15 @@ function hasResourcesToDeploy(projectData) {
244238
244261
  const hasAgents = agents.length > 0;
244239
244262
  const hasConnectors = connectors.length > 0;
244240
244263
  const hasAuthConfig = authConfig.length > 0;
244241
- return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasSite;
244264
+ const hasVisibility = Boolean(project.visibility);
244265
+ return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
244242
244266
  }
244243
244267
  async function deployAll(projectData, options) {
244244
244268
  const { project, entities, functions, agents, connectors, authConfig } = projectData;
244269
+ await setAppVisibility(project.visibility);
244270
+ if (project.visibility) {
244271
+ options?.onVisibilitySet?.(project.visibility);
244272
+ }
244245
244273
  await entityResource.push(entities);
244246
244274
  await deployFunctionsSequentially(functions, {
244247
244275
  onStart: options?.onFunctionStart,
@@ -253465,6 +253493,9 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
253465
253493
  if (authConfig.length > 0) {
253466
253494
  summaryLines.push(" - Auth config");
253467
253495
  }
253496
+ if (project2.visibility) {
253497
+ summaryLines.push(` - Visibility: ${project2.visibility}`);
253498
+ }
253468
253499
  if (project2.site?.outputDirectory) {
253469
253500
  summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
253470
253501
  }
@@ -253486,6 +253517,9 @@ ${summaryLines.join(`
253486
253517
  let functionCompleted = 0;
253487
253518
  const functionTotal = functions.length;
253488
253519
  const result = await deployAll(projectData, {
253520
+ onVisibilitySet: (level) => {
253521
+ log.success(`App visibility set to ${level}`);
253522
+ },
253489
253523
  onFunctionStart: (names) => {
253490
253524
  const label = names.length === 1 ? names[0] : `${names.length} functions`;
253491
253525
  log.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
@@ -253953,6 +253987,17 @@ Examples:
253953
253987
  $ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
253954
253988
  }
253955
253989
 
253990
+ // src/cli/commands/project/visibility.ts
253991
+ async function setVisibility({ runTask: runTask2 }, level) {
253992
+ await runTask2(`Setting app visibility to ${level}`, () => setAppVisibility(level));
253993
+ return { outroMessage: `App visibility set to ${level}` };
253994
+ }
253995
+ function getVisibilityCommand() {
253996
+ return new Base44Command("visibility").description("Set the app's visibility on the server (public, private, or workspace)").addArgument(new Argument("<level>", "Visibility level").choices([
253997
+ ...VISIBILITY_LEVELS
253998
+ ])).action(setVisibility);
253999
+ }
254000
+
253956
254001
  // src/core/resources/sandbox/schema.ts
253957
254002
  var FileErrorSchema = exports_external.object({
253958
254003
  code: exports_external.string(),
@@ -258324,6 +258369,7 @@ function createProgram(context) {
258324
258369
  program2.addCommand(getScaffoldCommand());
258325
258370
  program2.addCommand(getDashboardCommand());
258326
258371
  program2.addCommand(getDeployCommand2());
258372
+ program2.addCommand(getVisibilityCommand());
258327
258373
  program2.addCommand(getLinkCommand());
258328
258374
  program2.addCommand(getEjectCommand());
258329
258375
  program2.addCommand(getEntitiesPushCommand());
@@ -262585,4 +262631,4 @@ export {
262585
262631
  CLIExitError
262586
262632
  };
262587
262633
 
262588
- //# debugId=2758F4A8B728399A64756E2164756E21
262634
+ //# debugId=099C426F953D698C64756E2164756E21