@base44-preview/cli 0.3.4-pr.701.87b0681 → 0.3.4-pr.702.1894d21
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 +71 -54
- package/dist/cli/index.js.map +12 -12
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -228529,20 +228529,6 @@ class AppNotPublishedError extends UserError {
|
|
|
228529
228529
|
});
|
|
228530
228530
|
}
|
|
228531
228531
|
}
|
|
228532
|
-
|
|
228533
|
-
class DeploymentExistsError extends UserError {
|
|
228534
|
-
code = "DEPLOYMENT_EXISTS";
|
|
228535
|
-
constructor(gitHash, options) {
|
|
228536
|
-
super(`Commit ${gitHash.slice(0, 12)} already has a different build, so this one was not deployed`, {
|
|
228537
|
-
hints: options?.hints ?? [
|
|
228538
|
-
{
|
|
228539
|
-
message: "Run the same command again with --overwrite to replace that build, or commit your changes and deploy the new commit"
|
|
228540
|
-
}
|
|
228541
|
-
],
|
|
228542
|
-
cause: options?.cause
|
|
228543
|
-
});
|
|
228544
|
-
}
|
|
228545
|
-
}
|
|
228546
228532
|
var MAX_RESPONSE_TEXT_CHARS = 500;
|
|
228547
228533
|
async function readResponseText(response) {
|
|
228548
228534
|
try {
|
|
@@ -230847,7 +230833,8 @@ var TestOverridesSchema = object({
|
|
|
230847
230833
|
projectRoot: string2()
|
|
230848
230834
|
}).optional(),
|
|
230849
230835
|
latestVersion: string2().nullable().optional(),
|
|
230850
|
-
claudeBin: string2().optional()
|
|
230836
|
+
claudeBin: string2().optional(),
|
|
230837
|
+
skipRetryWait: boolean2().optional()
|
|
230851
230838
|
});
|
|
230852
230839
|
|
|
230853
230840
|
// src/core/config.ts
|
|
@@ -236627,9 +236614,6 @@ var DeployResponseSchema = object({
|
|
|
236627
236614
|
var PublishedUrlResponseSchema = object({
|
|
236628
236615
|
url: string2()
|
|
236629
236616
|
});
|
|
236630
|
-
var DeploymentExistsRefusalSchema = object({
|
|
236631
|
-
error: object({ code: literal("deployment_already_exists") })
|
|
236632
|
-
});
|
|
236633
236617
|
var CreateDeploymentResponseSchema = object({
|
|
236634
236618
|
deployment_id: string2(),
|
|
236635
236619
|
session_id: string2(),
|
|
@@ -239730,11 +239714,7 @@ async function createDeployment(request) {
|
|
|
239730
239714
|
timeout: 120000
|
|
239731
239715
|
});
|
|
239732
239716
|
} catch (error) {
|
|
239733
|
-
|
|
239734
|
-
if (apiError.statusCode === 409 && DeploymentExistsRefusalSchema.safeParse(apiError.responseBody).success) {
|
|
239735
|
-
throw new DeploymentExistsError(request.git_hash, { cause: apiError });
|
|
239736
|
-
}
|
|
239737
|
-
throw apiError;
|
|
239717
|
+
throw await ApiError.fromHttpError(error, "creating deployment");
|
|
239738
239718
|
}
|
|
239739
239719
|
const result = CreateDeploymentResponseSchema.safeParse(await response.json());
|
|
239740
239720
|
if (!result.success) {
|
|
@@ -240371,7 +240351,7 @@ async function putPresignedBody(upload, body) {
|
|
|
240371
240351
|
// src/core/site/deployment.ts
|
|
240372
240352
|
var NO_ASSETS = { manifest: {}, filesByHash: new Map };
|
|
240373
240353
|
async function deployToDeployments(options) {
|
|
240374
|
-
const { projectRoot, outputDir, gitHash, concurrency,
|
|
240354
|
+
const { projectRoot, outputDir, gitHash, concurrency, progress } = options;
|
|
240375
240355
|
const worker = await resolveWorkerBuild(projectRoot, progress);
|
|
240376
240356
|
const assetsDir = worker ? worker.assetsDir : outputDir;
|
|
240377
240357
|
const assets = assetsDir ? await buildAssetManifest(assetsDir, getAppContext().id) : NO_ASSETS;
|
|
@@ -240381,8 +240361,7 @@ async function deployToDeployments(options) {
|
|
|
240381
240361
|
const created = await createDeployment({
|
|
240382
240362
|
git_hash: gitHash,
|
|
240383
240363
|
config: worker?.config,
|
|
240384
|
-
asset_manifest: assets.manifest
|
|
240385
|
-
overwrite
|
|
240364
|
+
asset_manifest: assets.manifest
|
|
240386
240365
|
});
|
|
240387
240366
|
const completionJwt = await uploadDeploymentAssets(created.assetUploads, assets, { concurrency, progress });
|
|
240388
240367
|
const completion = worker ? { kind: "worker", modules: worker.modules, completionJwt } : await resolveStaticCompletion(assetsDir, assets, created.indexHtmlStaged);
|
|
@@ -247085,7 +247064,6 @@ async function shipCommit(projectRoot, outputDir, gitHash, options) {
|
|
|
247085
247064
|
projectRoot,
|
|
247086
247065
|
outputDir,
|
|
247087
247066
|
gitHash,
|
|
247088
|
-
overwrite: options?.overwrite,
|
|
247089
247067
|
progress: {
|
|
247090
247068
|
onWarning: (message) => options?.onSiteProgress?.(message),
|
|
247091
247069
|
onAssets: ({ totalAssets, newAssets }) => options?.onSiteProgress?.(`Found ${totalAssets} static assets (${newAssets} new)`)
|
|
@@ -252206,7 +252184,6 @@ ${summaryLines.join(`
|
|
|
252206
252184
|
let actorCompleted = 0;
|
|
252207
252185
|
const result = await deployAll(projectData, {
|
|
252208
252186
|
gitHash: options.gitHash,
|
|
252209
|
-
overwrite: options.overwrite,
|
|
252210
252187
|
onSiteProgress: (message) => {
|
|
252211
252188
|
log.message(theme.styles.dim(message));
|
|
252212
252189
|
},
|
|
@@ -252248,7 +252225,7 @@ ${summaryLines.join(`
|
|
|
252248
252225
|
return { outroMessage: "App deployed successfully" };
|
|
252249
252226
|
}
|
|
252250
252227
|
function getDeployCommand3() {
|
|
252251
|
-
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).
|
|
252228
|
+
return new Base44Command("deploy").description("Deploy all project resources (entities, functions, actors, agents, connectors, and site)").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).action(deployAction);
|
|
252252
252229
|
}
|
|
252253
252230
|
async function handleOAuthConnectors(connectorResults, isNonInteractive, options, log) {
|
|
252254
252231
|
const needsOAuth = filterPendingOAuth(connectorResults);
|
|
@@ -265367,11 +265344,14 @@ var SessionImportResponseSchema = object({
|
|
|
265367
265344
|
var ErrorEnvelopeSchema = object({
|
|
265368
265345
|
error: object({
|
|
265369
265346
|
code: string2().optional(),
|
|
265347
|
+
message: string2().optional(),
|
|
265370
265348
|
details: object({ branch_name: string2(), branch_url: string2() }).partial().optional()
|
|
265371
265349
|
})
|
|
265372
265350
|
});
|
|
265373
265351
|
var NETWORK_BLOCKED = "Your Claude cloud environment can't reach Base44 yet. In the environment's settings, open Network access, add `app.base44.com` to Allowed domains, and try again.";
|
|
265374
|
-
function messageFor(status, code, details, viaToken) {
|
|
265352
|
+
function messageFor(status, code, details, viaToken, serverMessage) {
|
|
265353
|
+
if (code === "authority_unavailable" && serverMessage)
|
|
265354
|
+
return serverMessage;
|
|
265375
265355
|
if (code === "branch_exists" && details?.branch_url) {
|
|
265376
265356
|
return `Base Code already has ${details.branch_name ?? "a branch for this session"}. Open it: ${new URL(details.branch_url, getBase44ApiUrl())}`;
|
|
265377
265357
|
}
|
|
@@ -265415,9 +265395,9 @@ async function toImportError(error, viaToken) {
|
|
|
265415
265395
|
const { status } = error.response;
|
|
265416
265396
|
const fallback = await ApiError.fromHttpError(error, "importing session");
|
|
265417
265397
|
const envelope = ErrorEnvelopeSchema.safeParse(fallback.responseBody);
|
|
265418
|
-
const { code, details } = envelope.success ? envelope.data.error : {};
|
|
265398
|
+
const { code, details, message } = envelope.success ? envelope.data.error : {};
|
|
265419
265399
|
const blocked = process.env.CLAUDE_CODE_REMOTE && status === 403 && typeof fallback.responseBody !== "object";
|
|
265420
|
-
const known = blocked ? NETWORK_BLOCKED : messageFor(status, code, details, viaToken);
|
|
265400
|
+
const known = blocked ? NETWORK_BLOCKED : messageFor(status, code, details, viaToken, message);
|
|
265421
265401
|
return new ApiError(known ?? fallback.message, {
|
|
265422
265402
|
statusCode: status,
|
|
265423
265403
|
requestUrl: error.request.url,
|
|
@@ -265426,10 +265406,29 @@ async function toImportError(error, viaToken) {
|
|
|
265426
265406
|
hints: known ? [] : fallback.hints
|
|
265427
265407
|
});
|
|
265428
265408
|
}
|
|
265409
|
+
var MAX_RETRIES = 3;
|
|
265410
|
+
var MAX_TOTAL_WAIT_SECONDS = 600;
|
|
265411
|
+
async function retryDelay(error) {
|
|
265412
|
+
if (!(error instanceof HTTPError))
|
|
265413
|
+
return;
|
|
265414
|
+
const { status, headers } = error.response;
|
|
265415
|
+
if (status !== 503 && status !== 429)
|
|
265416
|
+
return;
|
|
265417
|
+
const body = await error.response.clone().json().catch(() => {
|
|
265418
|
+
return;
|
|
265419
|
+
});
|
|
265420
|
+
const code = ErrorEnvelopeSchema.safeParse(body).data?.error.code;
|
|
265421
|
+
if (!(status === 503 && code === "authority_unavailable") && !(status === 429 && code === "rate_limited")) {
|
|
265422
|
+
return;
|
|
265423
|
+
}
|
|
265424
|
+
const seconds = Number(headers.get("Retry-After") ?? Number.NaN);
|
|
265425
|
+
return Number.isFinite(seconds) && seconds >= 0 ? seconds : 60;
|
|
265426
|
+
}
|
|
265429
265427
|
async function uploadSession(appId, content, {
|
|
265430
265428
|
token,
|
|
265431
265429
|
sourceBranch,
|
|
265432
|
-
artifacts = []
|
|
265430
|
+
artifacts = [],
|
|
265431
|
+
onRetry
|
|
265433
265432
|
} = {}) {
|
|
265434
265433
|
const form = new FormData;
|
|
265435
265434
|
form.append("file", new Blob([content]), "session.jsonl");
|
|
@@ -265445,23 +265444,41 @@ async function uploadSession(appId, content, {
|
|
|
265445
265444
|
}))));
|
|
265446
265445
|
}
|
|
265447
265446
|
const idempotencyKey = randomUUID5();
|
|
265447
|
+
const post = () => token ? distribution_default.post(new URL(`/api/apps/${appId}/imported/session-imports`, getBase44ApiUrl()), {
|
|
265448
|
+
body: form,
|
|
265449
|
+
headers: {
|
|
265450
|
+
Authorization: `Bearer ${token}`,
|
|
265451
|
+
"User-Agent": "Base44 CLI",
|
|
265452
|
+
"Idempotency-Key": idempotencyKey
|
|
265453
|
+
},
|
|
265454
|
+
timeout: 180000
|
|
265455
|
+
}) : getAppClient().post("imported/session-imports", {
|
|
265456
|
+
body: form,
|
|
265457
|
+
headers: { "Idempotency-Key": idempotencyKey },
|
|
265458
|
+
timeout: 180000
|
|
265459
|
+
});
|
|
265448
265460
|
let response;
|
|
265449
|
-
|
|
265450
|
-
|
|
265451
|
-
|
|
265452
|
-
|
|
265453
|
-
|
|
265454
|
-
|
|
265455
|
-
|
|
265456
|
-
|
|
265457
|
-
|
|
265458
|
-
|
|
265459
|
-
|
|
265460
|
-
|
|
265461
|
-
|
|
265462
|
-
|
|
265463
|
-
|
|
265464
|
-
|
|
265461
|
+
let waited = 0;
|
|
265462
|
+
for (let attempt = 1;; attempt++) {
|
|
265463
|
+
try {
|
|
265464
|
+
response = await post();
|
|
265465
|
+
break;
|
|
265466
|
+
} catch (error) {
|
|
265467
|
+
const seconds = await retryDelay(error);
|
|
265468
|
+
if (seconds === undefined || attempt > MAX_RETRIES || waited + seconds > MAX_TOTAL_WAIT_SECONDS) {
|
|
265469
|
+
throw await toImportError(error, Boolean(token));
|
|
265470
|
+
}
|
|
265471
|
+
waited += seconds;
|
|
265472
|
+
onRetry?.({
|
|
265473
|
+
status: error.response.status,
|
|
265474
|
+
seconds,
|
|
265475
|
+
attempt: attempt + 1,
|
|
265476
|
+
attempts: MAX_RETRIES + 1
|
|
265477
|
+
});
|
|
265478
|
+
if (!getTestOverrides()?.skipRetryWait) {
|
|
265479
|
+
await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
|
265480
|
+
}
|
|
265481
|
+
}
|
|
265465
265482
|
}
|
|
265466
265483
|
const result = SessionImportResponseSchema.safeParse(await response.json());
|
|
265467
265484
|
if (!result.success) {
|
|
@@ -266044,10 +266061,11 @@ async function importAction(ctx, link, options, command) {
|
|
|
266044
266061
|
for (const { fileName, reason } of skipped) {
|
|
266045
266062
|
ctx.log.warn(`Not sending ${fileName}: ${reason}.`);
|
|
266046
266063
|
}
|
|
266047
|
-
const imported = await ctx.runTask("Importing session", () => uploadSession(appId, content, {
|
|
266064
|
+
const imported = await ctx.runTask("Importing session", (updateMessage) => uploadSession(appId, content, {
|
|
266048
266065
|
token: options.token,
|
|
266049
266066
|
sourceBranch: git?.branch,
|
|
266050
|
-
artifacts
|
|
266067
|
+
artifacts,
|
|
266068
|
+
onRetry: ({ status, seconds, attempt, attempts }) => updateMessage(`${status === 503 ? "GitHub is rate-limiting access checks" : "Too many imports"}. Retrying in ${seconds}s (attempt ${attempt} of ${attempts})…`)
|
|
266051
266069
|
}));
|
|
266052
266070
|
const url = `${getBase44ApiUrl()}${imported.branchUrl}`;
|
|
266053
266071
|
const { importedArtifacts: saved, skippedArtifacts: refused } = imported;
|
|
@@ -266124,7 +266142,6 @@ async function deployToDeploymentsApi(ctx, project, options) {
|
|
|
266124
266142
|
outputDir,
|
|
266125
266143
|
gitHash,
|
|
266126
266144
|
concurrency: options.concurrency,
|
|
266127
|
-
overwrite: options.overwrite,
|
|
266128
266145
|
progress: {
|
|
266129
266146
|
onWarning: (message) => {
|
|
266130
266147
|
warnings.push(message);
|
|
@@ -266176,7 +266193,7 @@ function siteOutputDir(project) {
|
|
|
266176
266193
|
return resolve17(project.root, outputDirectory);
|
|
266177
266194
|
}
|
|
266178
266195
|
function getSiteDeployCommand() {
|
|
266179
|
-
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--publish", "Serve this build in production once it is deployed").
|
|
266196
|
+
return new Base44Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").option("--build", "Build the site before deploying (skips the prompt)").option("--no-build", "Deploy without building (skips the prompt)").option("--publish", "Serve this build in production once it is deployed").addOption(new Option2("--git-hash <hash>", "Deploy by the commit the build came from, through the deployments API").argParser(parseGitHash)).addOption(new Option2("--concurrency <n>", "Parallel asset uploads").default(DEFAULT_UPLOAD_CONCURRENCY).argParser(parseConcurrency)).action(deployAction2);
|
|
266180
266197
|
}
|
|
266181
266198
|
function parseConcurrency(value) {
|
|
266182
266199
|
const parsed = Number(value);
|
|
@@ -275332,4 +275349,4 @@ export {
|
|
|
275332
275349
|
runCLI
|
|
275333
275350
|
};
|
|
275334
275351
|
|
|
275335
|
-
//# debugId=
|
|
275352
|
+
//# debugId=9D8063E65A56942D64756E2164756E21
|