@docling/docling-client 2.145.0 → 2.146.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 +40 -2
- package/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -593,7 +593,7 @@ interface WebsocketMessage {
|
|
|
593
593
|
task?: TaskStatusResponse | null;
|
|
594
594
|
error?: string | null;
|
|
595
595
|
}
|
|
596
|
-
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
|
|
596
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle' | 'chunks';
|
|
597
597
|
interface ArtifactRef {
|
|
598
598
|
artifact_type: ArtifactType;
|
|
599
599
|
mime_type: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -593,7 +593,7 @@ interface WebsocketMessage {
|
|
|
593
593
|
task?: TaskStatusResponse | null;
|
|
594
594
|
error?: string | null;
|
|
595
595
|
}
|
|
596
|
-
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle';
|
|
596
|
+
type ArtifactType = 'json' | 'html' | 'markdown' | 'text' | 'doctags' | 'doclang' | 'dclx' | 'resource_bundle' | 'chunks';
|
|
597
597
|
interface ArtifactRef {
|
|
598
598
|
artifact_type: ArtifactType;
|
|
599
599
|
mime_type: string;
|
package/dist/index.js
CHANGED
|
@@ -2863,7 +2863,9 @@ var DoclingClient = class {
|
|
|
2863
2863
|
target: { kind: "inbody" }
|
|
2864
2864
|
},
|
|
2865
2865
|
options
|
|
2866
|
-
)
|
|
2866
|
+
).catch((fallbackError) => {
|
|
2867
|
+
throw combineInBodyFallbackError(error, fallbackError);
|
|
2868
|
+
});
|
|
2867
2869
|
});
|
|
2868
2870
|
}
|
|
2869
2871
|
#submitNormalizedWithAutoTarget(source, options, requestOptions) {
|
|
@@ -2881,7 +2883,9 @@ var DoclingClient = class {
|
|
|
2881
2883
|
withJsonOutput(options),
|
|
2882
2884
|
{ kind: "inbody" },
|
|
2883
2885
|
requestOptions
|
|
2884
|
-
)
|
|
2886
|
+
).catch((fallbackError) => {
|
|
2887
|
+
throw combineInBodyFallbackError(error, fallbackError);
|
|
2888
|
+
});
|
|
2885
2889
|
});
|
|
2886
2890
|
}
|
|
2887
2891
|
async #submitRequestForTarget(request, options) {
|
|
@@ -3407,7 +3411,8 @@ function parsePresignedResponse(value) {
|
|
|
3407
3411
|
"doctags",
|
|
3408
3412
|
"doclang",
|
|
3409
3413
|
"dclx",
|
|
3410
|
-
"resource_bundle"
|
|
3414
|
+
"resource_bundle",
|
|
3415
|
+
"chunks"
|
|
3411
3416
|
].includes(String(artifact.artifact_type))) {
|
|
3412
3417
|
throw schemaMismatch(`${artifactPath}.artifact_type is unsupported`);
|
|
3413
3418
|
}
|
|
@@ -3711,6 +3716,18 @@ function shouldFallbackFromPresigned(error) {
|
|
|
3711
3716
|
"enum"
|
|
3712
3717
|
].some((phrase) => detail.includes(phrase));
|
|
3713
3718
|
}
|
|
3719
|
+
function combineInBodyFallbackError(presignedError, fallbackError) {
|
|
3720
|
+
if (!(presignedError instanceof DoclingHttpError) || !(fallbackError instanceof DoclingHttpError) || ![400, 422].includes(fallbackError.status)) {
|
|
3721
|
+
return fallbackError;
|
|
3722
|
+
}
|
|
3723
|
+
const fallbackDetail = httpDetail2(fallbackError.body);
|
|
3724
|
+
const prefix = fallbackDetail === void 0 ? "" : `${fallbackDetail} `;
|
|
3725
|
+
return new DoclingServiceError(fallbackError.message, {
|
|
3726
|
+
status: fallbackError.status,
|
|
3727
|
+
detail: `${prefix}The client tried the InBody target because the server rejected the presigned_url target: ${httpDetail2(presignedError.body)}`,
|
|
3728
|
+
cause: fallbackError
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3714
3731
|
function targetNeedsJson(target) {
|
|
3715
3732
|
return target.kind === "inbody";
|
|
3716
3733
|
}
|