@pdfvector/client 0.0.20 → 0.0.22
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/CHANGELOG.md +16 -0
- package/README.md +7 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pdfvector/client
|
|
2
2
|
|
|
3
|
+
## 0.0.22
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [[`3a1c66b`](https://github.com/phuctm97/pdfvector/commit/3a1c66bcdfade057be5f1b9170f8ed64934bf2a9)]:
|
|
7
|
+
- @pdfvector/instance-client@0.0.42
|
|
8
|
+
|
|
9
|
+
## 0.0.21
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- [#205](https://github.com/phuctm97/pdfvector/pull/205) [`93b9624`](https://github.com/phuctm97/pdfvector/commit/93b9624333f643b143062e08c6af216eed5a859a) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Improve SDK error handling and tighten academic provider types
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`93b9624`](https://github.com/phuctm97/pdfvector/commit/93b9624333f643b143062e08c6af216eed5a859a)]:
|
|
17
|
+
- @pdfvector/instance-client@0.0.41
|
|
18
|
+
|
|
3
19
|
## 0.0.20
|
|
4
20
|
### Patch Changes
|
|
5
21
|
|
package/README.md
CHANGED
|
@@ -580,10 +580,10 @@ console.log(resultB.documentId); // "doc-b"
|
|
|
580
580
|
|
|
581
581
|
## Error Handling
|
|
582
582
|
|
|
583
|
-
All API errors are thrown as `
|
|
583
|
+
All API errors are thrown as `ORPCError` instances with structured error information matching the server's error response shape:
|
|
584
584
|
|
|
585
585
|
```typescript
|
|
586
|
-
import { createClient,
|
|
586
|
+
import { createClient, ORPCError } from "@pdfvector/client";
|
|
587
587
|
|
|
588
588
|
const client = createClient({
|
|
589
589
|
apiKey: "your-api-key",
|
|
@@ -595,23 +595,24 @@ try {
|
|
|
595
595
|
});
|
|
596
596
|
console.log(result.markdown);
|
|
597
597
|
} catch (error) {
|
|
598
|
-
if (error instanceof
|
|
598
|
+
if (error instanceof ORPCError) {
|
|
599
599
|
console.error(`API Error [${error.code}]: ${error.message}`);
|
|
600
600
|
console.error(`HTTP Status: ${error.status}`);
|
|
601
601
|
console.error(`Error Data:`, error.data);
|
|
602
602
|
} else {
|
|
603
|
+
// Network errors (DNS, connection refused, timeout) bubble up as TypeError.
|
|
603
604
|
console.error("Unexpected Error:", error);
|
|
604
605
|
}
|
|
605
606
|
}
|
|
606
607
|
```
|
|
607
608
|
|
|
608
|
-
You can
|
|
609
|
+
You can branch on the error code:
|
|
609
610
|
|
|
610
611
|
```typescript
|
|
611
612
|
try {
|
|
612
613
|
await client.document.parse({ url: "..." });
|
|
613
614
|
} catch (error) {
|
|
614
|
-
if (
|
|
615
|
+
if (error instanceof ORPCError) {
|
|
615
616
|
switch (error.code) {
|
|
616
617
|
case "UNAUTHORIZED":
|
|
617
618
|
console.error("Invalid API key");
|
|
@@ -644,7 +645,7 @@ The SDK is written in TypeScript and includes full type definitions:
|
|
|
644
645
|
```typescript
|
|
645
646
|
import {
|
|
646
647
|
createClient,
|
|
647
|
-
|
|
648
|
+
ORPCError,
|
|
648
649
|
} from "@pdfvector/client";
|
|
649
650
|
|
|
650
651
|
import type {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official TypeScript/JavaScript SDK for PDF Vector API",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"main": ".tsc/lib/index.js",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@pdfvector/instance-client": "^0.0.
|
|
26
|
+
"@pdfvector/instance-client": "^0.0.42"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
".tsc",
|