@docling/docling-client 0.1.0 → 0.3.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/dist/index.cjs +46 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +45 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote';
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote' | 'ebcdic';
|
|
16
16
|
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks';
|
|
17
17
|
type ProcessingPipeline = 'legacy' | 'standard' | 'vlm' | 'asr';
|
|
18
18
|
type TableMode = 'fast' | 'accurate';
|
|
@@ -225,18 +225,16 @@ interface GoogleDriveSource extends GoogleDriveCoordinates {
|
|
|
225
225
|
interface GoogleDriveTarget extends GoogleDriveCoordinates {
|
|
226
226
|
kind: 'google_drive';
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
type GenericSource = {
|
|
229
229
|
kind: string;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
interface GenericTarget {
|
|
230
|
+
} & Record<string, unknown>;
|
|
231
|
+
type GenericTarget = {
|
|
233
232
|
kind: string;
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
-
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
233
|
+
} & Record<string, unknown>;
|
|
238
234
|
type BatchSource = HttpSource | S3Source | AzureBlobSource | GoogleCloudStorageSource | GoogleDriveSource | GenericSource;
|
|
239
235
|
type BatchTarget = PresignedUrlTarget | StorageTarget | GenericTarget;
|
|
236
|
+
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
+
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
240
238
|
interface CallbackSpec {
|
|
241
239
|
url: string;
|
|
242
240
|
headers?: Record<string, string>;
|
|
@@ -252,7 +250,8 @@ interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
|
|
|
252
250
|
interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget> {
|
|
253
251
|
options?: ConvertDocumentsOptions;
|
|
254
252
|
sources: BatchSource[];
|
|
255
|
-
target
|
|
253
|
+
target?: TTarget;
|
|
254
|
+
targets?: TTarget[];
|
|
256
255
|
callbacks?: CallbackSpec[];
|
|
257
256
|
}
|
|
258
257
|
type ChunkerKind = 'hybrid' | 'hierarchical';
|
|
@@ -359,7 +358,7 @@ interface ExportResult<TDocument = DoclingDocument> {
|
|
|
359
358
|
timings: Record<string, ProfilingItem>;
|
|
360
359
|
confidence?: ConfidenceScores | null;
|
|
361
360
|
}
|
|
362
|
-
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'resource_bundle';
|
|
361
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
|
|
363
362
|
interface ArtifactRef {
|
|
364
363
|
artifact_type: ArtifactType;
|
|
365
364
|
mime_type: string;
|
|
@@ -608,6 +607,7 @@ interface SubmitSourceOptions<TTarget extends SubmitTarget = SubmitTarget> exten
|
|
|
608
607
|
options?: ConvertDocumentsOptions;
|
|
609
608
|
outputFormats?: ConvertDocumentsOptions['to_formats'];
|
|
610
609
|
target?: TTarget;
|
|
610
|
+
callbacks?: CallbackSpec[];
|
|
611
611
|
}
|
|
612
612
|
interface ConvertOptions extends WaitForTaskOptions {
|
|
613
613
|
options?: ConvertDocumentsOptions;
|
|
@@ -859,7 +859,7 @@ declare function validateConvertOptions(options: ConvertDocumentsOptions): void;
|
|
|
859
859
|
declare function applyPageLimits(options: ConvertDocumentsOptions, pageRange?: [number, number], maxNumPages?: number): ConvertDocumentsOptions;
|
|
860
860
|
declare function validateMaxFileSize(value: number | undefined): void;
|
|
861
861
|
declare function preflightFileSize(source: NormalizedSource, maxFileSize: number | undefined): string | null;
|
|
862
|
-
declare function
|
|
862
|
+
declare function appendFormValue(form: FormData, key: string, value: unknown): void;
|
|
863
863
|
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
864
864
|
|
|
865
|
-
export { type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobTarget, type BaseChunkingOptions, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSubmitCallOptions, type BatchTarget, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResultItem, type ChunkerKind, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentResponse, type ConvertDocumentsOptions, type ConvertOptions, type ConvertSourcesRequest, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, type DoclingBinaryResponse, DoclingClient, type DoclingClientOptions, type DoclingComponentType, DoclingConversionError, type DoclingDocument, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, type DoclingRequestBodyType, DoclingResponseSchemaMismatchError, type DoclingResponseType, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentLimits, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type GenericSource, type GenericTarget, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveTarget, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkingOptions, type HttpSource, type HybridChunkSourcesRequest, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type RemoteTargetResponse, type S3Coordinates, type S3Source, type S3Target, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type ZipTarget, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary,
|
|
865
|
+
export { type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobTarget, type BaseChunkingOptions, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSubmitCallOptions, type BatchTarget, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResultItem, type ChunkerKind, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentResponse, type ConvertDocumentsOptions, type ConvertOptions, type ConvertSourcesRequest, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, type DoclingBinaryResponse, DoclingClient, type DoclingClientOptions, type DoclingComponentType, DoclingConversionError, type DoclingDocument, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, type DoclingRequestBodyType, DoclingResponseSchemaMismatchError, type DoclingResponseType, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentLimits, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type GenericSource, type GenericTarget, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveTarget, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkingOptions, type HttpSource, type HybridChunkSourcesRequest, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type RemoteTargetResponse, type S3Coordinates, type S3Source, type S3Target, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type ZipTarget, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
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' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote';
|
|
15
|
+
type InputFormat = 'docx' | 'doc' | 'pptx' | 'html' | 'image' | 'pdf' | 'asciidoc' | 'md' | 'csv' | 'xlsx' | 'xml_uspto' | 'xml_jats' | 'json_docling' | 'dclx' | 'audio' | 'vtt' | 'xml_xbrl' | 'mets_gbs' | 'latex' | 'ppt' | 'xls' | 'odt' | 'ods' | 'odp' | 'xml_doclang' | 'video' | 'email' | 'epub' | 'boxnote' | 'ebcdic';
|
|
16
16
|
type OutputFormat = 'md' | 'json' | 'yaml' | 'html' | 'html_split_page' | 'text' | 'doctags' | 'vtt' | 'doclang' | 'dclx' | 'chunks';
|
|
17
17
|
type ProcessingPipeline = 'legacy' | 'standard' | 'vlm' | 'asr';
|
|
18
18
|
type TableMode = 'fast' | 'accurate';
|
|
@@ -225,18 +225,16 @@ interface GoogleDriveSource extends GoogleDriveCoordinates {
|
|
|
225
225
|
interface GoogleDriveTarget extends GoogleDriveCoordinates {
|
|
226
226
|
kind: 'google_drive';
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
type GenericSource = {
|
|
229
229
|
kind: string;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
interface GenericTarget {
|
|
230
|
+
} & Record<string, unknown>;
|
|
231
|
+
type GenericTarget = {
|
|
233
232
|
kind: string;
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
-
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
233
|
+
} & Record<string, unknown>;
|
|
238
234
|
type BatchSource = HttpSource | S3Source | AzureBlobSource | GoogleCloudStorageSource | GoogleDriveSource | GenericSource;
|
|
239
235
|
type BatchTarget = PresignedUrlTarget | StorageTarget | GenericTarget;
|
|
236
|
+
type StorageTarget = S3Target | AzureBlobTarget | GoogleCloudStorageTarget | GoogleDriveTarget;
|
|
237
|
+
type SubmitTarget = InBodyTarget | ZipTarget | PresignedUrlTarget | PutTarget | StorageTarget;
|
|
240
238
|
interface CallbackSpec {
|
|
241
239
|
url: string;
|
|
242
240
|
headers?: Record<string, string>;
|
|
@@ -252,7 +250,8 @@ interface ConvertSourcesRequest<TTarget extends SubmitTarget = SubmitTarget> {
|
|
|
252
250
|
interface BatchConvertSourcesRequest<TTarget extends BatchTarget = BatchTarget> {
|
|
253
251
|
options?: ConvertDocumentsOptions;
|
|
254
252
|
sources: BatchSource[];
|
|
255
|
-
target
|
|
253
|
+
target?: TTarget;
|
|
254
|
+
targets?: TTarget[];
|
|
256
255
|
callbacks?: CallbackSpec[];
|
|
257
256
|
}
|
|
258
257
|
type ChunkerKind = 'hybrid' | 'hierarchical';
|
|
@@ -359,7 +358,7 @@ interface ExportResult<TDocument = DoclingDocument> {
|
|
|
359
358
|
timings: Record<string, ProfilingItem>;
|
|
360
359
|
confidence?: ConfidenceScores | null;
|
|
361
360
|
}
|
|
362
|
-
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'resource_bundle';
|
|
361
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
|
|
363
362
|
interface ArtifactRef {
|
|
364
363
|
artifact_type: ArtifactType;
|
|
365
364
|
mime_type: string;
|
|
@@ -608,6 +607,7 @@ interface SubmitSourceOptions<TTarget extends SubmitTarget = SubmitTarget> exten
|
|
|
608
607
|
options?: ConvertDocumentsOptions;
|
|
609
608
|
outputFormats?: ConvertDocumentsOptions['to_formats'];
|
|
610
609
|
target?: TTarget;
|
|
610
|
+
callbacks?: CallbackSpec[];
|
|
611
611
|
}
|
|
612
612
|
interface ConvertOptions extends WaitForTaskOptions {
|
|
613
613
|
options?: ConvertDocumentsOptions;
|
|
@@ -859,7 +859,7 @@ declare function validateConvertOptions(options: ConvertDocumentsOptions): void;
|
|
|
859
859
|
declare function applyPageLimits(options: ConvertDocumentsOptions, pageRange?: [number, number], maxNumPages?: number): ConvertDocumentsOptions;
|
|
860
860
|
declare function validateMaxFileSize(value: number | undefined): void;
|
|
861
861
|
declare function preflightFileSize(source: NormalizedSource, maxFileSize: number | undefined): string | null;
|
|
862
|
-
declare function
|
|
862
|
+
declare function appendFormValue(form: FormData, key: string, value: unknown): void;
|
|
863
863
|
declare function fileSourceFromBinary(source: BinaryFileSource, signal?: AbortSignal): Promise<FileSource>;
|
|
864
864
|
|
|
865
|
-
export { type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobTarget, type BaseChunkingOptions, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSubmitCallOptions, type BatchTarget, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResultItem, type ChunkerKind, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentResponse, type ConvertDocumentsOptions, type ConvertOptions, type ConvertSourcesRequest, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, type DoclingBinaryResponse, DoclingClient, type DoclingClientOptions, type DoclingComponentType, DoclingConversionError, type DoclingDocument, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, type DoclingRequestBodyType, DoclingResponseSchemaMismatchError, type DoclingResponseType, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentLimits, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type GenericSource, type GenericTarget, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveTarget, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkingOptions, type HttpSource, type HybridChunkSourcesRequest, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type RemoteTargetResponse, type S3Coordinates, type S3Source, type S3Target, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type ZipTarget, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary,
|
|
865
|
+
export { type ArtifactAddressResolver, ArtifactDownloader, type ArtifactDownloaderOptions, type ArtifactRef, type ArtifactType, type AutoSubmitResult, type AzureBlobCoordinates, type AzureBlobSource, type AzureBlobTarget, type BaseChunkingOptions, type BatchConvertSourcesRequest, type BatchResultForTarget, type BatchSource, type BatchSubmitCallOptions, type BatchTarget, type BinaryFileSource, type CallbackSpec, type ChunkCallOptions, type ChunkDocumentResponse, type ChunkSourceOptions, type ChunkSourcesRequest, type ChunkedDocumentResultItem, type ChunkerKind, type ConfidenceScores, type ConversionInput, type ConversionItem, type ConversionResult, type ConversionSource, type ConversionSourceInput, type ConversionStatus, type ConvertAllOptions, type ConvertDocumentResponse, type ConvertDocumentsOptions, type ConvertOptions, type ConvertSourcesRequest, DEFAULT_MAX_CONCURRENCY, DoclingArtifactDownloadError, DoclingBatchConversionError, type DoclingBinaryResponse, DoclingClient, type DoclingClientOptions, type DoclingComponentType, DoclingConversionError, type DoclingDocument, DoclingError, DoclingHttpError, DoclingJob, DoclingProtocolError, type DoclingRequestBodyType, DoclingResponseSchemaMismatchError, type DoclingResponseType, DoclingResultExpiredError, DoclingResultNotReadyError, DoclingServiceError, DoclingServiceUnavailableError, DoclingTaskError, DoclingTaskNotFoundError, DoclingTimeoutError, type DoclingTransport, type DoclingTransportRequest, DoclingUsageLimitExceededError, type DocumentArtifactItem, type DocumentLimits, type ErrorItem, type ExportDocumentResponse, type ExportResult, type FailureCategory, type FetchLike, FetchTransport, type FetchTransportOptions, type FileSource, type GenericSource, type GenericTarget, type GoogleCloudStorageCoordinates, type GoogleCloudStorageServiceAccountInfo, type GoogleCloudStorageSource, type GoogleCloudStorageTarget, type GoogleDriveCoordinates, type GoogleDriveCredentials, type GoogleDriveSource, type GoogleDriveTarget, type HealthCheckResponse, type HierarchicalChunkSourcesRequest, type HierarchicalChunkingOptions, type HttpSource, type HybridChunkSourcesRequest, type HybridChunkingOptions, type ImageExportMode, type InBodyConversionResponse, type InBodyTarget, type InputFormat, type LegacyVlmModelType, MAX_CONCURRENCY_LIMIT, type NormalizedJsonSource, type NormalizedMultipartSource, type NormalizedSource, type OutcomeCounts, type OutputFormat, type PdfBackend, type PictureClassificationLabel, type PictureDescriptionApi, type PictureDescriptionLocal, type PresignedUrlConvertDocumentResponse, type PresignedUrlConvertResponse, type PresignedUrlTarget, type ProcessingPipeline, type ProfilingItem, type ProfilingScope, type PublicFailureInfo, type PutTarget, type QualityGrade, type RawServiceResult, type RemoteTargetResponse, type S3Coordinates, type S3Source, type S3Target, type StatusWatcherKind, type StorageTarget, type SubmitAndRetrieveOptions, type SubmitCallOptions, type SubmitResultForTarget, type SubmitSourceOptions, type SubmitTarget, type TableMode, type TaskFailureResult, type TaskProcessingMeta, type TaskStatus, type TaskStatusResponse, type TaskType, type TransformersModelType, type VlmInferenceFramework, type VlmModelApi, type VlmModelLocal, type VlmResponseFormat, type WaitForTaskOptions, type WatchTaskOptions, type WebSocketFactory, type WebSocketFactoryOptions, type WebSocketLike, type ZipTarget, appendFormValue, applyPageLimits, documentFromBundle, documentFromJson, fileSourceFromBinary, materializePresignedResult, normalizeSourceInput, preflightFileSize, resolveConvertOptions, selectDocumentArtifact, validateConvertOptions, validateMaxFileSize, watchTask, withJsonOutput };
|
package/dist/index.js
CHANGED
|
@@ -1111,14 +1111,16 @@ function preflightFileSize(source, maxFileSize) {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
return `File size ${source.descriptor.file_size} exceeds the configured limit of ${maxFileSize} bytes`;
|
|
1113
1113
|
}
|
|
1114
|
-
function
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1114
|
+
function appendFormValue(form, key, value) {
|
|
1115
|
+
if (Array.isArray(value)) {
|
|
1116
|
+
value.forEach((item) => appendFormValue(form, key, item));
|
|
1117
|
+
} else if (typeof value === "string") {
|
|
1118
|
+
form.append(key, value);
|
|
1119
|
+
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
1120
|
+
form.append(key, String(value));
|
|
1121
|
+
} else {
|
|
1122
|
+
form.append(key, JSON.stringify(value));
|
|
1120
1123
|
}
|
|
1121
|
-
return JSON.stringify(value);
|
|
1122
1124
|
}
|
|
1123
1125
|
async function fileSourceFromBinary(source, signal) {
|
|
1124
1126
|
throwIfAborted(signal);
|
|
@@ -2395,7 +2397,8 @@ var DoclingClient = class {
|
|
|
2395
2397
|
const payload = {
|
|
2396
2398
|
options: convertOptions,
|
|
2397
2399
|
sources: structuredClone(request.sources),
|
|
2398
|
-
target: structuredClone(request.target),
|
|
2400
|
+
...request.target !== void 0 ? { target: structuredClone(request.target) } : {},
|
|
2401
|
+
...request.targets !== void 0 ? { targets: structuredClone(request.targets) } : {},
|
|
2399
2402
|
callbacks: structuredClone(request.callbacks ?? [])
|
|
2400
2403
|
};
|
|
2401
2404
|
throwIfAborted2(options.signal);
|
|
@@ -2406,7 +2409,8 @@ var DoclingClient = class {
|
|
|
2406
2409
|
signal: options.signal
|
|
2407
2410
|
})
|
|
2408
2411
|
);
|
|
2409
|
-
const
|
|
2412
|
+
const effectiveTargetList = request.targets?.length ? request.targets : request.target !== void 0 ? [request.target] : [];
|
|
2413
|
+
const loader = effectiveTargetList.some(isStorageTarget) ? (taskId, lastStatus, signal) => this.#fetchCountsResult(taskId, lastStatus, signal) : (taskId, lastStatus, signal) => this.#fetchPresignedResult(taskId, lastStatus, signal);
|
|
2410
2414
|
return new DoclingJob(
|
|
2411
2415
|
this,
|
|
2412
2416
|
status,
|
|
@@ -2516,12 +2520,12 @@ var DoclingClient = class {
|
|
|
2516
2520
|
);
|
|
2517
2521
|
for (const [key, value] of Object.entries(convertOptions)) {
|
|
2518
2522
|
if (value !== void 0 && value !== null) {
|
|
2519
|
-
form
|
|
2523
|
+
appendFormValue(form, `convert_${key}`, value);
|
|
2520
2524
|
}
|
|
2521
2525
|
}
|
|
2522
2526
|
for (const [key, value] of Object.entries(request.chunking_options ?? {})) {
|
|
2523
2527
|
if (key !== "chunker" && value !== void 0 && value !== null) {
|
|
2524
|
-
form
|
|
2528
|
+
appendFormValue(form, `chunking_${key}`, value);
|
|
2525
2529
|
}
|
|
2526
2530
|
}
|
|
2527
2531
|
form.append(
|
|
@@ -2836,13 +2840,14 @@ var DoclingClient = class {
|
|
|
2836
2840
|
);
|
|
2837
2841
|
}
|
|
2838
2842
|
async #submitNormalizedForTarget(source, options, target, requestOptions) {
|
|
2843
|
+
const callbacks = requestOptions.callbacks ?? [];
|
|
2839
2844
|
if (source.kind === "json") {
|
|
2840
2845
|
return this.#submitRequestForTarget(
|
|
2841
2846
|
{
|
|
2842
2847
|
options,
|
|
2843
2848
|
sources: [source.source],
|
|
2844
2849
|
target,
|
|
2845
|
-
callbacks
|
|
2850
|
+
callbacks
|
|
2846
2851
|
},
|
|
2847
2852
|
requestOptions
|
|
2848
2853
|
);
|
|
@@ -2854,7 +2859,7 @@ var DoclingClient = class {
|
|
|
2854
2859
|
options,
|
|
2855
2860
|
sources: [fileSource],
|
|
2856
2861
|
target,
|
|
2857
|
-
callbacks
|
|
2862
|
+
callbacks
|
|
2858
2863
|
},
|
|
2859
2864
|
requestOptions
|
|
2860
2865
|
);
|
|
@@ -2862,9 +2867,13 @@ var DoclingClient = class {
|
|
|
2862
2867
|
const form = new FormData();
|
|
2863
2868
|
for (const [key, value] of Object.entries(options)) {
|
|
2864
2869
|
if (value !== void 0 && value !== null) {
|
|
2865
|
-
form
|
|
2870
|
+
appendFormValue(form, key, value);
|
|
2866
2871
|
}
|
|
2867
2872
|
}
|
|
2873
|
+
validateCallbacks(callbacks);
|
|
2874
|
+
for (const callback of callbacks) {
|
|
2875
|
+
form.append("callbacks", JSON.stringify(callback));
|
|
2876
|
+
}
|
|
2868
2877
|
form.append("target_type", target.kind);
|
|
2869
2878
|
form.append("files", source.blob, source.descriptor.filename);
|
|
2870
2879
|
const status = parseTaskStatus(
|
|
@@ -3326,6 +3335,7 @@ function parsePresignedResponse(value) {
|
|
|
3326
3335
|
"text",
|
|
3327
3336
|
"doctags",
|
|
3328
3337
|
"doclang",
|
|
3338
|
+
"dclx",
|
|
3329
3339
|
"resource_bundle"
|
|
3330
3340
|
].includes(String(artifact.artifact_type))) {
|
|
3331
3341
|
throw schemaMismatch(`${artifactPath}.artifact_type is unsupported`);
|
|
@@ -3622,8 +3632,8 @@ function shouldFallbackFromPresigned(error) {
|
|
|
3622
3632
|
function targetNeedsJson(target) {
|
|
3623
3633
|
return target.kind === "inbody";
|
|
3624
3634
|
}
|
|
3625
|
-
function
|
|
3626
|
-
return target.kind
|
|
3635
|
+
function isStorageTarget(target) {
|
|
3636
|
+
return target.kind !== "presigned_url";
|
|
3627
3637
|
}
|
|
3628
3638
|
function validateBatchRequest(request) {
|
|
3629
3639
|
if (!Array.isArray(request.sources) || request.sources.length === 0) {
|
|
@@ -3638,15 +3648,28 @@ function validateBatchRequest(request) {
|
|
|
3638
3648
|
}
|
|
3639
3649
|
validateKnownConnector(source, "source");
|
|
3640
3650
|
}
|
|
3641
|
-
if (
|
|
3642
|
-
throw new DoclingProtocolError(
|
|
3651
|
+
if (request.target === void 0 && (request.targets === void 0 || request.targets.length === 0)) {
|
|
3652
|
+
throw new DoclingProtocolError(
|
|
3653
|
+
"Batch conversion requires either 'target' or 'targets'"
|
|
3654
|
+
);
|
|
3643
3655
|
}
|
|
3644
|
-
if (
|
|
3656
|
+
if (request.target !== void 0 && request.targets !== void 0 && request.targets.length > 0) {
|
|
3645
3657
|
throw new DoclingProtocolError(
|
|
3646
|
-
|
|
3658
|
+
"Batch conversion received both 'target' and 'targets'; supply only one"
|
|
3647
3659
|
);
|
|
3648
3660
|
}
|
|
3649
|
-
|
|
3661
|
+
const effectiveTargets = request.targets && request.targets.length > 0 ? request.targets : request.target !== void 0 ? [request.target] : [];
|
|
3662
|
+
for (const target of effectiveTargets) {
|
|
3663
|
+
if (!isRecord4(target) || typeof target.kind !== "string" || target.kind === "") {
|
|
3664
|
+
throw new DoclingProtocolError("Batch target kind must not be empty");
|
|
3665
|
+
}
|
|
3666
|
+
if (["inbody", "zip", "put"].includes(target.kind)) {
|
|
3667
|
+
throw new DoclingProtocolError(
|
|
3668
|
+
`Batch conversion does not accept ${target.kind} targets`
|
|
3669
|
+
);
|
|
3670
|
+
}
|
|
3671
|
+
validateKnownConnector(target, "target");
|
|
3672
|
+
}
|
|
3650
3673
|
validateCallbacks(request.callbacks);
|
|
3651
3674
|
}
|
|
3652
3675
|
function validateChunkRequestOptions(request) {
|
|
@@ -4073,11 +4096,11 @@ export {
|
|
|
4073
4096
|
DoclingUsageLimitExceededError,
|
|
4074
4097
|
FetchTransport,
|
|
4075
4098
|
MAX_CONCURRENCY_LIMIT,
|
|
4099
|
+
appendFormValue,
|
|
4076
4100
|
applyPageLimits,
|
|
4077
4101
|
documentFromBundle,
|
|
4078
4102
|
documentFromJson,
|
|
4079
4103
|
fileSourceFromBinary,
|
|
4080
|
-
formValue,
|
|
4081
4104
|
materializePresignedResult,
|
|
4082
4105
|
normalizeSourceInput,
|
|
4083
4106
|
preflightFileSize,
|