@base44-preview/cli 0.1.10-pr.607.517737 → 0.1.10-pr.607.748f2a1

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