@base44-preview/cli 0.2.7-pr.689.072f10a → 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 +163 -142
- package/dist/cli/index.js.map +25 -25
- 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"),
|
|
@@ -236688,9 +236705,9 @@ async function downloadProject(projectId, projectPath) {
|
|
|
236688
236705
|
await makeDirectory(projectPath);
|
|
236689
236706
|
await pipeline(nodeStream, extract({ cwd: projectPath }));
|
|
236690
236707
|
}
|
|
236691
|
-
async function getAppUserToken(
|
|
236708
|
+
async function getAppUserToken() {
|
|
236692
236709
|
try {
|
|
236693
|
-
const response = await
|
|
236710
|
+
const response = await getAppClient().get("auth/token").json();
|
|
236694
236711
|
return response.token;
|
|
236695
236712
|
} catch (error) {
|
|
236696
236713
|
throw await ApiError.fromHttpError(error, "exchanging platform token for app user token");
|
|
@@ -238253,21 +238270,19 @@ async function pullAllConnectors() {
|
|
|
238253
238270
|
return connectors;
|
|
238254
238271
|
}
|
|
238255
238272
|
// src/core/resources/connector/push.ts
|
|
238256
|
-
async function pushConnectors(connectors) {
|
|
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
|
-
const oauthResults = await syncOAuthConnectors(oauthConnectors);
|
|
238260
|
-
const stripeResult = await syncStripeConnector(stripeConnector);
|
|
238276
|
+
const oauthResults = await syncOAuthConnectors(oauthConnectors, prune);
|
|
238277
|
+
const stripeResult = stripeConnector || prune ? await syncStripeConnector(stripeConnector) : null;
|
|
238261
238278
|
const results = [...oauthResults];
|
|
238262
238279
|
if (stripeResult) {
|
|
238263
238280
|
results.push(stripeResult);
|
|
238264
238281
|
}
|
|
238265
238282
|
return { results };
|
|
238266
238283
|
}
|
|
238267
|
-
async function syncOAuthConnectors(connectors) {
|
|
238284
|
+
async function syncOAuthConnectors(connectors, prune) {
|
|
238268
238285
|
const results = [];
|
|
238269
|
-
const upstream = await listConnectors();
|
|
238270
|
-
const localTypes = new Set(connectors.map((c) => c.type));
|
|
238271
238286
|
for (const connector of connectors) {
|
|
238272
238287
|
try {
|
|
238273
238288
|
const response = await setConnector(connector.type, connector.scopes ?? []);
|
|
@@ -238280,6 +238295,11 @@ async function syncOAuthConnectors(connectors) {
|
|
|
238280
238295
|
});
|
|
238281
238296
|
}
|
|
238282
238297
|
}
|
|
238298
|
+
if (!prune) {
|
|
238299
|
+
return results;
|
|
238300
|
+
}
|
|
238301
|
+
const upstream = await listConnectors();
|
|
238302
|
+
const localTypes = new Set(connectors.map((c) => c.type));
|
|
238283
238303
|
for (const upstreamConnector of upstream.integrations) {
|
|
238284
238304
|
if (!localTypes.has(upstreamConnector.integrationType)) {
|
|
238285
238305
|
try {
|
|
@@ -238671,7 +238691,8 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
238671
238691
|
source: ResourceSourceSchema
|
|
238672
238692
|
});
|
|
238673
238693
|
var DeploySingleFunctionResponseSchema = object({
|
|
238674
|
-
status: _enum(["deployed", "unchanged"])
|
|
238694
|
+
status: _enum(["deployed", "unchanged"]),
|
|
238695
|
+
warnings: array(string2()).optional().default([])
|
|
238675
238696
|
});
|
|
238676
238697
|
var FunctionInfoSchema = object({
|
|
238677
238698
|
name: string2(),
|
|
@@ -238898,7 +238919,8 @@ async function deployOne2(fn) {
|
|
|
238898
238919
|
return {
|
|
238899
238920
|
name: functionWithCode.name,
|
|
238900
238921
|
status: response.status,
|
|
238901
|
-
durationMs: Date.now() - start
|
|
238922
|
+
durationMs: Date.now() - start,
|
|
238923
|
+
warnings: response.warnings
|
|
238902
238924
|
};
|
|
238903
238925
|
} catch (error) {
|
|
238904
238926
|
return {
|
|
@@ -239384,7 +239406,7 @@ import { join as join13 } from "node:path";
|
|
|
239384
239406
|
// package.json
|
|
239385
239407
|
var package_default = {
|
|
239386
239408
|
name: "base44",
|
|
239387
|
-
version: "0.
|
|
239409
|
+
version: "0.3.1",
|
|
239388
239410
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239389
239411
|
type: "module",
|
|
239390
239412
|
bin: {
|
|
@@ -246979,8 +247001,7 @@ async function deployAll(projectData, options) {
|
|
|
246979
247001
|
await agentSkillResource.push(agentSkills);
|
|
246980
247002
|
await agentResource.push(agents);
|
|
246981
247003
|
await authConfigResource.push(authConfig);
|
|
246982
|
-
const
|
|
246983
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
247004
|
+
const { results: connectorResults } = await pushConnectors(connectors);
|
|
246984
247005
|
const appUrl = await deployProjectSite(project, options);
|
|
246985
247006
|
return appUrl ? { appUrl, connectorResults } : { connectorResults };
|
|
246986
247007
|
}
|
|
@@ -247038,6 +247059,7 @@ async function resolveBuildTarget(projectRoot, overrides = {}) {
|
|
|
247038
247059
|
outputDir: resolve6(root, overrides.outputDir ?? site.outputDirectory ?? DEFAULT_SITE.outputDirectory),
|
|
247039
247060
|
entitiesDir: project?.entitiesDir ?? "entities",
|
|
247040
247061
|
agentsDir: project?.agentsDir ?? "agents",
|
|
247062
|
+
workflowsDir: project?.workflowsDir ?? "workflows",
|
|
247041
247063
|
functionsDir: project?.functionsDir ?? "functions",
|
|
247042
247064
|
actorsDir: project?.actorsDir ?? "actors"
|
|
247043
247065
|
};
|
|
@@ -247120,23 +247142,6 @@ var base44Client = distribution_default.create({
|
|
|
247120
247142
|
afterResponse: [handleUnauthorized]
|
|
247121
247143
|
}
|
|
247122
247144
|
});
|
|
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
247145
|
function getAppClient() {
|
|
247141
247146
|
const { id } = getAppContext();
|
|
247142
247147
|
return base44Client.extend({
|
|
@@ -247259,6 +247264,24 @@ async function getUserInfo(accessToken) {
|
|
|
247259
247264
|
}
|
|
247260
247265
|
return result.data;
|
|
247261
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
|
+
}
|
|
247262
247285
|
// src/cli/commands/auth/login-flow.ts
|
|
247263
247286
|
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
247264
247287
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
@@ -247335,6 +247358,16 @@ async function ensureAuth(ctx) {
|
|
|
247335
247358
|
await seedAuthFromEnv();
|
|
247336
247359
|
const loggedIn = await isLoggedIn();
|
|
247337
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
|
+
}
|
|
247338
247371
|
ctx.log.info("You need to login first to continue.");
|
|
247339
247372
|
await login(ctx);
|
|
247340
247373
|
}
|
|
@@ -247866,6 +247899,11 @@ function formatDeployResult(result, log) {
|
|
|
247866
247899
|
log.success(`${label} unchanged`);
|
|
247867
247900
|
} else {
|
|
247868
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}`);
|
|
247869
247907
|
}
|
|
247870
247908
|
}
|
|
247871
247909
|
|
|
@@ -247888,9 +247926,6 @@ async function deployActorsAction({ log, jsonMode }, rawNames) {
|
|
|
247888
247926
|
onResult: (result) => {
|
|
247889
247927
|
completed++;
|
|
247890
247928
|
formatDeployResult(result, log);
|
|
247891
|
-
if (result.status !== "error")
|
|
247892
|
-
for (const warning of result.warnings)
|
|
247893
|
-
log.warn(`${result.name}: ${warning}`);
|
|
247894
247929
|
}
|
|
247895
247930
|
});
|
|
247896
247931
|
const summary = {
|
|
@@ -249370,15 +249405,10 @@ function cleanText(text) {
|
|
|
249370
249405
|
// src/core/api-spec/operations.ts
|
|
249371
249406
|
var PERSONAL_ACCESS_TOKEN_SCHEME = "PersonalAccessTokenAuth";
|
|
249372
249407
|
var READ_ONLY_SCOPE = "read_only";
|
|
249373
|
-
var APP_USER_TOKEN_SCHEME = "AppUserTokenAuth";
|
|
249374
249408
|
function isReadOnly(operation, spec) {
|
|
249375
249409
|
const security = operation.security ?? spec.security ?? [];
|
|
249376
249410
|
return security.some((requirement) => requirement[PERSONAL_ACCESS_TOKEN_SCHEME]?.includes(READ_ONLY_SCOPE));
|
|
249377
249411
|
}
|
|
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
249412
|
function parameterText(operation) {
|
|
249383
249413
|
return (operation.parameters ?? []).flatMap((parameter) => {
|
|
249384
249414
|
const parsed = ParameterSchema.safeParse(parameter);
|
|
@@ -249430,7 +249460,6 @@ function listOperations(spec) {
|
|
|
249430
249460
|
description: cleanText(operation.description ?? ""),
|
|
249431
249461
|
parameterText: parameterText(operation),
|
|
249432
249462
|
readOnly: isReadOnly(operation, spec),
|
|
249433
|
-
appUserToken: takesAppUserToken(operation, spec),
|
|
249434
249463
|
operation
|
|
249435
249464
|
}
|
|
249436
249465
|
];
|
|
@@ -249459,10 +249488,6 @@ function matchOperation(operations, method, concretePath) {
|
|
|
249459
249488
|
});
|
|
249460
249489
|
return candidates.sort((a, b) => literalSegments(b.path).localeCompare(literalSegments(a.path)))[0];
|
|
249461
249490
|
}
|
|
249462
|
-
function pathParameter(op, concretePath, name) {
|
|
249463
|
-
const index = pathSegments(op.path).indexOf(`{${name}}`);
|
|
249464
|
-
return index < 0 ? undefined : pathSegments(concretePath)[index];
|
|
249465
|
-
}
|
|
249466
249491
|
|
|
249467
249492
|
// src/core/api-spec/contract.ts
|
|
249468
249493
|
var SCHEMA_REF_PREFIX = "#/components/schemas/";
|
|
@@ -249603,6 +249628,59 @@ function grepOperations(spec, operations, pattern, options = {}) {
|
|
|
249603
249628
|
const regex = new RegExp(pattern, options.ignoreCase ? "i" : "");
|
|
249604
249629
|
return operations.filter((op) => regex.test(JSON.stringify(getOperationContract(spec, op)))).slice(0, options.limit ?? 20).map(toOperationSummary);
|
|
249605
249630
|
}
|
|
249631
|
+
// src/core/api-spec/request.ts
|
|
249632
|
+
var MAX_ERROR_BODY_CHARS = 4000;
|
|
249633
|
+
var QUERY_STRING = /\?\S*/g;
|
|
249634
|
+
async function readBody(response) {
|
|
249635
|
+
try {
|
|
249636
|
+
const text = (await response.clone().text()).trim();
|
|
249637
|
+
return text.length > MAX_ERROR_BODY_CHARS ? `${text.slice(0, MAX_ERROR_BODY_CHARS)}…` : text || undefined;
|
|
249638
|
+
} catch {
|
|
249639
|
+
return;
|
|
249640
|
+
}
|
|
249641
|
+
}
|
|
249642
|
+
function normalizePath(path) {
|
|
249643
|
+
const url = new URL(path.replace(/^\/*/, "/"), "http://placeholder");
|
|
249644
|
+
return `${url.pathname}${url.search}`;
|
|
249645
|
+
}
|
|
249646
|
+
async function sendApiRequest(method, path, body) {
|
|
249647
|
+
try {
|
|
249648
|
+
const response = await base44Client(path.replace(/^\/+/, ""), {
|
|
249649
|
+
method,
|
|
249650
|
+
body,
|
|
249651
|
+
headers: typeof body === "string" ? { "Content-Type": "application/json" } : {},
|
|
249652
|
+
timeout: false,
|
|
249653
|
+
retry: { methods: ["get", "head"] }
|
|
249654
|
+
});
|
|
249655
|
+
return {
|
|
249656
|
+
status: response.status,
|
|
249657
|
+
contentType: response.headers.get("content-type") ?? "",
|
|
249658
|
+
body: new Uint8Array(await response.arrayBuffer())
|
|
249659
|
+
};
|
|
249660
|
+
} catch (error) {
|
|
249661
|
+
const apiError = await ApiError.fromHttpError(error, `calling ${method} ${path}`);
|
|
249662
|
+
const response = error instanceof HTTPError ? error.response : undefined;
|
|
249663
|
+
const raw = response ? await readBody(response) : undefined;
|
|
249664
|
+
const retryAfter = response?.headers.get("retry-after") ?? undefined;
|
|
249665
|
+
throw redactedApiError(apiError, raw, method, path, retryAfter);
|
|
249666
|
+
}
|
|
249667
|
+
}
|
|
249668
|
+
function redactedApiError(apiError, raw, method, path, retryAfter) {
|
|
249669
|
+
const wait = retryAfter ? ` (retry after ${/^\d+$/.test(retryAfter) ? `${retryAfter} s` : retryAfter})` : "";
|
|
249670
|
+
const reason = apiError.statusCode !== undefined ? `HTTP ${apiError.statusCode}${wait}` : (apiError.cause?.message ?? "request failed").replace(QUERY_STRING, "");
|
|
249671
|
+
const message = `Error calling ${method} ${path.split("?", 1)[0]}: ${reason}`;
|
|
249672
|
+
return new ApiError(message, {
|
|
249673
|
+
statusCode: apiError.statusCode,
|
|
249674
|
+
requestUrl: apiError.requestUrl?.split("?", 1)[0],
|
|
249675
|
+
requestMethod: apiError.requestMethod,
|
|
249676
|
+
requestId: apiError.requestId,
|
|
249677
|
+
hints: apiError.hints,
|
|
249678
|
+
details: [
|
|
249679
|
+
...raw ? [`Response body: ${raw}`] : apiError.details ?? [],
|
|
249680
|
+
...apiError.requestId ? [`Request ID: ${apiError.requestId}`] : []
|
|
249681
|
+
]
|
|
249682
|
+
});
|
|
249683
|
+
}
|
|
249606
249684
|
// src/core/api-spec/spec.ts
|
|
249607
249685
|
import { rename, rm, stat as stat3 } from "node:fs/promises";
|
|
249608
249686
|
import { join as join22 } from "node:path";
|
|
@@ -249669,71 +249747,6 @@ async function loadSpec(options = {}) {
|
|
|
249669
249747
|
}
|
|
249670
249748
|
return { text, spec };
|
|
249671
249749
|
}
|
|
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
249750
|
// src/cli/commands/api/shared.ts
|
|
249738
249751
|
import { basename as basename6 } from "node:path";
|
|
249739
249752
|
function formatJson(value) {
|
|
@@ -249953,12 +249966,7 @@ ${CONTRACT_HELP}
|
|
|
249953
249966
|
}
|
|
249954
249967
|
await ensureAuth(ctx);
|
|
249955
249968
|
const body = options.form.length > 0 ? await readFormBody(options.form) : await readRequestBody(options.body);
|
|
249956
|
-
const response = await ctx.runTask(`Calling ${method} ${target}`,
|
|
249957
|
-
const appUserToken = await appUserTokenFor(method, target, {
|
|
249958
|
-
refresh: options.refresh && !options.readOnly
|
|
249959
|
-
});
|
|
249960
|
-
return sendApiRequest(method, target, body, appUserToken);
|
|
249961
|
-
}, {
|
|
249969
|
+
const response = await ctx.runTask(`Calling ${method} ${target}`, () => sendApiRequest(method, target, body), {
|
|
249962
249970
|
successMessage: `Called ${method} ${target}`,
|
|
249963
249971
|
errorMessage: "Request failed"
|
|
249964
249972
|
});
|
|
@@ -250457,11 +250465,18 @@ async function whoami(_ctx) {
|
|
|
250457
250465
|
outroMessage: `Using workspace API key: ${theme.styles.bold(workspaceApiKey.slice(0, 10))}`
|
|
250458
250466
|
};
|
|
250459
250467
|
}
|
|
250460
|
-
|
|
250461
|
-
|
|
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)}` };
|
|
250462
250474
|
}
|
|
250463
250475
|
function getWhoamiCommand() {
|
|
250464
|
-
return new Base44Command("whoami", {
|
|
250476
|
+
return new Base44Command("whoami", {
|
|
250477
|
+
requireAuth: false,
|
|
250478
|
+
requireAppContext: false
|
|
250479
|
+
}).description("Display current authenticated user").action(whoami);
|
|
250465
250480
|
}
|
|
250466
250481
|
|
|
250467
250482
|
// src/cli/commands/branches/index.ts
|
|
@@ -251402,25 +251417,26 @@ function printSummary(results, oauthOutcomes, log) {
|
|
|
251402
251417
|
}
|
|
251403
251418
|
async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }, options) {
|
|
251404
251419
|
const connectors = await readConnectorsToPush(options);
|
|
251420
|
+
if (connectors.length === 0) {
|
|
251421
|
+
return { outroMessage: "No local connectors found - nothing to push" };
|
|
251422
|
+
}
|
|
251405
251423
|
if (!jsonMode) {
|
|
251406
|
-
|
|
251407
|
-
|
|
251408
|
-
} else {
|
|
251409
|
-
const connectorNames = connectors.map((c) => c.type).join(", ");
|
|
251410
|
-
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251411
|
-
}
|
|
251424
|
+
const connectorNames = connectors.map((c) => c.type).join(", ");
|
|
251425
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251412
251426
|
}
|
|
251413
|
-
|
|
251414
|
-
|
|
251415
|
-
|
|
251416
|
-
|
|
251417
|
-
|
|
251418
|
-
|
|
251419
|
-
|
|
251420
|
-
|
|
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
|
+
}
|
|
251421
251437
|
}
|
|
251422
251438
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
251423
|
-
return await pushConnectors(connectors);
|
|
251439
|
+
return await pushConnectors(connectors, { prune: options.force });
|
|
251424
251440
|
});
|
|
251425
251441
|
const needsOAuth = filterPendingOAuth(results);
|
|
251426
251442
|
let outroMessage = "Connectors pushed to Base44";
|
|
@@ -251442,7 +251458,7 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }
|
|
|
251442
251458
|
return { outroMessage };
|
|
251443
251459
|
}
|
|
251444
251460
|
function getConnectorsPushCommand() {
|
|
251445
|
-
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);
|
|
251446
251462
|
}
|
|
251447
251463
|
|
|
251448
251464
|
// src/cli/commands/connectors/index.ts
|
|
@@ -252147,9 +252163,6 @@ ${summaryLines.join(`
|
|
|
252147
252163
|
onActorResult: (result) => {
|
|
252148
252164
|
actorCompleted++;
|
|
252149
252165
|
formatDeployResult(result, log);
|
|
252150
|
-
if (result.status !== "error")
|
|
252151
|
-
for (const warning of result.warnings)
|
|
252152
|
-
log.warn(`${result.name}: ${warning}`);
|
|
252153
252166
|
}
|
|
252154
252167
|
});
|
|
252155
252168
|
const connectorResults = result.connectorResults ?? [];
|
|
@@ -252162,6 +252175,12 @@ ${summaryLines.join(`
|
|
|
252162
252175
|
if (result.appUrl) {
|
|
252163
252176
|
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
252164
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
|
+
}
|
|
252165
252184
|
return { outroMessage: "App deployed successfully" };
|
|
252166
252185
|
}
|
|
252167
252186
|
function getDeployCommand3() {
|
|
@@ -252845,6 +252864,7 @@ async function createVersion(artifacts, options = {}) {
|
|
|
252845
252864
|
actors: artifacts.actors.map(declaredActor),
|
|
252846
252865
|
entities: artifacts.entities,
|
|
252847
252866
|
agents: artifacts.agents,
|
|
252867
|
+
workflows: artifacts.workflows,
|
|
252848
252868
|
source_commit: options.sourceCommit
|
|
252849
252869
|
}, "declaring a version")).json(), "declare");
|
|
252850
252870
|
const declaredFiles = [
|
|
@@ -264504,11 +264524,11 @@ async function describeSiteWorker(built) {
|
|
|
264504
264524
|
servingConfig: config.assetsConfig
|
|
264505
264525
|
};
|
|
264506
264526
|
}
|
|
264507
|
-
async function readRawResources(dir) {
|
|
264527
|
+
async function readRawResources(dir, extensions = CONFIG_FILE_EXTENSION_GLOB) {
|
|
264508
264528
|
if (!await pathExists(dir)) {
|
|
264509
264529
|
return {};
|
|
264510
264530
|
}
|
|
264511
|
-
const files = await globby(`**/*.${
|
|
264531
|
+
const files = await globby(`**/*.${extensions}`, {
|
|
264512
264532
|
cwd: dir,
|
|
264513
264533
|
onlyFiles: true,
|
|
264514
264534
|
followSymbolicLinks: false
|
|
@@ -264521,11 +264541,12 @@ async function readRawResources(dir) {
|
|
|
264521
264541
|
return payloads;
|
|
264522
264542
|
}
|
|
264523
264543
|
async function collectResources(configDir, dirs) {
|
|
264524
|
-
const [entities, agents] = await Promise.all([
|
|
264544
|
+
const [entities, agents, workflows] = await Promise.all([
|
|
264525
264545
|
readRawResources(join30(configDir, dirs.entitiesDir)),
|
|
264526
|
-
readRawResources(join30(configDir, dirs.agentsDir))
|
|
264546
|
+
readRawResources(join30(configDir, dirs.agentsDir)),
|
|
264547
|
+
readRawResources(join30(configDir, dirs.workflowsDir), CONFIG_FILE_EXTENSION)
|
|
264527
264548
|
]);
|
|
264528
|
-
return { entities, agents };
|
|
264549
|
+
return { entities, agents, workflows };
|
|
264529
264550
|
}
|
|
264530
264551
|
async function collectArtifacts(target) {
|
|
264531
264552
|
const built = await resolveFullStackBuild(target.root);
|
|
@@ -275025,4 +275046,4 @@ export {
|
|
|
275025
275046
|
runCLI
|
|
275026
275047
|
};
|
|
275027
275048
|
|
|
275028
|
-
//# debugId=
|
|
275049
|
+
//# debugId=33EA9FBB4F1B512964756E2164756E21
|