@pdfvector/instance-client 0.0.63 → 0.0.65

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.
@@ -32,8 +32,8 @@ export declare class PDFVectorError extends Error {
32
32
  readonly code: PDFVectorErrorCode;
33
33
  readonly status: number;
34
34
  readonly data: Record<string, unknown>;
35
- readonly requestId?: number;
36
- readonly documentId?: string;
35
+ readonly requestId: number | undefined;
36
+ readonly documentId: string | undefined;
37
37
  readonly userError: boolean;
38
38
  readonly category: PDFVectorErrorCategory;
39
39
  readonly origin: PDFVectorErrorOrigin;
@@ -41,8 +41,8 @@ export declare class PDFVectorError extends Error {
41
41
  readonly suggestion: string;
42
42
  readonly retryable: boolean;
43
43
  readonly retryableWithHigherModel: boolean;
44
- readonly requestedModel?: string;
45
- readonly reasonCode?: string;
44
+ readonly requestedModel: string | undefined;
45
+ readonly reasonCode: string | undefined;
46
46
  readonly supportMessage: string;
47
47
  constructor(options: PDFVectorErrorOptions);
48
48
  toAgentError(): PDFVectorAgentError;
@@ -58,9 +58,9 @@ export declare class NotFoundError extends PDFVectorError {
58
58
  constructor(options: SubclassOptions);
59
59
  }
60
60
  export declare class TooManyRequestsError extends PDFVectorError {
61
- readonly limit?: number;
62
- readonly resetAt?: string;
63
- readonly retryAfterSeconds?: number;
61
+ readonly limit: number | undefined;
62
+ readonly resetAt: string | undefined;
63
+ readonly retryAfterSeconds: number | undefined;
64
64
  constructor(options: SubclassOptions);
65
65
  }
66
66
  export declare class ConflictError extends PDFVectorError {
@@ -76,28 +76,28 @@ export declare class InternalServerError extends PDFVectorError {
76
76
  constructor(options: SubclassOptions);
77
77
  }
78
78
  export declare class FileTooLargeError extends BadRequestError {
79
- readonly fileSizeMB?: number;
80
- readonly limitMB?: number;
81
- readonly model?: string;
79
+ readonly fileSizeMB: number | undefined;
80
+ readonly limitMB: number | undefined;
81
+ readonly model: string | undefined;
82
82
  constructor(options: SubclassOptions);
83
83
  }
84
84
  export declare class PageLimitExceededError extends BadRequestError {
85
- readonly pageCount?: number;
86
- readonly pageLimit?: number;
87
- readonly model?: string;
85
+ readonly pageCount: number | undefined;
86
+ readonly pageLimit: number | undefined;
87
+ readonly model: string | undefined;
88
88
  constructor(options: SubclassOptions);
89
89
  }
90
90
  export declare class PasswordProtectedError extends BadRequestError {
91
91
  }
92
92
  export declare class UnsupportedFormatError extends BadRequestError {
93
- readonly format?: string;
94
- readonly supportedFormats?: string;
93
+ readonly format: string | undefined;
94
+ readonly supportedFormats: string | undefined;
95
95
  constructor(options: SubclassOptions);
96
96
  }
97
97
  export declare class URLFetchError extends BadRequestError {
98
- readonly url?: string;
99
- readonly statusCode?: number;
100
- readonly statusText?: string;
98
+ readonly url: string | undefined;
99
+ readonly statusCode: number | undefined;
100
+ readonly statusText: string | undefined;
101
101
  constructor(options: SubclassOptions);
102
102
  }
103
103
  export declare class InvalidDocumentURLError extends BadRequestError {
@@ -105,13 +105,13 @@ export declare class InvalidDocumentURLError extends BadRequestError {
105
105
  export declare class InvalidBase64Error extends BadRequestError {
106
106
  }
107
107
  export declare class TierNotSupportedError extends BadRequestError {
108
- readonly documentType?: string;
109
- readonly model?: string;
110
- readonly allowedTypes?: string[];
108
+ readonly documentType: string | undefined;
109
+ readonly model: string | undefined;
110
+ readonly allowedTypes: string[] | undefined;
111
111
  constructor(options: SubclassOptions);
112
112
  }
113
113
  export declare class InvalidSchemaError extends BadRequestError {
114
- readonly reason?: string;
114
+ readonly reason: string | undefined;
115
115
  constructor(options: SubclassOptions);
116
116
  }
117
117
  export declare class NoInputProvidedError extends BadRequestError {
@@ -121,23 +121,24 @@ export declare class EmptyDocumentError extends UnprocessableContentError {
121
121
  export declare class NoTextDetectedError extends UnprocessableContentError {
122
122
  }
123
123
  export declare class ExtractionFailedError extends UnprocessableContentError {
124
- readonly hint?: string;
125
- readonly rawText?: string;
124
+ readonly hint: string | undefined;
125
+ readonly rawText: string | undefined;
126
126
  constructor(options: SubclassOptions);
127
127
  }
128
128
  export declare class AcademicPaperNotFoundError extends NotFoundError {
129
- readonly input?: string;
130
- readonly paperErrorCode?: string;
129
+ readonly input: string | undefined;
130
+ readonly paperErrorCode: string | undefined;
131
131
  constructor(options: SubclassOptions);
132
132
  }
133
133
  export declare class NoPublicPDFError extends NotFoundError {
134
- readonly input?: string;
135
- readonly paperTitle?: string;
136
- readonly doi?: string;
137
- readonly providerURL?: string;
134
+ readonly input: string | undefined;
135
+ readonly paperTitle: string | undefined;
136
+ readonly doi: string | undefined;
137
+ readonly providerURL: string | undefined;
138
138
  constructor(options: SubclassOptions);
139
139
  }
140
140
  export declare function fromORPCError(error: unknown): PDFVectorError | undefined;
141
141
  export declare function isPDFVectorError(error: unknown): error is PDFVectorError;
142
142
  export declare function isPDFVectorUserError(error: unknown): error is PDFVectorError;
143
143
  export {};
144
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +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,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GAAG,SAAS,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;AAiGD,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"}
@@ -66,7 +66,9 @@ function inferCategory(code, message, data) {
66
66
  if (code === "INTERNAL_SERVER_ERROR")
67
67
  return "server";
68
68
  if (code === "UNPROCESSABLE_CONTENT") {
69
- return data.userError === true ? "document_input" : "document_processing";
69
+ return data["userError"] === true
70
+ ? "document_input"
71
+ : "document_processing";
70
72
  }
71
73
  if (lower.includes("json schema") ||
72
74
  lower.includes("invalid input") ||
@@ -77,11 +79,11 @@ function inferCategory(code, message, data) {
77
79
  return "document_input";
78
80
  }
79
81
  function inferOrigin(code, category, data) {
80
- if (data.userError === true)
82
+ if (data["userError"] === true)
81
83
  return "user";
82
84
  if (code === "INTERNAL_SERVER_ERROR")
83
85
  return "system";
84
- if (category === "document_processing" && data.userError !== true)
86
+ if (category === "document_processing" && data["userError"] !== true)
85
87
  return "system";
86
88
  return "user";
87
89
  }
@@ -497,11 +499,11 @@ function selectSpecializedClass(code, message, data) {
497
499
  return EmptyDocumentError;
498
500
  if (lower.startsWith("failed to extract structured data"))
499
501
  return ExtractionFailedError;
500
- if (data.hint !== undefined || data.rawText !== undefined)
502
+ if (data["hint"] !== undefined || data["rawText"] !== undefined)
501
503
  return ExtractionFailedError;
502
504
  }
503
505
  if (code === "NOT_FOUND") {
504
- if (data.code === "NO_PUBLIC_PDF" || lower.includes("no public pdf url"))
506
+ if (data["code"] === "NO_PUBLIC_PDF" || lower.includes("no public pdf url"))
505
507
  return NoPublicPDFError;
506
508
  if (lower.startsWith("paper not found"))
507
509
  return AcademicPaperNotFoundError;
@@ -15,3 +15,4 @@ export type Client = Omit<ContractRouterClient<typeof contract, ClientContext>,
15
15
  export declare function createClient(options?: CreateClientOptions): Client;
16
16
  export * from "@pdfvector/instance-contract";
17
17
  export * from "./errors.js";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAoCF,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAwBlE;AAED,cAAc,8BAA8B,CAAC;AAC7C,cAAc,UAAU,CAAC"}
package/.tsc/lib/index.js CHANGED
@@ -42,7 +42,7 @@ export function createClient(options) {
42
42
  "x-pdfvector-source": source,
43
43
  };
44
44
  if (token)
45
- headers.authorization = `Bearer ${token}`;
45
+ headers["authorization"] = `Bearer ${token}`;
46
46
  if (context?.documentId)
47
47
  headers["x-pdfvector-document-id"] = context.documentId;
48
48
  return headers;
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @pdfvector/instance-client
2
2
 
3
+ ## 0.0.65
4
+ ### Patch Changes
5
+
6
+ - Updated dependencies [[`58ab8c2`](https://github.com/phuctm97/pdfvector/commit/58ab8c23d6fb7d7a5eaf8621f8c2251b2c263184)]:
7
+ - @pdfvector/instance-contract@0.1.0
8
+
9
+ ## 0.0.64
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [[`1295973`](https://github.com/phuctm97/pdfvector/commit/12959733e27a056c78241404ef1f842f47487d21)]:
13
+ - @pdfvector/instance-contract@0.0.60
14
+
3
15
  ## 0.0.63
4
16
  ### Patch Changes
5
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfvector/instance-client",
3
- "version": "0.0.63",
3
+ "version": "0.0.65",
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.59"
36
+ "@pdfvector/instance-contract": "^0.1.0"
37
37
  },
38
38
  "files": [
39
39
  ".tsc",