@docling/docling-client 2.146.0 → 2.148.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/PYTHON_CLIENT_PARITY.md +82 -19
- package/dist/index.cjs +69 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +68 -7
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ interface DoclingDocument {
|
|
|
12
12
|
name: string;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
}
|
|
15
|
-
type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'iwork_numbers' | 'ebcdic' | 'afp';
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'iwork_numbers' | 'ebcdic' | 'afp' | 'calendar';
|
|
16
16
|
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks' | 'latex';
|
|
17
17
|
type ProcessingPipeline = 'legacy' | 'standard' | 'native' | 'vlm' | 'asr';
|
|
18
18
|
type TableMode = 'fast' | 'accurate';
|
|
@@ -20,7 +20,7 @@ type TableFormerMode = TableMode;
|
|
|
20
20
|
type ImageExportMode = 'placeholder' | 'embedded' | 'referenced';
|
|
21
21
|
type ImageRefMode = ImageExportMode;
|
|
22
22
|
type PdfBackend = 'pypdfium2' | 'docling_parse' | 'threaded_docling_parse' | '_docling_parse' | 'dlparse_v1' | 'dlparse_v2' | 'dlparse_v4';
|
|
23
|
-
type VlmResponseFormat = 'doctags' | 'doclang' | 'markdown' | 'deepseekocr_markdown' | 'unlimited_ocr_markdown' | 'html' | 'otsl' | 'plaintext' | 'chandra_html' | 'dots_json' | 'nemotron_parse_v2' | 'mineru2';
|
|
23
|
+
type VlmResponseFormat = 'doctags' | 'doclang' | 'markdown' | 'deepseekocr_markdown' | 'unlimited_ocr_markdown' | 'unlimited_ocr2' | 'lightonocr_markdown' | 'html' | 'otsl' | 'plaintext' | 'chandra_html' | 'surya_html' | 'dots_json' | 'nemotron_parse_v2' | 'nemotron_parse_v3_5' | 'mineru2';
|
|
24
24
|
type ResponseFormat = VlmResponseFormat;
|
|
25
25
|
type VlmInferenceFramework = 'mlx' | 'transformers' | 'vllm';
|
|
26
26
|
type InferenceFramework = VlmInferenceFramework;
|
|
@@ -730,6 +730,12 @@ interface SubmitAndRetrieveOptions<TTarget extends SubmitTarget> {
|
|
|
730
730
|
}
|
|
731
731
|
|
|
732
732
|
type ArtifactAddressResolver = (hostname: string) => Promise<string[]>;
|
|
733
|
+
interface ParsedOrigin {
|
|
734
|
+
protocol: string;
|
|
735
|
+
hostname: string;
|
|
736
|
+
port: number;
|
|
737
|
+
}
|
|
738
|
+
declare function parseArtifactOrigin(value: string): ParsedOrigin;
|
|
733
739
|
interface ArtifactDownloaderOptions {
|
|
734
740
|
fetch?: typeof globalThis.fetch;
|
|
735
741
|
resolver?: ArtifactAddressResolver;
|
|
@@ -737,6 +743,7 @@ interface ArtifactDownloaderOptions {
|
|
|
737
743
|
timeoutMs?: number;
|
|
738
744
|
maxBytes?: number;
|
|
739
745
|
maxRedirects?: number;
|
|
746
|
+
artifactUrlAllowlist?: string[];
|
|
740
747
|
}
|
|
741
748
|
declare class ArtifactDownloader {
|
|
742
749
|
#private;
|
|
@@ -840,6 +847,10 @@ interface DoclingClientOptions {
|
|
|
840
847
|
maxConcurrency?: number;
|
|
841
848
|
artifactDownloader?: ArtifactDownloader;
|
|
842
849
|
artifactDownload?: ArtifactDownloaderOptions;
|
|
850
|
+
artifactDownloadTimeout?: number;
|
|
851
|
+
maxArtifactDownloadBytes?: number;
|
|
852
|
+
artifactUrlAllowlist?: string[];
|
|
853
|
+
allowPrivateArtifactUrls?: boolean;
|
|
843
854
|
}
|
|
844
855
|
interface SubmitCallOptions {
|
|
845
856
|
signal?: AbortSignal;
|
|
@@ -1107,5 +1118,5 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
|
|
|
1107
1118
|
declare function appendFormValue(form: FormData, key: string, value: unknown): void;
|
|
1108
1119
|
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
1109
1120
|
|
|
1110
|
-
export { ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1111
|
-
export type { AnyHttpSourceRequest, ArtifactAddressResolver, ArtifactDownloaderOptions, ArtifactRef, ArtifactType, AutoSubmitResult, AzureBlobCoordinates, AzureBlobSource, AzureBlobSourceRequest, AzureBlobTarget, BaseChunkDocumentsRequest, BaseChunkerOptions, BaseChunkingOptions, BaseProgress, BatchConvertSourcesRequest, BatchResultForTarget, BatchSource, BatchSourceRequestInput, BatchSourceRequestItem, BatchSubmitCallOptions, BatchTarget, BatchTargetRequest, BatchTargetRequestInput, BinaryFileSource, CallbackSpec, ChunkCallOptions, ChunkDocumentResponse, ChunkSourceOptions, ChunkSourcesRequest, ChunkedDocumentResult, ChunkedDocumentResultItem, ChunkingExportOptions, ChunkingOptionType, ClearResponse, ConfidenceScores, ConversionInput, ConversionItem, ConversionResult, ConversionSource, ConversionSourceInput, ConversionStatus, ConvertAllOptions, ConvertDocumentErrorResponse, ConvertDocumentResponse, ConvertDocumentResult, ConvertDocumentsOptions, ConvertDocumentsRequest, ConvertOptions, ConvertSourcesRequest, ConvertedOutcomeCountsMixin, DoclingBinaryResponse, DoclingClientOptions, DoclingComponentType, DoclingDocument, DoclingRequestBodyType, DoclingResponseType, DoclingTaskResult, DoclingTransport, DoclingTransportRequest, DocumentArtifactItem, DocumentCompletedItem, DocumentLimits, DocumentResultItem, ErrorItem, ExportDocumentResponse, ExportResult, FailureCategory, FailurePhase, FetchLike, FetchTransportOptions, FileSource, FileSourceRequest, GenericChunkDocumentsRequest, GenericSource, GenericSourceRequest, GenericTarget, GenericTargetRequest, GoogleCloudStorageCoordinates, GoogleCloudStorageServiceAccountInfo, GoogleCloudStorageSource, GoogleCloudStorageSourceRequest, GoogleCloudStorageTarget, GoogleDriveCoordinates, GoogleDriveCredentials, GoogleDriveSource, GoogleDriveSourceRequest, GoogleDriveTarget, HeadingHierarchyOptions, HealthCheckResponse, HierarchicalChunkSourcesRequest, HierarchicalChunkerOptions, HierarchicalChunkingOptions, HttpSource, HttpSourceRequest, HybridChunkSourcesRequest, HybridChunkerOptions, HybridChunkingOptions, ImageExportMode, ImageRefMode, InBodyConversionResponse, InBodyTarget, InferenceFramework, InputFormat, KnownBatchSourceRequestItem, KnownBatchTargetRequest, LegacyVlmModelType, MessageKind, NormalizedJsonSource, NormalizedMultipartSource, NormalizedSource, OutcomeCounts, OutputFormat, PdfBackend, PictureClassificationLabel, PictureDescriptionApi, PictureDescriptionLocal, PresignedArtifactResult, PresignedUrlConvertDocumentResponse, PresignedUrlConvertResponse, PresignedUrlTarget, ProcessedDocsItem, ProcessingPipeline, ProfilingItem, ProfilingScope, ProgressCallbackRequest, ProgressCallbackResponse, ProgressDocumentCompleted, ProgressKind, ProgressSetNumDocs, ProgressTaskCompleted, ProgressUpdateProcessed, PublicFailureInfo, PutTarget, QualityGrade, RawServiceResult, ReadinessResponse, RemoteTargetResponse, RemoteTargetResult, ResponseFormat, ResultType, S3Coordinates, S3Source, S3SourceRequest, S3Target, SourceRequestItem, StorageTarget, SubmitAndRetrieveOptions, SubmitCallOptions, SubmitResultForTarget, SubmitSourceOptions, SubmitTarget, TableFormerMode, TableMode, Target, TargetRequest, TaskFailureResult, TaskProcessingMeta, TaskStatus, TaskStatusResponse, TaskType, TransformersModelType, UsageLimitExceededDetails, UsageLimitExceededResponse, VlmInferenceFramework, VlmModelApi, VlmModelLocal, VlmModelType, VlmResponseFormat, WaitForTaskOptions, WatchTaskOptions, WebSocketFactory, WebSocketFactoryOptions, WebSocketLike, WebsocketMessage, ZipArchiveResult, ZipTarget };
|
|
1121
|
+
export { ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1122
|
+
export type { AnyHttpSourceRequest, ArtifactAddressResolver, ArtifactDownloaderOptions, ArtifactRef, ArtifactType, AutoSubmitResult, AzureBlobCoordinates, AzureBlobSource, AzureBlobSourceRequest, AzureBlobTarget, BaseChunkDocumentsRequest, BaseChunkerOptions, BaseChunkingOptions, BaseProgress, BatchConvertSourcesRequest, BatchResultForTarget, BatchSource, BatchSourceRequestInput, BatchSourceRequestItem, BatchSubmitCallOptions, BatchTarget, BatchTargetRequest, BatchTargetRequestInput, BinaryFileSource, CallbackSpec, ChunkCallOptions, ChunkDocumentResponse, ChunkSourceOptions, ChunkSourcesRequest, ChunkedDocumentResult, ChunkedDocumentResultItem, ChunkingExportOptions, ChunkingOptionType, ClearResponse, ConfidenceScores, ConversionInput, ConversionItem, ConversionResult, ConversionSource, ConversionSourceInput, ConversionStatus, ConvertAllOptions, ConvertDocumentErrorResponse, ConvertDocumentResponse, ConvertDocumentResult, ConvertDocumentsOptions, ConvertDocumentsRequest, ConvertOptions, ConvertSourcesRequest, ConvertedOutcomeCountsMixin, DoclingBinaryResponse, DoclingClientOptions, DoclingComponentType, DoclingDocument, DoclingRequestBodyType, DoclingResponseType, DoclingTaskResult, DoclingTransport, DoclingTransportRequest, DocumentArtifactItem, DocumentCompletedItem, DocumentLimits, DocumentResultItem, ErrorItem, ExportDocumentResponse, ExportResult, FailureCategory, FailurePhase, FetchLike, FetchTransportOptions, FileSource, FileSourceRequest, GenericChunkDocumentsRequest, GenericSource, GenericSourceRequest, GenericTarget, GenericTargetRequest, GoogleCloudStorageCoordinates, GoogleCloudStorageServiceAccountInfo, GoogleCloudStorageSource, GoogleCloudStorageSourceRequest, GoogleCloudStorageTarget, GoogleDriveCoordinates, GoogleDriveCredentials, GoogleDriveSource, GoogleDriveSourceRequest, GoogleDriveTarget, HeadingHierarchyOptions, HealthCheckResponse, HierarchicalChunkSourcesRequest, HierarchicalChunkerOptions, HierarchicalChunkingOptions, HttpSource, HttpSourceRequest, HybridChunkSourcesRequest, HybridChunkerOptions, HybridChunkingOptions, ImageExportMode, ImageRefMode, InBodyConversionResponse, InBodyTarget, InferenceFramework, InputFormat, KnownBatchSourceRequestItem, KnownBatchTargetRequest, LegacyVlmModelType, MessageKind, NormalizedJsonSource, NormalizedMultipartSource, NormalizedSource, OutcomeCounts, OutputFormat, ParsedOrigin, PdfBackend, PictureClassificationLabel, PictureDescriptionApi, PictureDescriptionLocal, PresignedArtifactResult, PresignedUrlConvertDocumentResponse, PresignedUrlConvertResponse, PresignedUrlTarget, ProcessedDocsItem, ProcessingPipeline, ProfilingItem, ProfilingScope, ProgressCallbackRequest, ProgressCallbackResponse, ProgressDocumentCompleted, ProgressKind, ProgressSetNumDocs, ProgressTaskCompleted, ProgressUpdateProcessed, PublicFailureInfo, PutTarget, QualityGrade, RawServiceResult, ReadinessResponse, RemoteTargetResponse, RemoteTargetResult, ResponseFormat, ResultType, S3Coordinates, S3Source, S3SourceRequest, S3Target, SourceRequestItem, StorageTarget, SubmitAndRetrieveOptions, SubmitCallOptions, SubmitResultForTarget, SubmitSourceOptions, SubmitTarget, TableFormerMode, TableMode, Target, TargetRequest, TaskFailureResult, TaskProcessingMeta, TaskStatus, TaskStatusResponse, TaskType, TransformersModelType, UsageLimitExceededDetails, UsageLimitExceededResponse, VlmInferenceFramework, VlmModelApi, VlmModelLocal, VlmModelType, VlmResponseFormat, WaitForTaskOptions, WatchTaskOptions, WebSocketFactory, WebSocketFactoryOptions, WebSocketLike, WebsocketMessage, ZipArchiveResult, ZipTarget };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ interface DoclingDocument {
|
|
|
12
12
|
name: string;
|
|
13
13
|
[key: string]: unknown;
|
|
14
14
|
}
|
|
15
|
-
type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'iwork_numbers' | 'ebcdic' | 'afp';
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'rtf' | 'pptx' | 'ppt' | 'html' | 'mhtml' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_uspto' | 'xml_jats' | 'xml_xbrl' | 'xml_doclang' | 'dclx' | 'mets_gbs' | 'json_docling' | 'audio' | 'video' | 'vtt' | 'latex' | 'email' | 'epub' | 'boxnote' | 'iwork_pages' | 'iwork_keynote' | 'iwork_numbers' | 'ebcdic' | 'afp' | 'calendar';
|
|
16
16
|
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks' | 'latex';
|
|
17
17
|
type ProcessingPipeline = 'legacy' | 'standard' | 'native' | 'vlm' | 'asr';
|
|
18
18
|
type TableMode = 'fast' | 'accurate';
|
|
@@ -20,7 +20,7 @@ type TableFormerMode = TableMode;
|
|
|
20
20
|
type ImageExportMode = 'placeholder' | 'embedded' | 'referenced';
|
|
21
21
|
type ImageRefMode = ImageExportMode;
|
|
22
22
|
type PdfBackend = 'pypdfium2' | 'docling_parse' | 'threaded_docling_parse' | '_docling_parse' | 'dlparse_v1' | 'dlparse_v2' | 'dlparse_v4';
|
|
23
|
-
type VlmResponseFormat = 'doctags' | 'doclang' | 'markdown' | 'deepseekocr_markdown' | 'unlimited_ocr_markdown' | 'html' | 'otsl' | 'plaintext' | 'chandra_html' | 'dots_json' | 'nemotron_parse_v2' | 'mineru2';
|
|
23
|
+
type VlmResponseFormat = 'doctags' | 'doclang' | 'markdown' | 'deepseekocr_markdown' | 'unlimited_ocr_markdown' | 'unlimited_ocr2' | 'lightonocr_markdown' | 'html' | 'otsl' | 'plaintext' | 'chandra_html' | 'surya_html' | 'dots_json' | 'nemotron_parse_v2' | 'nemotron_parse_v3_5' | 'mineru2';
|
|
24
24
|
type ResponseFormat = VlmResponseFormat;
|
|
25
25
|
type VlmInferenceFramework = 'mlx' | 'transformers' | 'vllm';
|
|
26
26
|
type InferenceFramework = VlmInferenceFramework;
|
|
@@ -730,6 +730,12 @@ interface SubmitAndRetrieveOptions<TTarget extends SubmitTarget> {
|
|
|
730
730
|
}
|
|
731
731
|
|
|
732
732
|
type ArtifactAddressResolver = (hostname: string) => Promise<string[]>;
|
|
733
|
+
interface ParsedOrigin {
|
|
734
|
+
protocol: string;
|
|
735
|
+
hostname: string;
|
|
736
|
+
port: number;
|
|
737
|
+
}
|
|
738
|
+
declare function parseArtifactOrigin(value: string): ParsedOrigin;
|
|
733
739
|
interface ArtifactDownloaderOptions {
|
|
734
740
|
fetch?: typeof globalThis.fetch;
|
|
735
741
|
resolver?: ArtifactAddressResolver;
|
|
@@ -737,6 +743,7 @@ interface ArtifactDownloaderOptions {
|
|
|
737
743
|
timeoutMs?: number;
|
|
738
744
|
maxBytes?: number;
|
|
739
745
|
maxRedirects?: number;
|
|
746
|
+
artifactUrlAllowlist?: string[];
|
|
740
747
|
}
|
|
741
748
|
declare class ArtifactDownloader {
|
|
742
749
|
#private;
|
|
@@ -840,6 +847,10 @@ interface DoclingClientOptions {
|
|
|
840
847
|
maxConcurrency?: number;
|
|
841
848
|
artifactDownloader?: ArtifactDownloader;
|
|
842
849
|
artifactDownload?: ArtifactDownloaderOptions;
|
|
850
|
+
artifactDownloadTimeout?: number;
|
|
851
|
+
maxArtifactDownloadBytes?: number;
|
|
852
|
+
artifactUrlAllowlist?: string[];
|
|
853
|
+
allowPrivateArtifactUrls?: boolean;
|
|
843
854
|
}
|
|
844
855
|
interface SubmitCallOptions {
|
|
845
856
|
signal?: AbortSignal;
|
|
@@ -1107,5 +1118,5 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
|
|
|
1107
1118
|
declare function appendFormValue(form: FormData, key: string, value: unknown): void;
|
|
1108
1119
|
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
1109
1120
|
|
|
1110
|
-
export { ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1111
|
-
export type { AnyHttpSourceRequest, ArtifactAddressResolver, ArtifactDownloaderOptions, ArtifactRef, ArtifactType, AutoSubmitResult, AzureBlobCoordinates, AzureBlobSource, AzureBlobSourceRequest, AzureBlobTarget, BaseChunkDocumentsRequest, BaseChunkerOptions, BaseChunkingOptions, BaseProgress, BatchConvertSourcesRequest, BatchResultForTarget, BatchSource, BatchSourceRequestInput, BatchSourceRequestItem, BatchSubmitCallOptions, BatchTarget, BatchTargetRequest, BatchTargetRequestInput, BinaryFileSource, CallbackSpec, ChunkCallOptions, ChunkDocumentResponse, ChunkSourceOptions, ChunkSourcesRequest, ChunkedDocumentResult, ChunkedDocumentResultItem, ChunkingExportOptions, ChunkingOptionType, ClearResponse, ConfidenceScores, ConversionInput, ConversionItem, ConversionResult, ConversionSource, ConversionSourceInput, ConversionStatus, ConvertAllOptions, ConvertDocumentErrorResponse, ConvertDocumentResponse, ConvertDocumentResult, ConvertDocumentsOptions, ConvertDocumentsRequest, ConvertOptions, ConvertSourcesRequest, ConvertedOutcomeCountsMixin, DoclingBinaryResponse, DoclingClientOptions, DoclingComponentType, DoclingDocument, DoclingRequestBodyType, DoclingResponseType, DoclingTaskResult, DoclingTransport, DoclingTransportRequest, DocumentArtifactItem, DocumentCompletedItem, DocumentLimits, DocumentResultItem, ErrorItem, ExportDocumentResponse, ExportResult, FailureCategory, FailurePhase, FetchLike, FetchTransportOptions, FileSource, FileSourceRequest, GenericChunkDocumentsRequest, GenericSource, GenericSourceRequest, GenericTarget, GenericTargetRequest, GoogleCloudStorageCoordinates, GoogleCloudStorageServiceAccountInfo, GoogleCloudStorageSource, GoogleCloudStorageSourceRequest, GoogleCloudStorageTarget, GoogleDriveCoordinates, GoogleDriveCredentials, GoogleDriveSource, GoogleDriveSourceRequest, GoogleDriveTarget, HeadingHierarchyOptions, HealthCheckResponse, HierarchicalChunkSourcesRequest, HierarchicalChunkerOptions, HierarchicalChunkingOptions, HttpSource, HttpSourceRequest, HybridChunkSourcesRequest, HybridChunkerOptions, HybridChunkingOptions, ImageExportMode, ImageRefMode, InBodyConversionResponse, InBodyTarget, InferenceFramework, InputFormat, KnownBatchSourceRequestItem, KnownBatchTargetRequest, LegacyVlmModelType, MessageKind, NormalizedJsonSource, NormalizedMultipartSource, NormalizedSource, OutcomeCounts, OutputFormat, PdfBackend, PictureClassificationLabel, PictureDescriptionApi, PictureDescriptionLocal, PresignedArtifactResult, PresignedUrlConvertDocumentResponse, PresignedUrlConvertResponse, PresignedUrlTarget, ProcessedDocsItem, ProcessingPipeline, ProfilingItem, ProfilingScope, ProgressCallbackRequest, ProgressCallbackResponse, ProgressDocumentCompleted, ProgressKind, ProgressSetNumDocs, ProgressTaskCompleted, ProgressUpdateProcessed, PublicFailureInfo, PutTarget, QualityGrade, RawServiceResult, ReadinessResponse, RemoteTargetResponse, RemoteTargetResult, ResponseFormat, ResultType, S3Coordinates, S3Source, S3SourceRequest, S3Target, SourceRequestItem, StorageTarget, SubmitAndRetrieveOptions, SubmitCallOptions, SubmitResultForTarget, SubmitSourceOptions, SubmitTarget, TableFormerMode, TableMode, Target, TargetRequest, TaskFailureResult, TaskProcessingMeta, TaskStatus, TaskStatusResponse, TaskType, TransformersModelType, UsageLimitExceededDetails, UsageLimitExceededResponse, VlmInferenceFramework, VlmModelApi, VlmModelLocal, VlmModelType, VlmResponseFormat, WaitForTaskOptions, WatchTaskOptions, WebSocketFactory, WebSocketFactoryOptions, WebSocketLike, WebsocketMessage, ZipArchiveResult, ZipTarget };
|
|
1121
|
+
export { ArtifactDownloader, ChunkerKind, ChunkerType, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, DoclingClient, DoclingConversionError, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, DoclingResponseSchemaMismatchError, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, DoclingUsageLimitExceededError, FetchTransport, MAX_CONCURRENCY_LIMIT, StatusWatcherKind, TargetName, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1122
|
+
export type { AnyHttpSourceRequest, ArtifactAddressResolver, ArtifactDownloaderOptions, ArtifactRef, ArtifactType, AutoSubmitResult, AzureBlobCoordinates, AzureBlobSource, AzureBlobSourceRequest, AzureBlobTarget, BaseChunkDocumentsRequest, BaseChunkerOptions, BaseChunkingOptions, BaseProgress, BatchConvertSourcesRequest, BatchResultForTarget, BatchSource, BatchSourceRequestInput, BatchSourceRequestItem, BatchSubmitCallOptions, BatchTarget, BatchTargetRequest, BatchTargetRequestInput, BinaryFileSource, CallbackSpec, ChunkCallOptions, ChunkDocumentResponse, ChunkSourceOptions, ChunkSourcesRequest, ChunkedDocumentResult, ChunkedDocumentResultItem, ChunkingExportOptions, ChunkingOptionType, ClearResponse, ConfidenceScores, ConversionInput, ConversionItem, ConversionResult, ConversionSource, ConversionSourceInput, ConversionStatus, ConvertAllOptions, ConvertDocumentErrorResponse, ConvertDocumentResponse, ConvertDocumentResult, ConvertDocumentsOptions, ConvertDocumentsRequest, ConvertOptions, ConvertSourcesRequest, ConvertedOutcomeCountsMixin, DoclingBinaryResponse, DoclingClientOptions, DoclingComponentType, DoclingDocument, DoclingRequestBodyType, DoclingResponseType, DoclingTaskResult, DoclingTransport, DoclingTransportRequest, DocumentArtifactItem, DocumentCompletedItem, DocumentLimits, DocumentResultItem, ErrorItem, ExportDocumentResponse, ExportResult, FailureCategory, FailurePhase, FetchLike, FetchTransportOptions, FileSource, FileSourceRequest, GenericChunkDocumentsRequest, GenericSource, GenericSourceRequest, GenericTarget, GenericTargetRequest, GoogleCloudStorageCoordinates, GoogleCloudStorageServiceAccountInfo, GoogleCloudStorageSource, GoogleCloudStorageSourceRequest, GoogleCloudStorageTarget, GoogleDriveCoordinates, GoogleDriveCredentials, GoogleDriveSource, GoogleDriveSourceRequest, GoogleDriveTarget, HeadingHierarchyOptions, HealthCheckResponse, HierarchicalChunkSourcesRequest, HierarchicalChunkerOptions, HierarchicalChunkingOptions, HttpSource, HttpSourceRequest, HybridChunkSourcesRequest, HybridChunkerOptions, HybridChunkingOptions, ImageExportMode, ImageRefMode, InBodyConversionResponse, InBodyTarget, InferenceFramework, InputFormat, KnownBatchSourceRequestItem, KnownBatchTargetRequest, LegacyVlmModelType, MessageKind, NormalizedJsonSource, NormalizedMultipartSource, NormalizedSource, OutcomeCounts, OutputFormat, ParsedOrigin, PdfBackend, PictureClassificationLabel, PictureDescriptionApi, PictureDescriptionLocal, PresignedArtifactResult, PresignedUrlConvertDocumentResponse, PresignedUrlConvertResponse, PresignedUrlTarget, ProcessedDocsItem, ProcessingPipeline, ProfilingItem, ProfilingScope, ProgressCallbackRequest, ProgressCallbackResponse, ProgressDocumentCompleted, ProgressKind, ProgressSetNumDocs, ProgressTaskCompleted, ProgressUpdateProcessed, PublicFailureInfo, PutTarget, QualityGrade, RawServiceResult, ReadinessResponse, RemoteTargetResponse, RemoteTargetResult, ResponseFormat, ResultType, S3Coordinates, S3Source, S3SourceRequest, S3Target, SourceRequestItem, StorageTarget, SubmitAndRetrieveOptions, SubmitCallOptions, SubmitResultForTarget, SubmitSourceOptions, SubmitTarget, TableFormerMode, TableMode, Target, TargetRequest, TaskFailureResult, TaskProcessingMeta, TaskStatus, TaskStatusResponse, TaskType, TransformersModelType, UsageLimitExceededDetails, UsageLimitExceededResponse, VlmInferenceFramework, VlmModelApi, VlmModelLocal, VlmModelType, VlmResponseFormat, WaitForTaskOptions, WatchTaskOptions, WebSocketFactory, WebSocketFactoryOptions, WebSocketLike, WebsocketMessage, ZipArchiveResult, ZipTarget };
|
package/dist/index.js
CHANGED
|
@@ -118,6 +118,27 @@ var DoclingBatchConversionError = class extends DoclingError {
|
|
|
118
118
|
};
|
|
119
119
|
|
|
120
120
|
// src/artifacts.ts
|
|
121
|
+
function parseArtifactOrigin(value) {
|
|
122
|
+
try {
|
|
123
|
+
const url = new URL(value);
|
|
124
|
+
const protocol = url.protocol.toLowerCase();
|
|
125
|
+
if (protocol !== "http:" && protocol !== "https:") {
|
|
126
|
+
throw new Error("Only http and https protocols are supported");
|
|
127
|
+
}
|
|
128
|
+
const hostname = url.hostname.toLowerCase();
|
|
129
|
+
if (!hostname) {
|
|
130
|
+
throw new Error("Host is required");
|
|
131
|
+
}
|
|
132
|
+
const defaultPort = protocol === "http:" ? 80 : 443;
|
|
133
|
+
const port = url.port !== "" ? parseInt(url.port, 10) : defaultPort;
|
|
134
|
+
return { protocol: protocol.slice(0, -1), hostname, port };
|
|
135
|
+
} catch (error) {
|
|
136
|
+
throw new DoclingArtifactDownloadError(
|
|
137
|
+
`Invalid artifactUrlAllowlist entry ${JSON.stringify(value)}: expected an http(s) origin such as 'http://minio.storage.svc.cluster.local:9000'.`,
|
|
138
|
+
{ cause: error }
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
121
142
|
var ArtifactDownloader = class {
|
|
122
143
|
#fetch;
|
|
123
144
|
#resolver;
|
|
@@ -125,6 +146,7 @@ var ArtifactDownloader = class {
|
|
|
125
146
|
#timeoutMs;
|
|
126
147
|
#maxBytes;
|
|
127
148
|
#maxRedirects;
|
|
149
|
+
#artifactUrlAllowlist;
|
|
128
150
|
constructor(options = {}) {
|
|
129
151
|
if (options.fetch === void 0 && globalThis.fetch === void 0) {
|
|
130
152
|
throw new DoclingArtifactDownloadError(
|
|
@@ -137,6 +159,8 @@ var ArtifactDownloader = class {
|
|
|
137
159
|
this.#timeoutMs = options.timeoutMs ?? 6e4;
|
|
138
160
|
this.#maxBytes = options.maxBytes ?? 512 * 1024 * 1024;
|
|
139
161
|
this.#maxRedirects = options.maxRedirects ?? 5;
|
|
162
|
+
const allowlist = options.artifactUrlAllowlist ?? [];
|
|
163
|
+
this.#artifactUrlAllowlist = allowlist.map(parseArtifactOrigin);
|
|
140
164
|
validateArtifactLimits(this.#timeoutMs, this.#maxBytes, this.#maxRedirects);
|
|
141
165
|
}
|
|
142
166
|
async download(url, signal) {
|
|
@@ -213,13 +237,23 @@ var ArtifactDownloader = class {
|
|
|
213
237
|
if (this.#allowPrivateUrls) {
|
|
214
238
|
return;
|
|
215
239
|
}
|
|
216
|
-
const
|
|
240
|
+
const protocol = url.protocol.slice(0, -1).toLowerCase();
|
|
241
|
+
const hostname = url.hostname.toLowerCase();
|
|
242
|
+
const defaultPort = protocol === "http" ? 80 : 443;
|
|
243
|
+
const port = url.port !== "" ? parseInt(url.port, 10) : defaultPort;
|
|
244
|
+
const isTrusted = this.#artifactUrlAllowlist.some(
|
|
245
|
+
(origin) => origin.protocol === protocol && origin.hostname === hostname && origin.port === port
|
|
246
|
+
);
|
|
247
|
+
if (isTrusted) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const cleanHostname = url.hostname.replace(/^\[|\]$/g, "");
|
|
217
251
|
let addresses;
|
|
218
252
|
try {
|
|
219
|
-
addresses = ipaddr.isValid(
|
|
253
|
+
addresses = ipaddr.isValid(cleanHostname) ? [cleanHostname] : await this.#resolver(cleanHostname);
|
|
220
254
|
} catch (error) {
|
|
221
255
|
throw new DoclingArtifactDownloadError(
|
|
222
|
-
`Could not resolve artifact host ${
|
|
256
|
+
`Could not resolve artifact host ${cleanHostname}`,
|
|
223
257
|
{ cause: error }
|
|
224
258
|
);
|
|
225
259
|
}
|
|
@@ -798,7 +832,11 @@ var EXTENSION_FORMATS = {
|
|
|
798
832
|
numbers: "iwork_numbers",
|
|
799
833
|
ebc: "ebcdic",
|
|
800
834
|
ebcdic: "ebcdic",
|
|
801
|
-
afp: "afp"
|
|
835
|
+
afp: "afp",
|
|
836
|
+
ics: "calendar",
|
|
837
|
+
ical: "calendar",
|
|
838
|
+
icalendar: "calendar",
|
|
839
|
+
ifb: "calendar"
|
|
802
840
|
};
|
|
803
841
|
async function normalizeSourceInput(input, signal) {
|
|
804
842
|
throwIfAborted(signal);
|
|
@@ -1275,7 +1313,9 @@ function guessMimeType(filename) {
|
|
|
1275
1313
|
vtt: "text/vtt",
|
|
1276
1314
|
eml: "message/rfc822",
|
|
1277
1315
|
msg: "application/vnd.ms-outlook",
|
|
1278
|
-
epub: "application/epub+zip"
|
|
1316
|
+
epub: "application/epub+zip",
|
|
1317
|
+
ics: "text/calendar",
|
|
1318
|
+
ifb: "text/calendar"
|
|
1279
1319
|
}[extension] ?? "application/octet-stream";
|
|
1280
1320
|
}
|
|
1281
1321
|
var INPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
@@ -1314,7 +1354,8 @@ var INPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
|
1314
1354
|
"iwork_keynote",
|
|
1315
1355
|
"iwork_numbers",
|
|
1316
1356
|
"ebcdic",
|
|
1317
|
-
"afp"
|
|
1357
|
+
"afp",
|
|
1358
|
+
"calendar"
|
|
1318
1359
|
]);
|
|
1319
1360
|
var OUTPUT_FORMATS = /* @__PURE__ */ new Set([
|
|
1320
1361
|
"md",
|
|
@@ -1366,12 +1407,16 @@ var VLM_RESPONSE_FORMATS = /* @__PURE__ */ new Set([
|
|
|
1366
1407
|
"markdown",
|
|
1367
1408
|
"deepseekocr_markdown",
|
|
1368
1409
|
"unlimited_ocr_markdown",
|
|
1410
|
+
"unlimited_ocr2",
|
|
1411
|
+
"lightonocr_markdown",
|
|
1369
1412
|
"html",
|
|
1370
1413
|
"otsl",
|
|
1371
1414
|
"plaintext",
|
|
1372
1415
|
"chandra_html",
|
|
1416
|
+
"surya_html",
|
|
1373
1417
|
"dots_json",
|
|
1374
1418
|
"nemotron_parse_v2",
|
|
1419
|
+
"nemotron_parse_v3_5",
|
|
1375
1420
|
"mineru2"
|
|
1376
1421
|
]);
|
|
1377
1422
|
var VLM_INFERENCE_FRAMEWORKS = /* @__PURE__ */ new Set(["mlx", "transformers", "vllm"]);
|
|
@@ -2337,7 +2382,22 @@ var DoclingClient = class {
|
|
|
2337
2382
|
this.#maxConcurrency = validateConcurrency(
|
|
2338
2383
|
options.maxConcurrency ?? DEFAULT_MAX_CONCURRENCY
|
|
2339
2384
|
);
|
|
2340
|
-
|
|
2385
|
+
const downloaderOptions = {
|
|
2386
|
+
...options.artifactDownload
|
|
2387
|
+
};
|
|
2388
|
+
if (options.artifactDownloadTimeout !== void 0) {
|
|
2389
|
+
downloaderOptions.timeoutMs = options.artifactDownloadTimeout;
|
|
2390
|
+
}
|
|
2391
|
+
if (options.maxArtifactDownloadBytes !== void 0) {
|
|
2392
|
+
downloaderOptions.maxBytes = options.maxArtifactDownloadBytes;
|
|
2393
|
+
}
|
|
2394
|
+
if (options.artifactUrlAllowlist !== void 0) {
|
|
2395
|
+
downloaderOptions.artifactUrlAllowlist = options.artifactUrlAllowlist;
|
|
2396
|
+
}
|
|
2397
|
+
if (options.allowPrivateArtifactUrls !== void 0) {
|
|
2398
|
+
downloaderOptions.allowPrivateUrls = options.allowPrivateArtifactUrls;
|
|
2399
|
+
}
|
|
2400
|
+
this.#artifactDownloader = options.artifactDownloader ?? new ArtifactDownloader(downloaderOptions);
|
|
2341
2401
|
}
|
|
2342
2402
|
async health(options = {}) {
|
|
2343
2403
|
const value = await this.#request("GET", "/health", {
|
|
@@ -4204,6 +4264,7 @@ export {
|
|
|
4204
4264
|
fileSourceFromBinary,
|
|
4205
4265
|
materializePresignedResult,
|
|
4206
4266
|
normalizeSourceInput,
|
|
4267
|
+
parseArtifactOrigin,
|
|
4207
4268
|
preflightFileSize,
|
|
4208
4269
|
resolveConvertOptions,
|
|
4209
4270
|
selectDocumentArtifact,
|