@pdfvector/instance-contract 0.0.47 → 0.0.55

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.
@@ -0,0 +1,5 @@
1
+ import { z } from "zod";
2
+ export declare const pageMarkdownSchema: z.ZodObject<{
3
+ pageNumber: z.ZodNumber;
4
+ markdown: z.ZodString;
5
+ }, z.core.$strip>;
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ export const pageMarkdownSchema = z.object({
3
+ pageNumber: z
4
+ .number()
5
+ .int()
6
+ .min(1)
7
+ .describe("1-based page number in the source document"),
8
+ markdown: z.string().describe("Extracted markdown content for this page"),
9
+ });
@@ -9,6 +9,7 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
9
9
  max: "max";
10
10
  auto: "auto";
11
11
  }>>>;
12
+ includePages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
13
  callback: z.ZodOptional<z.ZodObject<{
13
14
  url: z.ZodURL;
14
15
  type: z.ZodOptional<z.ZodString>;
@@ -41,4 +42,8 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
41
42
  credits: z.ZodNumber;
42
43
  requestId: z.ZodNumber;
43
44
  html: z.ZodOptional<z.ZodString>;
45
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ pageNumber: z.ZodNumber;
47
+ markdown: z.ZodString;
48
+ }, z.core.$strip>>>;
44
49
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -1,6 +1,8 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { academicParseOpenApiCodeSamples } from "@pdfvector/api-docs";
2
3
  import { z } from "zod";
3
4
  import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
5
+ import { pageMarkdownSchema } from "../../page-markdown-schema.js";
4
6
  import { pdfvectorModelSchema } from "../../pdfvector-model-schema.js";
5
7
  import { documentParseModelDescription, outputModelDescription, } from "../../supported-mimes.js";
6
8
  import { providerSchema } from "./provider.js";
@@ -33,6 +35,11 @@ const parseInputSchema = z
33
35
  .optional()
34
36
  .default("auto")
35
37
  .describe(documentParseModelDescription),
38
+ includePages: z
39
+ .boolean()
40
+ .optional()
41
+ .default(false)
42
+ .describe("Set to true to include page-separated markdown in the pages array. Existing markdown output is still returned as the full paper text."),
36
43
  callback: callbackSchema,
37
44
  })
38
45
  .superRefine((input, ctx) => {
@@ -82,6 +89,10 @@ const parseOutputSchema = z.object({
82
89
  .string()
83
90
  .optional()
84
91
  .describe("Full HTML representation of the paper content. Only available when using the 'max' model."),
92
+ pages: z
93
+ .array(pageMarkdownSchema)
94
+ .optional()
95
+ .describe("Page-separated markdown content. Returned only when includePages is true."),
85
96
  });
86
97
  const requestExamples = {
87
98
  "Parse ArXiv paper by ID": {
@@ -105,6 +116,14 @@ const requestExamples = {
105
116
  model: "auto",
106
117
  },
107
118
  },
119
+ "Parse paper with page-separated output": {
120
+ summary: "Parse paper with page-separated output",
121
+ value: {
122
+ id: "1706.03762",
123
+ model: "auto",
124
+ includePages: true,
125
+ },
126
+ },
108
127
  };
109
128
  export const parse = oc
110
129
  .input(parseInputSchema)
@@ -121,6 +140,7 @@ export const parse = oc
121
140
  mediaType.examples = requestExamples;
122
141
  }
123
142
  }
143
+ op["x-codeSamples"] = academicParseOpenApiCodeSamples;
124
144
  return op;
125
145
  },
126
146
  });
@@ -10,6 +10,10 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
10
10
  max: "max";
11
11
  auto: "auto";
12
12
  }>>>;
13
+ includePages: z.ZodDefault<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodPipe<z.ZodEnum<{
14
+ true: "true";
15
+ false: "false";
16
+ }>, z.ZodTransform<boolean, "true" | "false">>]>>>;
13
17
  callback: z.ZodOptional<z.ZodObject<{
14
18
  url: z.ZodURL;
15
19
  type: z.ZodOptional<z.ZodString>;
@@ -27,4 +31,8 @@ export declare const parse: import("@orpc/contract").ContractProcedureBuilderWit
27
31
  requestId: z.ZodNumber;
28
32
  html: z.ZodOptional<z.ZodString>;
29
33
  documentId: z.ZodOptional<z.ZodString>;
34
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ pageNumber: z.ZodNumber;
36
+ markdown: z.ZodString;
37
+ }, z.core.$strip>>>;
30
38
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
@@ -1,6 +1,8 @@
1
1
  import { oc } from "@orpc/contract";
2
+ import { documentParseOpenApiCodeSamples } from "@pdfvector/api-docs";
2
3
  import { z } from "zod";
3
4
  import { fetchableUrlSchema } from "../../fetchable-url-schema.js";
5
+ import { pageMarkdownSchema } from "../../page-markdown-schema.js";
4
6
  import { pdfvectorModelSchema } from "../../pdfvector-model-schema.js";
5
7
  import { documentParseModelDescription, outputModelDescription, supportedFileFormatsDescription, supportedFileMimeErrorMessage, supportedFileMimes, supportedFileTypesLong, } from "../../supported-mimes.js";
6
8
  import { getDefaultSpec } from "./get-default-spec.js";
@@ -22,6 +24,14 @@ const parseInputSchema = z.object({
22
24
  .optional()
23
25
  .default("auto")
24
26
  .describe(documentParseModelDescription),
27
+ includePages: z
28
+ .union([
29
+ z.boolean(),
30
+ z.enum(["true", "false"]).transform((value) => value === "true"),
31
+ ])
32
+ .optional()
33
+ .default(false)
34
+ .describe("Set to true to include page-separated markdown in the pages array. Existing markdown output is still returned as the full document text."),
25
35
  callback: z
26
36
  .object({
27
37
  url: fetchableUrlSchema.describe("Webhook URL where results will be POSTed when processing completes"),
@@ -57,6 +67,10 @@ const parseOutputSchema = z.object({
57
67
  .string()
58
68
  .optional()
59
69
  .describe("Document ID if provided via x-pdfvector-document-id header"),
70
+ pages: z
71
+ .array(pageMarkdownSchema)
72
+ .optional()
73
+ .describe("Page-separated markdown content. Returned only when includePages is true."),
60
74
  });
61
75
  const requestExamples = {
62
76
  "Parse from URL": {
@@ -84,6 +98,13 @@ const requestExamples = {
84
98
  model: "nano",
85
99
  },
86
100
  },
101
+ "Parse with page-separated output": {
102
+ summary: "Parse with page-separated output",
103
+ value: {
104
+ url: "https://drive.google.com/file/d/13T04Yk20OwBNIDyvJJ3XlUg9WfOsmbjm/view?usp=share_link",
105
+ includePages: true,
106
+ },
107
+ },
87
108
  "Parse with small complex documents (pro)": {
88
109
  summary: "Parse with small complex documents (pro)",
89
110
  value: {
@@ -104,7 +125,11 @@ export const parse = oc
104
125
  summary: "Parse a document",
105
126
  description: `Extract text and page count from a document. Supports ${supportedFileTypesLong}. Provide the document via file upload, a public URL, or a base64-encoded string.`,
106
127
  tags: ["Document"],
107
- spec: (op) => getDefaultSpec(op, requestExamples),
128
+ spec: (op) => {
129
+ const spec = getDefaultSpec(op, requestExamples);
130
+ spec["x-codeSamples"] = documentParseOpenApiCodeSamples;
131
+ return spec;
132
+ },
108
133
  })
109
134
  .input(parseInputSchema)
110
135
  .output(parseOutputSchema);
package/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # @pdfvector/instance-contract
2
2
 
3
+ ## 0.0.55
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#273](https://github.com/phuctm97/pdfvector/pull/273) [`905025f`](https://github.com/phuctm97/pdfvector/commit/905025f926b760b5b1b7f6cfc876fc8557c70d46) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Release npm packages with trusted publishing
9
+
10
+ - Updated dependencies [[`905025f`](https://github.com/phuctm97/pdfvector/commit/905025f926b760b5b1b7f6cfc876fc8557c70d46)]:
11
+ - @pdfvector/api-docs@0.0.5
12
+ - @pdfvector/util@0.0.23
13
+
14
+ ## 0.0.54
15
+ ### Patch Changes
16
+
17
+
18
+
19
+ - [#271](https://github.com/phuctm97/pdfvector/pull/271) [`054e4db`](https://github.com/phuctm97/pdfvector/commit/054e4dbeb712d5fe482c80f08082c33e09480942) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Authenticate npm package release workflows
20
+
21
+ - Updated dependencies [[`054e4db`](https://github.com/phuctm97/pdfvector/commit/054e4dbeb712d5fe482c80f08082c33e09480942)]:
22
+ - @pdfvector/api-docs@0.0.4
23
+
24
+ ## 0.0.53
25
+ ### Patch Changes
26
+
27
+
28
+
29
+ - [#270](https://github.com/phuctm97/pdfvector/pull/270) [`e3503c4`](https://github.com/phuctm97/pdfvector/commit/e3503c4922384cad889e92cc2a6f5979b05544fe) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Use npm publish for npm package release workflows
30
+
31
+ - Updated dependencies [[`e3503c4`](https://github.com/phuctm97/pdfvector/commit/e3503c4922384cad889e92cc2a6f5979b05544fe)]:
32
+ - @pdfvector/api-docs@0.0.3
33
+
34
+ ## 0.0.52
35
+ ### Patch Changes
36
+
37
+
38
+
39
+ - [#269](https://github.com/phuctm97/pdfvector/pull/269) [`11c2f38`](https://github.com/phuctm97/pdfvector/commit/11c2f3891ceaa9f051664598624a3e75aa5f096d) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Fix npm package release publishing
40
+
41
+ - Updated dependencies [[`11c2f38`](https://github.com/phuctm97/pdfvector/commit/11c2f3891ceaa9f051664598624a3e75aa5f096d)]:
42
+ - @pdfvector/api-docs@0.0.2
43
+
44
+ ## 0.0.51
45
+ ### Patch Changes
46
+
47
+
48
+
49
+ - [#268](https://github.com/phuctm97/pdfvector/pull/268) [`37c6f35`](https://github.com/phuctm97/pdfvector/commit/37c6f35a6d2129e95a79fd44f7834a6e12df04ee) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add page-separated parse output
50
+
51
+ - Updated dependencies [[`37c6f35`](https://github.com/phuctm97/pdfvector/commit/37c6f35a6d2129e95a79fd44f7834a6e12df04ee)]:
52
+ - @pdfvector/api-docs@0.0.1
53
+
54
+ ## 0.0.50
55
+ ### Patch Changes
56
+
57
+
58
+
59
+ - [#267](https://github.com/phuctm97/pdfvector/pull/267) [`d6f79b3`](https://github.com/phuctm97/pdfvector/commit/d6f79b3d9a8bf5554e3f8dc0912468031ddb0c7a) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Suppress image empty parse Sentry noise
60
+
61
+ ## 0.0.49
62
+ ### Patch Changes
63
+
64
+
65
+
66
+ - [#260](https://github.com/phuctm97/pdfvector/pull/260) [`e24aa70`](https://github.com/phuctm97/pdfvector/commit/e24aa706cdd48a10efa13d3d613d63cebf921d16) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Update workspace dependencies
67
+
68
+ ## 0.0.48
69
+ ### Patch Changes
70
+
71
+
72
+
73
+ - [#250](https://github.com/phuctm97/pdfvector/pull/250) [`a2e6883`](https://github.com/phuctm97/pdfvector/commit/a2e68833d9f0dd6b38ea5b4b2a91aefb9f13aaf8) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Upgrade workspace dependencies and adapt SPA navigation state typing for React Router 7.15.1.
74
+
3
75
  ## 0.0.47
4
76
  ### Patch Changes
5
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfvector/instance-contract",
3
- "version": "0.0.47",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "description": "API contract definitions for PDF Vector instance server",
6
6
  "license": "MIT",
@@ -20,9 +20,10 @@
20
20
  },
21
21
  "main": ".tsc/lib/index.js",
22
22
  "dependencies": {
23
- "@orpc/client": "^1.14.2",
24
- "@orpc/contract": "^1.14.2",
25
- "@pdfvector/util": "0.0.22"
23
+ "@orpc/client": "^1.14.5",
24
+ "@orpc/contract": "^1.14.5",
25
+ "@pdfvector/api-docs": "^0.0.5",
26
+ "@pdfvector/util": "^0.0.23"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "zod": "^4.4.3"