@base44-preview/cli 0.1.10-pr.607.0546dc2 → 0.1.10-pr.607.517737

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
@@ -258369,6 +258369,31 @@ function normalizeLogEntry(entry, functionName) {
258369
258369
  source: functionName
258370
258370
  };
258371
258371
  }
258372
+ async function getRemoteFunctionNames() {
258373
+ const { functions } = await listDeployedFunctions();
258374
+ return functions.map((fn) => fn.name);
258375
+ }
258376
+ async function getFunctionNamesForHint(availableFunctionNames, logsError) {
258377
+ if (availableFunctionNames.length > 0)
258378
+ return availableFunctionNames;
258379
+ try {
258380
+ return await getRemoteFunctionNames();
258381
+ } catch {
258382
+ throw logsError;
258383
+ }
258384
+ }
258385
+ function createFunctionNotFoundError(functionName, availableFunctionNames) {
258386
+ const available = availableFunctionNames.join(", ");
258387
+ return new InvalidInputError(`Function "${functionName}" was not found in this app`, {
258388
+ hints: [
258389
+ { message: `Available functions in this app: ${available}` },
258390
+ {
258391
+ message: "Make sure the function has been deployed before fetching logs",
258392
+ command: "base44 functions deploy"
258393
+ }
258394
+ ]
258395
+ });
258396
+ }
258372
258397
  async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
258373
258398
  const filters = parseFunctionFilters(options);
258374
258399
  const allEntries = [];
@@ -258377,24 +258402,12 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
258377
258402
  try {
258378
258403
  logs = await fetchFunctionLogs(functionName, filters);
258379
258404
  } catch (error48) {
258380
- if (error48 instanceof ApiError && error48.statusCode === 404) {
258381
- const namesForHint = availableFunctionNames.length > 0 ? availableFunctionNames : await getRemoteFunctionNames();
258382
- if (namesForHint.length > 0) {
258383
- const available = namesForHint.join(", ");
258384
- throw new InvalidInputError(`Function "${functionName}" was not found in this app`, {
258385
- hints: [
258386
- {
258387
- message: `Available functions in this app: ${available}`
258388
- },
258389
- {
258390
- message: "Make sure the function has been deployed before fetching logs",
258391
- command: "base44 functions deploy"
258392
- }
258393
- ]
258394
- });
258395
- }
258396
- }
258397
- throw error48;
258405
+ if (!(error48 instanceof ApiError) || error48.statusCode !== 404)
258406
+ throw error48;
258407
+ const namesForHint = await getFunctionNamesForHint(availableFunctionNames, error48);
258408
+ if (namesForHint.length === 0)
258409
+ throw error48;
258410
+ throw createFunctionNotFoundError(functionName, namesForHint);
258398
258411
  }
258399
258412
  const matchingLogs = filters.level ? logs.filter((entry) => entry.level === filters.level) : logs;
258400
258413
  allEntries.push(...matchingLogs.map((entry) => normalizeLogEntry(entry, functionName)));
@@ -258405,10 +258418,6 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
258405
258418
  }
258406
258419
  return allEntries;
258407
258420
  }
258408
- async function getRemoteFunctionNames() {
258409
- const { functions } = await listDeployedFunctions();
258410
- return functions.map((fn) => fn.name);
258411
- }
258412
258421
  function validateLimit(limit) {
258413
258422
  if (limit === undefined)
258414
258423
  return;
@@ -268082,4 +268091,4 @@ export {
268082
268091
  runCLI
268083
268092
  };
268084
268093
 
268085
- //# debugId=F40F9B54DF07697964756E2164756E21
268094
+ //# debugId=7E75083392B74DA264756E2164756E21