@ontos-ai/knowhere-sdk 2.1.1 → 2.1.3
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/README.md +7 -7
- package/dist/index.d.mts +219 -318
- package/dist/index.d.ts +219 -318
- package/dist/index.js +703 -731
- package/dist/index.mjs +703 -731
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -378,179 +378,6 @@ interface ParseResult {
|
|
|
378
378
|
save(directory: string): Promise<string>;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
/**
|
|
382
|
-
* Canonical document state returned by document lifecycle endpoints.
|
|
383
|
-
*/
|
|
384
|
-
interface Document {
|
|
385
|
-
/** Stable document identifier */
|
|
386
|
-
documentId: string;
|
|
387
|
-
/** Retrieval namespace */
|
|
388
|
-
namespace: string;
|
|
389
|
-
/** Current lifecycle status */
|
|
390
|
-
status: string;
|
|
391
|
-
/** Current published job result identifier */
|
|
392
|
-
currentJobResultId?: string;
|
|
393
|
-
/** Original source file name */
|
|
394
|
-
sourceFileName?: string;
|
|
395
|
-
/** Client-provided display metadata copied from the publishing job */
|
|
396
|
-
documentMetadata?: Record<string, unknown>;
|
|
397
|
-
/** Document creation timestamp */
|
|
398
|
-
createdAt?: Date;
|
|
399
|
-
/** Last update timestamp */
|
|
400
|
-
updatedAt?: Date;
|
|
401
|
-
/** Archive timestamp, when archived */
|
|
402
|
-
archivedAt?: Date;
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Pagination metadata returned by document list endpoints.
|
|
406
|
-
*/
|
|
407
|
-
interface DocumentListPagination {
|
|
408
|
-
/** Current page number */
|
|
409
|
-
page: number;
|
|
410
|
-
/** Number of items requested per page */
|
|
411
|
-
pageSize: number;
|
|
412
|
-
/** Total matching documents */
|
|
413
|
-
total: number;
|
|
414
|
-
/** Total number of pages */
|
|
415
|
-
totalPages: number;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Query parameters for GET /v2/documents.
|
|
419
|
-
*/
|
|
420
|
-
interface DocumentListParams {
|
|
421
|
-
/** Retrieval namespace */
|
|
422
|
-
namespace?: string;
|
|
423
|
-
/** Page number (default: 1) */
|
|
424
|
-
page?: number;
|
|
425
|
-
/** Items per page (default: 50, maximum: 200) */
|
|
426
|
-
pageSize?: number;
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Response from GET /v2/documents.
|
|
430
|
-
*/
|
|
431
|
-
interface DocumentListResponse {
|
|
432
|
-
/** Namespace listed by the API */
|
|
433
|
-
namespace: string;
|
|
434
|
-
/** Documents visible in the namespace */
|
|
435
|
-
documents: Document[];
|
|
436
|
-
/** Pagination metadata */
|
|
437
|
-
pagination: DocumentListPagination;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Document chunk types supported by document chunk endpoints.
|
|
441
|
-
*/
|
|
442
|
-
type DocumentChunkType = 'text' | 'image' | 'table' | 'page';
|
|
443
|
-
/**
|
|
444
|
-
* Pagination metadata returned by chunk list endpoints.
|
|
445
|
-
*/
|
|
446
|
-
interface DocumentChunkPagination {
|
|
447
|
-
/** Current page number */
|
|
448
|
-
page: number;
|
|
449
|
-
/** Number of items requested per page */
|
|
450
|
-
pageSize: number;
|
|
451
|
-
/** Total matching chunks */
|
|
452
|
-
total: number;
|
|
453
|
-
/** Total number of pages */
|
|
454
|
-
totalPages: number;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Query parameters for GET /v2/documents/{document_id}/chunks.
|
|
458
|
-
*/
|
|
459
|
-
interface DocumentChunkListParams {
|
|
460
|
-
/** Page number (default: 1) */
|
|
461
|
-
page?: number;
|
|
462
|
-
/** Items per page (default: 50, maximum: 200) */
|
|
463
|
-
pageSize?: number;
|
|
464
|
-
/** Optional chunk type filter */
|
|
465
|
-
chunkType?: DocumentChunkType;
|
|
466
|
-
/** Set true to include 7-day asset URLs for media and page citation assets */
|
|
467
|
-
includeAssetUrls?: boolean;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Query parameters for GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
|
|
471
|
-
*/
|
|
472
|
-
interface DocumentChunkGetParams {
|
|
473
|
-
/** Set true to include 7-day asset URLs for media and page citation assets */
|
|
474
|
-
includeAssetUrls?: boolean;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* One current-revision document chunk.
|
|
478
|
-
*/
|
|
479
|
-
interface DocumentChunk {
|
|
480
|
-
/** Stable document chunk row identifier */
|
|
481
|
-
id: string;
|
|
482
|
-
/** Parser-provided chunk identifier */
|
|
483
|
-
chunkId: string;
|
|
484
|
-
/** Chunk content type */
|
|
485
|
-
chunkType: DocumentChunkType;
|
|
486
|
-
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
487
|
-
contentSource?: string | null;
|
|
488
|
-
/** Chunk text or generated summary content */
|
|
489
|
-
content?: string | null;
|
|
490
|
-
/** Parent section identifier */
|
|
491
|
-
sectionId?: string | null;
|
|
492
|
-
/** Parent section path */
|
|
493
|
-
sectionPath?: string | null;
|
|
494
|
-
/** Source path from the parser output */
|
|
495
|
-
sourceChunkPath?: string | null;
|
|
496
|
-
/** Generated artifact file path for media chunks */
|
|
497
|
-
filePath?: string | null;
|
|
498
|
-
/** Sort order within the document revision */
|
|
499
|
-
sortOrder: number;
|
|
500
|
-
/** Chunk metadata returned by the API */
|
|
501
|
-
metadata: Record<string, unknown>;
|
|
502
|
-
/** 7-day asset URL for media or page citation assets when available */
|
|
503
|
-
assetUrl?: string | null;
|
|
504
|
-
/** Chunk creation timestamp */
|
|
505
|
-
createdAt?: Date;
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Response from GET /v2/documents/{document_id}/files/page-citation-source.
|
|
509
|
-
*/
|
|
510
|
-
interface DocumentPageCitationSource {
|
|
511
|
-
documentId: string;
|
|
512
|
-
namespace?: string;
|
|
513
|
-
jobId?: string;
|
|
514
|
-
jobResultId?: string;
|
|
515
|
-
variant?: string;
|
|
516
|
-
fileName: string;
|
|
517
|
-
contentType: string;
|
|
518
|
-
url: string;
|
|
519
|
-
expiresAt?: Date;
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Response from GET /v2/documents/{document_id}/chunks.
|
|
523
|
-
*/
|
|
524
|
-
interface DocumentChunkListResponse {
|
|
525
|
-
/** Stable document identifier */
|
|
526
|
-
documentId: string;
|
|
527
|
-
/** Retrieval namespace */
|
|
528
|
-
namespace: string;
|
|
529
|
-
/** Current published job result identifier */
|
|
530
|
-
jobResultId?: string | null;
|
|
531
|
-
/** Current published job identifier */
|
|
532
|
-
jobId?: string | null;
|
|
533
|
-
/** Current-revision chunks */
|
|
534
|
-
chunks: DocumentChunk[];
|
|
535
|
-
/** Pagination metadata */
|
|
536
|
-
pagination: DocumentChunkPagination;
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Response from GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
|
|
540
|
-
*/
|
|
541
|
-
interface DocumentChunkResponse {
|
|
542
|
-
/** Stable document identifier */
|
|
543
|
-
documentId: string;
|
|
544
|
-
/** Retrieval namespace */
|
|
545
|
-
namespace: string;
|
|
546
|
-
/** Current published job result identifier */
|
|
547
|
-
jobResultId?: string | null;
|
|
548
|
-
/** Current published job identifier */
|
|
549
|
-
jobId?: string | null;
|
|
550
|
-
/** Requested current-revision chunk */
|
|
551
|
-
chunk: DocumentChunk;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
381
|
type KnowhereAssetStorageBody = Uint8Array;
|
|
555
382
|
interface KnowhereAssetStorageObject {
|
|
556
383
|
readonly key: string;
|
|
@@ -578,127 +405,67 @@ interface KnowhereAssetStorageOptions {
|
|
|
578
405
|
readonly adapter: KnowhereAssetStorageAdapter;
|
|
579
406
|
readonly keyPrefix: string;
|
|
580
407
|
readonly skipExisting?: boolean;
|
|
581
|
-
readonly chunkPageSize?: number;
|
|
582
|
-
readonly revisionKey?: string;
|
|
583
|
-
}
|
|
584
|
-
interface KnowhereParsedSnapshotChunk {
|
|
585
|
-
readonly id: string;
|
|
586
|
-
readonly chunkId: string;
|
|
587
|
-
readonly chunkType: string;
|
|
588
|
-
readonly contentSource?: string;
|
|
589
|
-
readonly content: string;
|
|
590
|
-
readonly sectionPath?: string;
|
|
591
|
-
readonly sourceChunkPath: string;
|
|
592
|
-
readonly filePath?: string;
|
|
593
|
-
readonly sortOrder: number;
|
|
594
|
-
readonly metadata: Record<string, unknown>;
|
|
595
|
-
readonly assetUrl?: string;
|
|
596
|
-
}
|
|
597
|
-
interface KnowhereParsedSnapshotChunkPage {
|
|
598
|
-
readonly version: 1;
|
|
599
|
-
readonly jobId: string;
|
|
600
|
-
readonly revisionKey?: string;
|
|
601
|
-
readonly documentId?: string;
|
|
602
|
-
readonly namespace?: string;
|
|
603
|
-
readonly sourceFileName: string;
|
|
604
|
-
readonly page: number;
|
|
605
|
-
readonly pageSize: number;
|
|
606
|
-
readonly total: number;
|
|
607
|
-
readonly totalPages: number;
|
|
608
|
-
readonly chunks: readonly KnowhereParsedSnapshotChunk[];
|
|
609
|
-
}
|
|
610
|
-
interface KnowhereParsedSnapshotChunkPageReference {
|
|
611
|
-
readonly page: number;
|
|
612
|
-
readonly pageSize: number;
|
|
613
|
-
readonly chunkCount: number;
|
|
614
|
-
readonly key: string;
|
|
615
|
-
readonly url?: string;
|
|
616
|
-
}
|
|
617
|
-
interface KnowhereParsedSnapshotManifest {
|
|
618
|
-
readonly version: 1;
|
|
619
|
-
readonly kind: 'knowhere-parsed-result-snapshot';
|
|
620
|
-
readonly jobId: string;
|
|
621
|
-
readonly revisionKey?: string;
|
|
622
|
-
readonly documentId?: string;
|
|
623
|
-
readonly namespace?: string;
|
|
624
|
-
readonly sourceFileName: string;
|
|
625
|
-
readonly totalChunks: number;
|
|
626
|
-
readonly typeCounts?: Readonly<Partial<Record<DocumentChunkType, number>>>;
|
|
627
|
-
readonly chunkPageSize: number;
|
|
628
|
-
readonly chunkPages: readonly KnowhereParsedSnapshotChunkPageReference[];
|
|
629
|
-
readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
|
|
630
|
-
readonly createdAt: string;
|
|
631
|
-
}
|
|
632
|
-
interface KnowhereParsedSnapshot {
|
|
633
|
-
readonly manifest: KnowhereParsedSnapshotManifest;
|
|
634
|
-
readonly manifestKey: string;
|
|
635
|
-
readonly manifestUrl?: string;
|
|
636
|
-
readonly indexKey: string;
|
|
637
|
-
readonly indexUrl?: string;
|
|
638
|
-
readonly chunkPageUrlsByPage: Readonly<Record<number, string>>;
|
|
639
408
|
}
|
|
640
409
|
interface KnowhereAssetStorageResult {
|
|
641
410
|
readonly result: ParseResult;
|
|
642
411
|
readonly assetUrlsByFilePath: Readonly<Record<string, string>>;
|
|
643
|
-
readonly snapshot?: KnowhereParsedSnapshot;
|
|
644
412
|
}
|
|
645
|
-
type ParsedDocumentAssetUrlPolicy = 'none' | 'durable';
|
|
646
413
|
interface ParsedDocumentStorageDocument {
|
|
647
414
|
readonly documentId: string;
|
|
648
415
|
readonly revisionKey: string;
|
|
649
416
|
}
|
|
650
|
-
type
|
|
651
|
-
interface
|
|
652
|
-
readonly
|
|
653
|
-
readonly chunkType?: DocumentChunkType;
|
|
417
|
+
type ParsedDocumentRevisionParams = ParsedDocumentStorageDocument;
|
|
418
|
+
interface ParsedDocumentObjectParams extends ParsedDocumentRevisionParams {
|
|
419
|
+
readonly path: string;
|
|
654
420
|
}
|
|
655
|
-
interface
|
|
656
|
-
readonly
|
|
421
|
+
interface ParsedDocumentObjectHead extends ParsedDocumentObjectParams {
|
|
422
|
+
readonly contentType?: string;
|
|
423
|
+
readonly contentLength?: number;
|
|
424
|
+
readonly metadata?: Readonly<Record<string, string>>;
|
|
425
|
+
readonly url?: string;
|
|
426
|
+
}
|
|
427
|
+
interface ParsedDocumentObject extends ParsedDocumentObjectHead {
|
|
428
|
+
readonly body: KnowhereAssetStorageBody;
|
|
429
|
+
}
|
|
430
|
+
interface ParsedDocumentWriteObjectParams extends ParsedDocumentObjectParams {
|
|
657
431
|
readonly body: KnowhereAssetStorageBody;
|
|
658
432
|
readonly contentType: string;
|
|
659
433
|
readonly metadata?: Readonly<Record<string, string>>;
|
|
660
434
|
}
|
|
661
|
-
interface
|
|
662
|
-
readonly
|
|
435
|
+
interface ParsedDocumentWriteObjectResult extends ParsedDocumentObjectParams {
|
|
436
|
+
readonly url?: string;
|
|
437
|
+
}
|
|
438
|
+
type ParsedDocumentCommitSource = 'resultZip' | 'remoteReconstruction';
|
|
439
|
+
interface ParsedDocumentCommit {
|
|
440
|
+
readonly version: 1;
|
|
441
|
+
readonly documentId: string;
|
|
442
|
+
readonly revisionKey: string;
|
|
443
|
+
readonly source: ParsedDocumentCommitSource;
|
|
444
|
+
readonly committedAt: string;
|
|
663
445
|
}
|
|
664
446
|
interface ParsedDocumentSyncProgress {
|
|
665
447
|
readonly documentId: string;
|
|
666
448
|
readonly revisionKey: string;
|
|
667
|
-
readonly nextChunkPage
|
|
668
|
-
readonly nextAssetIndex: number;
|
|
449
|
+
readonly nextChunkPage?: number;
|
|
669
450
|
readonly status: 'running' | 'completed' | 'failed';
|
|
670
451
|
readonly updatedAt: string;
|
|
671
452
|
readonly error?: string;
|
|
672
453
|
}
|
|
673
454
|
interface ParsedDocumentStorage {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
readChunkPage(params: ParsedDocumentStorageChunkPageParams): Promise<KnowhereParsedSnapshotChunkPage | null>;
|
|
681
|
-
writeChunkPage(params: {
|
|
682
|
-
readonly documentId: string;
|
|
683
|
-
readonly revisionKey: string;
|
|
684
|
-
readonly page: KnowhereParsedSnapshotChunkPage;
|
|
685
|
-
}): Promise<void>;
|
|
686
|
-
writeAsset(params: ParsedDocumentStorageDocument & ParsedDocumentStorageAsset): Promise<{
|
|
687
|
-
readonly sourcePath: string;
|
|
688
|
-
readonly url?: string;
|
|
689
|
-
}>;
|
|
690
|
-
getAssetUrl(params: ParsedDocumentStorageAssetParams): Promise<string | null>;
|
|
691
|
-
readSyncProgress(params: ParsedDocumentStorageDocument): Promise<ParsedDocumentSyncProgress | null>;
|
|
455
|
+
readObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObject | null>;
|
|
456
|
+
writeObject(params: ParsedDocumentWriteObjectParams): Promise<ParsedDocumentWriteObjectResult>;
|
|
457
|
+
headObject?(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObjectHead | null>;
|
|
458
|
+
getObjectUrl?(params: ParsedDocumentObjectParams): Promise<string | null>;
|
|
459
|
+
deletePrefix?(params: ParsedDocumentRevisionParams): Promise<void>;
|
|
460
|
+
readSyncProgress(params: ParsedDocumentRevisionParams): Promise<ParsedDocumentSyncProgress | null>;
|
|
692
461
|
writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
|
|
693
462
|
}
|
|
694
463
|
interface ParsedDocumentSyncScheduler {
|
|
695
464
|
schedule(task: () => Promise<void>): void | Promise<void>;
|
|
696
465
|
}
|
|
697
466
|
interface ParsedDocumentStorageLimits {
|
|
698
|
-
readonly chunkPageSize?: number;
|
|
699
467
|
readonly remotePageSize?: number;
|
|
700
468
|
readonly maxPagesPerSync?: number;
|
|
701
|
-
readonly maxAssetsPerSync?: number;
|
|
702
469
|
readonly syncDeadlineMs?: number;
|
|
703
470
|
readonly grepMaxPages?: number;
|
|
704
471
|
readonly grepDeadlineMs?: number;
|
|
@@ -1151,6 +918,179 @@ declare class Retrieval extends BaseResource {
|
|
|
1151
918
|
query(params: RetrievalQueryParams): Promise<RetrievalQueryResponse>;
|
|
1152
919
|
}
|
|
1153
920
|
|
|
921
|
+
/**
|
|
922
|
+
* Canonical document state returned by document lifecycle endpoints.
|
|
923
|
+
*/
|
|
924
|
+
interface Document {
|
|
925
|
+
/** Stable document identifier */
|
|
926
|
+
documentId: string;
|
|
927
|
+
/** Retrieval namespace */
|
|
928
|
+
namespace: string;
|
|
929
|
+
/** Current lifecycle status */
|
|
930
|
+
status: string;
|
|
931
|
+
/** Current published job result identifier */
|
|
932
|
+
currentJobResultId?: string;
|
|
933
|
+
/** Original source file name */
|
|
934
|
+
sourceFileName?: string;
|
|
935
|
+
/** Client-provided display metadata copied from the publishing job */
|
|
936
|
+
documentMetadata?: Record<string, unknown>;
|
|
937
|
+
/** Document creation timestamp */
|
|
938
|
+
createdAt?: Date;
|
|
939
|
+
/** Last update timestamp */
|
|
940
|
+
updatedAt?: Date;
|
|
941
|
+
/** Archive timestamp, when archived */
|
|
942
|
+
archivedAt?: Date;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Pagination metadata returned by document list endpoints.
|
|
946
|
+
*/
|
|
947
|
+
interface DocumentListPagination {
|
|
948
|
+
/** Current page number */
|
|
949
|
+
page: number;
|
|
950
|
+
/** Number of items requested per page */
|
|
951
|
+
pageSize: number;
|
|
952
|
+
/** Total matching documents */
|
|
953
|
+
total: number;
|
|
954
|
+
/** Total number of pages */
|
|
955
|
+
totalPages: number;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Query parameters for GET /v2/documents.
|
|
959
|
+
*/
|
|
960
|
+
interface DocumentListParams {
|
|
961
|
+
/** Retrieval namespace */
|
|
962
|
+
namespace?: string;
|
|
963
|
+
/** Page number (default: 1) */
|
|
964
|
+
page?: number;
|
|
965
|
+
/** Items per page (default: 50, maximum: 200) */
|
|
966
|
+
pageSize?: number;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Response from GET /v2/documents.
|
|
970
|
+
*/
|
|
971
|
+
interface DocumentListResponse {
|
|
972
|
+
/** Namespace listed by the API */
|
|
973
|
+
namespace: string;
|
|
974
|
+
/** Documents visible in the namespace */
|
|
975
|
+
documents: Document[];
|
|
976
|
+
/** Pagination metadata */
|
|
977
|
+
pagination: DocumentListPagination;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Document chunk types supported by document chunk endpoints.
|
|
981
|
+
*/
|
|
982
|
+
type DocumentChunkType = 'text' | 'image' | 'table' | 'page';
|
|
983
|
+
/**
|
|
984
|
+
* Pagination metadata returned by chunk list endpoints.
|
|
985
|
+
*/
|
|
986
|
+
interface DocumentChunkPagination {
|
|
987
|
+
/** Current page number */
|
|
988
|
+
page: number;
|
|
989
|
+
/** Number of items requested per page */
|
|
990
|
+
pageSize: number;
|
|
991
|
+
/** Total matching chunks */
|
|
992
|
+
total: number;
|
|
993
|
+
/** Total number of pages */
|
|
994
|
+
totalPages: number;
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* Query parameters for GET /v2/documents/{document_id}/chunks.
|
|
998
|
+
*/
|
|
999
|
+
interface DocumentChunkListParams {
|
|
1000
|
+
/** Page number (default: 1) */
|
|
1001
|
+
page?: number;
|
|
1002
|
+
/** Items per page (default: 50, maximum: 200) */
|
|
1003
|
+
pageSize?: number;
|
|
1004
|
+
/** Optional chunk type filter */
|
|
1005
|
+
chunkType?: DocumentChunkType;
|
|
1006
|
+
/** Set true to include 7-day asset URLs for media and page citation assets */
|
|
1007
|
+
includeAssetUrls?: boolean;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Query parameters for GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
|
|
1011
|
+
*/
|
|
1012
|
+
interface DocumentChunkGetParams {
|
|
1013
|
+
/** Set true to include 7-day asset URLs for media and page citation assets */
|
|
1014
|
+
includeAssetUrls?: boolean;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* One current-revision document chunk.
|
|
1018
|
+
*/
|
|
1019
|
+
interface DocumentChunk {
|
|
1020
|
+
/** Stable document chunk row identifier */
|
|
1021
|
+
id: string;
|
|
1022
|
+
/** Parser-provided chunk identifier */
|
|
1023
|
+
chunkId: string;
|
|
1024
|
+
/** Chunk content type */
|
|
1025
|
+
chunkType: DocumentChunkType;
|
|
1026
|
+
/** Content source marker. Page chunks normally expose summaries as content. */
|
|
1027
|
+
contentSource?: string | null;
|
|
1028
|
+
/** Chunk text or generated summary content */
|
|
1029
|
+
content?: string | null;
|
|
1030
|
+
/** Parent section identifier */
|
|
1031
|
+
sectionId?: string | null;
|
|
1032
|
+
/** Parent section path */
|
|
1033
|
+
sectionPath?: string | null;
|
|
1034
|
+
/** Source path from the parser output */
|
|
1035
|
+
sourceChunkPath?: string | null;
|
|
1036
|
+
/** Generated artifact file path for media chunks */
|
|
1037
|
+
filePath?: string | null;
|
|
1038
|
+
/** Sort order within the document revision */
|
|
1039
|
+
sortOrder: number;
|
|
1040
|
+
/** Chunk metadata returned by the API */
|
|
1041
|
+
metadata: Record<string, unknown>;
|
|
1042
|
+
/** 7-day asset URL for media or page citation assets when available */
|
|
1043
|
+
assetUrl?: string | null;
|
|
1044
|
+
/** Chunk creation timestamp */
|
|
1045
|
+
createdAt?: Date;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Response from GET /v2/documents/{document_id}/files/page-citation-source.
|
|
1049
|
+
*/
|
|
1050
|
+
interface DocumentPageCitationSource {
|
|
1051
|
+
documentId: string;
|
|
1052
|
+
namespace?: string;
|
|
1053
|
+
jobId?: string;
|
|
1054
|
+
jobResultId?: string;
|
|
1055
|
+
variant?: string;
|
|
1056
|
+
fileName: string;
|
|
1057
|
+
contentType: string;
|
|
1058
|
+
url: string;
|
|
1059
|
+
expiresAt?: Date;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Response from GET /v2/documents/{document_id}/chunks.
|
|
1063
|
+
*/
|
|
1064
|
+
interface DocumentChunkListResponse {
|
|
1065
|
+
/** Stable document identifier */
|
|
1066
|
+
documentId: string;
|
|
1067
|
+
/** Retrieval namespace */
|
|
1068
|
+
namespace: string;
|
|
1069
|
+
/** Current published job result identifier */
|
|
1070
|
+
jobResultId?: string | null;
|
|
1071
|
+
/** Current published job identifier */
|
|
1072
|
+
jobId?: string | null;
|
|
1073
|
+
/** Current-revision chunks */
|
|
1074
|
+
chunks: DocumentChunk[];
|
|
1075
|
+
/** Pagination metadata */
|
|
1076
|
+
pagination: DocumentChunkPagination;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Response from GET /v2/documents/{document_id}/chunks/{document_chunk_id}.
|
|
1080
|
+
*/
|
|
1081
|
+
interface DocumentChunkResponse {
|
|
1082
|
+
/** Stable document identifier */
|
|
1083
|
+
documentId: string;
|
|
1084
|
+
/** Retrieval namespace */
|
|
1085
|
+
namespace: string;
|
|
1086
|
+
/** Current published job result identifier */
|
|
1087
|
+
jobResultId?: string | null;
|
|
1088
|
+
/** Current published job identifier */
|
|
1089
|
+
jobId?: string | null;
|
|
1090
|
+
/** Requested current-revision chunk */
|
|
1091
|
+
chunk: DocumentChunk;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1154
1094
|
/**
|
|
1155
1095
|
* Resource for canonical document lifecycle operations.
|
|
1156
1096
|
*/
|
|
@@ -1228,7 +1168,6 @@ interface LocalKnowledgeParseResponse {
|
|
|
1228
1168
|
document: LocalKnowledgeDocument;
|
|
1229
1169
|
result: ParseResult;
|
|
1230
1170
|
assetUrlsByFilePath?: Readonly<Record<string, string>>;
|
|
1231
|
-
parsedSnapshot?: KnowhereParsedSnapshot;
|
|
1232
1171
|
}
|
|
1233
1172
|
interface KnowledgeAsyncParseParams extends ParseParams {
|
|
1234
1173
|
/** Optional stable local identifier to use when this job result is cached later. */
|
|
@@ -1264,7 +1203,6 @@ interface KnowledgeImportJobResultParams extends KnowledgeLoadJobResultParams {
|
|
|
1264
1203
|
interface KnowledgeJobResultResponse {
|
|
1265
1204
|
result: ParseResult;
|
|
1266
1205
|
assetUrlsByFilePath?: Readonly<Record<string, string>>;
|
|
1267
|
-
parsedSnapshot?: KnowhereParsedSnapshot;
|
|
1268
1206
|
}
|
|
1269
1207
|
/** @deprecated Use KnowledgeImportJobResultParams with importJobResult instead. */
|
|
1270
1208
|
type KnowledgeCacheJobResultParams = KnowledgeImportJobResultParams;
|
|
@@ -1290,7 +1228,7 @@ interface KnowledgeSyncParsedDocumentResponse {
|
|
|
1290
1228
|
documentId: string;
|
|
1291
1229
|
revisionKey: string;
|
|
1292
1230
|
completed: boolean;
|
|
1293
|
-
|
|
1231
|
+
commit?: ParsedDocumentCommit;
|
|
1294
1232
|
}
|
|
1295
1233
|
interface KnowledgeSection {
|
|
1296
1234
|
sectionPath: string;
|
|
@@ -1321,7 +1259,6 @@ interface KnowledgeReadParams extends KnowledgeDocumentReference {
|
|
|
1321
1259
|
chunkId?: string;
|
|
1322
1260
|
chunkType?: KnowledgeChunkType;
|
|
1323
1261
|
limit?: number;
|
|
1324
|
-
assetUrlPolicy?: ParsedDocumentAssetUrlPolicy;
|
|
1325
1262
|
}
|
|
1326
1263
|
interface KnowledgeReadChunk {
|
|
1327
1264
|
position: number;
|
|
@@ -1450,12 +1387,11 @@ declare class Knowledge {
|
|
|
1450
1387
|
private tryReadChunksFromParsedStorage;
|
|
1451
1388
|
private tryGrepChunksFromParsedStorage;
|
|
1452
1389
|
private tryReadOutlineFromParsedStorage;
|
|
1453
|
-
private
|
|
1454
|
-
private readStoredSnapshotChunks;
|
|
1455
|
-
private toRemoteReadChunks;
|
|
1456
|
-
private hardenReadChunkAssetUrls;
|
|
1390
|
+
private readCommittedParsedStorageResult;
|
|
1457
1391
|
private scheduleParsedStorageSync;
|
|
1458
1392
|
private syncRemoteDocumentToParsedStorage;
|
|
1393
|
+
private syncRemoteDocumentChunksToParsedStorage;
|
|
1394
|
+
private readRemoteReconstructionChunks;
|
|
1459
1395
|
private requireParsedStorageConfig;
|
|
1460
1396
|
private findLocalDocumentByRemoteId;
|
|
1461
1397
|
private getPublishedDocumentJobId;
|
|
@@ -1559,53 +1495,18 @@ declare function storeParseResultAssets(result: ParseResult, options?: KnowhereA
|
|
|
1559
1495
|
declare class DiskParsedDocumentStorage implements ParsedDocumentStorage {
|
|
1560
1496
|
private readonly rootDirectory;
|
|
1561
1497
|
constructor(rootDirectory: string);
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
readonly revisionKey: string;
|
|
1569
|
-
readonly manifest: KnowhereParsedSnapshotManifest;
|
|
1570
|
-
}): Promise<void>;
|
|
1571
|
-
readChunkPage(params: {
|
|
1572
|
-
readonly documentId: string;
|
|
1573
|
-
readonly revisionKey: string;
|
|
1574
|
-
readonly page: number;
|
|
1575
|
-
}): Promise<KnowhereParsedSnapshotChunkPage | null>;
|
|
1576
|
-
writeChunkPage(params: {
|
|
1577
|
-
readonly documentId: string;
|
|
1578
|
-
readonly revisionKey: string;
|
|
1579
|
-
readonly page: KnowhereParsedSnapshotChunkPage;
|
|
1580
|
-
}): Promise<void>;
|
|
1581
|
-
writeAsset(params: {
|
|
1582
|
-
readonly documentId: string;
|
|
1583
|
-
readonly revisionKey: string;
|
|
1584
|
-
readonly sourcePath: string;
|
|
1585
|
-
readonly body: Uint8Array;
|
|
1586
|
-
readonly contentType: string;
|
|
1587
|
-
readonly metadata?: Readonly<Record<string, string>>;
|
|
1588
|
-
}): Promise<{
|
|
1589
|
-
readonly sourcePath: string;
|
|
1590
|
-
readonly url?: string;
|
|
1591
|
-
}>;
|
|
1592
|
-
getAssetUrl(params: {
|
|
1593
|
-
readonly documentId: string;
|
|
1594
|
-
readonly revisionKey: string;
|
|
1595
|
-
readonly sourcePath: string;
|
|
1596
|
-
}): Promise<string | null>;
|
|
1597
|
-
readSyncProgress(params: {
|
|
1598
|
-
readonly documentId: string;
|
|
1599
|
-
readonly revisionKey: string;
|
|
1600
|
-
}): Promise<ParsedDocumentSyncProgress | null>;
|
|
1498
|
+
readObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObject | null>;
|
|
1499
|
+
writeObject(params: ParsedDocumentWriteObjectParams): Promise<ParsedDocumentWriteObjectResult>;
|
|
1500
|
+
headObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObjectHead | null>;
|
|
1501
|
+
getObjectUrl(params: ParsedDocumentObjectParams): Promise<string | null>;
|
|
1502
|
+
deletePrefix(params: ParsedDocumentRevisionParams): Promise<void>;
|
|
1503
|
+
readSyncProgress(params: ParsedDocumentRevisionParams): Promise<ParsedDocumentSyncProgress | null>;
|
|
1601
1504
|
writeSyncProgress(params: ParsedDocumentSyncProgress): Promise<void>;
|
|
1602
|
-
private
|
|
1603
|
-
private getChunkPagePath;
|
|
1604
|
-
private getProgressPath;
|
|
1605
|
-
private getAssetPath;
|
|
1505
|
+
private getObjectPath;
|
|
1606
1506
|
private getRevisionDirectory;
|
|
1607
1507
|
private readOptionalJson;
|
|
1608
|
-
private
|
|
1508
|
+
private readObjectMetadata;
|
|
1509
|
+
private writeObjectMetadata;
|
|
1609
1510
|
}
|
|
1610
1511
|
|
|
1611
1512
|
declare function syncParseResultToParsedDocumentStorage(params: {
|
|
@@ -1613,12 +1514,12 @@ declare function syncParseResultToParsedDocumentStorage(params: {
|
|
|
1613
1514
|
readonly storage: ParsedDocumentStorage;
|
|
1614
1515
|
readonly documentId?: string;
|
|
1615
1516
|
readonly revisionKey?: string;
|
|
1616
|
-
readonly
|
|
1517
|
+
readonly source?: ParsedDocumentCommitSource;
|
|
1617
1518
|
}): Promise<{
|
|
1618
1519
|
readonly result: ParseResult;
|
|
1619
|
-
readonly snapshot?: KnowhereParsedSnapshot;
|
|
1620
1520
|
readonly documentId: string;
|
|
1621
1521
|
readonly revisionKey: string;
|
|
1522
|
+
readonly commit: ParsedDocumentCommit;
|
|
1622
1523
|
}>;
|
|
1623
1524
|
|
|
1624
1525
|
/**
|
|
@@ -1750,4 +1651,4 @@ declare class JobFailedError extends KnowhereError {
|
|
|
1750
1651
|
constructor(message: string, code: string, jobResult: JobResult);
|
|
1751
1652
|
}
|
|
1752
1653
|
|
|
1753
|
-
export { APIError, type AuthTokenProvider, AuthenticationError, BadRequestError, type BaseChunk, ChecksumError, type Chunk, ConflictError, type CreateJobParams, DiskParsedDocumentStorage, type DocType, type Document, type DocumentChunk, type DocumentChunkGetParams, type DocumentChunkListParams, type DocumentChunkListResponse, type DocumentChunkPagination, type DocumentChunkResponse, type DocumentChunkType, type DocumentListPagination, type DocumentListParams, type DocumentListResponse, type DocumentMetadata, type DocumentPageCitationSource, Documents, type FileIndex, GatewayTimeoutError, type ImageChunk, InternalServerError, InvalidStateError, type Job, type JobError, JobFailedError, type JobResult, type JobStatus, Jobs, Knowhere, type KnowhereAssetStorageAdapter, type KnowhereAssetStorageBody, type KnowhereAssetStorageHead, type KnowhereAssetStorageObject, type KnowhereAssetStorageOptions, type KnowhereAssetStorageResult, type KnowhereAssetStorageWriteResult, KnowhereError, type KnowhereOptions,
|
|
1654
|
+
export { APIError, type AuthTokenProvider, AuthenticationError, BadRequestError, type BaseChunk, ChecksumError, type Chunk, ConflictError, type CreateJobParams, DiskParsedDocumentStorage, type DocType, type Document, type DocumentChunk, type DocumentChunkGetParams, type DocumentChunkListParams, type DocumentChunkListResponse, type DocumentChunkPagination, type DocumentChunkResponse, type DocumentChunkType, type DocumentListPagination, type DocumentListParams, type DocumentListResponse, type DocumentMetadata, type DocumentPageCitationSource, Documents, type FileIndex, GatewayTimeoutError, type ImageChunk, InternalServerError, InvalidStateError, type Job, type JobError, JobFailedError, type JobResult, type JobStatus, Jobs, Knowhere, type KnowhereAssetStorageAdapter, type KnowhereAssetStorageBody, type KnowhereAssetStorageHead, type KnowhereAssetStorageObject, type KnowhereAssetStorageOptions, type KnowhereAssetStorageResult, type KnowhereAssetStorageWriteResult, KnowhereError, type KnowhereOptions, Knowledge, type KnowledgeAsyncJobStatusResponse, type KnowledgeAsyncParseParams, type KnowledgeAsyncParseResponse, type KnowledgeCacheDocumentParams, type KnowledgeCacheJobResultParams, type KnowledgeChunkType, type KnowledgeDocumentReference, type KnowledgeGrepMatch, type KnowledgeGrepParams, type KnowledgeGrepResponse, type KnowledgeImportJobResultParams, type KnowledgeJobResultResponse, type KnowledgeLoadJobResultParams, type KnowledgeOutline, type KnowledgeParseParams, type KnowledgeParsedStorageOptions, type KnowledgeReadChunk, type KnowledgeReadParams, type KnowledgeReadResponse, type KnowledgeSearchParams, type KnowledgeSearchReference, type KnowledgeSearchResponse, type KnowledgeSearchResult, type KnowledgeSection, type KnowledgeStartupRecoveryResponse, type KnowledgeSyncParsedDocumentParams, type KnowledgeSyncParsedDocumentResponse, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, type ParsedDocumentCommit, type ParsedDocumentCommitSource, type ParsedDocumentObject, type ParsedDocumentObjectHead, type ParsedDocumentObjectParams, type ParsedDocumentRevisionParams, type ParsedDocumentStorage, type ParsedDocumentStorageConfig, type ParsedDocumentStorageDocument, type ParsedDocumentStorageLimits, type ParsedDocumentSyncProgress, type ParsedDocumentSyncScheduler, type ParsedDocumentWriteObjectParams, type ParsedDocumentWriteObjectResult, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalFilterMode, type RetrievalQueryParams, type RetrievalQueryResponse, type RetrievalReferencedChunk, type RetrievalResult, type RetrievalSectionExclusion, type RetrievalSource, ServiceUnavailableError, type Statistics, type TableChunk, type TextChunk, TimeoutError, type UploadParams, type UploadProgress, VERSION, ValidationError, type WaitOptions, type WebhookConfig, Knowhere as default, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
|