@ontos-ai/knowhere-sdk 2.4.1 → 2.5.0
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 +12 -0
- package/dist/chunk-4PWLXJGH.mjs +719 -0
- package/dist/index.d.mts +45 -8
- package/dist/index.d.ts +45 -8
- package/dist/index.js +1051 -513
- package/dist/index.mjs +127 -446
- package/dist/sequential-parsed-document-archive-S56UEARH.mjs +139 -0
- package/package.json +5 -2
package/dist/index.d.mts
CHANGED
|
@@ -199,14 +199,23 @@ interface Manifest {
|
|
|
199
199
|
interface ConnectTo {
|
|
200
200
|
/** Target chunk_id */
|
|
201
201
|
target: string;
|
|
202
|
-
/**
|
|
203
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Relationship type.
|
|
204
|
+
* - `embeds`: body chunk -> inline image/table asset
|
|
205
|
+
* - `embedded_by`: image/table asset -> owning body chunk (reverse of `embeds`)
|
|
206
|
+
* - `related`: same-page body chunk -> asset
|
|
207
|
+
* - `cross_doc_entity` / `intra_doc_ref`: reserved, not produced yet
|
|
208
|
+
*/
|
|
209
|
+
relation: 'embeds' | 'embedded_by' | 'related' | 'cross_doc_entity' | 'intra_doc_ref';
|
|
210
|
+
/** Reserved for cross-document targets; omitted for same-document edges */
|
|
211
|
+
targetDocumentId?: string;
|
|
204
212
|
/** Placeholder ref in content, e.g. '[images/a.png]' (embeds only) */
|
|
205
213
|
ref?: string;
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
/** Character offsets of `ref` in the body content (embeds only) */
|
|
215
|
+
position?: {
|
|
216
|
+
start: number;
|
|
217
|
+
end: number;
|
|
218
|
+
};
|
|
210
219
|
}
|
|
211
220
|
/**
|
|
212
221
|
* A single image or table resource entry in ``doc_nav.json``.
|
|
@@ -432,6 +441,11 @@ interface ParsedDocumentWriteObjectParams extends ParsedDocumentObjectParams {
|
|
|
432
441
|
readonly contentType: string;
|
|
433
442
|
readonly metadata?: Readonly<Record<string, string>>;
|
|
434
443
|
}
|
|
444
|
+
/** Stream sinks must consume the body before resolving and reject partial writes. */
|
|
445
|
+
interface ParsedDocumentWriteObjectStreamParams extends Omit<ParsedDocumentWriteObjectParams, 'body'> {
|
|
446
|
+
readonly body: ReadableStream<Uint8Array>;
|
|
447
|
+
readonly signal?: AbortSignal;
|
|
448
|
+
}
|
|
435
449
|
interface ParsedDocumentWriteObjectResult extends ParsedDocumentObjectParams {
|
|
436
450
|
readonly url?: string;
|
|
437
451
|
}
|
|
@@ -447,6 +461,11 @@ interface ParsedDocumentSyncProgress {
|
|
|
447
461
|
readonly documentId: string;
|
|
448
462
|
readonly revisionKey: string;
|
|
449
463
|
readonly nextChunkPage?: number;
|
|
464
|
+
readonly pinnedRevisionKey?: string;
|
|
465
|
+
readonly archiveIdentity?: string;
|
|
466
|
+
readonly nextArchiveEntry?: number;
|
|
467
|
+
/** Content hashes for verifying a sequential retry without a strong HTTP validator. */
|
|
468
|
+
readonly archiveEntryHashes?: readonly string[];
|
|
450
469
|
readonly status: 'running' | 'completed' | 'failed';
|
|
451
470
|
readonly updatedAt: string;
|
|
452
471
|
readonly error?: string;
|
|
@@ -454,6 +473,7 @@ interface ParsedDocumentSyncProgress {
|
|
|
454
473
|
interface ParsedDocumentStorage {
|
|
455
474
|
readObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObject | null>;
|
|
456
475
|
writeObject(params: ParsedDocumentWriteObjectParams): Promise<ParsedDocumentWriteObjectResult>;
|
|
476
|
+
writeObjectStream?(params: ParsedDocumentWriteObjectStreamParams): Promise<ParsedDocumentWriteObjectResult>;
|
|
457
477
|
headObject?(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObjectHead | null>;
|
|
458
478
|
getObjectUrl?(params: ParsedDocumentObjectParams): Promise<string | null>;
|
|
459
479
|
deletePrefix?(params: ParsedDocumentRevisionParams): Promise<void>;
|
|
@@ -464,6 +484,10 @@ interface ParsedDocumentSyncScheduler {
|
|
|
464
484
|
schedule(task: () => Promise<void>): void | Promise<void>;
|
|
465
485
|
}
|
|
466
486
|
interface ParsedDocumentStorageLimits {
|
|
487
|
+
/** ZIP entries copied per invocation (default 100). */
|
|
488
|
+
readonly maxEntriesPerSync?: number;
|
|
489
|
+
/** ZIP copy budget checked between entries (default 120000ms). */
|
|
490
|
+
readonly archiveSyncDeadlineMs?: number;
|
|
467
491
|
readonly remotePageSize?: number;
|
|
468
492
|
readonly maxPagesPerSync?: number;
|
|
469
493
|
readonly syncDeadlineMs?: number;
|
|
@@ -1294,7 +1318,11 @@ interface KnowledgeDocumentReference {
|
|
|
1294
1318
|
revisionKey?: string;
|
|
1295
1319
|
}
|
|
1296
1320
|
type KnowledgeParsedStorageOptions = ParsedDocumentStorageConfig;
|
|
1297
|
-
|
|
1321
|
+
interface KnowledgeSyncParsedDocumentParams extends KnowledgeDocumentReference {
|
|
1322
|
+
readonly signal?: AbortSignal;
|
|
1323
|
+
/** Optionally retain the exact source ZIP as result.zip after committing the snapshot. */
|
|
1324
|
+
readonly retainResultArchive?: boolean;
|
|
1325
|
+
}
|
|
1298
1326
|
interface KnowledgeSyncParsedDocumentResponse {
|
|
1299
1327
|
documentId: string;
|
|
1300
1328
|
revisionKey: string;
|
|
@@ -1608,6 +1636,8 @@ declare function syncParseResultToParsedDocumentStorage(params: {
|
|
|
1608
1636
|
readonly documentId?: string;
|
|
1609
1637
|
readonly revisionKey?: string;
|
|
1610
1638
|
readonly source?: ParsedDocumentCommitSource;
|
|
1639
|
+
readonly signal?: AbortSignal;
|
|
1640
|
+
readonly beforeCommit?: () => Promise<void>;
|
|
1611
1641
|
}): Promise<{
|
|
1612
1642
|
readonly result: ParseResult;
|
|
1613
1643
|
readonly documentId: string;
|
|
@@ -1744,4 +1774,11 @@ declare class JobFailedError extends KnowhereError {
|
|
|
1744
1774
|
constructor(message: string, code: string, jobResult: JobResult);
|
|
1745
1775
|
}
|
|
1746
1776
|
|
|
1747
|
-
|
|
1777
|
+
/** The sequential ZIP fallback could not access its SDK-owned temporary storage. */
|
|
1778
|
+
declare class ParsedDocumentArchiveError extends KnowhereError {
|
|
1779
|
+
readonly code: "ARCHIVE_SPOOL_FAILED";
|
|
1780
|
+
readonly cause: unknown;
|
|
1781
|
+
constructor(cause: unknown);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
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 LlmConfig, type LlmModelsConfig, type LlmProviderConfig, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NODE_SDK_DOCUMENT_METADATA_DEFAULTS, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, ParsedDocumentArchiveError, 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 ParsedDocumentWriteObjectStreamParams, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalEvidencePart, 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, mergeDocumentMetadataDefaults, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
|
package/dist/index.d.ts
CHANGED
|
@@ -199,14 +199,23 @@ interface Manifest {
|
|
|
199
199
|
interface ConnectTo {
|
|
200
200
|
/** Target chunk_id */
|
|
201
201
|
target: string;
|
|
202
|
-
/**
|
|
203
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Relationship type.
|
|
204
|
+
* - `embeds`: body chunk -> inline image/table asset
|
|
205
|
+
* - `embedded_by`: image/table asset -> owning body chunk (reverse of `embeds`)
|
|
206
|
+
* - `related`: same-page body chunk -> asset
|
|
207
|
+
* - `cross_doc_entity` / `intra_doc_ref`: reserved, not produced yet
|
|
208
|
+
*/
|
|
209
|
+
relation: 'embeds' | 'embedded_by' | 'related' | 'cross_doc_entity' | 'intra_doc_ref';
|
|
210
|
+
/** Reserved for cross-document targets; omitted for same-document edges */
|
|
211
|
+
targetDocumentId?: string;
|
|
204
212
|
/** Placeholder ref in content, e.g. '[images/a.png]' (embeds only) */
|
|
205
213
|
ref?: string;
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
214
|
+
/** Character offsets of `ref` in the body content (embeds only) */
|
|
215
|
+
position?: {
|
|
216
|
+
start: number;
|
|
217
|
+
end: number;
|
|
218
|
+
};
|
|
210
219
|
}
|
|
211
220
|
/**
|
|
212
221
|
* A single image or table resource entry in ``doc_nav.json``.
|
|
@@ -432,6 +441,11 @@ interface ParsedDocumentWriteObjectParams extends ParsedDocumentObjectParams {
|
|
|
432
441
|
readonly contentType: string;
|
|
433
442
|
readonly metadata?: Readonly<Record<string, string>>;
|
|
434
443
|
}
|
|
444
|
+
/** Stream sinks must consume the body before resolving and reject partial writes. */
|
|
445
|
+
interface ParsedDocumentWriteObjectStreamParams extends Omit<ParsedDocumentWriteObjectParams, 'body'> {
|
|
446
|
+
readonly body: ReadableStream<Uint8Array>;
|
|
447
|
+
readonly signal?: AbortSignal;
|
|
448
|
+
}
|
|
435
449
|
interface ParsedDocumentWriteObjectResult extends ParsedDocumentObjectParams {
|
|
436
450
|
readonly url?: string;
|
|
437
451
|
}
|
|
@@ -447,6 +461,11 @@ interface ParsedDocumentSyncProgress {
|
|
|
447
461
|
readonly documentId: string;
|
|
448
462
|
readonly revisionKey: string;
|
|
449
463
|
readonly nextChunkPage?: number;
|
|
464
|
+
readonly pinnedRevisionKey?: string;
|
|
465
|
+
readonly archiveIdentity?: string;
|
|
466
|
+
readonly nextArchiveEntry?: number;
|
|
467
|
+
/** Content hashes for verifying a sequential retry without a strong HTTP validator. */
|
|
468
|
+
readonly archiveEntryHashes?: readonly string[];
|
|
450
469
|
readonly status: 'running' | 'completed' | 'failed';
|
|
451
470
|
readonly updatedAt: string;
|
|
452
471
|
readonly error?: string;
|
|
@@ -454,6 +473,7 @@ interface ParsedDocumentSyncProgress {
|
|
|
454
473
|
interface ParsedDocumentStorage {
|
|
455
474
|
readObject(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObject | null>;
|
|
456
475
|
writeObject(params: ParsedDocumentWriteObjectParams): Promise<ParsedDocumentWriteObjectResult>;
|
|
476
|
+
writeObjectStream?(params: ParsedDocumentWriteObjectStreamParams): Promise<ParsedDocumentWriteObjectResult>;
|
|
457
477
|
headObject?(params: ParsedDocumentObjectParams): Promise<ParsedDocumentObjectHead | null>;
|
|
458
478
|
getObjectUrl?(params: ParsedDocumentObjectParams): Promise<string | null>;
|
|
459
479
|
deletePrefix?(params: ParsedDocumentRevisionParams): Promise<void>;
|
|
@@ -464,6 +484,10 @@ interface ParsedDocumentSyncScheduler {
|
|
|
464
484
|
schedule(task: () => Promise<void>): void | Promise<void>;
|
|
465
485
|
}
|
|
466
486
|
interface ParsedDocumentStorageLimits {
|
|
487
|
+
/** ZIP entries copied per invocation (default 100). */
|
|
488
|
+
readonly maxEntriesPerSync?: number;
|
|
489
|
+
/** ZIP copy budget checked between entries (default 120000ms). */
|
|
490
|
+
readonly archiveSyncDeadlineMs?: number;
|
|
467
491
|
readonly remotePageSize?: number;
|
|
468
492
|
readonly maxPagesPerSync?: number;
|
|
469
493
|
readonly syncDeadlineMs?: number;
|
|
@@ -1294,7 +1318,11 @@ interface KnowledgeDocumentReference {
|
|
|
1294
1318
|
revisionKey?: string;
|
|
1295
1319
|
}
|
|
1296
1320
|
type KnowledgeParsedStorageOptions = ParsedDocumentStorageConfig;
|
|
1297
|
-
|
|
1321
|
+
interface KnowledgeSyncParsedDocumentParams extends KnowledgeDocumentReference {
|
|
1322
|
+
readonly signal?: AbortSignal;
|
|
1323
|
+
/** Optionally retain the exact source ZIP as result.zip after committing the snapshot. */
|
|
1324
|
+
readonly retainResultArchive?: boolean;
|
|
1325
|
+
}
|
|
1298
1326
|
interface KnowledgeSyncParsedDocumentResponse {
|
|
1299
1327
|
documentId: string;
|
|
1300
1328
|
revisionKey: string;
|
|
@@ -1608,6 +1636,8 @@ declare function syncParseResultToParsedDocumentStorage(params: {
|
|
|
1608
1636
|
readonly documentId?: string;
|
|
1609
1637
|
readonly revisionKey?: string;
|
|
1610
1638
|
readonly source?: ParsedDocumentCommitSource;
|
|
1639
|
+
readonly signal?: AbortSignal;
|
|
1640
|
+
readonly beforeCommit?: () => Promise<void>;
|
|
1611
1641
|
}): Promise<{
|
|
1612
1642
|
readonly result: ParseResult;
|
|
1613
1643
|
readonly documentId: string;
|
|
@@ -1744,4 +1774,11 @@ declare class JobFailedError extends KnowhereError {
|
|
|
1744
1774
|
constructor(message: string, code: string, jobResult: JobResult);
|
|
1745
1775
|
}
|
|
1746
1776
|
|
|
1747
|
-
|
|
1777
|
+
/** The sequential ZIP fallback could not access its SDK-owned temporary storage. */
|
|
1778
|
+
declare class ParsedDocumentArchiveError extends KnowhereError {
|
|
1779
|
+
readonly code: "ARCHIVE_SPOOL_FAILED";
|
|
1780
|
+
readonly cause: unknown;
|
|
1781
|
+
constructor(cause: unknown);
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
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 LlmConfig, type LlmModelsConfig, type LlmProviderConfig, type LoadOptions, type LocalKnowledgeDocument, type LocalKnowledgeParseResponse, LocalKnowledgeStore, type Manifest, NODE_SDK_DOCUMENT_METADATA_DEFAULTS, NetworkError, NotFoundError, type PageChunk, type PageCitationAsset, type PageCitationAssetContentType, type PageCitationAssetSource, type ParseParams, type ParseResult, ParsedDocumentArchiveError, 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 ParsedDocumentWriteObjectStreamParams, type ParsingModel, type ParsingParams, PaymentRequiredError, PermissionDeniedError, type PollProgress, PollingTimeoutError, RateLimitError, Retrieval, type RetrievalChannel, type RetrievalChunkType, type RetrievalEvidencePart, 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, mergeDocumentMetadataDefaults, storeParseResultAssets, syncParseResultToParsedDocumentStorage };
|