@base44-preview/cli 0.1.10-pr.607.841a324 → 0.1.10-pr.608.09b4b41
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 +30 -36
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -258369,32 +258369,6 @@ function normalizeLogEntry(entry, functionName) {
|
|
|
258369
258369
|
source: functionName
|
|
258370
258370
|
};
|
|
258371
258371
|
}
|
|
258372
|
-
async function getRemoteFunctionNames() {
|
|
258373
|
-
const { functions } = await listDeployedFunctions();
|
|
258374
|
-
return functions.map((fn) => fn.name);
|
|
258375
|
-
}
|
|
258376
|
-
async function getFunctionNamesForHint(availableFunctionNames, logsError) {
|
|
258377
|
-
if (availableFunctionNames.length > 0)
|
|
258378
|
-
return availableFunctionNames;
|
|
258379
|
-
try {
|
|
258380
|
-
return await getRemoteFunctionNames();
|
|
258381
|
-
} catch {
|
|
258382
|
-
throw logsError;
|
|
258383
|
-
}
|
|
258384
|
-
}
|
|
258385
|
-
function createFunctionNotFoundError(functionName, availableFunctionNames, logsError) {
|
|
258386
|
-
const available = availableFunctionNames.join(", ");
|
|
258387
|
-
return new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
258388
|
-
cause: logsError,
|
|
258389
|
-
hints: [
|
|
258390
|
-
{ message: `Available functions in this app: ${available}` },
|
|
258391
|
-
{
|
|
258392
|
-
message: "Make sure the function has been deployed before fetching logs",
|
|
258393
|
-
command: "base44 functions deploy"
|
|
258394
|
-
}
|
|
258395
|
-
]
|
|
258396
|
-
});
|
|
258397
|
-
}
|
|
258398
258372
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
258399
258373
|
const filters = parseFunctionFilters(options);
|
|
258400
258374
|
const allEntries = [];
|
|
@@ -258403,12 +258377,21 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258403
258377
|
try {
|
|
258404
258378
|
logs = await fetchFunctionLogs(functionName, filters);
|
|
258405
258379
|
} catch (error48) {
|
|
258406
|
-
if (
|
|
258407
|
-
|
|
258408
|
-
|
|
258409
|
-
|
|
258410
|
-
|
|
258411
|
-
|
|
258380
|
+
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
258381
|
+
const available = availableFunctionNames.join(", ");
|
|
258382
|
+
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
258383
|
+
hints: [
|
|
258384
|
+
{
|
|
258385
|
+
message: `Available functions in this project: ${available}`
|
|
258386
|
+
},
|
|
258387
|
+
{
|
|
258388
|
+
message: "Make sure the function has been deployed before fetching logs",
|
|
258389
|
+
command: "base44 functions deploy"
|
|
258390
|
+
}
|
|
258391
|
+
]
|
|
258392
|
+
});
|
|
258393
|
+
}
|
|
258394
|
+
throw error48;
|
|
258412
258395
|
}
|
|
258413
258396
|
const matchingLogs = filters.level ? logs.filter((entry) => entry.level === filters.level) : logs;
|
|
258414
258397
|
allEntries.push(...matchingLogs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
@@ -258419,6 +258402,14 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258419
258402
|
}
|
|
258420
258403
|
return allEntries;
|
|
258421
258404
|
}
|
|
258405
|
+
async function getProjectFunctionNames(projectRoot) {
|
|
258406
|
+
const { functions } = await readProjectConfig(projectRoot);
|
|
258407
|
+
return functions.map((fn) => fn.name);
|
|
258408
|
+
}
|
|
258409
|
+
async function getRemoteFunctionNames() {
|
|
258410
|
+
const { functions } = await listDeployedFunctions();
|
|
258411
|
+
return functions.map((fn) => fn.name);
|
|
258412
|
+
}
|
|
258422
258413
|
function validateLimit(limit) {
|
|
258423
258414
|
if (limit === undefined)
|
|
258424
258415
|
return;
|
|
@@ -258430,10 +258421,13 @@ function validateLimit(limit) {
|
|
|
258430
258421
|
async function logsAction(ctx, options) {
|
|
258431
258422
|
validateLimit(options.limit);
|
|
258432
258423
|
const specifiedFunctions = parseFunctionNames(options.function);
|
|
258433
|
-
const
|
|
258424
|
+
const localProjectRoot = ctx.app?.projectRoot;
|
|
258425
|
+
const availableFunctionNames = localProjectRoot ? await getProjectFunctionNames(localProjectRoot) : await getRemoteFunctionNames();
|
|
258434
258426
|
const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : availableFunctionNames;
|
|
258435
258427
|
if (functionNames.length === 0) {
|
|
258436
|
-
return {
|
|
258428
|
+
return {
|
|
258429
|
+
outroMessage: localProjectRoot ? "No functions found in this project." : "No functions found in this app."
|
|
258430
|
+
};
|
|
258437
258431
|
}
|
|
258438
258432
|
if (options.follow) {
|
|
258439
258433
|
if (options.until) {
|
|
@@ -258460,7 +258454,7 @@ async function logsAction(ctx, options) {
|
|
|
258460
258454
|
};
|
|
258461
258455
|
}
|
|
258462
258456
|
function getLogsCommand() {
|
|
258463
|
-
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all
|
|
258457
|
+
return new Base44Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).option("--until <datetime>", "Show logs until this time. ISO datetime or relative shorthand (e.g. 1h, 30m, 2d)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([
|
|
258464
258458
|
...LogLevelSchema.options
|
|
258465
258459
|
])).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").option("-f, --follow", "Stream new logs as they arrive").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option("--env <env>", "Which deployment to read logs from: preview (current draft) or prod (published). Default: preview").choices([...LogEnvSchema.options])).action(logsAction);
|
|
258466
258460
|
}
|
|
@@ -268092,4 +268086,4 @@ export {
|
|
|
268092
268086
|
runCLI
|
|
268093
268087
|
};
|
|
268094
268088
|
|
|
268095
|
-
//# debugId=
|
|
268089
|
+
//# debugId=D870A60616C29E0964756E2164756E21
|