@base44-preview/cli 0.1.2-pr.564.3a64396 → 0.1.3-pr.550.44b16f9

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
@@ -233593,6 +233593,9 @@ var ApiErrorResponseSchema = exports_external.looseObject({
233593
233593
  });
233594
233594
 
233595
233595
  // src/core/errors.ts
233596
+ function usingWorkspaceApiKey() {
233597
+ return process.env.BASE44_API_KEY?.trim().startsWith("b44k_") ?? false;
233598
+ }
233596
233599
  function formatApiError(errorBody, parsed) {
233597
233600
  const data = parsed ?? ApiErrorResponseSchema.safeParse(errorBody).data;
233598
233601
  if (data) {
@@ -233787,6 +233790,13 @@ class ApiError extends SystemError {
233787
233790
  ];
233788
233791
  }
233789
233792
  if (statusCode === 401) {
233793
+ if (usingWorkspaceApiKey()) {
233794
+ return [
233795
+ {
233796
+ message: "The workspace API key (BASE44_API_KEY) was rejected. Verify it is valid and authorized for this app."
233797
+ }
233798
+ ];
233799
+ }
233790
233800
  return [{ message: "Try logging in again", command: "base44 login" }];
233791
233801
  }
233792
233802
  if (statusCode === 403) {
@@ -233809,6 +233819,9 @@ class ApiError extends SystemError {
233809
233819
  }
233810
233820
  ];
233811
233821
  }
233822
+ if (statusCode && statusCode < 500) {
233823
+ return [];
233824
+ }
233812
233825
  return [{ message: "Check your network connection and try again" }];
233813
233826
  }
233814
233827
  static getReasonHints(parsedResponse) {
@@ -236030,11 +236043,13 @@ var PluginMetadataSchema = exports_external.object({
236030
236043
  var PluginReferenceSchema = exports_external.object({
236031
236044
  source: exports_external.string().min(1, "Plugin source cannot be empty")
236032
236045
  });
236046
+ var VISIBILITY_LEVELS = ["public", "private", "workspace"];
236033
236047
  var ProjectConfigSchema = exports_external.object({
236034
236048
  name: exports_external.string({
236035
236049
  error: "App name cannot be empty"
236036
236050
  }).min(1, "App name cannot be empty"),
236037
236051
  description: exports_external.string().optional(),
236052
+ visibility: exports_external.enum(VISIBILITY_LEVELS).optional(),
236038
236053
  site: SiteConfigSchema.optional(),
236039
236054
  entitiesDir: exports_external.string().optional().default("entities"),
236040
236055
  functionsDir: exports_external.string().optional().default("functions"),
@@ -236102,7 +236117,19 @@ function getTestOverrides() {
236102
236117
 
236103
236118
  // src/core/auth/config.ts
236104
236119
  var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
236120
+ var WORKSPACE_API_KEY_PREFIX = "b44k_";
236105
236121
  var refreshPromise = null;
236122
+ function getWorkspaceApiKeyFromEnv() {
236123
+ const key = process.env.BASE44_API_KEY?.trim();
236124
+ return key ? key : null;
236125
+ }
236126
+ function isWorkspaceApiKey(value) {
236127
+ return value.startsWith(WORKSPACE_API_KEY_PREFIX);
236128
+ }
236129
+ function hasWorkspaceApiKeyAuth() {
236130
+ const key = getWorkspaceApiKeyFromEnv();
236131
+ return key !== null && isWorkspaceApiKey(key);
236132
+ }
236106
236133
  async function seedAuthFromEnv() {
236107
236134
  const accessToken = process.env.BASE44_ACCESS_TOKEN;
236108
236135
  if (!accessToken) {
@@ -241817,6 +241844,11 @@ var PublishedUrlResponseSchema = exports_external.object({
241817
241844
  });
241818
241845
 
241819
241846
  // src/core/project/api.ts
241847
+ var PUBLIC_SETTINGS = {
241848
+ public: "public_without_login",
241849
+ private: "private_with_login",
241850
+ workspace: "workspace_with_login"
241851
+ };
241820
241852
  async function createProject(projectName, description) {
241821
241853
  let response;
241822
241854
  try {
@@ -241825,7 +241857,7 @@ async function createProject(projectName, description) {
241825
241857
  name: projectName,
241826
241858
  user_description: description ?? `Backend for '${projectName}'`,
241827
241859
  is_managed_source_code: false,
241828
- public_settings: "public_without_login"
241860
+ public_settings: PUBLIC_SETTINGS.public
241829
241861
  }
241830
241862
  });
241831
241863
  } catch (error48) {
@@ -241839,6 +241871,18 @@ async function createProject(projectName, description) {
241839
241871
  projectId: result.data.id
241840
241872
  };
241841
241873
  }
241874
+ async function setAppVisibility(visibility) {
241875
+ if (!visibility)
241876
+ return;
241877
+ const { id } = getAppContext();
241878
+ try {
241879
+ await base44Client.put(`api/apps/${id}`, {
241880
+ json: { public_settings: PUBLIC_SETTINGS[visibility] }
241881
+ });
241882
+ } catch (error48) {
241883
+ throw await ApiError.fromHttpError(error48, "updating app visibility");
241884
+ }
241885
+ }
241842
241886
  async function listProjects() {
241843
241887
  let response;
241844
241888
  try {
@@ -243920,7 +243964,7 @@ import { join as join11 } from "node:path";
243920
243964
  // package.json
243921
243965
  var package_default = {
243922
243966
  name: "base44",
243923
- version: "0.1.2",
243967
+ version: "0.1.3",
243924
243968
  description: "Base44 CLI - Unified interface for managing Base44 applications",
243925
243969
  type: "module",
243926
243970
  bin: {
@@ -244206,10 +244250,15 @@ function hasResourcesToDeploy(projectData) {
244206
244250
  const hasAgents = agents.length > 0;
244207
244251
  const hasConnectors = connectors.length > 0;
244208
244252
  const hasAuthConfig = authConfig.length > 0;
244209
- return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasSite;
244253
+ const hasVisibility = Boolean(project.visibility);
244254
+ return hasEntities || hasFunctions || hasAgents || hasConnectors || hasAuthConfig || hasVisibility || hasSite;
244210
244255
  }
244211
244256
  async function deployAll(projectData, options) {
244212
244257
  const { project, entities, functions, agents, connectors, authConfig } = projectData;
244258
+ await setAppVisibility(project.visibility);
244259
+ if (project.visibility) {
244260
+ options?.onVisibilitySet?.(project.visibility);
244261
+ }
244213
244262
  await entityResource.push(entities);
244214
244263
  await deployFunctionsSequentially(functions, {
244215
244264
  onStart: options?.onFunctionStart,
@@ -244217,7 +244266,8 @@ async function deployAll(projectData, options) {
244217
244266
  });
244218
244267
  await agentResource.push(agents);
244219
244268
  await authConfigResource.push(authConfig);
244220
- const { results: connectorResults } = await pushConnectors(connectors);
244269
+ const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
244270
+ const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
244221
244271
  if (project.site?.outputDirectory) {
244222
244272
  const outputDir = resolve2(project.root, project.site.outputDirectory);
244223
244273
  const { appUrl } = await deploySite(outputDir);
@@ -244241,6 +244291,9 @@ async function handleUnauthorized(request, _options, response) {
244241
244291
  if (response.status !== 401) {
244242
244292
  return;
244243
244293
  }
244294
+ if (hasWorkspaceApiKeyAuth()) {
244295
+ return;
244296
+ }
244244
244297
  if (retriedRequests.has(request)) {
244245
244298
  return;
244246
244299
  }
@@ -244269,6 +244322,11 @@ var base44Client = distribution_default.create({
244269
244322
  },
244270
244323
  captureRequestBody,
244271
244324
  async (request) => {
244325
+ const workspaceApiKey = getWorkspaceApiKeyFromEnv();
244326
+ if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
244327
+ request.headers.set("api_key", workspaceApiKey);
244328
+ return;
244329
+ }
244272
244330
  try {
244273
244331
  const auth = await readAuth();
244274
244332
  if (isTokenExpired(auth)) {
@@ -244474,6 +244532,12 @@ async function login({
244474
244532
 
244475
244533
  // src/cli/utils/command/middleware.ts
244476
244534
  async function ensureAuth(ctx) {
244535
+ if (hasWorkspaceApiKeyAuth()) {
244536
+ ctx.errorReporter.setContext({
244537
+ user: { email: "workspace-api-key", name: "Workspace API key" }
244538
+ });
244539
+ return;
244540
+ }
244477
244541
  await seedAuthFromEnv();
244478
244542
  const loggedIn = await isLoggedIn();
244479
244543
  if (!loggedIn) {
@@ -251898,6 +251962,12 @@ function getLogoutCommand() {
251898
251962
 
251899
251963
  // src/cli/commands/auth/whoami.ts
251900
251964
  async function whoami(_ctx) {
251965
+ const workspaceApiKey = getWorkspaceApiKeyFromEnv();
251966
+ if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
251967
+ return {
251968
+ outroMessage: `Using workspace API key: ${theme.styles.bold(workspaceApiKey.slice(0, 10))}`
251969
+ };
251970
+ }
251901
251971
  const auth2 = await readAuth();
251902
251972
  return { outroMessage: `Logged in as: ${theme.styles.bold(auth2.email)}` };
251903
251973
  }
@@ -253412,6 +253482,9 @@ async function deployAction({ isNonInteractive, log }, options = {}) {
253412
253482
  if (authConfig.length > 0) {
253413
253483
  summaryLines.push(" - Auth config");
253414
253484
  }
253485
+ if (project2.visibility) {
253486
+ summaryLines.push(` - Visibility: ${project2.visibility}`);
253487
+ }
253415
253488
  if (project2.site?.outputDirectory) {
253416
253489
  summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
253417
253490
  }
@@ -253433,6 +253506,9 @@ ${summaryLines.join(`
253433
253506
  let functionCompleted = 0;
253434
253507
  const functionTotal = functions.length;
253435
253508
  const result = await deployAll(projectData, {
253509
+ onVisibilitySet: (level) => {
253510
+ log.success(`App visibility set to ${level}`);
253511
+ },
253436
253512
  onFunctionStart: (names) => {
253437
253513
  const label = names.length === 1 ? names[0] : `${names.length} functions`;
253438
253514
  log.step(theme.styles.dim(`[${functionCompleted + 1}/${functionTotal}] Deploying ${label}...`));
@@ -253782,7 +253858,8 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
253782
253858
  }
253783
253859
  throw error48;
253784
253860
  }
253785
- allEntries.push(...logs.map((entry) => normalizeLogEntry(entry, functionName)));
253861
+ const matchingLogs = filters.level ? logs.filter((entry) => entry.level === filters.level) : logs;
253862
+ allEntries.push(...matchingLogs.map((entry) => normalizeLogEntry(entry, functionName)));
253786
253863
  }
253787
253864
  if (functionNames.length > 1) {
253788
253865
  const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
@@ -253899,6 +253976,17 @@ Examples:
253899
253976
  $ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
253900
253977
  }
253901
253978
 
253979
+ // src/cli/commands/project/visibility.ts
253980
+ async function setVisibility({ runTask: runTask2 }, level) {
253981
+ await runTask2(`Setting app visibility to ${level}`, () => setAppVisibility(level));
253982
+ return { outroMessage: `App visibility set to ${level}` };
253983
+ }
253984
+ function getVisibilityCommand() {
253985
+ return new Base44Command("visibility").description("Set the app's visibility on the server (public, private, or workspace)").addArgument(new Argument("<level>", "Visibility level").choices([
253986
+ ...VISIBILITY_LEVELS
253987
+ ])).action(setVisibility);
253988
+ }
253989
+
253902
253990
  // src/core/resources/sandbox/schema.ts
253903
253991
  var FileErrorSchema = exports_external.object({
253904
253992
  code: exports_external.string(),
@@ -258270,6 +258358,7 @@ function createProgram(context) {
258270
258358
  program2.addCommand(getScaffoldCommand());
258271
258359
  program2.addCommand(getDashboardCommand());
258272
258360
  program2.addCommand(getDeployCommand2());
258361
+ program2.addCommand(getVisibilityCommand());
258273
258362
  program2.addCommand(getLinkCommand());
258274
258363
  program2.addCommand(getEjectCommand());
258275
258364
  program2.addCommand(getEntitiesPushCommand());
@@ -262531,4 +262620,4 @@ export {
262531
262620
  CLIExitError
262532
262621
  };
262533
262622
 
262534
- //# debugId=4A0242D8E23FB42E64756E2164756E21
262623
+ //# debugId=278D22E76D79024164756E2164756E21