@pdfvector/instance-client 0.0.70 → 0.0.72
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/.tsc/lib/errors.d.ts.map +1 -1
- package/.tsc/lib/errors.js +19 -5
- package/.tsc/lib/index.d.ts.map +1 -1
- package/.tsc/lib/index.js +3 -31
- package/.tsc/lib/map-client-error.d.ts +4 -0
- package/.tsc/lib/map-client-error.d.ts.map +1 -0
- package/.tsc/lib/map-client-error.js +9 -0
- package/CHANGELOG.md +14 -0
- package/README.md +3 -2
- package/package.json +2 -2
package/.tsc/lib/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../lib/errors.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAC3B,aAAa,GACb,cAAc,GACd,WAAW,GACX,mBAAmB,GACnB,UAAU,GACV,iBAAiB,GACjB,uBAAuB,GACvB,uBAAuB,CAAC;AAE3B,MAAM,MAAM,sBAAsB,GAC/B,gBAAgB,GAChB,YAAY,GACZ,gBAAgB,GAChB,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,UAAU,GACV,aAAa,GACb,QAAQ,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,KAAK,eAAe,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EA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CAAC;IAEpC,YAAY,OAAO,EAAE,eAAe,EAKnC;CACD;AAED,qBAAa,oBAAqB,SAAQ,eAAe;CAAG;AAE5D,qBAAa,kBAAmB,SAAQ,yBAAyB;CAAG;AAEpE,qBAAa,mBAAoB,SAAQ,yBAAyB;CAAG;AAErE,qBAAa,qBAAsB,SAAQ,yBAAyB;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC,YAAY,OAAO,EAAE,eAAe,EAInC;CACD;AAED,qBAAa,0BAA2B,SAAQ,aAAa;IAC5D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5C,YAAY,OAAO,EAAE,eAAe,EAInC;CACD;AAED,qBAAa,gBAAiB,SAAQ,aAAa;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,YAAY,OAAO,EAAE,eAAe,EAMnC;CACD;AAkGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAexE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAE5E"}
|
package/.tsc/lib/errors.js
CHANGED
|
@@ -154,12 +154,29 @@ function inferSuggestion(code, message, data) {
|
|
|
154
154
|
? `Wait until ${resetAt}, then retry the request.`
|
|
155
155
|
: "Wait for the rate limit window to reset, then retry the request.";
|
|
156
156
|
}
|
|
157
|
+
if (code === "INTERNAL_SERVER_ERROR") {
|
|
158
|
+
return requestId
|
|
159
|
+
? `Retry the request. If it keeps failing, contact support with requestId ${requestId}.`
|
|
160
|
+
: "Retry the request. If it keeps failing, contact support with the request details.";
|
|
161
|
+
}
|
|
157
162
|
if (hasHigherModelHint(message, data)) {
|
|
158
163
|
const requestedModel = readString(data, "requestedModel");
|
|
159
164
|
return requestedModel
|
|
160
165
|
? `Retry with a higher model than '${requestedModel}', or reduce the file size/pages before sending it again.`
|
|
161
166
|
: "Retry with a higher model, or reduce the file size/pages before sending it again.";
|
|
162
167
|
}
|
|
168
|
+
const reasonCode = readString(data, "code");
|
|
169
|
+
if (reasonCode === "DOCUMENT_PROCESSING_FAILED" ||
|
|
170
|
+
reasonCode === "DOCUMENT_AI_INVALID_ARGUMENT" ||
|
|
171
|
+
reasonCode === "DOCUMENT_INTELLIGENCE_INVALID_REQUEST") {
|
|
172
|
+
return requestId
|
|
173
|
+
? `Retry the request. If it keeps failing, contact support with requestId ${requestId}.`
|
|
174
|
+
: "Retry the request. If it keeps failing, contact support with the request details.";
|
|
175
|
+
}
|
|
176
|
+
if (reasonCode === "EXTRACTION_FAILED")
|
|
177
|
+
return "Simplify the extraction schema or prompt, then retry.";
|
|
178
|
+
if (reasonCode === "MODEL_OUTPUT_UNUSABLE")
|
|
179
|
+
return "Try a simpler question or a clearer document, then retry.";
|
|
163
180
|
if (lower.includes("password-protected")) {
|
|
164
181
|
return "Remove the document password or upload an unlocked copy.";
|
|
165
182
|
}
|
|
@@ -191,11 +208,6 @@ function inferSuggestion(code, message, data) {
|
|
|
191
208
|
if (code === "NOT_FOUND") {
|
|
192
209
|
return "Check the identifier or URL and retry with a value that PDF Vector can resolve.";
|
|
193
210
|
}
|
|
194
|
-
if (code === "INTERNAL_SERVER_ERROR") {
|
|
195
|
-
return requestId
|
|
196
|
-
? `Retry the request. If it keeps failing, contact support with requestId ${requestId}.`
|
|
197
|
-
: "Retry the request. If it keeps failing, contact support with the request details.";
|
|
198
|
-
}
|
|
199
211
|
if (code === "UNPROCESSABLE_CONTENT") {
|
|
200
212
|
return "Review the document quality and requested operation, then retry with clearer content or a simpler extraction prompt/schema.";
|
|
201
213
|
}
|
|
@@ -491,6 +503,8 @@ function selectSpecializedClass(code, message, data) {
|
|
|
491
503
|
return NoInputProvidedError;
|
|
492
504
|
}
|
|
493
505
|
if (code === "UNPROCESSABLE_CONTENT") {
|
|
506
|
+
if (data["code"] === "EXTRACTION_FAILED")
|
|
507
|
+
return ExtractionFailedError;
|
|
494
508
|
if (lower.includes("does not appear to contain any readable text") ||
|
|
495
509
|
lower.includes("does not appear to contain any text"))
|
|
496
510
|
return NoTextDetectedError;
|
package/.tsc/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EAGb,MAAM,8BAA8B,CAAC;AAKtC,MAAM,MAAM,SAAS,GAClB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,KAAK,GACL,YAAY,GACZ,KAAK,GACL,SAAS,CAAC;AAEb,MAAM,WAAW,mBAAmB;IACnC,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,MAAM,GAAG,IAAI,CACxB,oBAAoB,CAAC,OAAO,QAAQ,EAAE,aAAa,CAAC,EACpD,OAAO,GAAG,MAAM,CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EAGb,MAAM,8BAA8B,CAAC;AAKtC,MAAM,MAAM,SAAS,GAClB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,KAAK,GACL,YAAY,GACZ,KAAK,GACL,SAAS,CAAC;AAEb,MAAM,WAAW,mBAAmB;IACnC,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,MAAM,GAAG,IAAI,CACxB,oBAAoB,CAAC,OAAO,QAAQ,EAAE,aAAa,CAAC,EACpD,OAAO,GAAG,MAAM,CAChB,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAwBlE;AAED,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC"}
|
package/.tsc/lib/index.js
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
import { createORPCClient, RPCLink, } from "@pdfvector/instance-contract";
|
|
2
|
-
import {
|
|
2
|
+
import { mapClientError } from "./map-client-error.js";
|
|
3
3
|
const DEFAULT_DOMAIN = "global.pdfvector.com";
|
|
4
|
-
function wrapWithErrorMapping(target) {
|
|
5
|
-
return new Proxy(target, {
|
|
6
|
-
apply(obj, thisArg, args) {
|
|
7
|
-
try {
|
|
8
|
-
const result = Reflect.apply(obj, thisArg, args);
|
|
9
|
-
if (result instanceof Promise) {
|
|
10
|
-
return result.catch((err) => {
|
|
11
|
-
const mapped = fromORPCError(err);
|
|
12
|
-
throw mapped ?? err;
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
const mapped = fromORPCError(err);
|
|
19
|
-
throw mapped ?? err;
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
get(obj, prop, receiver) {
|
|
23
|
-
const value = Reflect.get(obj, prop, receiver);
|
|
24
|
-
if (value !== null &&
|
|
25
|
-
(typeof value === "object" || typeof value === "function")) {
|
|
26
|
-
return wrapWithErrorMapping(value);
|
|
27
|
-
}
|
|
28
|
-
return value;
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
4
|
export function createClient(options) {
|
|
33
5
|
const domain = options?.domain ?? DEFAULT_DOMAIN;
|
|
34
6
|
const isLocal = domain.startsWith("localhost") || domain.startsWith("127.0.0.1");
|
|
@@ -37,6 +9,7 @@ export function createClient(options) {
|
|
|
37
9
|
const source = options?.source ?? "sdk";
|
|
38
10
|
const link = new RPCLink({
|
|
39
11
|
url: `${baseUrl}/rpc`,
|
|
12
|
+
interceptors: [mapClientError],
|
|
40
13
|
headers: ({ context }) => {
|
|
41
14
|
const headers = {
|
|
42
15
|
"x-pdfvector-source": source,
|
|
@@ -49,8 +22,7 @@ export function createClient(options) {
|
|
|
49
22
|
},
|
|
50
23
|
fetch: (input, init) => fetch(input, token ? init : { ...init, credentials: "include" }),
|
|
51
24
|
});
|
|
52
|
-
|
|
53
|
-
return wrapWithErrorMapping(raw);
|
|
25
|
+
return createORPCClient(link);
|
|
54
26
|
}
|
|
55
27
|
export * from "@pdfvector/instance-contract";
|
|
56
28
|
export * from "./errors.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-client-error.d.ts","sourceRoot":"","sources":["../../lib/map-client-error.ts"],"names":[],"mappings":"AAEA,wBAAsB,cAAc,CAAC,EACpC,IAAI,GACJ,EAAE;IACF,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7B,GAAG,OAAO,CAAC,OAAO,CAAC,CAMnB"}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pdfvector/instance-client
|
|
2
2
|
|
|
3
|
+
## 0.0.72
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#376](https://github.com/phuctm97/pdfvector/pull/376) [`3b01a52`](https://github.com/phuctm97/pdfvector/commit/3b01a52958ae4d2d7830d41ae36b1021ab6fc8a7) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Upgrade workspace dependencies, remove package overrides and redundant declarations, merge shared API documentation into the util package, use native Bun timing in instance retries, and replace manual browser detection with Bowser.
|
|
8
|
+
- Updated dependencies [[`3b01a52`](https://github.com/phuctm97/pdfvector/commit/3b01a52958ae4d2d7830d41ae36b1021ab6fc8a7)]:
|
|
9
|
+
- @pdfvector/instance-contract@0.2.11
|
|
10
|
+
|
|
11
|
+
## 0.0.71
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#368](https://github.com/phuctm97/pdfvector/pull/368) [`8c7c7d0`](https://github.com/phuctm97/pdfvector/commit/8c7c7d0c650765ffe93f9e7524c42e9eba1e1f15) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Use the documented UKRI project search response and EU Funding & Tenders grant filter, and URL-encode arXiv search queries safely. Retry transient academic HTTP responses through Ky's response hook while preserving normal Response objects for callers. Report system-caused document and model errors to Sentry; return safe messages for internal failures while preserving support request IDs; and expose provider-neutral processing reason codes without raw AI output, with accurate client suggestions. Use the Google Document AI client's built-in retry policy, Azure's typed nested errors, and AI SDK's API error guards instead of manual wrappers and property inspection. Repair malformed AI SDK structured output and avoid stacking its retries over model fallbacks. Map npm client errors with oRPC link interceptors instead of recursive proxy wrappers.
|
|
16
|
+
|
|
3
17
|
## 0.0.70
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -625,6 +625,8 @@ console.log(resultB.documentId); // "doc-b"
|
|
|
625
625
|
|
|
626
626
|
All API errors are thrown as `PDFVectorError` instances. The SDK maps server errors into specific subclasses and adds user/agent-friendly fields such as `title`, `suggestion`, `userError`, retry flags, and `requestId`.
|
|
627
627
|
|
|
628
|
+
For `INTERNAL_SERVER_ERROR`, the API returns a safe message and keeps the original provider failure in server diagnostics. Use `requestId` when contacting support. For document processing failures, check `reasonCode` and `retryableWithHigherModel` instead of parsing the message; `EXTRACTION_FAILED` identifies unusable structured output even if message wording changes. `DOCUMENT_PROCESSING_FAILED` identifies a processing rejection that was not confirmed to be a caller-input error, so the SDK suggests retrying or contacting support rather than changing the document. Error responses do not include raw AI output.
|
|
629
|
+
|
|
628
630
|
```typescript
|
|
629
631
|
import {
|
|
630
632
|
PDFVectorError,
|
|
@@ -722,7 +724,6 @@ try {
|
|
|
722
724
|
console.error("The document has no readable content");
|
|
723
725
|
} else if (error instanceof ExtractionFailedError) {
|
|
724
726
|
console.error(`Extraction failed. Hint: ${error.hint}`);
|
|
725
|
-
if (error.rawText) console.error(`Model output sample: ${error.rawText}`);
|
|
726
727
|
}
|
|
727
728
|
}
|
|
728
729
|
```
|
|
@@ -751,7 +752,7 @@ PDFVectorError
|
|
|
751
752
|
├── UnprocessableContentError (422)
|
|
752
753
|
│ ├── EmptyDocumentError
|
|
753
754
|
│ ├── NoTextDetectedError
|
|
754
|
-
│ └── ExtractionFailedError — hint
|
|
755
|
+
│ └── ExtractionFailedError — hint
|
|
755
756
|
├── InternalServerError (500)
|
|
756
757
|
└── NotImplementedError (501)
|
|
757
758
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/instance-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official TypeScript/JavaScript SDK for PDF Vector API - Parse PDF/Word/Image/Excel documents to clean, structured markdown format and search academic publications across multiple databases",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"main": ".tsc/lib/index.js",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@pdfvector/instance-contract": "^0.2.
|
|
36
|
+
"@pdfvector/instance-contract": "^0.2.11"
|
|
37
37
|
},
|
|
38
38
|
"types": ".tsc/lib/index.d.ts",
|
|
39
39
|
"files": [
|