base44 0.0.33 → 0.0.34

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/README.md CHANGED
@@ -44,21 +44,22 @@ The CLI will guide you through project setup. For step-by-step tutorials, see th
44
44
  | Command | Description |
45
45
  | ------- | ----------- |
46
46
  | [`create`](https://docs.base44.com/developers/references/cli/commands/create) | Create a new Base44 project from a template |
47
- | [`deploy`](https://docs.base44.com/developers/references/cli/commands/deploy) | Deploy resources and site to Base44 |
48
- | [`link`](https://docs.base44.com/developers/references/cli/commands/link) | Link a local project to a project on Base44 |
47
+ | [`deploy`](https://docs.base44.com/developers/references/cli/commands/deploy) | Deploy all project resources and site to Base44 |
48
+ | [`eject`](https://docs.base44.com/developers/references/cli/commands/eject) | Download the code for an existing Base44 project |
49
+ | [`link`](https://docs.base44.com/developers/references/cli/commands/link) | Link a local project to a Base44 project |
49
50
  | [`dashboard open`](https://docs.base44.com/developers/references/cli/commands/dashboard) | Open the app dashboard in your browser |
50
51
  | [`login`](https://docs.base44.com/developers/references/cli/commands/login) | Authenticate with Base44 |
51
52
  | [`logout`](https://docs.base44.com/developers/references/cli/commands/logout) | Sign out and clear stored credentials |
52
53
  | [`whoami`](https://docs.base44.com/developers/references/cli/commands/whoami) | Display the current authenticated user |
53
54
  | [`agents pull`](https://docs.base44.com/developers/references/cli/commands/agents-pull) | Pull agents from Base44 to local files |
54
55
  | [`agents push`](https://docs.base44.com/developers/references/cli/commands/agents-push) | Push local agents to Base44 |
55
- | [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entity schemas to Base44 |
56
+ | [`connectors pull`](https://docs.base44.com/developers/references/cli/commands/connectors-pull) | Pull connectors from Base44 to local files |
57
+ | [`connectors push`](https://docs.base44.com/developers/references/cli/commands/connectors-push) | Push local connectors to Base44 |
58
+ | [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entities to Base44 |
56
59
  | [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
57
60
  | [`site deploy`](https://docs.base44.com/developers/references/cli/commands/site-deploy) | Deploy built site files to Base44 hosting |
58
61
  | [`site open`](https://docs.base44.com/developers/references/cli/commands/site-open) | Open the published site in your browser |
59
-
60
-
61
- <!--| [`eject`](https://docs.base44.com/developers/references/cli/commands/eject) | Create a Base44 backend project from an existing Base44 app | -->
62
+ | [`types generate`](https://docs.base44.com/developers/references/cli/commands/types-generate) | Generate TypeScript types from project resources |
62
63
 
63
64
  ## AI agent skills
64
65
 
@@ -91,4 +92,4 @@ Found a bug? [Open an issue](https://github.com/base44/cli/issues).
91
92
 
92
93
  ## License
93
94
 
94
- ISC
95
+ MIT
package/dist/cli/index.js CHANGED
@@ -1,4 +1,4 @@
1
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="019c751d-ed06-7271-9f3f-d37c42112446")}catch(e){}}();import { createRequire } from "node:module";
1
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="019c89f2-5709-70e0-92fd-2ed2ea0125c8")}catch(e){}}();import { createRequire } from "node:module";
2
2
  var __create = Object.create;
3
3
  var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
@@ -178557,9 +178557,10 @@ class ApiError extends SystemError {
178557
178557
  } catch {
178558
178558
  message = error48.message;
178559
178559
  }
178560
+ const statusCode = ApiError.normalizeStatusCode(error48.response.status, responseBody);
178560
178561
  const requestBody = error48.options.context?.__requestBody;
178561
178562
  return new ApiError(`Error ${context}: ${message}`, {
178562
- statusCode: error48.response.status,
178563
+ statusCode,
178563
178564
  requestUrl: error48.request.url,
178564
178565
  requestMethod: error48.request.method,
178565
178566
  requestBody,
@@ -178616,6 +178617,12 @@ class ApiError extends SystemError {
178616
178617
  return;
178617
178618
  return REASON_HINTS[reason];
178618
178619
  }
178620
+ static normalizeStatusCode(statusCode, responseBody) {
178621
+ if (responseBody?.error_type === "KeyError") {
178622
+ return 404;
178623
+ }
178624
+ return statusCode;
178625
+ }
178619
178626
  }
178620
178627
 
178621
178628
  class FileNotFoundError extends SystemError {
@@ -186012,6 +186019,13 @@ var DeployFunctionsResponseSchema = exports_external.object({
186012
186019
  skipped: exports_external.array(exports_external.string()).optional().nullable(),
186013
186020
  errors: exports_external.array(exports_external.object({ name: exports_external.string(), message: exports_external.string() })).nullable()
186014
186021
  });
186022
+ var LogLevelSchema = exports_external.enum(["log", "info", "warn", "error", "debug"]);
186023
+ var FunctionLogEntrySchema = exports_external.object({
186024
+ time: exports_external.string(),
186025
+ level: LogLevelSchema,
186026
+ message: exports_external.string()
186027
+ });
186028
+ var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
186015
186029
 
186016
186030
  // src/core/resources/function/api.ts
186017
186031
  function toDeployPayloadItem(fn) {
@@ -186042,6 +186056,42 @@ async function deployFunctions(functions) {
186042
186056
  }
186043
186057
  return result.data;
186044
186058
  }
186059
+ function buildLogsQueryString(filters) {
186060
+ const params = new URLSearchParams;
186061
+ if (filters.since) {
186062
+ params.set("since", filters.since);
186063
+ }
186064
+ if (filters.until) {
186065
+ params.set("until", filters.until);
186066
+ }
186067
+ if (filters.level) {
186068
+ params.set("level", filters.level);
186069
+ }
186070
+ if (filters.limit !== undefined) {
186071
+ params.set("limit", String(filters.limit));
186072
+ }
186073
+ if (filters.order) {
186074
+ params.set("order", filters.order);
186075
+ }
186076
+ return params;
186077
+ }
186078
+ async function fetchFunctionLogs(functionName, filters = {}) {
186079
+ const appClient = getAppClient();
186080
+ const searchParams = buildLogsQueryString(filters);
186081
+ let response;
186082
+ try {
186083
+ response = await appClient.get(`functions-mgmt/${functionName}/logs`, {
186084
+ searchParams
186085
+ });
186086
+ } catch (error48) {
186087
+ throw await ApiError.fromHttpError(error48, `fetching function logs: '${functionName}'`);
186088
+ }
186089
+ const result = FunctionLogsResponseSchema.safeParse(await response.json());
186090
+ if (!result.success) {
186091
+ throw new SchemaValidationError("Invalid function logs response from server", result.error);
186092
+ }
186093
+ return result.data;
186094
+ }
186045
186095
  // src/core/resources/function/config.ts
186046
186096
  import { dirname as dirname4, join as join5 } from "node:path";
186047
186097
  async function readFunctionConfig(configPath) {
@@ -193875,7 +193925,7 @@ var {
193875
193925
  // package.json
193876
193926
  var package_default = {
193877
193927
  name: "base44",
193878
- version: "0.0.33",
193928
+ version: "0.0.34",
193879
193929
  description: "Base44 CLI - Unified interface for managing Base44 applications",
193880
193930
  type: "module",
193881
193931
  bin: {
@@ -194003,7 +194053,6 @@ async function printUpgradeNotificationIfAvailable() {
194003
194053
 
194004
194054
  // src/cli/utils/runCommand.ts
194005
194055
  async function runCommand(commandFn, options, context) {
194006
- console.log();
194007
194056
  if (options?.fullBanner) {
194008
194057
  await printBanner(context.isNonInteractive);
194009
194058
  We("");
@@ -194029,8 +194078,11 @@ async function runCommand(commandFn, options, context) {
194029
194078
  const appConfig = await initAppConfig();
194030
194079
  context.errorReporter.setContext({ appId: appConfig.id });
194031
194080
  }
194032
- const { outroMessage } = await commandFn();
194033
- Le(outroMessage || "");
194081
+ const result = await commandFn();
194082
+ Le(result.outroMessage || "");
194083
+ if (result.stdout) {
194084
+ process.stdout.write(result.stdout);
194085
+ }
194034
194086
  } catch (error48) {
194035
194087
  const errorMessage = error48 instanceof Error ? error48.message : String(error48);
194036
194088
  R2.error(errorMessage);
@@ -195451,6 +195503,122 @@ function getLinkCommand(context) {
195451
195503
  });
195452
195504
  }
195453
195505
 
195506
+ // src/cli/commands/project/logs.ts
195507
+ function parseFunctionFilters(options) {
195508
+ const filters = {};
195509
+ if (options.since) {
195510
+ filters.since = options.since;
195511
+ }
195512
+ if (options.until) {
195513
+ filters.until = options.until;
195514
+ }
195515
+ if (options.limit) {
195516
+ filters.limit = Number.parseInt(options.limit, 10);
195517
+ }
195518
+ if (options.order) {
195519
+ filters.order = options.order.toLowerCase();
195520
+ }
195521
+ return filters;
195522
+ }
195523
+ function parseFunctionNames(option) {
195524
+ if (!option)
195525
+ return [];
195526
+ return option.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
195527
+ }
195528
+ function normalizeDatetime(value) {
195529
+ if (/Z$|[+-]\d{2}:\d{2}$/.test(value))
195530
+ return value;
195531
+ return `${value}Z`;
195532
+ }
195533
+ function formatEntry(entry) {
195534
+ const time3 = entry.time.substring(0, 19).replace("T", " ");
195535
+ const level = entry.level.toUpperCase().padEnd(5);
195536
+ const message = entry.message.trim();
195537
+ return `${time3} ${level} ${message}`;
195538
+ }
195539
+ function formatLogs(entries) {
195540
+ if (entries.length === 0) {
195541
+ return `No logs found matching the filters.
195542
+ `;
195543
+ }
195544
+ const header2 = `Showing ${entries.length} function log entries
195545
+ `;
195546
+ return [header2, ...entries.map(formatEntry)].join(`
195547
+ `);
195548
+ }
195549
+ function normalizeLogEntry(entry, functionName) {
195550
+ return {
195551
+ time: entry.time,
195552
+ level: entry.level,
195553
+ message: `[${functionName}] ${entry.message}`,
195554
+ source: functionName
195555
+ };
195556
+ }
195557
+ async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
195558
+ const filters = parseFunctionFilters(options);
195559
+ const allEntries = [];
195560
+ for (const functionName of functionNames) {
195561
+ let logs;
195562
+ try {
195563
+ logs = await fetchFunctionLogs(functionName, filters);
195564
+ } catch (error48) {
195565
+ if (error48 instanceof ApiError && error48.statusCode === 404 && availableFunctionNames.length > 0) {
195566
+ const available = availableFunctionNames.join(", ");
195567
+ throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
195568
+ hints: [
195569
+ {
195570
+ message: `Available functions in this project: ${available}`
195571
+ },
195572
+ {
195573
+ message: "Make sure the function has been deployed before fetching logs",
195574
+ command: "base44 functions deploy"
195575
+ }
195576
+ ]
195577
+ });
195578
+ }
195579
+ throw error48;
195580
+ }
195581
+ const entries = logs.map((entry) => normalizeLogEntry(entry, functionName));
195582
+ allEntries.push(...entries);
195583
+ }
195584
+ if (functionNames.length > 1) {
195585
+ const order = options.order?.toUpperCase() === "ASC" ? 1 : -1;
195586
+ allEntries.sort((a2, b) => order * a2.time.localeCompare(b.time));
195587
+ }
195588
+ return allEntries;
195589
+ }
195590
+ async function getAllFunctionNames() {
195591
+ const { functions } = await readProjectConfig();
195592
+ return functions.map((fn) => fn.name);
195593
+ }
195594
+ async function logsAction(options) {
195595
+ const specifiedFunctions = parseFunctionNames(options.function);
195596
+ const allProjectFunctions = await getAllFunctionNames();
195597
+ const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions;
195598
+ if (functionNames.length === 0) {
195599
+ return { outroMessage: "No functions found in this project." };
195600
+ }
195601
+ let entries = await fetchLogsForFunctions(functionNames, options, allProjectFunctions);
195602
+ const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
195603
+ if (limit !== undefined && entries.length > limit) {
195604
+ entries = entries.slice(0, limit);
195605
+ }
195606
+ const logsOutput = options.json ? `${JSON.stringify(entries, null, 2)}
195607
+ ` : formatLogs(entries);
195608
+ return { outroMessage: "Fetched logs", stdout: logsOutput };
195609
+ }
195610
+ function getLogsCommand(context) {
195611
+ return new Command("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 format)", normalizeDatetime).option("--until <datetime>", "Show logs until this time (ISO format)", normalizeDatetime).option("-n, --limit <n>", "Results per page (1-1000, default: 50)", (v) => {
195612
+ const n2 = Number.parseInt(v, 10);
195613
+ if (Number.isNaN(n2) || n2 < 1 || n2 > 1000) {
195614
+ throw new InvalidInputError(`Invalid limit: "${v}". Must be a number between 1 and 1000.`);
195615
+ }
195616
+ return v;
195617
+ }).addOption(new Option("--order <order>", "Sort order").choices(["asc", "desc"])).option("--json", "Output raw JSON").action(async (options) => {
195618
+ await runCommand(() => logsAction(options), { requireAuth: true }, context);
195619
+ });
195620
+ }
195621
+
195454
195622
  // src/cli/commands/site/deploy.ts
195455
195623
  import { resolve as resolve3 } from "node:path";
195456
195624
  async function deployAction2(options) {
@@ -196172,6 +196340,7 @@ function createProgram(context) {
196172
196340
  program2.addCommand(getSiteCommand(context));
196173
196341
  program2.addCommand(getTypesCommand(context));
196174
196342
  program2.addCommand(getDevCommand(context), { hidden: true });
196343
+ program2.addCommand(getLogsCommand(context), { hidden: true });
196175
196344
  return program2;
196176
196345
  }
196177
196346
 
@@ -200436,6 +200605,6 @@ export {
200436
200605
  CLIExitError
200437
200606
  };
200438
200607
 
200439
- //# debugId=DF6807EB90E6667564756E2164756E21
200608
+ //# debugId=5F7AE36175BE8E7364756E2164756E21
200440
200609
 
200441
- //# chunkId=019c751d-ed06-7271-9f3f-d37c42112446
200610
+ //# chunkId=019c89f2-5709-70e0-92fd-2ed2ea0125c8