@@ -20,25 +20,32 @@ const fetchKeys = {
2020 field : (
2121 scanReportId : string | number ,
2222 tableId : string | number ,
23- fieldId : string | number | undefined
23+ fieldId : string | number | undefined ,
2424 ) => `v2/scanreports/${ scanReportId } /tables/${ tableId } /fields/${ fieldId } /` ,
2525 fields : ( scanReportId : string , tableId : string , filter ?: string ) =>
2626 `v2/scanreports/${ scanReportId } /tables/${ tableId } /fields/?${ filter } ` ,
2727 values : (
2828 scanReportId : string ,
2929 tableId : string ,
3030 fieldId : string ,
31- filter ?: string
31+ filter ?: string ,
3232 ) =>
3333 `v2/scanreports/${ scanReportId } /tables/${ tableId } /fields/${ fieldId } /values/?${ filter } ` ,
34+ valuesV3 : (
35+ scanReportId : string ,
36+ tableId : string ,
37+ fieldId : string ,
38+ filter ?: string ,
39+ ) =>
40+ `v3/scanreports/${ scanReportId } /tables/${ tableId } /fields/${ fieldId } /values/?${ filter } ` ,
3441} ;
3542
3643export async function getScanReports (
37- filter : string | undefined
44+ filter : string | undefined ,
3845) : Promise < PaginatedResponse < ScanReport > > {
3946 try {
4047 return await request < PaginatedResponse < ScanReport > > (
41- fetchKeys . index ( filter )
48+ fetchKeys . index ( filter ) ,
4249 ) ;
4350 } catch ( error ) {
4451 console . warn ( "Failed to fetch data." ) ;
@@ -71,7 +78,7 @@ export async function getScanReport(id: string): Promise<ScanReport | null> {
7178export async function updateScanReport (
7279 id : number ,
7380 data : { } ,
74- needRedirect ?: boolean
81+ needRedirect ?: boolean ,
7582) {
7683 try {
7784 await request ( fetchKeys . get ( id ) , {
@@ -111,7 +118,7 @@ export async function deleteScanReport(id: number) {
111118 * @returns A object with a list of the users permissions.
112119 */
113120export async function getScanReportPermissions (
114- id : string
121+ id : string ,
115122) : Promise < PermissionsResponse > {
116123 try {
117124 return await request < PermissionsResponse > ( fetchKeys . permissions ( id ) ) ;
@@ -123,11 +130,11 @@ export async function getScanReportPermissions(
123130
124131export async function getScanReportTable (
125132 scanReportId : string ,
126- tableId : string
133+ tableId : string ,
127134) : Promise < ScanReportTable > {
128135 try {
129136 return await request < ScanReportTable > (
130- fetchKeys . table ( scanReportId , tableId )
137+ fetchKeys . table ( scanReportId , tableId ) ,
131138 ) ;
132139 } catch ( error ) {
133140 console . warn ( "Failed to fetch data." ) ;
@@ -148,7 +155,7 @@ export async function getScanReportTable(
148155
149156export async function getJobs (
150157 scanReportId : string ,
151- stage ?: string
158+ stage ?: string ,
152159) : Promise < Job [ ] | null > {
153160 try {
154161 return await request < Job [ ] | null > ( fetchKeys . jobs ( scanReportId , stage ) ) ;
@@ -161,7 +168,7 @@ export async function getJobs(
161168export async function updateScanReportTable (
162169 scanReportId : string | number ,
163170 tableId : string | number ,
164- data : { }
171+ data : { } ,
165172) {
166173 try {
167174 await request ( fetchKeys . table ( scanReportId , tableId ) , {
@@ -179,11 +186,11 @@ export async function updateScanReportTable(
179186
180187export async function getScanReportTables (
181188 scanReportId : string ,
182- filter : string | undefined
189+ filter : string | undefined ,
183190) : Promise < PaginatedResponse < ScanReportTable > > {
184191 try {
185192 return await request < PaginatedResponse < ScanReportTable > > (
186- fetchKeys . tables ( scanReportId , filter )
193+ fetchKeys . tables ( scanReportId , filter ) ,
187194 ) ;
188195 } catch ( error ) {
189196 console . warn ( "Failed to fetch data." ) ;
@@ -194,11 +201,11 @@ export async function getScanReportTables(
194201export async function getScanReportFields (
195202 scanReportId : string ,
196203 tableId : string ,
197- filter : string | undefined
204+ filter : string | undefined ,
198205) : Promise < PaginatedResponse < ScanReportField > > {
199206 try {
200207 return await request < PaginatedResponse < ScanReportField > > (
201- fetchKeys . fields ( scanReportId , tableId , filter )
208+ fetchKeys . fields ( scanReportId , tableId , filter ) ,
202209 ) ;
203210 } catch ( error ) {
204211 console . warn ( "Failed to fetch data." ) ;
@@ -209,11 +216,11 @@ export async function getScanReportFields(
209216export async function getScanReportField (
210217 scanReportId : string ,
211218 tableId : string ,
212- fieldId : string | number | undefined
219+ fieldId : string | number | undefined ,
213220) : Promise < ScanReportField > {
214221 try {
215222 return await request < ScanReportField > (
216- fetchKeys . field ( scanReportId , tableId , fieldId )
223+ fetchKeys . field ( scanReportId , tableId , fieldId ) ,
217224 ) ;
218225 } catch ( error ) {
219226 console . warn ( "Failed to fetch data. Passed ID could be null" ) ;
@@ -247,7 +254,7 @@ export async function updateScanReportField(
247254 scanReportId : string | number ,
248255 tableId : string | number ,
249256 fieldId : string ,
250- data : { }
257+ data : { } ,
251258) {
252259 try {
253260 await request ( fetchKeys . field ( scanReportId , tableId , fieldId ) , {
@@ -265,11 +272,11 @@ export async function updateScanReportField(
265272export async function getAllScanReportFields (
266273 scanReportId : string ,
267274 tableId : string ,
268- filter : string | undefined
275+ filter : string | undefined ,
269276) : Promise < ScanReportField [ ] > {
270277 try {
271278 return await fetchAllPages < ScanReportField > (
272- fetchKeys . fields ( scanReportId , tableId , filter )
279+ fetchKeys . fields ( scanReportId , tableId , filter ) ,
273280 ) ;
274281 } catch ( error ) {
275282 console . warn ( "Failed to fetch data." ) ;
@@ -281,11 +288,27 @@ export async function getScanReportValues(
281288 scanReportId : string ,
282289 tableId : string ,
283290 fieldId : string ,
284- filter : string | undefined
291+ filter : string | undefined ,
285292) : Promise < PaginatedResponse < ScanReportValue > > {
286293 try {
287294 return await request < PaginatedResponse < ScanReportValue > > (
288- fetchKeys . values ( scanReportId , tableId , fieldId , filter )
295+ fetchKeys . values ( scanReportId , tableId , fieldId , filter ) ,
296+ ) ;
297+ } catch ( error ) {
298+ console . warn ( "Failed to fetch data." ) ;
299+ return { count : 0 , next : null , previous : null , results : [ ] } ;
300+ }
301+ }
302+
303+ export async function getScanReportValuesV3 (
304+ scanReportId : string ,
305+ tableId : string ,
306+ fieldId : string ,
307+ filter : string | undefined ,
308+ ) : Promise < PaginatedResponse < ScanReportValueV3 > > {
309+ try {
310+ return await request < PaginatedResponse < ScanReportValueV3 > > (
311+ fetchKeys . valuesV3 ( scanReportId , tableId , fieldId , filter ) ,
289312 ) ;
290313 } catch ( error ) {
291314 console . warn ( "Failed to fetch data." ) ;
0 commit comments