@base44-preview/cli 0.0.56-pr.552.afe1aea → 0.0.57-pr.551.ad8dd1c
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 +40 -26
- package/dist/cli/index.js.map +6 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -243487,6 +243487,9 @@ function buildLogsQueryString(filters) {
|
|
|
243487
243487
|
if (filters.order) {
|
|
243488
243488
|
params.set("order", filters.order);
|
|
243489
243489
|
}
|
|
243490
|
+
if (filters.env) {
|
|
243491
|
+
params.set("env", filters.env);
|
|
243492
|
+
}
|
|
243490
243493
|
return params;
|
|
243491
243494
|
}
|
|
243492
243495
|
async function fetchFunctionLogs(functionName, filters = {}) {
|
|
@@ -243891,7 +243894,7 @@ import { join as join11 } from "node:path";
|
|
|
243891
243894
|
// package.json
|
|
243892
243895
|
var package_default = {
|
|
243893
243896
|
name: "base44",
|
|
243894
|
-
version: "0.0.
|
|
243897
|
+
version: "0.0.57",
|
|
243895
243898
|
description: "Base44 CLI - Unified interface for managing Base44 applications",
|
|
243896
243899
|
type: "module",
|
|
243897
243900
|
bin: {
|
|
@@ -251108,9 +251111,12 @@ class Base44Command extends Command {
|
|
|
251108
251111
|
}
|
|
251109
251112
|
return this._context;
|
|
251110
251113
|
}
|
|
251114
|
+
isRawOutputMode() {
|
|
251115
|
+
return this.opts().format === "json";
|
|
251116
|
+
}
|
|
251111
251117
|
action(fn) {
|
|
251112
251118
|
return super.action(async (...args) => {
|
|
251113
|
-
const quiet = this.context.isNonInteractive;
|
|
251119
|
+
const quiet = this.context.isNonInteractive || this.isRawOutputMode();
|
|
251114
251120
|
if (!quiet) {
|
|
251115
251121
|
await showCommandStart(this._commandOptions.fullBanner);
|
|
251116
251122
|
}
|
|
@@ -253499,6 +253505,9 @@ function parseFunctionFilters(options) {
|
|
|
253499
253505
|
if (options.order) {
|
|
253500
253506
|
filters.order = options.order.toLowerCase();
|
|
253501
253507
|
}
|
|
253508
|
+
if (options.env) {
|
|
253509
|
+
filters.env = options.env;
|
|
253510
|
+
}
|
|
253502
253511
|
return filters;
|
|
253503
253512
|
}
|
|
253504
253513
|
function parseFunctionNames(option) {
|
|
@@ -253521,8 +253530,12 @@ function formatEntry(entry) {
|
|
|
253521
253530
|
const message = entry.message.trim();
|
|
253522
253531
|
return `${time3} ${level} ${message}`;
|
|
253523
253532
|
}
|
|
253524
|
-
function formatLogs(entries) {
|
|
253533
|
+
function formatLogs(entries, env3) {
|
|
253525
253534
|
if (entries.length === 0) {
|
|
253535
|
+
if (env3 === "prod") {
|
|
253536
|
+
return `No production logs found. Has this app been published? Try --env preview to see draft logs.
|
|
253537
|
+
`;
|
|
253538
|
+
}
|
|
253526
253539
|
return `No logs found matching the filters.
|
|
253527
253540
|
`;
|
|
253528
253541
|
}
|
|
@@ -253539,30 +253552,30 @@ function normalizeLogEntry(entry, functionName) {
|
|
|
253539
253552
|
source: functionName
|
|
253540
253553
|
};
|
|
253541
253554
|
}
|
|
253555
|
+
async function fetchLogsForFunction(functionName, filters, availableFunctionNames) {
|
|
253556
|
+
try {
|
|
253557
|
+
return await fetchFunctionLogs(functionName, filters);
|
|
253558
|
+
} catch (error48) {
|
|
253559
|
+
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253560
|
+
const available = availableFunctionNames.join(", ");
|
|
253561
|
+
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253562
|
+
hints: [
|
|
253563
|
+
{ message: `Available functions in this project: ${available}` },
|
|
253564
|
+
{
|
|
253565
|
+
message: "Make sure the function has been deployed before fetching logs",
|
|
253566
|
+
command: "base44 functions deploy"
|
|
253567
|
+
}
|
|
253568
|
+
]
|
|
253569
|
+
});
|
|
253570
|
+
}
|
|
253571
|
+
throw error48;
|
|
253572
|
+
}
|
|
253573
|
+
}
|
|
253542
253574
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
253543
253575
|
const filters = parseFunctionFilters(options);
|
|
253544
253576
|
const allEntries = [];
|
|
253545
253577
|
for (const functionName of functionNames) {
|
|
253546
|
-
|
|
253547
|
-
try {
|
|
253548
|
-
logs = await fetchFunctionLogs(functionName, filters);
|
|
253549
|
-
} catch (error48) {
|
|
253550
|
-
if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
|
|
253551
|
-
const available = availableFunctionNames.join(", ");
|
|
253552
|
-
throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
253553
|
-
hints: [
|
|
253554
|
-
{
|
|
253555
|
-
message: `Available functions in this project: ${available}`
|
|
253556
|
-
},
|
|
253557
|
-
{
|
|
253558
|
-
message: "Make sure the function has been deployed before fetching logs",
|
|
253559
|
-
command: "base44 functions deploy"
|
|
253560
|
-
}
|
|
253561
|
-
]
|
|
253562
|
-
});
|
|
253563
|
-
}
|
|
253564
|
-
throw error48;
|
|
253565
|
-
}
|
|
253578
|
+
const logs = await fetchLogsForFunction(functionName, filters, availableFunctionNames);
|
|
253566
253579
|
allEntries.push(...logs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
253567
253580
|
}
|
|
253568
253581
|
if (functionNames.length > 1) {
|
|
@@ -253603,8 +253616,9 @@ async function logsAction(ctx, options) {
|
|
|
253603
253616
|
if (limit !== undefined && entries.length > limit) {
|
|
253604
253617
|
entries = entries.slice(0, limit);
|
|
253605
253618
|
}
|
|
253619
|
+
const env3 = options.env ?? "preview";
|
|
253606
253620
|
const logsOutput = options.json ? `${JSON.stringify(entries, null, 2)}
|
|
253607
|
-
` : formatLogs(entries);
|
|
253621
|
+
` : formatLogs(entries, env3);
|
|
253608
253622
|
const shouldOutputOutroMessage = !options.json;
|
|
253609
253623
|
return {
|
|
253610
253624
|
outroMessage: shouldOutputOutroMessage ? "Fetched logs" : undefined,
|
|
@@ -253612,7 +253626,7 @@ async function logsAction(ctx, options) {
|
|
|
253612
253626
|
};
|
|
253613
253627
|
}
|
|
253614
253628
|
function getLogsCommand() {
|
|
253615
|
-
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([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).option("--json", "Output as JSON (clean stdout, safe to pipe to jq)").action(logsAction);
|
|
253629
|
+
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([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)").addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).addOption(new Option("--env <env>", "Environment to fetch logs from (default: preview)").choices(["preview", "prod"])).option("--json", "Output as JSON (clean stdout, safe to pipe to jq)").action(logsAction);
|
|
253616
253630
|
}
|
|
253617
253631
|
|
|
253618
253632
|
// src/cli/commands/project/scaffold.ts
|
|
@@ -261988,4 +262002,4 @@ export {
|
|
|
261988
262002
|
CLIExitError
|
|
261989
262003
|
};
|
|
261990
262004
|
|
|
261991
|
-
//# debugId=
|
|
262005
|
+
//# debugId=6564442B53593F8A64756E2164756E21
|