@pdfvector/client 0.0.52 → 0.0.53
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 +8 -0
- package/README.md +8 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @pdfvector/client
|
|
2
2
|
|
|
3
|
+
## 0.0.53
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#446](https://github.com/phuctm97/pdfvector/pull/446) [`96d7a33`](https://github.com/phuctm97/pdfvector/commit/96d7a337123f84ca844089239aee4f1d5a25462b) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add `PaymentRequiredError` (code `PAYMENT_REQUIRED`, HTTP 402, category `credits`) for workspaces that have used all their monthly credits. It is a non-retryable user error with `totalCredits`, `remainingCredits` and `resetsAt`, the API's message, and a suggestion to upgrade the plan or wait for the reset date. Before this, the SDK threw a raw `ORPCError` for HTTP 402.
|
|
8
|
+
- Updated dependencies [[`96d7a33`](https://github.com/phuctm97/pdfvector/commit/96d7a337123f84ca844089239aee4f1d5a25462b)]:
|
|
9
|
+
- @pdfvector/instance-client@0.0.73
|
|
10
|
+
|
|
3
11
|
## 0.0.52
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -692,6 +692,7 @@ import {
|
|
|
692
692
|
NoPublicPDFError,
|
|
693
693
|
PageLimitExceededError,
|
|
694
694
|
PasswordProtectedError,
|
|
695
|
+
PaymentRequiredError,
|
|
695
696
|
TooManyRequestsError,
|
|
696
697
|
UnauthorizedError,
|
|
697
698
|
URLFetchError,
|
|
@@ -718,6 +719,8 @@ try {
|
|
|
718
719
|
console.error("Provide a direct PDF URL or upload the paper file directly");
|
|
719
720
|
} else if (error instanceof UnauthorizedError) {
|
|
720
721
|
console.error("Invalid API key; check your dashboard");
|
|
722
|
+
} else if (error instanceof PaymentRequiredError) {
|
|
723
|
+
console.error(`${error.message} (${error.suggestion})`);
|
|
721
724
|
} else if (error instanceof TooManyRequestsError) {
|
|
722
725
|
console.error(`Rate limit ${error.limit} exceeded; resets at ${error.resetAt}`);
|
|
723
726
|
} else if (error instanceof EmptyDocumentError) {
|
|
@@ -744,6 +747,7 @@ PDFVectorError
|
|
|
744
747
|
│ ├── InvalidSchemaError — reason
|
|
745
748
|
│ └── NoInputProvidedError
|
|
746
749
|
├── UnauthorizedError (401)
|
|
750
|
+
├── PaymentRequiredError (402) — totalCredits, remainingCredits, resetsAt
|
|
747
751
|
├── NotFoundError (404)
|
|
748
752
|
│ ├── AcademicPaperNotFoundError — input, paperErrorCode
|
|
749
753
|
│ └── NoPublicPDFError — input, paperTitle, doi, providerURL
|
|
@@ -766,7 +770,7 @@ PDFVectorError
|
|
|
766
770
|
| `title` | `string` | Short readable summary |
|
|
767
771
|
| `message` | `string` | Server-provided error message |
|
|
768
772
|
| `suggestion` | `string` | Recommended next action |
|
|
769
|
-
| `category` | `string` | `authentication`, `validation`, `document_input`, `document_processing`, `rate_limit`, `not_found`, `conflict`, `unsupported`, or `server` |
|
|
773
|
+
| `category` | `string` | `authentication`, `credits`, `validation`, `document_input`, `document_processing`, `rate_limit`, `not_found`, `conflict`, `unsupported`, or `server` |
|
|
770
774
|
| `origin` | `"user" \| "system"` | Whether the failure is caller-fixable or likely server/provider-side |
|
|
771
775
|
| `userError` | `boolean` | `true` for expected caller-fixable failures |
|
|
772
776
|
| `retryable` | `boolean` | `true` when retrying may help |
|
|
@@ -785,7 +789,8 @@ Use `error.toAgentError()` or `JSON.stringify(error)` when you need a serializab
|
|
|
785
789
|
| Code | Status | Description |
|
|
786
790
|
|------|--------|-------------|
|
|
787
791
|
| `BAD_REQUEST` | 400 | Input validation failed, including invalid URLs, unsupported formats, file size limits, page limits, invalid base64, and invalid JSON Schema |
|
|
788
|
-
| `UNAUTHORIZED` | 401 | Missing or
|
|
792
|
+
| `UNAUTHORIZED` | 401 | Missing, invalid or deleted API key |
|
|
793
|
+
| `PAYMENT_REQUIRED` | 402 | The workspace has used all of its monthly credits; the message says when they reset and links to the plan page |
|
|
789
794
|
| `NOT_FOUND` | 404 | Resource not found, including academic paper IDs and papers without public PDFs |
|
|
790
795
|
| `CONFLICT` | 409 | Operation conflicts with the current state |
|
|
791
796
|
| `UNPROCESSABLE_CONTENT` | 422 | Document could not be processed, including empty documents, no readable text, and extraction failures |
|
|
@@ -807,6 +812,7 @@ import {
|
|
|
807
812
|
// HTTP-aligned error categories
|
|
808
813
|
BadRequestError,
|
|
809
814
|
UnauthorizedError,
|
|
815
|
+
PaymentRequiredError,
|
|
810
816
|
NotFoundError,
|
|
811
817
|
ConflictError,
|
|
812
818
|
TooManyRequestsError,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
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.73"
|
|
27
27
|
},
|
|
28
28
|
"types": ".tsc/lib/index.d.ts",
|
|
29
29
|
"files": [
|