@base44-preview/cli 0.2.7-pr.689.072f10a → 0.3.1-pr.685.145f2be
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 +162 -140
- package/dist/cli/index.js.map +22 -22
- 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) {
|
|
@@ -236688,9 +236704,9 @@ async function downloadProject(projectId, projectPath) {
|
|
|
236688
236704
|
await makeDirectory(projectPath);
|
|
236689
236705
|
await pipeline(nodeStream, extract({ cwd: projectPath }));
|
|
236690
236706
|
}
|
|
236691
|
-
async function getAppUserToken(
|
|
236707
|
+
async function getAppUserToken() {
|
|
236692
236708
|
try {
|
|
236693
|
-
const response = await
|
|
236709
|
+
const response = await getAppClient().get("auth/token").json();
|
|
236694
236710
|
return response.token;
|
|
236695
236711
|
} catch (error) {
|
|
236696
236712
|
throw await ApiError.fromHttpError(error, "exchanging platform token for app user token");
|
|
@@ -238253,21 +238269,19 @@ async function pullAllConnectors() {
|
|
|
238253
238269
|
return connectors;
|
|
238254
238270
|
}
|
|
238255
238271
|
// src/core/resources/connector/push.ts
|
|
238256
|
-
async function pushConnectors(connectors) {
|
|
238272
|
+
async function pushConnectors(connectors, { prune = false } = {}) {
|
|
238257
238273
|
const stripeConnector = connectors.find((c) => c.type === STRIPE_CONNECTOR_TYPE);
|
|
238258
238274
|
const oauthConnectors = connectors.filter((c) => c.type !== STRIPE_CONNECTOR_TYPE);
|
|
238259
|
-
const oauthResults = await syncOAuthConnectors(oauthConnectors);
|
|
238260
|
-
const stripeResult = await syncStripeConnector(stripeConnector);
|
|
238275
|
+
const oauthResults = await syncOAuthConnectors(oauthConnectors, prune);
|
|
238276
|
+
const stripeResult = stripeConnector || prune ? await syncStripeConnector(stripeConnector) : null;
|
|
238261
238277
|
const results = [...oauthResults];
|
|
238262
238278
|
if (stripeResult) {
|
|
238263
238279
|
results.push(stripeResult);
|
|
238264
238280
|
}
|
|
238265
238281
|
return { results };
|
|
238266
238282
|
}
|
|
238267
|
-
async function syncOAuthConnectors(connectors) {
|
|
238283
|
+
async function syncOAuthConnectors(connectors, prune) {
|
|
238268
238284
|
const results = [];
|
|
238269
|
-
const upstream = await listConnectors();
|
|
238270
|
-
const localTypes = new Set(connectors.map((c) => c.type));
|
|
238271
238285
|
for (const connector of connectors) {
|
|
238272
238286
|
try {
|
|
238273
238287
|
const response = await setConnector(connector.type, connector.scopes ?? []);
|
|
@@ -238280,6 +238294,11 @@ async function syncOAuthConnectors(connectors) {
|
|
|
238280
238294
|
});
|
|
238281
238295
|
}
|
|
238282
238296
|
}
|
|
238297
|
+
if (!prune) {
|
|
238298
|
+
return results;
|
|
238299
|
+
}
|
|
238300
|
+
const upstream = await listConnectors();
|
|
238301
|
+
const localTypes = new Set(connectors.map((c) => c.type));
|
|
238283
238302
|
for (const upstreamConnector of upstream.integrations) {
|
|
238284
238303
|
if (!localTypes.has(upstreamConnector.integrationType)) {
|
|
238285
238304
|
try {
|
|
@@ -238671,7 +238690,8 @@ var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
|
238671
238690
|
source: ResourceSourceSchema
|
|
238672
238691
|
});
|
|
238673
238692
|
var DeploySingleFunctionResponseSchema = object({
|
|
238674
|
-
status: _enum(["deployed", "unchanged"])
|
|
238693
|
+
status: _enum(["deployed", "unchanged"]),
|
|
238694
|
+
warnings: array(string2()).optional().default([])
|
|
238675
238695
|
});
|
|
238676
238696
|
var FunctionInfoSchema = object({
|
|
238677
238697
|
name: string2(),
|
|
@@ -238778,8 +238798,11 @@ async function fetchFunctionLogs(functionName, filters = {}) {
|
|
|
238778
238798
|
}
|
|
238779
238799
|
// src/core/resources/function/config.ts
|
|
238780
238800
|
import { basename as basename4, dirname as dirname8, join as join10, relative as relative3, resolve as resolve2 } from "node:path";
|
|
238801
|
+
function getSharedDir(functionsDir) {
|
|
238802
|
+
return resolve2(functionsDir, "..", "shared");
|
|
238803
|
+
}
|
|
238781
238804
|
async function readSharedFiles(functionsDir) {
|
|
238782
|
-
const sharedDir =
|
|
238805
|
+
const sharedDir = getSharedDir(functionsDir);
|
|
238783
238806
|
if (!await pathExists(sharedDir)) {
|
|
238784
238807
|
return [];
|
|
238785
238808
|
}
|
|
@@ -238898,7 +238921,8 @@ async function deployOne2(fn) {
|
|
|
238898
238921
|
return {
|
|
238899
238922
|
name: functionWithCode.name,
|
|
238900
238923
|
status: response.status,
|
|
238901
|
-
durationMs: Date.now() - start
|
|
238924
|
+
durationMs: Date.now() - start,
|
|
238925
|
+
warnings: response.warnings
|
|
238902
238926
|
};
|
|
238903
238927
|
} catch (error) {
|
|
238904
238928
|
return {
|
|
@@ -239384,7 +239408,7 @@ import { join as join13 } from "node:path";
|
|
|
239384
239408
|
// package.json
|
|
239385
239409
|
var package_default = {
|
|
239386
239410
|
name: "base44",
|
|
239387
|
-
version: "0.
|
|
239411
|
+
version: "0.3.1",
|
|
239388
239412
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
239389
239413
|
type: "module",
|
|
239390
239414
|
bin: {
|
|
@@ -246979,8 +247003,7 @@ async function deployAll(projectData, options) {
|
|
|
246979
247003
|
await agentSkillResource.push(agentSkills);
|
|
246980
247004
|
await agentResource.push(agents);
|
|
246981
247005
|
await authConfigResource.push(authConfig);
|
|
246982
|
-
const
|
|
246983
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
247006
|
+
const { results: connectorResults } = await pushConnectors(connectors);
|
|
246984
247007
|
const appUrl = await deployProjectSite(project, options);
|
|
246985
247008
|
return appUrl ? { appUrl, connectorResults } : { connectorResults };
|
|
246986
247009
|
}
|
|
@@ -247120,23 +247143,6 @@ var base44Client = distribution_default.create({
|
|
|
247120
247143
|
afterResponse: [handleUnauthorized]
|
|
247121
247144
|
}
|
|
247122
247145
|
});
|
|
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
247146
|
function getAppClient() {
|
|
247141
247147
|
const { id } = getAppContext();
|
|
247142
247148
|
return base44Client.extend({
|
|
@@ -247259,6 +247265,24 @@ async function getUserInfo(accessToken) {
|
|
|
247259
247265
|
}
|
|
247260
247266
|
return result.data;
|
|
247261
247267
|
}
|
|
247268
|
+
async function getSessionUser() {
|
|
247269
|
+
let response;
|
|
247270
|
+
try {
|
|
247271
|
+
response = await base44Client.get("oauth/userinfo");
|
|
247272
|
+
} catch (error) {
|
|
247273
|
+
if (error instanceof HTTPError && error.response.status === 401) {
|
|
247274
|
+
throw new AuthExpiredError("Your session has expired or was revoked", {
|
|
247275
|
+
cause: error
|
|
247276
|
+
});
|
|
247277
|
+
}
|
|
247278
|
+
throw await ApiError.fromHttpError(error, "verifying the session with the server");
|
|
247279
|
+
}
|
|
247280
|
+
const result = UserInfoSchema.safeParse(await response.json());
|
|
247281
|
+
if (!result.success) {
|
|
247282
|
+
throw new SchemaValidationError("Invalid UserInfo response from server", result.error);
|
|
247283
|
+
}
|
|
247284
|
+
return result.data;
|
|
247285
|
+
}
|
|
247262
247286
|
// src/cli/commands/auth/login-flow.ts
|
|
247263
247287
|
async function generateAndDisplayDeviceCode(log, runTask) {
|
|
247264
247288
|
const deviceCodeResponse = await runTask("Generating device code...", async () => {
|
|
@@ -247335,6 +247359,16 @@ async function ensureAuth(ctx) {
|
|
|
247335
247359
|
await seedAuthFromEnv();
|
|
247336
247360
|
const loggedIn = await isLoggedIn();
|
|
247337
247361
|
if (!loggedIn) {
|
|
247362
|
+
if (ctx.isNonInteractive) {
|
|
247363
|
+
throw new AuthRequiredError("Not logged in", {
|
|
247364
|
+
hints: [
|
|
247365
|
+
{ message: "Run 'base44 login' first", command: "base44 login" },
|
|
247366
|
+
{
|
|
247367
|
+
message: "Or set BASE44_API_KEY, or BASE44_ACCESS_TOKEN and BASE44_REFRESH_TOKEN"
|
|
247368
|
+
}
|
|
247369
|
+
]
|
|
247370
|
+
});
|
|
247371
|
+
}
|
|
247338
247372
|
ctx.log.info("You need to login first to continue.");
|
|
247339
247373
|
await login(ctx);
|
|
247340
247374
|
}
|
|
@@ -247866,6 +247900,11 @@ function formatDeployResult(result, log) {
|
|
|
247866
247900
|
log.success(`${label} unchanged`);
|
|
247867
247901
|
} else {
|
|
247868
247902
|
log.error(`${label} error: ${result.error}`);
|
|
247903
|
+
return;
|
|
247904
|
+
}
|
|
247905
|
+
for (const warning of result.warnings ?? []) {
|
|
247906
|
+
const prefix = `${result.name}: `;
|
|
247907
|
+
log.warn(warning.startsWith(prefix) ? warning : `${prefix}${warning}`);
|
|
247869
247908
|
}
|
|
247870
247909
|
}
|
|
247871
247910
|
|
|
@@ -247888,9 +247927,6 @@ async function deployActorsAction({ log, jsonMode }, rawNames) {
|
|
|
247888
247927
|
onResult: (result) => {
|
|
247889
247928
|
completed++;
|
|
247890
247929
|
formatDeployResult(result, log);
|
|
247891
|
-
if (result.status !== "error")
|
|
247892
|
-
for (const warning of result.warnings)
|
|
247893
|
-
log.warn(`${result.name}: ${warning}`);
|
|
247894
247930
|
}
|
|
247895
247931
|
});
|
|
247896
247932
|
const summary = {
|
|
@@ -249370,15 +249406,10 @@ function cleanText(text) {
|
|
|
249370
249406
|
// src/core/api-spec/operations.ts
|
|
249371
249407
|
var PERSONAL_ACCESS_TOKEN_SCHEME = "PersonalAccessTokenAuth";
|
|
249372
249408
|
var READ_ONLY_SCOPE = "read_only";
|
|
249373
|
-
var APP_USER_TOKEN_SCHEME = "AppUserTokenAuth";
|
|
249374
249409
|
function isReadOnly(operation, spec) {
|
|
249375
249410
|
const security = operation.security ?? spec.security ?? [];
|
|
249376
249411
|
return security.some((requirement) => requirement[PERSONAL_ACCESS_TOKEN_SCHEME]?.includes(READ_ONLY_SCOPE));
|
|
249377
249412
|
}
|
|
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
249413
|
function parameterText(operation) {
|
|
249383
249414
|
return (operation.parameters ?? []).flatMap((parameter) => {
|
|
249384
249415
|
const parsed = ParameterSchema.safeParse(parameter);
|
|
@@ -249430,7 +249461,6 @@ function listOperations(spec) {
|
|
|
249430
249461
|
description: cleanText(operation.description ?? ""),
|
|
249431
249462
|
parameterText: parameterText(operation),
|
|
249432
249463
|
readOnly: isReadOnly(operation, spec),
|
|
249433
|
-
appUserToken: takesAppUserToken(operation, spec),
|
|
249434
249464
|
operation
|
|
249435
249465
|
}
|
|
249436
249466
|
];
|
|
@@ -249459,10 +249489,6 @@ function matchOperation(operations, method, concretePath) {
|
|
|
249459
249489
|
});
|
|
249460
249490
|
return candidates.sort((a, b) => literalSegments(b.path).localeCompare(literalSegments(a.path)))[0];
|
|
249461
249491
|
}
|
|
249462
|
-
function pathParameter(op, concretePath, name) {
|
|
249463
|
-
const index = pathSegments(op.path).indexOf(`{${name}}`);
|
|
249464
|
-
return index < 0 ? undefined : pathSegments(concretePath)[index];
|
|
249465
|
-
}
|
|
249466
249492
|
|
|
249467
249493
|
// src/core/api-spec/contract.ts
|
|
249468
249494
|
var SCHEMA_REF_PREFIX = "#/components/schemas/";
|
|
@@ -249603,6 +249629,59 @@ function grepOperations(spec, operations, pattern, options = {}) {
|
|
|
249603
249629
|
const regex = new RegExp(pattern, options.ignoreCase ? "i" : "");
|
|
249604
249630
|
return operations.filter((op) => regex.test(JSON.stringify(getOperationContract(spec, op)))).slice(0, options.limit ?? 20).map(toOperationSummary);
|
|
249605
249631
|
}
|
|
249632
|
+
// src/core/api-spec/request.ts
|
|
249633
|
+
var MAX_ERROR_BODY_CHARS = 4000;
|
|
249634
|
+
var QUERY_STRING = /\?\S*/g;
|
|
249635
|
+
async function readBody(response) {
|
|
249636
|
+
try {
|
|
249637
|
+
const text = (await response.clone().text()).trim();
|
|
249638
|
+
return text.length > MAX_ERROR_BODY_CHARS ? `${text.slice(0, MAX_ERROR_BODY_CHARS)}…` : text || undefined;
|
|
249639
|
+
} catch {
|
|
249640
|
+
return;
|
|
249641
|
+
}
|
|
249642
|
+
}
|
|
249643
|
+
function normalizePath(path) {
|
|
249644
|
+
const url = new URL(path.replace(/^\/*/, "/"), "http://placeholder");
|
|
249645
|
+
return `${url.pathname}${url.search}`;
|
|
249646
|
+
}
|
|
249647
|
+
async function sendApiRequest(method, path, body) {
|
|
249648
|
+
try {
|
|
249649
|
+
const response = await base44Client(path.replace(/^\/+/, ""), {
|
|
249650
|
+
method,
|
|
249651
|
+
body,
|
|
249652
|
+
headers: typeof body === "string" ? { "Content-Type": "application/json" } : {},
|
|
249653
|
+
timeout: false,
|
|
249654
|
+
retry: { methods: ["get", "head"] }
|
|
249655
|
+
});
|
|
249656
|
+
return {
|
|
249657
|
+
status: response.status,
|
|
249658
|
+
contentType: response.headers.get("content-type") ?? "",
|
|
249659
|
+
body: new Uint8Array(await response.arrayBuffer())
|
|
249660
|
+
};
|
|
249661
|
+
} catch (error) {
|
|
249662
|
+
const apiError = await ApiError.fromHttpError(error, `calling ${method} ${path}`);
|
|
249663
|
+
const response = error instanceof HTTPError ? error.response : undefined;
|
|
249664
|
+
const raw = response ? await readBody(response) : undefined;
|
|
249665
|
+
const retryAfter = response?.headers.get("retry-after") ?? undefined;
|
|
249666
|
+
throw redactedApiError(apiError, raw, method, path, retryAfter);
|
|
249667
|
+
}
|
|
249668
|
+
}
|
|
249669
|
+
function redactedApiError(apiError, raw, method, path, retryAfter) {
|
|
249670
|
+
const wait = retryAfter ? ` (retry after ${/^\d+$/.test(retryAfter) ? `${retryAfter} s` : retryAfter})` : "";
|
|
249671
|
+
const reason = apiError.statusCode !== undefined ? `HTTP ${apiError.statusCode}${wait}` : (apiError.cause?.message ?? "request failed").replace(QUERY_STRING, "");
|
|
249672
|
+
const message = `Error calling ${method} ${path.split("?", 1)[0]}: ${reason}`;
|
|
249673
|
+
return new ApiError(message, {
|
|
249674
|
+
statusCode: apiError.statusCode,
|
|
249675
|
+
requestUrl: apiError.requestUrl?.split("?", 1)[0],
|
|
249676
|
+
requestMethod: apiError.requestMethod,
|
|
249677
|
+
requestId: apiError.requestId,
|
|
249678
|
+
hints: apiError.hints,
|
|
249679
|
+
details: [
|
|
249680
|
+
...raw ? [`Response body: ${raw}`] : apiError.details ?? [],
|
|
249681
|
+
...apiError.requestId ? [`Request ID: ${apiError.requestId}`] : []
|
|
249682
|
+
]
|
|
249683
|
+
});
|
|
249684
|
+
}
|
|
249606
249685
|
// src/core/api-spec/spec.ts
|
|
249607
249686
|
import { rename, rm, stat as stat3 } from "node:fs/promises";
|
|
249608
249687
|
import { join as join22 } from "node:path";
|
|
@@ -249669,71 +249748,6 @@ async function loadSpec(options = {}) {
|
|
|
249669
249748
|
}
|
|
249670
249749
|
return { text, spec };
|
|
249671
249750
|
}
|
|
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
249751
|
// src/cli/commands/api/shared.ts
|
|
249738
249752
|
import { basename as basename6 } from "node:path";
|
|
249739
249753
|
function formatJson(value) {
|
|
@@ -249953,12 +249967,7 @@ ${CONTRACT_HELP}
|
|
|
249953
249967
|
}
|
|
249954
249968
|
await ensureAuth(ctx);
|
|
249955
249969
|
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
|
-
}, {
|
|
249970
|
+
const response = await ctx.runTask(`Calling ${method} ${target}`, () => sendApiRequest(method, target, body), {
|
|
249962
249971
|
successMessage: `Called ${method} ${target}`,
|
|
249963
249972
|
errorMessage: "Request failed"
|
|
249964
249973
|
});
|
|
@@ -250457,11 +250466,18 @@ async function whoami(_ctx) {
|
|
|
250457
250466
|
outroMessage: `Using workspace API key: ${theme.styles.bold(workspaceApiKey.slice(0, 10))}`
|
|
250458
250467
|
};
|
|
250459
250468
|
}
|
|
250460
|
-
|
|
250461
|
-
|
|
250469
|
+
await seedAuthFromEnv();
|
|
250470
|
+
if (!await isLoggedIn()) {
|
|
250471
|
+
throw new AuthRequiredError("Not logged in");
|
|
250472
|
+
}
|
|
250473
|
+
const user = await getSessionUser();
|
|
250474
|
+
return { outroMessage: `Logged in as: ${theme.styles.bold(user.email)}` };
|
|
250462
250475
|
}
|
|
250463
250476
|
function getWhoamiCommand() {
|
|
250464
|
-
return new Base44Command("whoami", {
|
|
250477
|
+
return new Base44Command("whoami", {
|
|
250478
|
+
requireAuth: false,
|
|
250479
|
+
requireAppContext: false
|
|
250480
|
+
}).description("Display current authenticated user").action(whoami);
|
|
250465
250481
|
}
|
|
250466
250482
|
|
|
250467
250483
|
// src/cli/commands/branches/index.ts
|
|
@@ -251402,25 +251418,26 @@ function printSummary(results, oauthOutcomes, log) {
|
|
|
251402
251418
|
}
|
|
251403
251419
|
async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }, options) {
|
|
251404
251420
|
const connectors = await readConnectorsToPush(options);
|
|
251421
|
+
if (connectors.length === 0) {
|
|
251422
|
+
return { outroMessage: "No local connectors found - nothing to push" };
|
|
251423
|
+
}
|
|
251405
251424
|
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
|
-
}
|
|
251425
|
+
const connectorNames = connectors.map((c) => c.type).join(", ");
|
|
251426
|
+
log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
|
|
251412
251427
|
}
|
|
251413
|
-
|
|
251414
|
-
|
|
251415
|
-
|
|
251416
|
-
|
|
251417
|
-
|
|
251418
|
-
|
|
251419
|
-
|
|
251420
|
-
|
|
251428
|
+
if (options.force) {
|
|
251429
|
+
const proceed = await confirmPush({
|
|
251430
|
+
isNonInteractive,
|
|
251431
|
+
yes: options.yes,
|
|
251432
|
+
log,
|
|
251433
|
+
warning: "This will remove any connectors on Base44 that are not present locally."
|
|
251434
|
+
});
|
|
251435
|
+
if (!proceed) {
|
|
251436
|
+
return { outroMessage: "Push cancelled" };
|
|
251437
|
+
}
|
|
251421
251438
|
}
|
|
251422
251439
|
const { results } = await runTask("Pushing connectors to Base44", async () => {
|
|
251423
|
-
return await pushConnectors(connectors);
|
|
251440
|
+
return await pushConnectors(connectors, { prune: options.force });
|
|
251424
251441
|
});
|
|
251425
251442
|
const needsOAuth = filterPendingOAuth(results);
|
|
251426
251443
|
let outroMessage = "Connectors pushed to Base44";
|
|
@@ -251442,7 +251459,7 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask, jsonMode }
|
|
|
251442
251459
|
return { outroMessage };
|
|
251443
251460
|
}
|
|
251444
251461
|
function getConnectorsPushCommand() {
|
|
251445
|
-
return new Base44Command("push").description("Push local connectors to Base44 (
|
|
251462
|
+
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
251463
|
}
|
|
251447
251464
|
|
|
251448
251465
|
// src/cli/commands/connectors/index.ts
|
|
@@ -252147,9 +252164,6 @@ ${summaryLines.join(`
|
|
|
252147
252164
|
onActorResult: (result) => {
|
|
252148
252165
|
actorCompleted++;
|
|
252149
252166
|
formatDeployResult(result, log);
|
|
252150
|
-
if (result.status !== "error")
|
|
252151
|
-
for (const warning of result.warnings)
|
|
252152
|
-
log.warn(`${result.name}: ${warning}`);
|
|
252153
252167
|
}
|
|
252154
252168
|
});
|
|
252155
252169
|
const connectorResults = result.connectorResults ?? [];
|
|
@@ -252162,6 +252176,12 @@ ${summaryLines.join(`
|
|
|
252162
252176
|
if (result.appUrl) {
|
|
252163
252177
|
log.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
|
|
252164
252178
|
}
|
|
252179
|
+
const failedConnectors = connectorResults.flatMap((r) => r.action === "error" ? [`Connector ${r.type}: ${r.error}`] : []);
|
|
252180
|
+
if (failedConnectors.length > 0) {
|
|
252181
|
+
throw new ResourceDeploymentError("Some connectors failed to sync", {
|
|
252182
|
+
details: failedConnectors
|
|
252183
|
+
});
|
|
252184
|
+
}
|
|
252165
252185
|
return { outroMessage: "App deployed successfully" };
|
|
252166
252186
|
}
|
|
252167
252187
|
function getDeployCommand3() {
|
|
@@ -270453,14 +270473,16 @@ async function createDevServer(options) {
|
|
|
270453
270473
|
emitEntityEvent = (appId, entityName, event) => {
|
|
270454
270474
|
broadcastEntityEvent(io, appId, entityName, event);
|
|
270455
270475
|
};
|
|
270476
|
+
const functionsDir = join40(dirname29(project.configPath), project.functionsDir);
|
|
270456
270477
|
const base44ConfigWatcher = new WatchBase44({
|
|
270457
|
-
functions:
|
|
270478
|
+
functions: functionsDir,
|
|
270479
|
+
shared: getSharedDir(functionsDir),
|
|
270458
270480
|
entities: join40(dirname29(project.configPath), project.entitiesDir)
|
|
270459
270481
|
}, devLogger);
|
|
270460
270482
|
base44ConfigWatcher.on("change", async (name) => {
|
|
270461
270483
|
try {
|
|
270462
270484
|
const { functions, entities } = await options.loadResources();
|
|
270463
|
-
if (name === "functions") {
|
|
270485
|
+
if (name === "functions" || name === "shared") {
|
|
270464
270486
|
const previousFunctionCount = functionManager.getFunctionNames().length;
|
|
270465
270487
|
await functionManager.reload(functions);
|
|
270466
270488
|
const names = functionManager.getFunctionNames();
|
|
@@ -275025,4 +275047,4 @@ export {
|
|
|
275025
275047
|
runCLI
|
|
275026
275048
|
};
|
|
275027
275049
|
|
|
275028
|
-
//# debugId=
|
|
275050
|
+
//# debugId=B298C98845AB73BC64756E2164756E21
|