@base44-preview/cli 0.1.2-pr.563.37a52bb → 0.1.2-pr.563.7cff4d1
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 +9 -75
- package/dist/cli/index.js.map +13 -13
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -233593,9 +233593,6 @@ var ApiErrorResponseSchema = exports_external.looseObject({
|
|
|
233593
233593
|
});
|
|
233594
233594
|
|
|
233595
233595
|
// src/core/errors.ts
|
|
233596
|
-
function usingWorkspaceApiKey() {
|
|
233597
|
-
return process.env.BASE44_API_KEY?.trim().startsWith("b44k_") ?? false;
|
|
233598
|
-
}
|
|
233599
233596
|
function formatApiError(errorBody, parsed) {
|
|
233600
233597
|
const data = parsed ?? ApiErrorResponseSchema.safeParse(errorBody).data;
|
|
233601
233598
|
if (data) {
|
|
@@ -233790,13 +233787,6 @@ class ApiError extends SystemError {
|
|
|
233790
233787
|
];
|
|
233791
233788
|
}
|
|
233792
233789
|
if (statusCode === 401) {
|
|
233793
|
-
if (usingWorkspaceApiKey()) {
|
|
233794
|
-
return [
|
|
233795
|
-
{
|
|
233796
|
-
message: "The workspace API key (BASE44_API_KEY) was rejected. Verify it is valid and authorized for this app."
|
|
233797
|
-
}
|
|
233798
|
-
];
|
|
233799
|
-
}
|
|
233800
233790
|
return [{ message: "Try logging in again", command: "base44 login" }];
|
|
233801
233791
|
}
|
|
233802
233792
|
if (statusCode === 403) {
|
|
@@ -236112,19 +236102,7 @@ function getTestOverrides() {
|
|
|
236112
236102
|
|
|
236113
236103
|
// src/core/auth/config.ts
|
|
236114
236104
|
var TOKEN_REFRESH_BUFFER_MS = 60 * 1000;
|
|
236115
|
-
var WORKSPACE_API_KEY_PREFIX = "b44k_";
|
|
236116
236105
|
var refreshPromise = null;
|
|
236117
|
-
function getWorkspaceApiKeyFromEnv() {
|
|
236118
|
-
const key = process.env.BASE44_API_KEY?.trim();
|
|
236119
|
-
return key ? key : null;
|
|
236120
|
-
}
|
|
236121
|
-
function isWorkspaceApiKey(value) {
|
|
236122
|
-
return value.startsWith(WORKSPACE_API_KEY_PREFIX);
|
|
236123
|
-
}
|
|
236124
|
-
function hasWorkspaceApiKeyAuth() {
|
|
236125
|
-
const key = getWorkspaceApiKeyFromEnv();
|
|
236126
|
-
return key !== null && isWorkspaceApiKey(key);
|
|
236127
|
-
}
|
|
236128
236106
|
async function seedAuthFromEnv() {
|
|
236129
236107
|
const accessToken = process.env.BASE44_ACCESS_TOKEN;
|
|
236130
236108
|
if (!accessToken) {
|
|
@@ -243446,14 +243424,9 @@ var FunctionConfigSchema = exports_external.object({
|
|
|
243446
243424
|
entry: exports_external.string().min(1, "Entry point cannot be empty"),
|
|
243447
243425
|
automations: exports_external.array(AutomationSchema).optional()
|
|
243448
243426
|
});
|
|
243449
|
-
var OutOfBoundsImportSchema = exports_external.object({
|
|
243450
|
-
importer: exports_external.string(),
|
|
243451
|
-
specifier: exports_external.string()
|
|
243452
|
-
});
|
|
243453
243427
|
var BackendFunctionSchema = FunctionConfigSchema.extend({
|
|
243454
243428
|
entryPath: exports_external.string().min(1, "Entry path cannot be empty"),
|
|
243455
243429
|
filePaths: exports_external.array(exports_external.string()).min(1, "Function must have at least one file"),
|
|
243456
|
-
outOfBoundsImports: exports_external.array(OutOfBoundsImportSchema).optional().default([]),
|
|
243457
243430
|
source: ResourceSourceSchema
|
|
243458
243431
|
});
|
|
243459
243432
|
var DeploySingleFunctionResponseSchema = exports_external.object({
|
|
@@ -243597,7 +243570,6 @@ async function collectReachableBackendFiles(_entryPath, functionFilePaths, backe
|
|
|
243597
243570
|
const visited = new Set(functionFilePaths);
|
|
243598
243571
|
const queue = [...functionFilePaths];
|
|
243599
243572
|
const extra = [];
|
|
243600
|
-
const outOfBounds = [];
|
|
243601
243573
|
while (queue.length > 0) {
|
|
243602
243574
|
const filePath = queue.shift();
|
|
243603
243575
|
let content;
|
|
@@ -243613,10 +243585,8 @@ async function collectReachableBackendFiles(_entryPath, functionFilePaths, backe
|
|
|
243613
243585
|
if (!resolved)
|
|
243614
243586
|
continue;
|
|
243615
243587
|
const rel = relative(backendRoot, resolved);
|
|
243616
|
-
if (rel.startsWith(".."))
|
|
243617
|
-
outOfBounds.push({ importer: filePath, specifier });
|
|
243588
|
+
if (rel.startsWith(".."))
|
|
243618
243589
|
continue;
|
|
243619
|
-
}
|
|
243620
243590
|
if (!visited.has(resolved)) {
|
|
243621
243591
|
visited.add(resolved);
|
|
243622
243592
|
queue.push(resolved);
|
|
@@ -243625,10 +243595,7 @@ async function collectReachableBackendFiles(_entryPath, functionFilePaths, backe
|
|
|
243625
243595
|
}
|
|
243626
243596
|
}
|
|
243627
243597
|
const functionSet = new Set(functionFilePaths);
|
|
243628
|
-
return
|
|
243629
|
-
extra: extra.filter((p) => !functionSet.has(p)),
|
|
243630
|
-
outOfBounds
|
|
243631
|
-
};
|
|
243598
|
+
return extra.filter((p) => !functionSet.has(p));
|
|
243632
243599
|
}
|
|
243633
243600
|
|
|
243634
243601
|
// src/core/resources/function/config.ts
|
|
@@ -243653,13 +243620,12 @@ async function readFunction(configPath, backendRoot) {
|
|
|
243653
243620
|
cwd: functionDir,
|
|
243654
243621
|
absolute: true
|
|
243655
243622
|
});
|
|
243656
|
-
const
|
|
243657
|
-
const allFilePaths = [...new Set([...filePaths, ...
|
|
243623
|
+
const extraFiles = await collectReachableBackendFiles(entryPath, filePaths, backendRoot);
|
|
243624
|
+
const allFilePaths = [...new Set([...filePaths, ...extraFiles])];
|
|
243658
243625
|
const functionData = {
|
|
243659
243626
|
...config7,
|
|
243660
243627
|
entryPath,
|
|
243661
243628
|
filePaths: allFilePaths,
|
|
243662
|
-
outOfBoundsImports: outOfBounds,
|
|
243663
243629
|
source: { type: "project" }
|
|
243664
243630
|
};
|
|
243665
243631
|
return functionData;
|
|
@@ -243687,8 +243653,8 @@ async function readAllFunctions(functionsDir) {
|
|
|
243687
243653
|
cwd: functionDir,
|
|
243688
243654
|
absolute: true
|
|
243689
243655
|
});
|
|
243690
|
-
const
|
|
243691
|
-
const allFilePaths = [...new Set([...filePaths, ...
|
|
243656
|
+
const extraFiles = await collectReachableBackendFiles(entryFile, filePaths, backendRoot);
|
|
243657
|
+
const allFilePaths = [...new Set([...filePaths, ...extraFiles])];
|
|
243692
243658
|
const name2 = relative2(functionsDir, functionDir).split(/[/\\]/).join("/");
|
|
243693
243659
|
if (!name2) {
|
|
243694
243660
|
throw new InvalidInputError("entry.ts found directly in the functions directory — it must be inside a named subfolder", {
|
|
@@ -243705,7 +243671,6 @@ async function readAllFunctions(functionsDir) {
|
|
|
243705
243671
|
entry,
|
|
243706
243672
|
entryPath: entryFile,
|
|
243707
243673
|
filePaths: allFilePaths,
|
|
243708
|
-
outOfBoundsImports: outOfBounds,
|
|
243709
243674
|
source: { type: "project" }
|
|
243710
243675
|
};
|
|
243711
243676
|
return functionData;
|
|
@@ -244319,8 +244284,7 @@ async function deployAll(projectData, options) {
|
|
|
244319
244284
|
});
|
|
244320
244285
|
await agentResource.push(agents);
|
|
244321
244286
|
await authConfigResource.push(authConfig);
|
|
244322
|
-
const
|
|
244323
|
-
const connectorResults = skipConnectorSync ? [] : (await pushConnectors(connectors)).results;
|
|
244287
|
+
const { results: connectorResults } = await pushConnectors(connectors);
|
|
244324
244288
|
if (project.site?.outputDirectory) {
|
|
244325
244289
|
const outputDir = resolve4(project.root, project.site.outputDirectory);
|
|
244326
244290
|
const { appUrl } = await deploySite(outputDir);
|
|
@@ -244344,9 +244308,6 @@ async function handleUnauthorized(request, _options, response) {
|
|
|
244344
244308
|
if (response.status !== 401) {
|
|
244345
244309
|
return;
|
|
244346
244310
|
}
|
|
244347
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
244348
|
-
return;
|
|
244349
|
-
}
|
|
244350
244311
|
if (retriedRequests.has(request)) {
|
|
244351
244312
|
return;
|
|
244352
244313
|
}
|
|
@@ -244375,11 +244336,6 @@ var base44Client = distribution_default.create({
|
|
|
244375
244336
|
},
|
|
244376
244337
|
captureRequestBody,
|
|
244377
244338
|
async (request) => {
|
|
244378
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
244379
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
244380
|
-
request.headers.set("api_key", workspaceApiKey);
|
|
244381
|
-
return;
|
|
244382
|
-
}
|
|
244383
244339
|
try {
|
|
244384
244340
|
const auth = await readAuth();
|
|
244385
244341
|
if (isTokenExpired(auth)) {
|
|
@@ -244585,12 +244541,6 @@ async function login({
|
|
|
244585
244541
|
|
|
244586
244542
|
// src/cli/utils/command/middleware.ts
|
|
244587
244543
|
async function ensureAuth(ctx) {
|
|
244588
|
-
if (hasWorkspaceApiKeyAuth()) {
|
|
244589
|
-
ctx.errorReporter.setContext({
|
|
244590
|
-
user: { email: "workspace-api-key", name: "Workspace API key" }
|
|
244591
|
-
});
|
|
244592
|
-
return;
|
|
244593
|
-
}
|
|
244594
244544
|
await seedAuthFromEnv();
|
|
244595
244545
|
const loggedIn = await isLoggedIn();
|
|
244596
244546
|
if (!loggedIn) {
|
|
@@ -252015,12 +251965,6 @@ function getLogoutCommand() {
|
|
|
252015
251965
|
|
|
252016
251966
|
// src/cli/commands/auth/whoami.ts
|
|
252017
251967
|
async function whoami(_ctx) {
|
|
252018
|
-
const workspaceApiKey = getWorkspaceApiKeyFromEnv();
|
|
252019
|
-
if (workspaceApiKey && isWorkspaceApiKey(workspaceApiKey)) {
|
|
252020
|
-
return {
|
|
252021
|
-
outroMessage: `Using workspace API key: ${theme.styles.bold(workspaceApiKey.slice(0, 10))}`
|
|
252022
|
-
};
|
|
252023
|
-
}
|
|
252024
251968
|
const auth2 = await readAuth();
|
|
252025
251969
|
return { outroMessage: `Logged in as: ${theme.styles.bold(auth2.email)}` };
|
|
252026
251970
|
}
|
|
@@ -253153,15 +253097,6 @@ async function deployFunctionsAction({ log }, names, options) {
|
|
|
253153
253097
|
};
|
|
253154
253098
|
}
|
|
253155
253099
|
log.info(`Found ${toDeploy.length} ${toDeploy.length === 1 ? "function" : "functions"} to deploy`);
|
|
253156
|
-
for (const fn of toDeploy) {
|
|
253157
|
-
if (fn.outOfBoundsImports && fn.outOfBoundsImports.length > 0) {
|
|
253158
|
-
for (const { importer, specifier } of fn.outOfBoundsImports) {
|
|
253159
|
-
const rel = importer.includes(fn.name) ? importer.slice(importer.lastIndexOf(fn.name)) : importer;
|
|
253160
|
-
log.error(`[${fn.name}] Cannot import "${specifier}" in ${rel}: the file is outside base44/ and cannot be uploaded. Move it to base44/shared/ to share it across functions. Functions run on Deno — use npm: or jsr: specifiers (not package.json) for external packages.`);
|
|
253161
|
-
}
|
|
253162
|
-
throw new CLIExitError(1);
|
|
253163
|
-
}
|
|
253164
|
-
}
|
|
253165
253100
|
let completed = 0;
|
|
253166
253101
|
const total = toDeploy.length;
|
|
253167
253102
|
const results = await deployFunctionsSequentially(toDeploy, {
|
|
@@ -253914,8 +253849,7 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
253914
253849
|
}
|
|
253915
253850
|
throw error48;
|
|
253916
253851
|
}
|
|
253917
|
-
|
|
253918
|
-
allEntries.push(...matchingLogs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
253852
|
+
allEntries.push(...logs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
253919
253853
|
}
|
|
253920
253854
|
if (functionNames.length > 1) {
|
|
253921
253855
|
const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
|
|
@@ -262664,4 +262598,4 @@ export {
|
|
|
262664
262598
|
CLIExitError
|
|
262665
262599
|
};
|
|
262666
262600
|
|
|
262667
|
-
//# debugId=
|
|
262601
|
+
//# debugId=57BD6A8806A9B3BA64756E2164756E21
|