@pdfvector/instance-client 0.0.44 → 0.0.46
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/index.d.ts +4 -1
- package/.tsc/lib/index.js +6 -3
- package/CHANGELOG.md +20 -0
- package/package.json +2 -2
package/.tsc/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { type ContractRouterClient, type contract } from "@pdfvector/instance-contract";
|
|
2
|
+
export type APISource = "make" | "zapier" | "n8n" | "sdk" | "playground" | "api" | "unknown";
|
|
2
3
|
export interface CreateClientOptions {
|
|
3
4
|
/** Defaults to "global.pdfvector.com". */
|
|
4
5
|
domain?: string;
|
|
5
6
|
apiKey?: string;
|
|
7
|
+
/** Identifies the calling surface. Defaults to "sdk". */
|
|
8
|
+
source?: APISource;
|
|
6
9
|
}
|
|
7
10
|
export interface ClientContext {
|
|
8
11
|
/** Optional ID echoed back in responses, used for per-document usage tracking. */
|
|
@@ -11,4 +14,4 @@ export interface ClientContext {
|
|
|
11
14
|
export type Client = Omit<ContractRouterClient<typeof contract, ClientContext>, "admin" | "free">;
|
|
12
15
|
export declare function createClient(options?: CreateClientOptions): Client;
|
|
13
16
|
export * from "@pdfvector/instance-contract";
|
|
14
|
-
export * from "./errors";
|
|
17
|
+
export * from "./errors.js";
|
package/.tsc/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createORPCClient, RPCLink, } from "@pdfvector/instance-contract";
|
|
2
|
-
import { fromORPCError } from "./errors";
|
|
2
|
+
import { fromORPCError } from "./errors.js";
|
|
3
3
|
const DEFAULT_DOMAIN = "global.pdfvector.com";
|
|
4
4
|
function wrapWithErrorMapping(target) {
|
|
5
5
|
return new Proxy(target, {
|
|
@@ -34,10 +34,13 @@ export function createClient(options) {
|
|
|
34
34
|
const isLocal = domain.startsWith("localhost") || domain.startsWith("127.0.0.1");
|
|
35
35
|
const baseUrl = `${isLocal ? "http" : "https"}://${domain}`;
|
|
36
36
|
const token = options?.apiKey;
|
|
37
|
+
const source = options?.source ?? "sdk";
|
|
37
38
|
const link = new RPCLink({
|
|
38
39
|
url: `${baseUrl}/rpc`,
|
|
39
40
|
headers: ({ context }) => {
|
|
40
|
-
const headers = {
|
|
41
|
+
const headers = {
|
|
42
|
+
"x-pdfvector-source": source,
|
|
43
|
+
};
|
|
41
44
|
if (token)
|
|
42
45
|
headers.authorization = `Bearer ${token}`;
|
|
43
46
|
if (context?.documentId)
|
|
@@ -50,4 +53,4 @@ export function createClient(options) {
|
|
|
50
53
|
return wrapWithErrorMapping(raw);
|
|
51
54
|
}
|
|
52
55
|
export * from "@pdfvector/instance-contract";
|
|
53
|
-
export * from "./errors";
|
|
56
|
+
export * from "./errors.js";
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @pdfvector/instance-client
|
|
2
2
|
|
|
3
|
+
## 0.0.46
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#226](https://github.com/phuctm97/pdfvector/pull/226) [`216ba54`](https://github.com/phuctm97/pdfvector/commit/216ba5427a32de5eb3346f0b3ff8d60f01fb8751) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Fix published ESM artifact import paths and bump zapier and make
|
|
9
|
+
|
|
10
|
+
- Updated dependencies [[`216ba54`](https://github.com/phuctm97/pdfvector/commit/216ba5427a32de5eb3346f0b3ff8d60f01fb8751)]:
|
|
11
|
+
- @pdfvector/instance-contract@0.0.43
|
|
12
|
+
|
|
13
|
+
## 0.0.45
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
- [#225](https://github.com/phuctm97/pdfvector/pull/225) [`5d72a6c`](https://github.com/phuctm97/pdfvector/commit/5d72a6cb2dc5535b8c624f25709f8ae7fd9cc15b) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Track API caller source per usage record
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`5d72a6c`](https://github.com/phuctm97/pdfvector/commit/5d72a6cb2dc5535b8c624f25709f8ae7fd9cc15b)]:
|
|
21
|
+
- @pdfvector/instance-contract@0.0.42
|
|
22
|
+
|
|
3
23
|
## 0.0.44
|
|
4
24
|
### Patch Changes
|
|
5
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdfvector/instance-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
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.0.
|
|
36
|
+
"@pdfvector/instance-contract": "^0.0.43"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
".tsc",
|