@pdfvector/instance-client 0.0.44 → 0.0.45

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.
@@ -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. */
package/.tsc/lib/index.js CHANGED
@@ -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)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @pdfvector/instance-client
2
2
 
3
+ ## 0.0.45
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#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
9
+
10
+ - Updated dependencies [[`5d72a6c`](https://github.com/phuctm97/pdfvector/commit/5d72a6cb2dc5535b8c624f25709f8ae7fd9cc15b)]:
11
+ - @pdfvector/instance-contract@0.0.42
12
+
3
13
  ## 0.0.44
4
14
  ### Patch Changes
5
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfvector/instance-client",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
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.41"
36
+ "@pdfvector/instance-contract": "^0.0.42"
37
37
  },
38
38
  "files": [
39
39
  ".tsc",