@base44-preview/cli 0.2.7-pr.689.072f10a → 0.3.1-pr.681.c22cf4a

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
@@ -228411,6 +228411,22 @@ class UserError extends CLIError {
228411
228411
 
228412
228412
  class SystemError extends CLIError {
228413
228413
  }
228414
+
228415
+ class AuthRequiredError extends UserError {
228416
+ code = "AUTH_REQUIRED";
228417
+ constructor(message = "Authentication required", options) {
228418
+ super(message, {
228419
+ hints: options?.hints ?? [
228420
+ {
228421
+ message: "Run 'base44 login' to authenticate",
228422
+ command: "base44 login"
228423
+ }
228424
+ ],
228425
+ cause: options?.cause
228426
+ });
228427
+ }
228428
+ }
228429
+
228414
228430
  class AuthExpiredError extends UserError {
228415
228431
  code = "AUTH_EXPIRED";
228416
228432
  constructor(message = "Authentication has expired", options) {
@@ -228814,13 +228830,19 @@ function findEnvDir(cwd) {
228814
228830
  const configDir = dirname3(found.configPath);
228815
228831
  return basename(configDir) === PROJECT_SUBDIR ? dirname3(configDir) : configDir;
228816
228832
  }
228833
+ var accessTokenFromEnvFile = false;
228834
+ function isAccessTokenFromEnvFile() {
228835
+ return accessTokenFromEnvFile;
228836
+ }
228817
228837
  function loadProjectEnvFiles(cwd = process.cwd()) {
228818
228838
  const root = findEnvDir(cwd);
228839
+ const ambientAccessToken = process.env.BASE44_ACCESS_TOKEN ?? process.env[`${STRIPE_ENV_PREFIX}BASE44_ACCESS_TOKEN`];
228819
228840
  import_dotenv.config({
228820
228841
  path: [join(root, ".env.local"), join(root, ".env")],
228821
228842
  quiet: true
228822
228843
  });
228823
228844
  normalizeBase44Env();
228845
+ accessTokenFromEnvFile = ambientAccessToken === undefined && process.env.BASE44_ACCESS_TOKEN !== undefined;
228824
228846
  }
228825
228847
  function normalizeBase44Env() {
228826
228848
  for (const bareKey of BASE44_ENV_KEYS) {
@@ -230833,6 +230855,7 @@ function getTestOverrides() {
230833
230855
  var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
230834
230856
  var WORKSPACE_API_KEY_PREFIX = "b44k_";
230835
230857
  var refreshPromise = null;
230858
+ var envAccessTokenAuth = null;
230836
230859
  function getWorkspaceApiKeyFromEnv() {
230837
230860
  const key = process.env.BASE44_API_KEY?.trim();
230838
230861
  return key ? key : null;
@@ -230854,7 +230877,20 @@ async function seedAuthFromEnv() {
230854
230877
  const payload = claims !== null && typeof claims === "object" ? claims : null;
230855
230878
  const sub = typeof payload?.sub === "string" ? payload.sub : undefined;
230856
230879
  const exp = typeof payload?.exp === "number" ? payload.exp : undefined;
230857
- if (!refreshToken || !sub || !exp) {
230880
+ if (!sub || !exp) {
230881
+ return;
230882
+ }
230883
+ if (!refreshToken) {
230884
+ if (isAccessTokenFromEnvFile()) {
230885
+ return;
230886
+ }
230887
+ envAccessTokenAuth = {
230888
+ accessToken,
230889
+ refreshToken: "",
230890
+ expiresAt: exp * 1000,
230891
+ email: sub,
230892
+ name: sub
230893
+ };
230858
230894
  return;
230859
230895
  }
230860
230896
  await writeAuth({
@@ -230866,6 +230902,9 @@ async function seedAuthFromEnv() {
230866
230902
  });
230867
230903
  }
230868
230904
  async function readAuth() {
230905
+ if (envAccessTokenAuth) {
230906
+ return envAccessTokenAuth;
230907
+ }
230869
230908
  try {
230870
230909
  const authData = await readJsonFile(getAuthFilePath());
230871
230910
  const result = AuthDataSchema.safeParse(authData);
@@ -230902,6 +230941,9 @@ function isTokenExpired(auth) {
230902
230941
  return Date.now() >= auth.expiresAt - TOKEN_REFRESH_BUFFER_MS;
230903
230942
  }
230904
230943
  async function refreshAndSaveTokens() {
230944
+ if (envAccessTokenAuth) {
230945
+ return null;
230946
+ }
230905
230947
  if (refreshPromise) {
230906
230948
  return refreshPromise;
230907
230949
  }
@@ -236688,9 +236730,9 @@ async function downloadProject(projectId, projectPath) {
236688
236730
  await makeDirectory(projectPath);
236689
236731
  await pipeline(nodeStream, extract({ cwd: projectPath }));
236690
236732
  }
236691
- async function getAppUserToken(appId = getAppContext().id) {
236733
+ async function getAppUserToken() {
236692
236734
  try {
236693
- const response = await base44Client.get(`api/apps/${appId}/auth/token`).json();
236735
+ const response = await getAppClient().get("auth/token").json();
236694
236736
  return response.token;
236695
236737
  } catch (error) {
236696
236738
  throw await ApiError.fromHttpError(error, "exchanging platform token for app user token");
@@ -238253,21 +238295,19 @@ async function pullAllConnectors() {
238253
238295
  return connectors;
238254
238296
  }
238255
238297
  // src/core/resources/connector/push.ts
238256
- async function pushConnectors(connectors) {
238298
+ async function pushConnectors(connectors, { prune = false } = {}) {
238257
238299
  const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
238258
238300
  const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
238259
- const oauthResults = await syncOAuthConnectors(oauthConnectors);
238260
- const stripeResult = await syncStripeConnector(stripeConnector);
238301
+ const oauthResults = await syncOAuthConnectors(oauthConnectors, prune);
238302
+ const stripeResult = stripeConnector || prune ? await syncStripeConnector(stripeConnector) : null;
238261
238303
  const results = [...oauthResults];
238262
238304
  if (stripeResult) {
238263
238305
  results.push(stripeResult);
238264
238306
  }
238265
238307
  return { results };
238266
238308
  }
238267
- async function syncOAuthConnectors(connectors) {
238309
+ async function syncOAuthConnectors(connectors, prune) {
238268
238310
  const results = [];
238269
- const upstream = await listConnectors();
238270
- const localTypes = new Set(connectors.map((c) => c.type));
238271
238311
  for (const connector of connectors) {
238272
238312
  try {
238273
238313
  const response = await setConnector(connector.type, connector.scopes ?? []);
@@ -238280,6 +238320,11 @@ async function syncOAuthConnectors(connectors) {
238280
238320
  });
238281
238321
  }
238282
238322
  }
238323
+ if (!prune) {
238324
+ return results;
238325
+ }
238326
+ const upstream = await listConnectors();
238327
+ const localTypes = new Set(connectors.map((c) => c.type));
238283
238328
  for (const upstreamConnector of upstream.integrations) {
238284
238329
  if (!localTypes.has(upstreamConnector.integrationType)) {
238285
238330
  try {
@@ -238671,7 +238716,8 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
238671
238716
  source: ResourceSourceSchema
238672
238717
  });
238673
238718
  var DeploySingleFunctionResponseSchema = object({
238674
- status: _enum(["deployed", "unchanged"])
238719
+ status: _enum(["deployed", "unchanged"]),
238720
+ warnings: array(string2()).optional().default([])
238675
238721
  });
238676
238722
  var FunctionInfoSchema = object({
238677
238723
  name: string2(),
@@ -238898,7 +238944,8 @@ async function deployOne2(fn) {
238898
238944
  return {
238899
238945
  name: functionWithCode.name,
238900
238946
  status: response.status,
238901
- durationMs: Date.now() - start
238947
+ durationMs: Date.now() - start,
238948
+ warnings: response.warnings
238902
238949
  };
238903
238950
  } catch (error) {
238904
238951
  return {
@@ -239384,7 +239431,7 @@ import { join as join13 } from "node:path";
239384
239431
  // package.json
239385
239432
  var package_default = {
239386
239433
  name: "base44",
239387
- version: "0.2.7",
239434
+ version: "0.3.1",
239388
239435
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239389
239436
  type: "module",
239390
239437
  bin: {
@@ -246979,8 +247026,7 @@ async function deployAll(projectData, options) {
246979
247026
  await agentSkillResource.push(agentSkills);
246980
247027
  await agentResource.push(agents);
246981
247028
  await authConfigResource.push(authConfig);
246982
- const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
246983
- const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
247029
+ const { results: connectorResults } = await pushConnectors(connectors);
246984
247030
  const appUrl = await deployProjectSite(project, options);
246985
247031
  return appUrl ? { appUrl, connectorResults } : { connectorResults };
246986
247032
  }
@@ -247120,23 +247166,6 @@ var base44Client = distribution_default.create({
247120
247166
  afterResponse: [handleUnauthorized]
247121
247167
  }
247122
247168
  });
247123
- function getAppUserClient(token) {
247124
- return distribution_default.create({
247125
- prefixUrl: getBase44ApiUrl(),
247126
- headers: {
247127
- "User-Agent": "Base44 CLI",
247128
- Authorization: `Bearer ${token}`
247129
- },
247130
- hooks: {
247131
- beforeRequest: [
247132
- (request) => {
247133
- request.headers.set("X-Request-ID", randomUUID2());
247134
- },
247135
- captureRequestBody
247136
- ]
247137
- }
247138
- });
247139
- }
247140
247169
  function getAppClient() {
247141
247170
  const { id } = getAppContext();
247142
247171
  return base44Client.extend({
@@ -247259,6 +247288,24 @@ async function getUserInfo(accessToken) {
247259
247288
  }
247260
247289
  return result.data;
247261
247290
  }
247291
+ async function getSessionUser() {
247292
+ let response;
247293
+ try {
247294
+ response = await base44Client.get("oauth/userinfo");
247295
+ } catch (error) {
247296
+ if (error instanceof HTTPError && error.response.status === 401) {
247297
+ throw new AuthExpiredError("Your session has expired or was revoked", {
247298
+ cause: error
247299
+ });
247300
+ }
247301
+ throw await ApiError.fromHttpError(error, "verifying the session with the server");
247302
+ }
247303
+ const result = UserInfoSchema.safeParse(await response.json());
247304
+ if (!result.success) {
247305
+ throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
247306
+ }
247307
+ return result.data;
247308
+ }
247262
247309
  // src/cli/commands/auth/login-flow.ts
247263
247310
  async function generateAndDisplayDeviceCode(log, runTask) {
247264
247311
  const deviceCodeResponse = await runTask("Generating device code...", async () => {
@@ -247335,6 +247382,16 @@ async function ensureAuth(ctx) {
247335
247382
  await seedAuthFromEnv();
247336
247383
  const loggedIn = await isLoggedIn();
247337
247384
  if (!loggedIn) {
247385
+ if (ctx.isNonInteractive) {
247386
+ throw new AuthRequiredError("Not logged in", {
247387
+ hints: [
247388
+ { message: "Run 'base44 login' first", command: "base44 login" },
247389
+ {
247390
+ message: "Or set BASE44_API_KEY, or BASE44_ACCESS_TOKEN and BASE44_REFRESH_TOKEN"
247391
+ }
247392
+ ]
247393
+ });
247394
+ }
247338
247395
  ctx.log.info("You need to login first to continue.");
247339
247396
  await login(ctx);
247340
247397
  }
@@ -247866,6 +247923,11 @@ function formatDeployResult(result, log) {
247866
247923
  log.success(`${label} unchanged`);
247867
247924
  } else {
247868
247925
  log.error(`${label} error: ${result.error}`);
247926
+ return;
247927
+ }
247928
+ for (const warning of result.warnings ?? []) {
247929
+ const prefix = `${result.name}: `;
247930
+ log.warn(warning.startsWith(prefix) ? warning : `${prefix}${warning}`);
247869
247931
  }
247870
247932
  }
247871
247933
 
@@ -247888,9 +247950,6 @@ async function deployActorsAction({ log, jsonMode }, rawNames) {
247888
247950
  onResult: (result) => {
247889
247951
  completed++;
247890
247952
  formatDeployResult(result, log);
247891
- if (result.status !== "error")
247892
- for (const warning of result.warnings)
247893
- log.warn(`${result.name}: ${warning}`);
247894
247953
  }
247895
247954
  });
247896
247955
  const summary = {
@@ -249370,15 +249429,10 @@ function cleanText(text) {
249370
249429
  // src/core/api-spec/operations.ts
249371
249430
  var PERSONAL_ACCESS_TOKEN_SCHEME = "PersonalAccessTokenAuth";
249372
249431
  var READ_ONLY_SCOPE = "read_only";
249373
- var APP_USER_TOKEN_SCHEME = "AppUserTokenAuth";
249374
249432
  function isReadOnly(operation, spec) {
249375
249433
  const security = operation.security ?? spec.security ?? [];
249376
249434
  return security.some((requirement) => requirement[PERSONAL_ACCESS_TOKEN_SCHEME]?.includes(READ_ONLY_SCOPE));
249377
249435
  }
249378
- function takesAppUserToken(operation, spec) {
249379
- const security = operation.security ?? spec.security ?? [];
249380
- return security.some((requirement) => (APP_USER_TOKEN_SCHEME in requirement));
249381
- }
249382
249436
  function parameterText(operation) {
249383
249437
  return (operation.parameters ?? []).flatMap((parameter) => {
249384
249438
  const parsed = ParameterSchema.safeParse(parameter);
@@ -249430,7 +249484,6 @@ function listOperations(spec) {
249430
249484
  description: cleanText(operation.description ?? ""),
249431
249485
  parameterText: parameterText(operation),
249432
249486
  readOnly: isReadOnly(operation, spec),
249433
- appUserToken: takesAppUserToken(operation, spec),
249434
249487
  operation
249435
249488
  }
249436
249489
  ];
@@ -249459,10 +249512,6 @@ function matchOperation(operations, method, concretePath) {
249459
249512
  });
249460
249513
  return candidates.sort((a, b) => literalSegments(b.path).localeCompare(literalSegments(a.path)))[0];
249461
249514
  }
249462
- function pathParameter(op, concretePath, name) {
249463
- const index = pathSegments(op.path).indexOf(`{${name}}`);
249464
- return index < 0 ? undefined : pathSegments(concretePath)[index];
249465
- }
249466
249515
 
249467
249516
  // src/core/api-spec/contract.ts
249468
249517
  var SCHEMA_REF_PREFIX = "#/components/schemas/";
@@ -249603,6 +249652,59 @@ function grepOperations(spec, operations, pattern, options = {}) {
249603
249652
  const regex = new RegExp(pattern, options.ignoreCase ? "i" : "");
249604
249653
  return operations.filter((op) => regex.test(JSON.stringify(getOperationContract(spec, op)))).slice(0, options.limit ?? 20).map(toOperationSummary);
249605
249654
  }
249655
+ // src/core/api-spec/request.ts
249656
+ var MAX_ERROR_BODY_CHARS = 4000;
249657
+ var QUERY_STRING = /\?\S*/g;
249658
+ async function readBody(response) {
249659
+ try {
249660
+ const text = (await response.clone().text()).trim();
249661
+ return text.length > MAX_ERROR_BODY_CHARS ? `${text.slice(0, MAX_ERROR_BODY_CHARS)}…` : text || undefined;
249662
+ } catch {
249663
+ return;
249664
+ }
249665
+ }
249666
+ function normalizePath(path) {
249667
+ const url = new URL(path.replace(/^\/*/, "/"), "http://placeholder");
249668
+ return `${url.pathname}${url.search}`;
249669
+ }
249670
+ async function sendApiRequest(method, path, body) {
249671
+ try {
249672
+ const response = await base44Client(path.replace(/^\/+/, ""), {
249673
+ method,
249674
+ body,
249675
+ headers: typeof body === "string" ? { "Content-Type": "application/json" } : {},
249676
+ timeout: false,
249677
+ retry: { methods: ["get", "head"] }
249678
+ });
249679
+ return {
249680
+ status: response.status,
249681
+ contentType: response.headers.get("content-type") ?? "",
249682
+ body: new Uint8Array(await response.arrayBuffer())
249683
+ };
249684
+ } catch (error) {
249685
+ const apiError = await ApiError.fromHttpError(error, `calling ${method} ${path}`);
249686
+ const response = error instanceof HTTPError ? error.response : undefined;
249687
+ const raw = response ? await readBody(response) : undefined;
249688
+ const retryAfter = response?.headers.get("retry-after") ?? undefined;
249689
+ throw redactedApiError(apiError, raw, method, path, retryAfter);
249690
+ }
249691
+ }
249692
+ function redactedApiError(apiError, raw, method, path, retryAfter) {
249693
+ const wait = retryAfter ? ` (retry after ${/^\d+$/.test(retryAfter) ? `${retryAfter} s` : retryAfter})` : "";
249694
+ const reason = apiError.statusCode !== undefined ? `HTTP ${apiError.statusCode}${wait}` : (apiError.cause?.message ?? "request failed").replace(QUERY_STRING, "");
249695
+ const message = `Error calling ${method} ${path.split("?", 1)[0]}: ${reason}`;
249696
+ return new ApiError(message, {
249697
+ statusCode: apiError.statusCode,
249698
+ requestUrl: apiError.requestUrl?.split("?", 1)[0],
249699
+ requestMethod: apiError.requestMethod,
249700
+ requestId: apiError.requestId,
249701
+ hints: apiError.hints,
249702
+ details: [
249703
+ ...raw ? [`Response body: ${raw}`] : apiError.details ?? [],
249704
+ ...apiError.requestId ? [`Request ID: ${apiError.requestId}`] : []
249705
+ ]
249706
+ });
249707
+ }
249606
249708
  // src/core/api-spec/spec.ts
249607
249709
  import { rename, rm, stat as stat3 } from "node:fs/promises";
249608
249710
  import { join as join22 } from "node:path";
@@ -249669,71 +249771,6 @@ async function loadSpec(options = {}) {
249669
249771
  }
249670
249772
  return { text, spec };
249671
249773
  }
249672
-
249673
- // src/core/api-spec/request.ts
249674
- var MAX_ERROR_BODY_CHARS = 4000;
249675
- var QUERY_STRING = /\?\S*/g;
249676
- async function readBody(response) {
249677
- try {
249678
- const text = (await response.clone().text()).trim();
249679
- return text.length > MAX_ERROR_BODY_CHARS ? `${text.slice(0, MAX_ERROR_BODY_CHARS)}…` : text || undefined;
249680
- } catch {
249681
- return;
249682
- }
249683
- }
249684
- function normalizePath(path) {
249685
- const url = new URL(path.replace(/^\/*/, "/"), "http://placeholder");
249686
- return `${url.pathname}${url.search}`;
249687
- }
249688
- var APP_PATH = /^\/api\/apps\/[^/?#]+\//;
249689
- async function appUserTokenFor(method, path, options = {}) {
249690
- if (hasWorkspaceApiKeyAuth() || !APP_PATH.test(path)) {
249691
- return;
249692
- }
249693
- const loaded = await loadSpec(options).catch(() => null);
249694
- const op = loaded ? matchOperation(listOperations(loaded.spec), method, path) : undefined;
249695
- const appId = op?.appUserToken ? pathParameter(op, path, "app_id") : undefined;
249696
- return appId ? getAppUserToken(appId) : undefined;
249697
- }
249698
- async function sendApiRequest(method, path, body, appUserToken) {
249699
- const client = appUserToken ? getAppUserClient(appUserToken) : base44Client;
249700
- try {
249701
- const response = await client(path.replace(/^\/+/, ""), {
249702
- method,
249703
- body,
249704
- headers: typeof body === "string" ? { "Content-Type": "application/json" } : {},
249705
- timeout: false,
249706
- retry: { methods: ["get", "head"] }
249707
- });
249708
- return {
249709
- status: response.status,
249710
- contentType: response.headers.get("content-type") ?? "",
249711
- body: new Uint8Array(await response.arrayBuffer())
249712
- };
249713
- } catch (error) {
249714
- const apiError = await ApiError.fromHttpError(error, `calling ${method} ${path}`);
249715
- const response = error instanceof HTTPError ? error.response : undefined;
249716
- const raw = response ? await readBody(response) : undefined;
249717
- const retryAfter = response?.headers.get("retry-after") ?? undefined;
249718
- throw redactedApiError(apiError, raw, method, path, retryAfter);
249719
- }
249720
- }
249721
- function redactedApiError(apiError, raw, method, path, retryAfter) {
249722
- const wait = retryAfter ? ` (retry after ${/^\d+$/.test(retryAfter) ? `${retryAfter} s` : retryAfter})` : "";
249723
- const reason = apiError.statusCode !== undefined ? `HTTP ${apiError.statusCode}${wait}` : (apiError.cause?.message ?? "request failed").replace(QUERY_STRING, "");
249724
- const message = `Error calling ${method} ${path.split("?", 1)[0]}: ${reason}`;
249725
- return new ApiError(message, {
249726
- statusCode: apiError.statusCode,
249727
- requestUrl: apiError.requestUrl?.split("?", 1)[0],
249728
- requestMethod: apiError.requestMethod,
249729
- requestId: apiError.requestId,
249730
- hints: apiError.hints,
249731
- details: [
249732
- ...raw ? [`Response body: ${raw}`] : apiError.details ?? [],
249733
- ...apiError.requestId ? [`Request ID: ${apiError.requestId}`] : []
249734
- ]
249735
- });
249736
- }
249737
249774
  // src/cli/commands/api/shared.ts
249738
249775
  import { basename as basename6 } from "node:path";
249739
249776
  function formatJson(value) {
@@ -249953,12 +249990,7 @@ ${CONTRACT_HELP}
249953
249990
  }
249954
249991
  await ensureAuth(ctx);
249955
249992
  const body = options.form.length > 0 ? await readFormBody(options.form) : await readRequestBody(options.body);
249956
- const response = await ctx.runTask(`Calling ${method} ${target}`, async () => {
249957
- const appUserToken = await appUserTokenFor(method, target, {
249958
- refresh: options.refresh && !options.readOnly
249959
- });
249960
- return sendApiRequest(method, target, body, appUserToken);
249961
- }, {
249993
+ const response = await ctx.runTask(`Calling ${method} ${target}`, () => sendApiRequest(method, target, body), {
249962
249994
  successMessage: `Called ${method} ${target}`,
249963
249995
  errorMessage: "Request failed"
249964
249996
  });
@@ -250457,11 +250489,18 @@ async function whoami(_ctx) {
250457
250489
  outroMessage: `Using workspace API key: ${theme.styles.bold(workspaceApiKey.slice(0, 10))}`
250458
250490
  };
250459
250491
  }
250460
- const auth = await readAuth();
250461
- return { outroMessage: `Logged in as: ${theme.styles.bold(auth.email)}` };
250492
+ await seedAuthFromEnv();
250493
+ if (!await isLoggedIn()) {
250494
+ throw new AuthRequiredError("Not logged in");
250495
+ }
250496
+ const user = await getSessionUser();
250497
+ return { outroMessage: `Logged in as: ${theme.styles.bold(user.email)}` };
250462
250498
  }
250463
250499
  function getWhoamiCommand() {
250464
- return new Base44Command("whoami", { requireAppContext: false }).description("Display current authenticated user").action(whoami);
250500
+ return new Base44Command("whoami", {
250501
+ requireAuth: false,
250502
+ requireAppContext: false
250503
+ }).description("Display current authenticated user").action(whoami);
250465
250504
  }
250466
250505
 
250467
250506
  // src/cli/commands/branches/index.ts
@@ -251402,25 +251441,26 @@ function printSummary(results, oauthOutcomes, log) {
251402
251441
  }
251403
251442
  async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }, options) {
251404
251443
  const connectors = await readConnectorsToPush(options);
251444
+ if (connectors.length === 0) {
251445
+ return { outroMessage: "No local connectors found - nothing to push" };
251446
+ }
251405
251447
  if (!jsonMode) {
251406
- if (connectors.length === 0) {
251407
- log.info("No local connectors found - checking for remote connectors to remove");
251408
- } else {
251409
- const connectorNames = connectors.map((c) => c.type).join(", ");
251410
- log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
251411
- }
251448
+ const connectorNames = connectors.map((c) => c.type).join(", ");
251449
+ log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
251412
251450
  }
251413
- const proceed = await confirmPush({
251414
- isNonInteractive,
251415
- yes: options.yes,
251416
- log,
251417
- warning: "This will overwrite your app's connectors with your local copy and remove any not present locally."
251418
- });
251419
- if (!proceed) {
251420
- return { outroMessage: "Push cancelled" };
251451
+ if (options.force) {
251452
+ const proceed = await confirmPush({
251453
+ isNonInteractive,
251454
+ yes: options.yes,
251455
+ log,
251456
+ warning: "This will remove any connectors on Base44 that are not present locally."
251457
+ });
251458
+ if (!proceed) {
251459
+ return { outroMessage: "Push cancelled" };
251460
+ }
251421
251461
  }
251422
251462
  const { results } = await runTask("Pushing connectors to Base44", async () => {
251423
- return await pushConnectors(connectors);
251463
+ return await pushConnectors(connectors, { prune: options.force });
251424
251464
  });
251425
251465
  const needsOAuth = filterPendingOAuth(results);
251426
251466
  let outroMessage = "Connectors pushed to Base44";
@@ -251442,7 +251482,7 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }
251442
251482
  return { outroMessage };
251443
251483
  }
251444
251484
  function getConnectorsPushCommand() {
251445
- return new Base44Command("push").description("Push local connectors to Base44 (overwrites connectors on Base44)").option("--dir <path>", "Directory to read connector files from (default: ./connectors when using --app-id)").option("-y, --yes", "Skip confirmation prompt").action(pushConnectorsAction);
251485
+ return new Base44Command("push").description("Push local connectors to Base44 (adds and updates; --force also removes the rest)").option("--dir <path>", "Directory to read connector files from (default: ./connectors when using --app-id)").option("--force", "Remove connectors on Base44 not found locally").option("-y, --yes", "Skip the --force confirmation prompt").action(pushConnectorsAction);
251446
251486
  }
251447
251487
 
251448
251488
  // src/cli/commands/connectors/index.ts
@@ -252147,9 +252187,6 @@ ${summaryLines.join(`
252147
252187
  onActorResult: (result) => {
252148
252188
  actorCompleted++;
252149
252189
  formatDeployResult(result, log);
252150
- if (result.status !== "error")
252151
- for (const warning of result.warnings)
252152
- log.warn(`${result.name}: ${warning}`);
252153
252190
  }
252154
252191
  });
252155
252192
  const connectorResults = result.connectorResults ?? [];
@@ -252162,6 +252199,12 @@ ${summaryLines.join(`
252162
252199
  if (result.appUrl) {
252163
252200
  log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
252164
252201
  }
252202
+ const failedConnectors = connectorResults.flatMap((r) => r.action === "error" ? [`Connector ${r.type}: ${r.error}`] : []);
252203
+ if (failedConnectors.length > 0) {
252204
+ throw new ResourceDeploymentError("Some connectors failed to sync", {
252205
+ details: failedConnectors
252206
+ });
252207
+ }
252165
252208
  return { outroMessage: "App deployed successfully" };
252166
252209
  }
252167
252210
  function getDeployCommand3() {
@@ -275025,4 +275068,4 @@ export {
275025
275068
  runCLI
275026
275069
  };
275027
275070
 
275028
- //# debugId=337CE6C02AFECBB564756E2164756E21
275071
+ //# debugId=DCA6666E6511D55264756E2164756E21