@docling/docling-client 2.152.0 → 2.154.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 +78 -2
- package/README.md +3 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -856,10 +856,19 @@ declare function watchTask(options: WatchTaskOptions): AsyncGenerator<TaskStatus
|
|
|
856
856
|
|
|
857
857
|
declare const DEFAULT_MAX_CONCURRENCY = 8;
|
|
858
858
|
declare const MAX_CONCURRENCY_LIMIT = 512;
|
|
859
|
+
declare const ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
|
|
859
860
|
interface DoclingClientOptions {
|
|
860
861
|
baseUrl: string;
|
|
861
862
|
apiKey?: string;
|
|
862
863
|
headers?: Record<string, string>;
|
|
864
|
+
/**
|
|
865
|
+
* Newest DoclingDocument schema version this application can read, for
|
|
866
|
+
* example `CURRENT_VERSION` from `@docling/docling-core`. When set, it is sent
|
|
867
|
+
* on every HTTP request as `Accept-Docling-Document-Version` so the service
|
|
868
|
+
* can down-project newer documents. Python always sends its installed
|
|
869
|
+
* docling-core version; this client stays schema-neutral, so it is opt-in.
|
|
870
|
+
*/
|
|
871
|
+
acceptDocumentVersion?: string;
|
|
863
872
|
transport?: DoclingTransport;
|
|
864
873
|
fetch?: FetchLike;
|
|
865
874
|
httpRetries?: number;
|
|
@@ -1147,5 +1156,5 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
|
|
|
1147
1156
|
declare function appendFormValue(form: FormData, key: string, value: unknown): void;
|
|
1148
1157
|
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
1149
1158
|
|
|
1150
|
-
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, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1159
|
+
export { ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER, 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, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1151
1160
|
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
|
@@ -856,10 +856,19 @@ declare function watchTask(options: WatchTaskOptions): AsyncGenerator<TaskStatus
|
|
|
856
856
|
|
|
857
857
|
declare const DEFAULT_MAX_CONCURRENCY = 8;
|
|
858
858
|
declare const MAX_CONCURRENCY_LIMIT = 512;
|
|
859
|
+
declare const ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
|
|
859
860
|
interface DoclingClientOptions {
|
|
860
861
|
baseUrl: string;
|
|
861
862
|
apiKey?: string;
|
|
862
863
|
headers?: Record<string, string>;
|
|
864
|
+
/**
|
|
865
|
+
* Newest DoclingDocument schema version this application can read, for
|
|
866
|
+
* example `CURRENT_VERSION` from `@docling/docling-core`. When set, it is sent
|
|
867
|
+
* on every HTTP request as `Accept-Docling-Document-Version` so the service
|
|
868
|
+
* can down-project newer documents. Python always sends its installed
|
|
869
|
+
* docling-core version; this client stays schema-neutral, so it is opt-in.
|
|
870
|
+
*/
|
|
871
|
+
acceptDocumentVersion?: string;
|
|
863
872
|
transport?: DoclingTransport;
|
|
864
873
|
fetch?: FetchLike;
|
|
865
874
|
httpRetries?: number;
|
|
@@ -1147,5 +1156,5 @@ declare function preflightFileSize(source: NormalizedSource, maxFileSize: number
|
|
|
1147
1156
|
declare function appendFormValue(form: FormData, key: string, value: unknown): void;
|
|
1148
1157
|
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
1149
1158
|
|
|
1150
|
-
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, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1159
|
+
export { ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER, 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, documentFromBundleAsync, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, parseArtifactOrigin, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
|
1151
1160
|
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
|
@@ -2920,6 +2920,7 @@ function isRecord3(value) {
|
|
|
2920
2920
|
var DEFAULT_JOB_TIMEOUT_MS = 3e5;
|
|
2921
2921
|
var DEFAULT_MAX_CONCURRENCY = 8;
|
|
2922
2922
|
var MAX_CONCURRENCY_LIMIT = 512;
|
|
2923
|
+
var ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER = "Accept-Docling-Document-Version";
|
|
2923
2924
|
var DoclingClient = class {
|
|
2924
2925
|
#baseUrl;
|
|
2925
2926
|
#apiKey;
|
|
@@ -2942,6 +2943,9 @@ var DoclingClient = class {
|
|
|
2942
2943
|
this.#headers = {
|
|
2943
2944
|
accept: "application/json",
|
|
2944
2945
|
...normalizeHeaders(options.headers),
|
|
2946
|
+
...options.acceptDocumentVersion === void 0 ? {} : {
|
|
2947
|
+
[ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER.toLowerCase()]: validateDocumentVersion(options.acceptDocumentVersion)
|
|
2948
|
+
},
|
|
2945
2949
|
...this.#apiKey === "" ? {} : { "x-api-key": this.#apiKey }
|
|
2946
2950
|
};
|
|
2947
2951
|
if (options.transport !== void 0 && (options.fetch !== void 0 || options.httpRetries !== void 0 || options.httpTimeoutMs !== void 0 || options.httpBackoffBaseMs !== void 0)) {
|
|
@@ -4763,6 +4767,14 @@ function normalizeHeaders(headers) {
|
|
|
4763
4767
|
Object.entries(headers ?? {}).map(([name, value]) => [name.toLowerCase(), value])
|
|
4764
4768
|
);
|
|
4765
4769
|
}
|
|
4770
|
+
function validateDocumentVersion(value) {
|
|
4771
|
+
if (typeof value !== "string" || !/^[!-~]+$/.test(value)) {
|
|
4772
|
+
throw new DoclingProtocolError(
|
|
4773
|
+
"acceptDocumentVersion must be a non-empty visible ASCII string"
|
|
4774
|
+
);
|
|
4775
|
+
}
|
|
4776
|
+
return value;
|
|
4777
|
+
}
|
|
4766
4778
|
function positiveNumber(value, name) {
|
|
4767
4779
|
if (!Number.isFinite(value) || value <= 0) {
|
|
4768
4780
|
throw new DoclingProtocolError(`${name} must be a positive number`);
|
|
@@ -4828,6 +4840,7 @@ function isRecord4(value) {
|
|
|
4828
4840
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4829
4841
|
}
|
|
4830
4842
|
export {
|
|
4843
|
+
ACCEPT_DOCLING_DOCUMENT_VERSION_HEADER,
|
|
4831
4844
|
ArtifactDownloader,
|
|
4832
4845
|
ChunkerKind,
|
|
4833
4846
|
ChunkerType,
|