@base44-preview/cli 0.2.6-pr.686.71ca09f → 0.2.7-pr.687.1ccc695

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
@@ -238253,21 +238253,19 @@ async function pullAllConnectors() {
238253
238253
  return connectors;
238254
238254
  }
238255
238255
  // src/core/resources/connector/push.ts
238256
- async function pushConnectors(connectors) {
238256
+ async function pushConnectors(connectors, { prune = false } = {}) {
238257
238257
  const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
238258
238258
  const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
238259
- const oauthResults = await syncOAuthConnectors(oauthConnectors);
238260
- const stripeResult = await syncStripeConnector(stripeConnector);
238259
+ const oauthResults = await syncOAuthConnectors(oauthConnectors, prune);
238260
+ const stripeResult = stripeConnector || prune ? await syncStripeConnector(stripeConnector) : null;
238261
238261
  const results = [...oauthResults];
238262
238262
  if (stripeResult) {
238263
238263
  results.push(stripeResult);
238264
238264
  }
238265
238265
  return { results };
238266
238266
  }
238267
- async function syncOAuthConnectors(connectors) {
238267
+ async function syncOAuthConnectors(connectors, prune) {
238268
238268
  const results = [];
238269
- const upstream = await listConnectors();
238270
- const localTypes = new Set(connectors.map((c) => c.type));
238271
238269
  for (const connector of connectors) {
238272
238270
  try {
238273
238271
  const response = await setConnector(connector.type, connector.scopes ?? []);
@@ -238280,6 +238278,11 @@ async function syncOAuthConnectors(connectors) {
238280
238278
  });
238281
238279
  }
238282
238280
  }
238281
+ if (!prune) {
238282
+ return results;
238283
+ }
238284
+ const upstream = await listConnectors();
238285
+ const localTypes = new Set(connectors.map((c) => c.type));
238283
238286
  for (const upstreamConnector of upstream.integrations) {
238284
238287
  if (!localTypes.has(upstreamConnector.integrationType)) {
238285
238288
  try {
@@ -239384,7 +239387,7 @@ import { join as join13 } from "node:path";
239384
239387
  // package.json
239385
239388
  var package_default = {
239386
239389
  name: "base44",
239387
- version: "0.2.6",
239390
+ version: "0.2.7",
239388
239391
  description: "Base44 CLI - Unified interface for managing Base44 applications",
239389
239392
  type: "module",
239390
239393
  bin: {
@@ -246979,8 +246982,7 @@ async function deployAll(projectData, options) {
246979
246982
  await agentSkillResource.push(agentSkills);
246980
246983
  await agentResource.push(agents);
246981
246984
  await authConfigResource.push(authConfig);
246982
- const skipConnectorSync = connectors.length === 0 && hasWorkspaceApiKeyAuth();
246983
- const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
246985
+ const { results: connectorResults } = await pushConnectors(connectors);
246984
246986
  const appUrl = await deployProjectSite(project, options);
246985
246987
  return appUrl ? { appUrl, connectorResults } : { connectorResults };
246986
246988
  }
@@ -251358,25 +251360,26 @@ function printSummary(results, oauthOutcomes, log) {
251358
251360
  }
251359
251361
  async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }, options) {
251360
251362
  const connectors = await readConnectorsToPush(options);
251363
+ if (connectors.length === 0) {
251364
+ return { outroMessage: "No local connectors found - nothing to push" };
251365
+ }
251361
251366
  if (!jsonMode) {
251362
- if (connectors.length === 0) {
251363
- log.info("No local connectors found - checking for remote connectors to remove");
251364
- } else {
251365
- const connectorNames = connectors.map((c) => c.type).join(", ");
251366
- log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
251367
- }
251367
+ const connectorNames = connectors.map((c) => c.type).join(", ");
251368
+ log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
251368
251369
  }
251369
- const proceed = await confirmPush({
251370
- isNonInteractive,
251371
- yes: options.yes,
251372
- log,
251373
- warning: "This will overwrite your app's connectors with your local copy and remove any not present locally."
251374
- });
251375
- if (!proceed) {
251376
- return { outroMessage: "Push cancelled" };
251370
+ if (options.force) {
251371
+ const proceed = await confirmPush({
251372
+ isNonInteractive,
251373
+ yes: options.yes,
251374
+ log,
251375
+ warning: "This will remove any connectors on Base44 that are not present locally."
251376
+ });
251377
+ if (!proceed) {
251378
+ return { outroMessage: "Push cancelled" };
251379
+ }
251377
251380
  }
251378
251381
  const { results } = await runTask("Pushing connectors to Base44", async () => {
251379
- return await pushConnectors(connectors);
251382
+ return await pushConnectors(connectors, { prune: options.force });
251380
251383
  });
251381
251384
  const needsOAuth = filterPendingOAuth(results);
251382
251385
  let outroMessage = "Connectors pushed to Base44";
@@ -251398,7 +251401,7 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }
251398
251401
  return { outroMessage };
251399
251402
  }
251400
251403
  function getConnectorsPushCommand() {
251401
- 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);
251404
+ 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);
251402
251405
  }
251403
251406
 
251404
251407
  // src/cli/commands/connectors/index.ts
@@ -252118,6 +252121,12 @@ ${summaryLines.join(`
252118
252121
  if (result.appUrl) {
252119
252122
  log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
252120
252123
  }
252124
+ const failedConnectors = connectorResults.flatMap((r) => r.action === "error" ? [`Connector ${r.type}: ${r.error}`] : []);
252125
+ if (failedConnectors.length > 0) {
252126
+ throw new ResourceDeploymentError("Some connectors failed to sync", {
252127
+ details: failedConnectors
252128
+ });
252129
+ }
252121
252130
  return { outroMessage: "App deployed successfully" };
252122
252131
  }
252123
252132
  function getDeployCommand3() {
@@ -265213,7 +265222,7 @@ function lastCleanWrite(entries, path) {
265213
265222
  var readRegularFile = (path) => stat4(path).then((info) => info.isFile() ? readFile5(path) : undefined, () => {
265214
265223
  return;
265215
265224
  });
265216
- async function inlineImages(html, files) {
265225
+ async function inlineImages(html, files, missing) {
265217
265226
  const text = html.toString("utf8");
265218
265227
  const uris = new Map;
265219
265228
  for (const [, , , src = ""] of text.matchAll(IMG_SRC)) {
@@ -265222,6 +265231,8 @@ async function inlineImages(html, files) {
265222
265231
  const data = mediaType && await readRegularFile(local);
265223
265232
  if (data)
265224
265233
  uris.set(src, `data:${mediaType};base64,${data.toString("base64")}`);
265234
+ else if (local)
265235
+ missing.push(src);
265225
265236
  }
265226
265237
  if (!uris.size)
265227
265238
  return html;
@@ -265262,7 +265273,13 @@ async function collectArtifacts2(session, budget = MAX_REQUEST_BYTES - session.l
265262
265273
  continue;
265263
265274
  }
265264
265275
  if (found.files && /\.html?$/i.test(fileName)) {
265265
- data = await inlineImages(data, found.files);
265276
+ const missing = [];
265277
+ data = await inlineImages(data, found.files, missing);
265278
+ for (const src of new Set(missing))
265279
+ skipped.push({
265280
+ fileName: src,
265281
+ reason: `this image in ${fileName} isn't on disk anymore`
265282
+ });
265266
265283
  }
265267
265284
  if (data.length > MAX_BYTES) {
265268
265285
  skipped.push({ fileName, reason: "it's larger than 10 MB" });
@@ -274973,4 +274990,4 @@ export {
274973
274990
  runCLI
274974
274991
  };
274975
274992
 
274976
- //# debugId=4C7BDDBFD564720964756E2164756E21
274993
+ //# debugId=459D3D38C4CFDA5964756E2164756E21