@base44-preview/cli 0.0.31-pr.214.27ce774 → 0.0.31-pr.214.681d4a1
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 +57 -75
- package/dist/cli/index.js.map +6 -7
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -185978,26 +185978,24 @@ async function createArchive(pathToArchive, targetArchivePath) {
|
|
|
185978
185978
|
}
|
|
185979
185979
|
// src/core/project/deploy.ts
|
|
185980
185980
|
function hasResourcesToDeploy(projectData) {
|
|
185981
|
-
const { project, entities, functions, agents
|
|
185981
|
+
const { project, entities, functions, agents } = projectData;
|
|
185982
185982
|
const hasSite = Boolean(project.site?.outputDirectory);
|
|
185983
185983
|
const hasEntities = entities.length > 0;
|
|
185984
185984
|
const hasFunctions = functions.length > 0;
|
|
185985
185985
|
const hasAgents = agents.length > 0;
|
|
185986
|
-
|
|
185987
|
-
return hasEntities || hasFunctions || hasAgents || hasConnectors || hasSite;
|
|
185986
|
+
return hasEntities || hasFunctions || hasAgents || hasSite;
|
|
185988
185987
|
}
|
|
185989
185988
|
async function deployAll(projectData) {
|
|
185990
|
-
const { project, entities, functions, agents
|
|
185989
|
+
const { project, entities, functions, agents } = projectData;
|
|
185991
185990
|
await entityResource.push(entities);
|
|
185992
185991
|
await functionResource.push(functions);
|
|
185993
185992
|
await agentResource.push(agents);
|
|
185994
|
-
const { results: connectorResults } = await pushConnectors(connectors);
|
|
185995
185993
|
if (project.site?.outputDirectory) {
|
|
185996
185994
|
const outputDir = resolve(project.root, project.site.outputDirectory);
|
|
185997
185995
|
const { appUrl } = await deploySite(outputDir);
|
|
185998
|
-
return { appUrl
|
|
185996
|
+
return { appUrl };
|
|
185999
185997
|
}
|
|
186000
|
-
return {
|
|
185998
|
+
return {};
|
|
186001
185999
|
}
|
|
186002
186000
|
// src/core/clients/base44-client.ts
|
|
186003
186001
|
var retriedRequests = new WeakSet;
|
|
@@ -194375,30 +194373,27 @@ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
|
|
|
194375
194373
|
}));
|
|
194376
194374
|
var open_default = open;
|
|
194377
194375
|
|
|
194378
|
-
// src/cli/commands/connectors/
|
|
194376
|
+
// src/cli/commands/connectors/push.ts
|
|
194379
194377
|
var POLL_INTERVAL_MS = 2000;
|
|
194380
194378
|
var POLL_TIMEOUT_MS = 2 * 60 * 1000;
|
|
194381
|
-
function
|
|
194382
|
-
|
|
194383
|
-
}
|
|
194384
|
-
async function runOAuthFlowWithSkip(connector2) {
|
|
194385
|
-
await open_default(connector2.redirectUrl);
|
|
194379
|
+
async function runOAuthFlowWithSkip(params) {
|
|
194380
|
+
await open_default(params.redirectUrl);
|
|
194386
194381
|
let finalStatus = "PENDING";
|
|
194387
194382
|
let skipped = false;
|
|
194388
194383
|
const s = Y2();
|
|
194389
194384
|
const originalExit = process.exit;
|
|
194390
194385
|
process.exit = () => {
|
|
194391
194386
|
skipped = true;
|
|
194392
|
-
s.stop(`${
|
|
194387
|
+
s.stop(`${params.type} skipped`);
|
|
194393
194388
|
};
|
|
194394
|
-
s.start(`Waiting for ${
|
|
194389
|
+
s.start(`Waiting for ${params.type} authorization... (Esc to skip)`);
|
|
194395
194390
|
try {
|
|
194396
194391
|
await pWaitFor(async () => {
|
|
194397
194392
|
if (skipped) {
|
|
194398
194393
|
finalStatus = "SKIPPED";
|
|
194399
194394
|
return true;
|
|
194400
194395
|
}
|
|
194401
|
-
const response = await getOAuthStatus(
|
|
194396
|
+
const response = await getOAuthStatus(params.type, params.connectionId);
|
|
194402
194397
|
finalStatus = response.status;
|
|
194403
194398
|
return response.status !== "PENDING";
|
|
194404
194399
|
}, {
|
|
@@ -194415,49 +194410,19 @@ async function runOAuthFlowWithSkip(connector2) {
|
|
|
194415
194410
|
process.exit = originalExit;
|
|
194416
194411
|
if (!skipped) {
|
|
194417
194412
|
if (finalStatus === "ACTIVE") {
|
|
194418
|
-
s.stop(`${
|
|
194413
|
+
s.stop(`${params.type} authorization complete`);
|
|
194419
194414
|
} else if (finalStatus === "FAILED") {
|
|
194420
|
-
s.stop(`${
|
|
194415
|
+
s.stop(`${params.type} authorization failed`);
|
|
194421
194416
|
} else {
|
|
194422
|
-
s.stop(`${
|
|
194417
|
+
s.stop(`${params.type} authorization timed out`);
|
|
194423
194418
|
}
|
|
194424
194419
|
}
|
|
194425
194420
|
}
|
|
194426
|
-
return finalStatus;
|
|
194421
|
+
return { type: params.type, status: finalStatus };
|
|
194427
194422
|
}
|
|
194428
|
-
|
|
194429
|
-
|
|
194430
|
-
if (pending.length === 0) {
|
|
194431
|
-
return outcomes;
|
|
194432
|
-
}
|
|
194433
|
-
M2.warn(`${pending.length} connector(s) require authorization in your browser:`);
|
|
194434
|
-
for (const connector2 of pending) {
|
|
194435
|
-
M2.info(` ${connector2.type}: ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
194436
|
-
}
|
|
194437
|
-
if (options?.skipPrompt) {
|
|
194438
|
-
return outcomes;
|
|
194439
|
-
}
|
|
194440
|
-
const shouldAuth = await ye({
|
|
194441
|
-
message: "Open browser to authorize now?"
|
|
194442
|
-
});
|
|
194443
|
-
if (pD(shouldAuth) || !shouldAuth) {
|
|
194444
|
-
return outcomes;
|
|
194445
|
-
}
|
|
194446
|
-
for (const connector2 of pending) {
|
|
194447
|
-
try {
|
|
194448
|
-
M2.info(`
|
|
194449
|
-
Opening browser for ${connector2.type}...`);
|
|
194450
|
-
const status = await runOAuthFlowWithSkip(connector2);
|
|
194451
|
-
outcomes.set(connector2.type, status);
|
|
194452
|
-
} catch (err) {
|
|
194453
|
-
M2.error(`Failed to authorize ${connector2.type}: ${err instanceof Error ? err.message : String(err)}`);
|
|
194454
|
-
outcomes.set(connector2.type, "FAILED");
|
|
194455
|
-
}
|
|
194456
|
-
}
|
|
194457
|
-
return outcomes;
|
|
194423
|
+
function isPendingOAuth(r2) {
|
|
194424
|
+
return r2.action === "needs_oauth" && !!r2.redirectUrl && !!r2.connectionId;
|
|
194458
194425
|
}
|
|
194459
|
-
|
|
194460
|
-
// src/cli/commands/connectors/push.ts
|
|
194461
194426
|
function printSummary(results, oauthOutcomes) {
|
|
194462
194427
|
const synced = [];
|
|
194463
194428
|
const added = [];
|
|
@@ -194486,6 +194451,7 @@ function printSummary(results, oauthOutcomes) {
|
|
|
194486
194451
|
}
|
|
194487
194452
|
}
|
|
194488
194453
|
}
|
|
194454
|
+
M2.info("");
|
|
194489
194455
|
M2.info(theme.styles.bold("Summary:"));
|
|
194490
194456
|
if (synced.length > 0) {
|
|
194491
194457
|
M2.success(`Synced: ${synced.join(", ")}`);
|
|
@@ -194514,14 +194480,43 @@ async function pushConnectorsAction() {
|
|
|
194514
194480
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
194515
194481
|
return await pushConnectors(connectors);
|
|
194516
194482
|
});
|
|
194517
|
-
const
|
|
194483
|
+
const oauthOutcomes = new Map;
|
|
194484
|
+
const needsOAuth = results.filter(isPendingOAuth);
|
|
194518
194485
|
let outroMessage = "Connectors pushed to Base44";
|
|
194519
|
-
|
|
194520
|
-
|
|
194521
|
-
|
|
194522
|
-
|
|
194523
|
-
|
|
194524
|
-
|
|
194486
|
+
if (needsOAuth.length === 0) {
|
|
194487
|
+
printSummary(results, oauthOutcomes);
|
|
194488
|
+
return { outroMessage };
|
|
194489
|
+
}
|
|
194490
|
+
M2.warn(`${needsOAuth.length} connector(s) require authorization in your browser:`);
|
|
194491
|
+
for (const connector2 of needsOAuth) {
|
|
194492
|
+
M2.info(` '${connector2.type}': ${theme.styles.dim(connector2.redirectUrl)}`);
|
|
194493
|
+
}
|
|
194494
|
+
const pending = needsOAuth.map((c3) => c3.type).join(", ");
|
|
194495
|
+
if (process.env.CI) {
|
|
194496
|
+
outroMessage = `Skipped OAuth in CI. Pending: ${pending}. Run 'base44 connectors push' locally to authorize.`;
|
|
194497
|
+
} else {
|
|
194498
|
+
const shouldAuth = await ye({
|
|
194499
|
+
message: "Open browser to authorize now?"
|
|
194500
|
+
});
|
|
194501
|
+
if (pD(shouldAuth) || !shouldAuth) {
|
|
194502
|
+
outroMessage = `Authorization skipped. Pending: ${pending}. Run 'base44 connectors push' again to complete.`;
|
|
194503
|
+
} else {
|
|
194504
|
+
for (const connector2 of needsOAuth) {
|
|
194505
|
+
try {
|
|
194506
|
+
M2.info(`
|
|
194507
|
+
Opening browser for '${connector2.type}'...`);
|
|
194508
|
+
const oauthResult = await runOAuthFlowWithSkip({
|
|
194509
|
+
type: connector2.type,
|
|
194510
|
+
redirectUrl: connector2.redirectUrl,
|
|
194511
|
+
connectionId: connector2.connectionId
|
|
194512
|
+
});
|
|
194513
|
+
oauthOutcomes.set(connector2.type, oauthResult.status);
|
|
194514
|
+
} catch (err) {
|
|
194515
|
+
M2.error(`Failed to authorize '${connector2.type}': ${err instanceof Error ? err.message : String(err)}`);
|
|
194516
|
+
oauthOutcomes.set(connector2.type, "FAILED");
|
|
194517
|
+
}
|
|
194518
|
+
}
|
|
194519
|
+
}
|
|
194525
194520
|
}
|
|
194526
194521
|
printSummary(results, oauthOutcomes);
|
|
194527
194522
|
return { outroMessage };
|
|
@@ -194812,7 +194807,7 @@ async function deployAction(options) {
|
|
|
194812
194807
|
outroMessage: "No resources found to deploy"
|
|
194813
194808
|
};
|
|
194814
194809
|
}
|
|
194815
|
-
const { project: project2, entities, functions, agents
|
|
194810
|
+
const { project: project2, entities, functions, agents } = projectData;
|
|
194816
194811
|
const summaryLines = [];
|
|
194817
194812
|
if (entities.length > 0) {
|
|
194818
194813
|
summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
|
|
@@ -194823,9 +194818,6 @@ async function deployAction(options) {
|
|
|
194823
194818
|
if (agents.length > 0) {
|
|
194824
194819
|
summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
|
|
194825
194820
|
}
|
|
194826
|
-
if (connectors.length > 0) {
|
|
194827
|
-
summaryLines.push(` - ${connectors.length} ${connectors.length === 1 ? "connector" : "connectors"}`);
|
|
194828
|
-
}
|
|
194829
194821
|
if (project2.site?.outputDirectory) {
|
|
194830
194822
|
summaryLines.push(` - Site from ${project2.site.outputDirectory}`);
|
|
194831
194823
|
}
|
|
@@ -194850,16 +194842,6 @@ ${summaryLines.join(`
|
|
|
194850
194842
|
successMessage: theme.colors.base44Orange("Deployment completed"),
|
|
194851
194843
|
errorMessage: "Deployment failed"
|
|
194852
194844
|
});
|
|
194853
|
-
const needsOAuth = filterPendingOAuth(result.connectorResults ?? []);
|
|
194854
|
-
if (needsOAuth.length > 0) {
|
|
194855
|
-
const oauthOutcomes = await promptOAuthFlows(needsOAuth, {
|
|
194856
|
-
skipPrompt: options.yes || !!process.env.CI
|
|
194857
|
-
});
|
|
194858
|
-
const allAuthorized = oauthOutcomes.size > 0 && [...oauthOutcomes.values()].every((s) => s === "ACTIVE");
|
|
194859
|
-
if (!allAuthorized) {
|
|
194860
|
-
M2.info("Some connectors still require authorization. Run 'base44 connectors push' or open the links above in your browser.");
|
|
194861
|
-
}
|
|
194862
|
-
}
|
|
194863
194845
|
M2.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
194864
194846
|
if (result.appUrl) {
|
|
194865
194847
|
M2.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
@@ -194867,7 +194849,7 @@ ${summaryLines.join(`
|
|
|
194867
194849
|
return { outroMessage: "App deployed successfully" };
|
|
194868
194850
|
}
|
|
194869
194851
|
function getDeployCommand(context) {
|
|
194870
|
-
return new Command("deploy").description("Deploy all project resources (entities, functions, agents,
|
|
194852
|
+
return new Command("deploy").description("Deploy all project resources (entities, functions, agents, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
|
|
194871
194853
|
await runCommand(() => deployAction(options), { requireAuth: true }, context);
|
|
194872
194854
|
});
|
|
194873
194855
|
}
|
|
@@ -199758,4 +199740,4 @@ export {
|
|
|
199758
199740
|
CLIExitError
|
|
199759
199741
|
};
|
|
199760
199742
|
|
|
199761
|
-
//# debugId=
|
|
199743
|
+
//# debugId=C6B64E5818FEF02264756E2164756E21
|