@base44-preview/cli 0.1.0-pr.551.cd949a6 → 0.1.1-pr.554.01e80f2

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 CHANGED
@@ -243913,7 +243913,7 @@ import { join as join11 } from "node:path";
243913
243913
  // package.json
243914
243914
  var package_default = {
243915
243915
  name: "base44",
243916
- version: "0.1.0",
243916
+ version: "0.1.1",
243917
243917
  description: "Base44 CLI - Unified interface for managing Base44 applications",
243918
243918
  type: "module",
243919
243919
  bin: {
@@ -253687,6 +253687,48 @@ function formatEntry(entry) {
253687
253687
  const message = entry.message.trim();
253688
253688
  return `${time3} ${level} ${message}`;
253689
253689
  }
253690
+ function entryKey(entry) {
253691
+ return `${entry.time} ${entry.message}`;
253692
+ }
253693
+ function selectNewEntries(entries, state) {
253694
+ const fresh = entries.filter((e2) => {
253695
+ if (e2.time < state.lastTime)
253696
+ return false;
253697
+ if (e2.time === state.lastTime && state.boundaryKeys.has(entryKey(e2))) {
253698
+ return false;
253699
+ }
253700
+ return true;
253701
+ });
253702
+ if (fresh.length === 0)
253703
+ return { fresh, nextState: state };
253704
+ const newMax = fresh.reduce((max, e2) => e2.time > max ? e2.time : max, state.lastTime);
253705
+ const boundaryKeys = newMax === state.lastTime ? new Set(state.boundaryKeys) : new Set;
253706
+ for (const e2 of fresh) {
253707
+ if (e2.time === newMax)
253708
+ boundaryKeys.add(entryKey(e2));
253709
+ }
253710
+ return { fresh, nextState: { lastTime: newMax, boundaryKeys } };
253711
+ }
253712
+ function writeFollowLine(entry, jsonMode) {
253713
+ const line = jsonMode ? JSON.stringify(entry) : formatEntry(entry);
253714
+ process.stdout.write(`${line}
253715
+ `);
253716
+ }
253717
+ async function followLogs(functionNames, options, availableFunctionNames, jsonMode) {
253718
+ let state = { lastTime: "", boundaryKeys: new Set };
253719
+ let first = true;
253720
+ while (true) {
253721
+ const pollOptions = first ? options : { ...options, since: state.lastTime };
253722
+ const entries = await fetchLogsForFunctions(functionNames, pollOptions, availableFunctionNames);
253723
+ const { fresh, nextState } = selectNewEntries(entries, state);
253724
+ state = nextState;
253725
+ fresh.sort((a2, b) => a2.time.localeCompare(b.time));
253726
+ for (const entry of fresh)
253727
+ writeFollowLine(entry, jsonMode);
253728
+ first = false;
253729
+ await new Promise((resolve8) => setTimeout(resolve8, 2000));
253730
+ }
253731
+ }
253690
253732
  function formatLogs(entries, env3) {
253691
253733
  if (entries.length === 0) {
253692
253734
  if (env3 === "prod") {
@@ -253768,6 +253810,16 @@ async function logsAction(ctx, options) {
253768
253810
  outroMessage: localProjectRoot ? "No functions found in this project." : "No functions found in this app."
253769
253811
  };
253770
253812
  }
253813
+ if (options.follow) {
253814
+ if (options.until) {
253815
+ throw new InvalidInputError("--until cannot be combined with --follow (a stream has no end).");
253816
+ }
253817
+ if (options.order) {
253818
+ throw new InvalidInputError("--order cannot be combined with --follow (a live tail always streams oldest to newest).");
253819
+ }
253820
+ options.order = "asc";
253821
+ return followLogs(functionNames, options, availableFunctionNames, ctx.jsonMode);
253822
+ }
253771
253823
  let entries = await fetchLogsForFunctions(functionNames, options, availableFunctionNames);
253772
253824
  const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
253773
253825
  if (limit !== undefined && entries.length > limit) {
@@ -253783,7 +253835,7 @@ async function logsAction(ctx, options) {
253783
253835
  };
253784
253836
  }
253785
253837
  function getLogsCommand() {
253786
- 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>", "Which deployment to read logs from: preview (current draft) or prod (published). Default: preview").choices([...LogEnvSchema.options])).action(logsAction);
253838
+ 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)").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);
253787
253839
  }
253788
253840
 
253789
253841
  // src/cli/commands/project/scaffold.ts
@@ -262472,4 +262524,4 @@ export {
262472
262524
  CLIExitError
262473
262525
  };
262474
262526
 
262475
- //# debugId=D425B400F88D6F6D64756E2164756E21
262527
+ //# debugId=5AE819ADC89BA80F64756E2164756E21