@base44-preview/cli 0.2.7-pr.687.f53a85d → 0.3.1-pr.691.c21893d
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 +99 -42
- package/dist/cli/index.js.map +19 -19
- package/package.json +1 -1
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) {
|
|
@@ -230757,6 +230773,7 @@ var ProjectConfigSchema = object({
|
|
|
230757
230773
|
functionsDir: string2().optional().default("functions"),
|
|
230758
230774
|
actorsDir: string2().optional().default("actors"),
|
|
230759
230775
|
agentsDir: string2().optional().default("agents"),
|
|
230776
|
+
workflowsDir: string2().optional().default("workflows"),
|
|
230760
230777
|
agentSkillsDir: string2().optional().default("agent-skills"),
|
|
230761
230778
|
connectorsDir: string2().optional().default("connectors"),
|
|
230762
230779
|
authDir: string2().optional().default("auth"),
|
|
@@ -238253,7 +238270,7 @@ async function pullAllConnectors() {
|
|
|
238253
238270
|
return connectors;
|
|
238254
238271
|
}
|
|
238255
238272
|
// src/core/resources/connector/push.ts
|
|
238256
|
-
async function pushConnectors(connectors, { prune =
|
|
238273
|
+
async function pushConnectors(connectors, { prune = false } = {}) {
|
|
238257
238274
|
const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
|
|
238258
238275
|
const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
|
|
238259
238276
|
const oauthResults = await syncOAuthConnectors(oauthConnectors, prune);
|
|
@@ -238674,7 +238691,8 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
238674
238691
|
source: ResourceSourceSchema
|
|
238675
238692
|
});
|
|
238676
238693
|
var DeploySingleFunctionResponseSchema = object({
|
|
238677
|
-
status: _enum(["deployed", "unchanged"])
|
|
238694
|
+
status: _enum(["deployed", "unchanged"]),
|
|
238695
|
+
warnings: array(string2()).optional().default([])
|
|
238678
238696
|
});
|
|
238679
238697
|
var FunctionInfoSchema = object({
|
|
238680
238698
|
name: string2(),
|
|
@@ -238901,7 +238919,8 @@ async function deployOne2(fn) {
|
|
|
238901
238919
|
return {
|
|
238902
238920
|
name: functionWithCode.name,
|
|
238903
238921
|
status: response.status,
|
|
238904
|
-
durationMs: Date.now() - start
|
|
238922
|
+
durationMs: Date.now() - start,
|
|
238923
|
+
warnings: response.warnings
|
|
238905
238924
|
};
|
|
238906
238925
|
} catch (error) {
|
|
238907
238926
|
return {
|
|
@@ -239387,7 +239406,7 @@ import { join as join13 } from "node:path";
|
|
|
239387
239406
|
// package.json
|
|
239388
239407
|
var package_default = {
|
|
239389
239408
|
name: "base44",
|
|
239390
|
-
version: "0.
|
|
239409
|
+
version: "0.3.1",
|
|
239391
239410
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239392
239411
|
type: "module",
|
|
239393
239412
|
bin: {
|
|
@@ -246982,9 +247001,7 @@ async function deployAll(projectData, options) {
|
|
|
246982
247001
|
await agentSkillResource.push(agentSkills);
|
|
246983
247002
|
await agentResource.push(agents);
|
|
246984
247003
|
await authConfigResource.push(authConfig);
|
|
246985
|
-
const { results: connectorResults } = await pushConnectors(connectors
|
|
246986
|
-
prune: false
|
|
246987
|
-
});
|
|
247004
|
+
const { results: connectorResults } = await pushConnectors(connectors);
|
|
246988
247005
|
const appUrl = await deployProjectSite(project, options);
|
|
246989
247006
|
return appUrl ? { appUrl, connectorResults } : { connectorResults };
|
|
246990
247007
|
}
|
|
@@ -247042,6 +247059,7 @@ async function resolveBuildTarget(projectRoot, overrides = {}) {
|
|
|
247042
247059
|
outputDir: resolve6(root, overrides.outputDir ?? site.outputDirectory ?? DEFAULT_SITE.outputDirectory),
|
|
247043
247060
|
entitiesDir: project?.entitiesDir ?? "entities",
|
|
247044
247061
|
agentsDir: project?.agentsDir ?? "agents",
|
|
247062
|
+
workflowsDir: project?.workflowsDir ?? "workflows",
|
|
247045
247063
|
functionsDir: project?.functionsDir ?? "functions",
|
|
247046
247064
|
actorsDir: project?.actorsDir ?? "actors"
|
|
247047
247065
|
};
|
|
@@ -247246,6 +247264,24 @@ async function getUserInfo(accessToken) {
|
|
|
247246
247264
|
}
|
|
247247
247265
|
return result.data;
|
|
247248
247266
|
}
|
|
247267
|
+
async function getSessionUser() {
|
|
247268
|
+
let response;
|
|
247269
|
+
try {
|
|
247270
|
+
response = await base44Client.get("oauth/userinfo");
|
|
247271
|
+
} catch (error) {
|
|
247272
|
+
if (error instanceof HTTPError && error.response.status === 401) {
|
|
247273
|
+
throw new AuthExpiredError("Your session has expired or was revoked", {
|
|
247274
|
+
cause: error
|
|
247275
|
+
});
|
|
247276
|
+
}
|
|
247277
|
+
throw await ApiError.fromHttpError(error, "verifying the session with the server");
|
|
247278
|
+
}
|
|
247279
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
247280
|
+
if (!result.success) {
|
|
247281
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
247282
|
+
}
|
|
247283
|
+
return result.data;
|
|
247284
|
+
}
|
|
247249
247285
|
// src/cli/commands/auth/login-flow.ts
|
|
247250
247286
|
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
247251
247287
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
@@ -247322,6 +247358,16 @@ async function ensureAuth(ctx) {
|
|
|
247322
247358
|
await seedAuthFromEnv();
|
|
247323
247359
|
const loggedIn = await isLoggedIn();
|
|
247324
247360
|
if (!loggedIn) {
|
|
247361
|
+
if (ctx.isNonInteractive) {
|
|
247362
|
+
throw new AuthRequiredError("Not logged in", {
|
|
247363
|
+
hints: [
|
|
247364
|
+
{ message: "Run 'base44 login' first", command: "base44 login" },
|
|
247365
|
+
{
|
|
247366
|
+
message: "Or set BASE44_API_KEY, or BASE44_ACCESS_TOKEN and BASE44_REFRESH_TOKEN"
|
|
247367
|
+
}
|
|
247368
|
+
]
|
|
247369
|
+
});
|
|
247370
|
+
}
|
|
247325
247371
|
ctx.log.info("You need to login first to continue.");
|
|
247326
247372
|
await login(ctx);
|
|
247327
247373
|
}
|
|
@@ -247853,6 +247899,11 @@ function formatDeployResult(result, log) {
|
|
|
247853
247899
|
log.success(`${label} unchanged`);
|
|
247854
247900
|
} else {
|
|
247855
247901
|
log.error(`${label} error: ${result.error}`);
|
|
247902
|
+
return;
|
|
247903
|
+
}
|
|
247904
|
+
for (const warning of result.warnings ?? []) {
|
|
247905
|
+
const prefix = `${result.name}: `;
|
|
247906
|
+
log.warn(warning.startsWith(prefix) ? warning : `${prefix}${warning}`);
|
|
247856
247907
|
}
|
|
247857
247908
|
}
|
|
247858
247909
|
|
|
@@ -247875,9 +247926,6 @@ async function deployActorsAction({ log, jsonMode }, rawNames) {
|
|
|
247875
247926
|
onResult: (result) => {
|
|
247876
247927
|
completed++;
|
|
247877
247928
|
formatDeployResult(result, log);
|
|
247878
|
-
if (result.status !== "error")
|
|
247879
|
-
for (const warning of result.warnings)
|
|
247880
|
-
log.warn(`${result.name}: ${warning}`);
|
|
247881
247929
|
}
|
|
247882
247930
|
});
|
|
247883
247931
|
const summary = {
|
|
@@ -250417,11 +250465,18 @@ async function whoami(_ctx) {
|
|
|
250417
250465
|
outroMessage: `Using workspace API key: ${theme.styles.bold(workspaceApiKey.slice(0, 10))}`
|
|
250418
250466
|
};
|
|
250419
250467
|
}
|
|
250420
|
-
|
|
250421
|
-
|
|
250468
|
+
await seedAuthFromEnv();
|
|
250469
|
+
if (!await isLoggedIn()) {
|
|
250470
|
+
throw new AuthRequiredError("Not logged in");
|
|
250471
|
+
}
|
|
250472
|
+
const user = await getSessionUser();
|
|
250473
|
+
return { outroMessage: `Logged in as: ${theme.styles.bold(user.email)}` };
|
|
250422
250474
|
}
|
|
250423
250475
|
function getWhoamiCommand() {
|
|
250424
|
-
return new Base44Command("whoami", {
|
|
250476
|
+
return new Base44Command("whoami", {
|
|
250477
|
+
requireAuth: false,
|
|
250478
|
+
requireAppContext: false
|
|
250479
|
+
}).description("Display current authenticated user").action(whoami);
|
|
250425
250480
|
}
|
|
250426
250481
|
|
|
250427
250482
|
// src/cli/commands/branches/index.ts
|
|
@@ -251362,25 +251417,26 @@ function printSummary(results, oauthOutcomes, log) {
|
|
|
251362
251417
|
}
|
|
251363
251418
|
async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }, options) {
|
|
251364
251419
|
const connectors = await readConnectorsToPush(options);
|
|
251420
|
+
if (connectors.length === 0) {
|
|
251421
|
+
return { outroMessage: "No local connectors found - nothing to push" };
|
|
251422
|
+
}
|
|
251365
251423
|
if (!jsonMode) {
|
|
251366
|
-
|
|
251367
|
-
|
|
251368
|
-
} else {
|
|
251369
|
-
const connectorNames = connectors.map((c) => c.type).join(", ");
|
|
251370
|
-
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251371
|
-
}
|
|
251424
|
+
const connectorNames = connectors.map((c) => c.type).join(", ");
|
|
251425
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251372
251426
|
}
|
|
251373
|
-
|
|
251374
|
-
|
|
251375
|
-
|
|
251376
|
-
|
|
251377
|
-
|
|
251378
|
-
|
|
251379
|
-
|
|
251380
|
-
|
|
251427
|
+
if (options.force) {
|
|
251428
|
+
const proceed = await confirmPush({
|
|
251429
|
+
isNonInteractive,
|
|
251430
|
+
yes: options.yes,
|
|
251431
|
+
log,
|
|
251432
|
+
warning: "This will remove any connectors on Base44 that are not present locally."
|
|
251433
|
+
});
|
|
251434
|
+
if (!proceed) {
|
|
251435
|
+
return { outroMessage: "Push cancelled" };
|
|
251436
|
+
}
|
|
251381
251437
|
}
|
|
251382
251438
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
251383
|
-
return await pushConnectors(connectors);
|
|
251439
|
+
return await pushConnectors(connectors, { prune: options.force });
|
|
251384
251440
|
});
|
|
251385
251441
|
const needsOAuth = filterPendingOAuth(results);
|
|
251386
251442
|
let outroMessage = "Connectors pushed to Base44";
|
|
@@ -251402,7 +251458,7 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }
|
|
|
251402
251458
|
return { outroMessage };
|
|
251403
251459
|
}
|
|
251404
251460
|
function getConnectorsPushCommand() {
|
|
251405
|
-
return new Base44Command("push").description("Push local connectors to Base44 (
|
|
251461
|
+
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);
|
|
251406
251462
|
}
|
|
251407
251463
|
|
|
251408
251464
|
// src/cli/commands/connectors/index.ts
|
|
@@ -252107,9 +252163,6 @@ ${summaryLines.join(`
|
|
|
252107
252163
|
onActorResult: (result) => {
|
|
252108
252164
|
actorCompleted++;
|
|
252109
252165
|
formatDeployResult(result, log);
|
|
252110
|
-
if (result.status !== "error")
|
|
252111
|
-
for (const warning of result.warnings)
|
|
252112
|
-
log.warn(`${result.name}: ${warning}`);
|
|
252113
252166
|
}
|
|
252114
252167
|
});
|
|
252115
252168
|
const connectorResults = result.connectorResults ?? [];
|
|
@@ -252118,14 +252171,16 @@ ${summaryLines.join(`
|
|
|
252118
252171
|
if (stripeResult?.action === "provisioned") {
|
|
252119
252172
|
printStripeResult(stripeResult, log);
|
|
252120
252173
|
}
|
|
252121
|
-
for (const r of connectorResults) {
|
|
252122
|
-
if (r.action === "error")
|
|
252123
|
-
log.error(`Failed: ${r.type} - ${r.error}`);
|
|
252124
|
-
}
|
|
252125
252174
|
log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl())}`);
|
|
252126
252175
|
if (result.appUrl) {
|
|
252127
252176
|
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
252128
252177
|
}
|
|
252178
|
+
const failedConnectors = connectorResults.flatMap((r) => r.action === "error" ? [`Connector ${r.type}: ${r.error}`] : []);
|
|
252179
|
+
if (failedConnectors.length > 0) {
|
|
252180
|
+
throw new ResourceDeploymentError("Some connectors failed to sync", {
|
|
252181
|
+
details: failedConnectors
|
|
252182
|
+
});
|
|
252183
|
+
}
|
|
252129
252184
|
return { outroMessage: "App deployed successfully" };
|
|
252130
252185
|
}
|
|
252131
252186
|
function getDeployCommand3() {
|
|
@@ -252809,6 +252864,7 @@ async function createVersion(artifacts, options = {}) {
|
|
|
252809
252864
|
actors: artifacts.actors.map(declaredActor),
|
|
252810
252865
|
entities: artifacts.entities,
|
|
252811
252866
|
agents: artifacts.agents,
|
|
252867
|
+
workflows: artifacts.workflows,
|
|
252812
252868
|
source_commit: options.sourceCommit
|
|
252813
252869
|
}, "declaring a version")).json(), "declare");
|
|
252814
252870
|
const declaredFiles = [
|
|
@@ -264468,11 +264524,11 @@ async function describeSiteWorker(built) {
|
|
|
264468
264524
|
servingConfig: config.assetsConfig
|
|
264469
264525
|
};
|
|
264470
264526
|
}
|
|
264471
|
-
async function readRawResources(dir) {
|
|
264527
|
+
async function readRawResources(dir, extensions = CONFIG_FILE_EXTENSION_GLOB) {
|
|
264472
264528
|
if (!await pathExists(dir)) {
|
|
264473
264529
|
return {};
|
|
264474
264530
|
}
|
|
264475
|
-
const files = await globby(`**/*.${
|
|
264531
|
+
const files = await globby(`**/*.${extensions}`, {
|
|
264476
264532
|
cwd: dir,
|
|
264477
264533
|
onlyFiles: true,
|
|
264478
264534
|
followSymbolicLinks: false
|
|
@@ -264485,11 +264541,12 @@ async function readRawResources(dir) {
|
|
|
264485
264541
|
return payloads;
|
|
264486
264542
|
}
|
|
264487
264543
|
async function collectResources(configDir, dirs) {
|
|
264488
|
-
const [entities, agents] = await Promise.all([
|
|
264544
|
+
const [entities, agents, workflows] = await Promise.all([
|
|
264489
264545
|
readRawResources(join30(configDir, dirs.entitiesDir)),
|
|
264490
|
-
readRawResources(join30(configDir, dirs.agentsDir))
|
|
264546
|
+
readRawResources(join30(configDir, dirs.agentsDir)),
|
|
264547
|
+
readRawResources(join30(configDir, dirs.workflowsDir), CONFIG_FILE_EXTENSION)
|
|
264491
264548
|
]);
|
|
264492
|
-
return { entities, agents };
|
|
264549
|
+
return { entities, agents, workflows };
|
|
264493
264550
|
}
|
|
264494
264551
|
async function collectArtifacts(target) {
|
|
264495
264552
|
const built = await resolveFullStackBuild(target.root);
|
|
@@ -274989,4 +275046,4 @@ export {
|
|
|
274989
275046
|
runCLI
|
|
274990
275047
|
};
|
|
274991
275048
|
|
|
274992
|
-
//# debugId=
|
|
275049
|
+
//# debugId=33EA9FBB4F1B512964756E2164756E21
|