@base44-preview/cli 0.1.10-pr.607.748f2a1 → 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 +24 -30
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -258377,23 +258377,19 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258377
258377
|
try {
|
|
258378
258378
|
logs = await fetchFunctionLogs(functionName, filters);
|
|
258379
258379
|
} catch (error48) {
|
|
258380
|
-
if (error48 instanceof ApiError && error48.statusCode === 404) {
|
|
258381
|
-
const
|
|
258382
|
-
|
|
258383
|
-
|
|
258384
|
-
|
|
258385
|
-
|
|
258386
|
-
|
|
258387
|
-
|
|
258388
|
-
|
|
258389
|
-
|
|
258390
|
-
|
|
258391
|
-
|
|
258392
|
-
|
|
258393
|
-
}
|
|
258394
|
-
]
|
|
258395
|
-
});
|
|
258396
|
-
}
|
|
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
|
+
});
|
|
258397
258393
|
}
|
|
258398
258394
|
throw error48;
|
|
258399
258395
|
}
|
|
@@ -258406,19 +258402,14 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258406
258402
|
}
|
|
258407
258403
|
return allEntries;
|
|
258408
258404
|
}
|
|
258405
|
+
async function getProjectFunctionNames(projectRoot) {
|
|
258406
|
+
const { functions } = await readProjectConfig(projectRoot);
|
|
258407
|
+
return functions.map((fn) => fn.name);
|
|
258408
|
+
}
|
|
258409
258409
|
async function getRemoteFunctionNames() {
|
|
258410
258410
|
const { functions } = await listDeployedFunctions();
|
|
258411
258411
|
return functions.map((fn) => fn.name);
|
|
258412
258412
|
}
|
|
258413
|
-
async function getFunctionNamesForHint(availableFunctionNames, logsError) {
|
|
258414
|
-
if (availableFunctionNames.length > 0)
|
|
258415
|
-
return availableFunctionNames;
|
|
258416
|
-
try {
|
|
258417
|
-
return await getRemoteFunctionNames();
|
|
258418
|
-
} catch {
|
|
258419
|
-
throw logsError;
|
|
258420
|
-
}
|
|
258421
|
-
}
|
|
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
|