@@ -15,6 +15,7 @@ import {
15
15
IContent ,
16
16
IExtractResponse ,
17
17
IExtractedMetadata ,
18
+ ExtractionGraphAnalytics ,
18
19
} from "./types" ;
19
20
import { v4 as uuidv4 } from "uuid" ;
20
21
import CryptoJS from "crypto-js" ;
@@ -450,6 +451,20 @@ class IndexifyClient {
450
451
return resp . data ;
451
452
}
452
453
454
+ async getExtractionGraphAnalytics ( {
455
+ namespace,
456
+ extractionGraph,
457
+ } : {
458
+ namespace : string ;
459
+ extractionGraph : string ;
460
+ } ) : Promise < ExtractionGraphAnalytics > {
461
+ const response = await this . client . get (
462
+ `namespaces/${ namespace } /extraction_graphs/${ extractionGraph } /analytics`
463
+ ) ;
464
+
465
+ return response . data ;
466
+ }
467
+
453
468
async waitForExtraction ( contentIds : string | string [ ] ) : Promise < void > {
454
469
const ids = Array . isArray ( contentIds ) ? contentIds : [ contentIds ] ;
455
470
@@ -525,51 +540,51 @@ class IndexifyClient {
525
540
}
526
541
527
542
async listContent (
528
- extractionGraph : string ,
529
- namespace ?: string ,
530
- params ?: {
531
- namespace : string ;
532
- extractionGraph : string ;
533
- source ?: string ;
534
- ingestedContentId ?: string ;
535
- parentId ?: string ;
536
- labelsFilter ?: string [ ] ;
537
- startId ?: string ;
538
- limit ?: number ;
539
- returnTotal ?: boolean ;
540
- }
541
- ) : Promise < { contentList : IContentMetadata [ ] ; total ?: number } > {
542
- const defaultParams = {
543
- namespace : namespace || this . namespace ,
544
- extraction_graph : extractionGraph ,
545
- return_total : false ,
546
- } ;
547
-
548
- const mergedParams = {
549
- ...defaultParams ,
550
- ...params ,
551
- namespace : params ?. namespace || namespace || this . namespace ,
552
- extraction_graph : params ?. extractionGraph || extractionGraph ,
553
- labels_filter : params ?. labelsFilter ,
554
- ingested_content_id : params ?. ingestedContentId ,
555
- parent_id : params ?. parentId ,
556
- start_id : params ?. startId ,
557
- } ;
558
-
559
- const response = await this . client . get (
560
- `extraction_graphs/${ mergedParams . extraction_graph } /content` ,
561
- { params : mergedParams }
562
- ) ;
563
-
564
- const contentList = response . data . content_list . map ( ( item : IBaseContentMetadata ) =>
565
- this . baseContentToContentMetadata ( item )
566
- ) ;
567
-
568
- return {
569
- contentList,
570
- total : mergedParams . return_total ? response . data . total : undefined
571
- } ;
572
- }
543
+ extractionGraph : string ,
544
+ namespace ?: string ,
545
+ params ?: {
546
+ namespace : string ;
547
+ extractionGraph : string ;
548
+ source ?: string ;
549
+ ingestedContentId ?: string ;
550
+ parentId ?: string ;
551
+ labelsFilter ?: string [ ] ;
552
+ startId ?: string ;
553
+ limit ?: number ;
554
+ returnTotal ?: boolean ;
555
+ }
556
+ ) : Promise < { contentList : IContentMetadata [ ] ; total ?: number } > {
557
+ const defaultParams = {
558
+ namespace : namespace || this . namespace ,
559
+ extraction_graph : extractionGraph ,
560
+ return_total : false ,
561
+ } ;
562
+
563
+ const mergedParams = {
564
+ ...defaultParams ,
565
+ ...params ,
566
+ namespace : params ?. namespace || namespace || this . namespace ,
567
+ extraction_graph : params ?. extractionGraph || extractionGraph ,
568
+ labels_filter : params ?. labelsFilter ,
569
+ ingested_content_id : params ?. ingestedContentId ,
570
+ parent_id : params ?. parentId ,
571
+ start_id : params ?. startId ,
572
+ } ;
573
+
574
+ const response = await this . client . get (
575
+ `extraction_graphs/${ mergedParams . extraction_graph } /content` ,
576
+ { params : mergedParams }
577
+ ) ;
578
+
579
+ const contentList = response . data . content_list . map ( ( item : IBaseContentMetadata ) =>
580
+ this . baseContentToContentMetadata ( item )
581
+ ) ;
582
+
583
+ return {
584
+ contentList,
585
+ total : mergedParams . return_total ? response . data . total : undefined
586
+ } ;
587
+ }
573
588
574
589
async sqlQuery ( query : string ) : Promise < any > {
575
590
const response = await this . client . post (
0 commit comments