@base44-preview/cli 0.1.12-pr.595.ca69b55 → 0.1.12-pr.595.e3f5cae
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 +36 -22
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -258516,42 +258516,56 @@ async function connectWhileTransientlyUnavailable(filters) {
|
|
|
258516
258516
|
}
|
|
258517
258517
|
return attempt;
|
|
258518
258518
|
}
|
|
258519
|
-
async function streamUntilExhausted(options, jsonMode) {
|
|
258520
|
-
|
|
258521
|
-
functions: parseFunctionNames(options.function),
|
|
258522
|
-
env: options.env
|
|
258523
|
-
};
|
|
258524
|
-
let everConnected = false;
|
|
258519
|
+
async function streamUntilExhausted(firstStream, filters, options, jsonMode) {
|
|
258520
|
+
let events = firstStream;
|
|
258525
258521
|
let lastTime = "";
|
|
258526
258522
|
let dropsSinceLastEvent = 0;
|
|
258527
258523
|
while (true) {
|
|
258528
|
-
const
|
|
258529
|
-
if (attempt.kind !== "stream")
|
|
258530
|
-
break;
|
|
258531
|
-
everConnected = true;
|
|
258532
|
-
const ending = await printStreamUntilEnd(attempt.events, options.level, jsonMode, lastTime);
|
|
258524
|
+
const ending = await printStreamUntilEnd(events, options.level, jsonMode, lastTime);
|
|
258533
258525
|
lastTime = ending.lastTime;
|
|
258534
258526
|
if (ending.end) {
|
|
258535
258527
|
if (!ending.end.retriable)
|
|
258536
|
-
|
|
258528
|
+
return;
|
|
258537
258529
|
dropsSinceLastEvent = 0;
|
|
258538
258530
|
} else {
|
|
258539
258531
|
dropsSinceLastEvent = countDropTowardGivingUp(dropsSinceLastEvent, ending.provedAlive);
|
|
258540
258532
|
if (shouldGiveUpStreaming(dropsSinceLastEvent))
|
|
258541
|
-
|
|
258533
|
+
return;
|
|
258542
258534
|
}
|
|
258543
258535
|
await delay2(STREAM_RECONNECT_DELAY_MS);
|
|
258536
|
+
const reopened = await connectWhileTransientlyUnavailable(filters);
|
|
258537
|
+
if (reopened.kind !== "stream")
|
|
258538
|
+
return;
|
|
258539
|
+
events = reopened.events;
|
|
258544
258540
|
}
|
|
258545
|
-
return { everConnected, lastTime };
|
|
258546
258541
|
}
|
|
258547
|
-
|
|
258548
|
-
|
|
258549
|
-
|
|
258550
|
-
|
|
258551
|
-
|
|
258552
|
-
|
|
258542
|
+
function streamLostError() {
|
|
258543
|
+
return new ApiError("The realtime log stream stopped and could not be re-established", {
|
|
258544
|
+
hints: [
|
|
258545
|
+
{ message: "Start a new live tail", command: "base44 logs --follow" },
|
|
258546
|
+
{
|
|
258547
|
+
message: "Or read recent logs without streaming",
|
|
258548
|
+
command: "base44 logs"
|
|
258549
|
+
}
|
|
258550
|
+
]
|
|
258553
258551
|
});
|
|
258554
258552
|
}
|
|
258553
|
+
async function followLogs(functionNames, options, availableFunctionNames, jsonMode, logger2) {
|
|
258554
|
+
const filters = {
|
|
258555
|
+
functions: parseFunctionNames(options.function),
|
|
258556
|
+
env: options.env
|
|
258557
|
+
};
|
|
258558
|
+
const opened = await connectWhileTransientlyUnavailable(filters);
|
|
258559
|
+
if (opened.kind !== "stream") {
|
|
258560
|
+
logger2.warn(opened.kind === "refused" ? "Realtime logs are not available for this app — falling back to polling (lines may lag ~20-30s)." : "Could not reach the realtime log stream — falling back to polling (lines may lag ~20-30s).");
|
|
258561
|
+
return pollLogs(functionNames, options, availableFunctionNames, jsonMode, {
|
|
258562
|
+
lastTime: "",
|
|
258563
|
+
boundaryKeys: new Set
|
|
258564
|
+
});
|
|
258565
|
+
}
|
|
258566
|
+
await streamUntilExhausted(opened.events, filters, options, jsonMode);
|
|
258567
|
+
throw streamLostError();
|
|
258568
|
+
}
|
|
258555
258569
|
async function pollLogs(functionNames, options, availableFunctionNames, jsonMode, initialState) {
|
|
258556
258570
|
let state = initialState;
|
|
258557
258571
|
let first = state.lastTime === "";
|
|
@@ -258685,7 +258699,7 @@ async function logsAction(ctx, options) {
|
|
|
258685
258699
|
function getLogsCommand() {
|
|
258686
258700
|
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 deployed 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([
|
|
258687
258701
|
...LogLevelSchema.options
|
|
258688
|
-
])).option("-n, --limit <n>", "Results per page (1-1000
|
|
258702
|
+
])).option("-n, --limit <n>", "Results per page (1-1000; the server returns at most 500)").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);
|
|
258689
258703
|
}
|
|
258690
258704
|
|
|
258691
258705
|
// src/cli/commands/project/scaffold.ts
|
|
@@ -268315,4 +268329,4 @@ export {
|
|
|
268315
268329
|
runCLI
|
|
268316
268330
|
};
|
|
268317
268331
|
|
|
268318
|
-
//# debugId=
|
|
268332
|
+
//# debugId=2322876375B5637364756E2164756E21
|