@base44-preview/cli 0.1.10-pr.607.748f2a1 → 0.1.10-pr.607.841a324
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 +33 -33
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -258369,6 +258369,32 @@ 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, logsError) {
|
|
258386
|
+
const available = availableFunctionNames.join(", ");
|
|
258387
|
+
return new InvalidInputError(`Function "${functionName}" was not found in this app`, {
|
|
258388
|
+
cause: logsError,
|
|
258389
|
+
hints: [
|
|
258390
|
+
{ message: `Available functions in this app: ${available}` },
|
|
258391
|
+
{
|
|
258392
|
+
message: "Make sure the function has been deployed before fetching logs",
|
|
258393
|
+
command: "base44 functions deploy"
|
|
258394
|
+
}
|
|
258395
|
+
]
|
|
258396
|
+
});
|
|
258397
|
+
}
|
|
258372
258398
|
async function fetchLogsForFunctions(functionNames, options, availableFunctionNames) {
|
|
258373
258399
|
const filters = parseFunctionFilters(options);
|
|
258374
258400
|
const allEntries = [];
|
|
@@ -258377,25 +258403,12 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258377
258403
|
try {
|
|
258378
258404
|
logs = await fetchFunctionLogs(functionName, filters);
|
|
258379
258405
|
} catch (error48) {
|
|
258380
|
-
if (error48 instanceof ApiError
|
|
258381
|
-
|
|
258382
|
-
|
|
258383
|
-
|
|
258384
|
-
|
|
258385
|
-
|
|
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;
|
|
258406
|
+
if (!(error48 instanceof ApiError) || error48.statusCode !== 404)
|
|
258407
|
+
throw error48;
|
|
258408
|
+
const namesForHint = await getFunctionNamesForHint(availableFunctionNames, error48);
|
|
258409
|
+
if (namesForHint.length === 0)
|
|
258410
|
+
throw error48;
|
|
258411
|
+
throw createFunctionNotFoundError(functionName, namesForHint, error48);
|
|
258399
258412
|
}
|
|
258400
258413
|
const matchingLogs = filters.level ? logs.filter((entry) => entry.level === filters.level) : logs;
|
|
258401
258414
|
allEntries.push(...matchingLogs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
@@ -258406,19 +258419,6 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258406
258419
|
}
|
|
258407
258420
|
return allEntries;
|
|
258408
258421
|
}
|
|
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
|
-
}
|
|
258422
258422
|
function validateLimit(limit) {
|
|
258423
258423
|
if (limit === undefined)
|
|
258424
258424
|
return;
|
|
@@ -268092,4 +268092,4 @@ export {
|
|
|
268092
268092
|
runCLI
|
|
268093
268093
|
};
|
|
268094
268094
|
|
|
268095
|
-
//# debugId=
|
|
268095
|
+
//# debugId=85D146C5204055CA64756E2164756E21
|