mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 04:51:51 +00:00
feat: add fields prop for fetching necessary findings data
This commit is contained in:
@@ -8,6 +8,7 @@ export const getLighthouseFindings = async ({
|
||||
query = "",
|
||||
sort = "",
|
||||
filters = {},
|
||||
fields = [],
|
||||
}) => {
|
||||
const headers = await getAuthHeaders({ contentType: false });
|
||||
|
||||
@@ -21,6 +22,9 @@ export const getLighthouseFindings = async ({
|
||||
|
||||
if (query) url.searchParams.append("filter[search]", query);
|
||||
if (sort) url.searchParams.append("sort", sort);
|
||||
if (fields.length > 0) {
|
||||
url.searchParams.append("fields[findings]", fields.join(","));
|
||||
}
|
||||
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
url.searchParams.append(key, String(value));
|
||||
|
||||
@@ -213,6 +213,31 @@ export const getFindingsSchema = z.object({
|
||||
.describe(
|
||||
"The filters to apply. Default is {}. Only add necessary filters and ignore others. Generate the filters object **only** with non-empty values included.",
|
||||
),
|
||||
fields: z
|
||||
.array(
|
||||
z.enum([
|
||||
"uid",
|
||||
"delta",
|
||||
"status",
|
||||
"status_extended",
|
||||
"severity",
|
||||
"check_id",
|
||||
"check_metadata",
|
||||
"raw_result",
|
||||
"inserted_at",
|
||||
"updated_at",
|
||||
"first_seen_at",
|
||||
"muted",
|
||||
"muted_reason",
|
||||
"url",
|
||||
"scan",
|
||||
"resources",
|
||||
]),
|
||||
)
|
||||
.optional()
|
||||
.describe(
|
||||
"List of fields to include in the response. Use only available fields.",
|
||||
),
|
||||
});
|
||||
|
||||
// Get Metadata Info Schema
|
||||
|
||||
Reference in New Issue
Block a user