@base44-preview/cli 0.1.10-pr.607.4743740 → 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 +32 -33
- package/dist/cli/index.js.map +3 -3
- package/package.json +1 -1
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,25 +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
|
|
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;
|
|
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);
|
|
258399
258411
|
}
|
|
258400
258412
|
const matchingLogs = filters.level ? logs.filter((entry) => entry.level === filters.level) : logs;
|
|
258401
258413
|
allEntries.push(...matchingLogs.map((entry) => normalizeLogEntry(entry, functionName)));
|
|
@@ -258406,19 +258418,6 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
|
|
|
258406
258418
|
}
|
|
258407
258419
|
return allEntries;
|
|
258408
258420
|
}
|
|
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
258421
|
function validateLimit(limit) {
|
|
258423
258422
|
if (limit === undefined)
|
|
258424
258423
|
return;
|
|
@@ -268092,4 +268091,4 @@ export {
|
|
|
268092
268091
|
runCLI
|
|
268093
268092
|
};
|
|
268094
268093
|
|
|
268095
|
-
//# debugId=
|
|
268094
|
+
//# debugId=7E75083392B74DA264756E2164756E21
|