@base44-preview/cli 0.1.0-pr.551.d451f39 → 0.1.1-pr.554.ccdd34f

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
@@ -243442,6 +243442,7 @@ var ListFunctionsResponseSchema = exports_external.object({
243442
243442
  functions: exports_external.array(FunctionInfoSchema)
243443
243443
  });
243444
243444
  var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
243445
+ var LogEnvSchema = exports_external.enum(["preview", "prod"]);
243445
243446
  var FunctionLogEntrySchema = exports_external.object({
243446
243447
  time: exports_external.string(),
243447
243448
  level: exports_external.preprocess((v) => v === "warn" ? "warning" : !v || v === "log" ? "info" : v, LogLevelSchema),
@@ -243912,7 +243913,7 @@ import { join as join11 } from "node:path";
243912
243913
  // package.json
243913
243914
  var package_default = {
243914
243915
  name: "base44",
243915
- version: "0.1.0",
243916
+ version: "0.1.1",
243916
243917
  description: "Base44 CLI - Unified interface for managing Base44 applications",
243917
243918
  type: "module",
243918
243919
  bin: {
@@ -253686,6 +253687,48 @@ function formatEntry(entry) {
253686
253687
  const message = entry.message.trim();
253687
253688
  return `${time3} ${level} ${message}`;
253688
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
+ }
253689
253732
  function formatLogs(entries, env3) {
253690
253733
  if (entries.length === 0) {
253691
253734
  if (env3 === "prod") {
@@ -253767,6 +253810,13 @@ async function logsAction(ctx, options) {
253767
253810
  outroMessage: localProjectRoot ? "No functions found in this project." : "No functions found in this app."
253768
253811
  };
253769
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
+ options.order = "asc";
253818
+ return followLogs(functionNames, options, availableFunctionNames, ctx.jsonMode);
253819
+ }
253770
253820
  let entries = await fetchLogsForFunctions(functionNames, options, availableFunctionNames);
253771
253821
  const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
253772
253822
  if (limit !== undefined && entries.length > limit) {
@@ -253782,7 +253832,7 @@ async function logsAction(ctx, options) {
253782
253832
  };
253783
253833
  }
253784
253834
  function getLogsCommand() {
253785
- 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(["preview", "prod"])).action(logsAction);
253835
+ 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 (poll every 2s). Exit with Ctrl-C").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);
253786
253836
  }
253787
253837
 
253788
253838
  // src/cli/commands/project/scaffold.ts
@@ -262471,4 +262521,4 @@ export {
262471
262521
  CLIExitError
262472
262522
  };
262473
262523
 
262474
- //# debugId=E1F62E870494041064756E2164756E21
262524
+ //# debugId=FC35766F7FE11BCF64756E2164756E21