@pdfvector/client 0.2.1 → 0.2.2

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.
@@ -1160,7 +1160,7 @@ declare const paperGraph: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1160
1160
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1161
1161
  declare const parse$4: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1162
1162
  id: z.ZodOptional<z.ZodString>;
1163
- url: z.ZodOptional<z.ZodURL>;
1163
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1164
1164
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1165
1165
  auto: "auto";
1166
1166
  max: "max";
@@ -1170,7 +1170,7 @@ declare const parse$4: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1170
1170
  }>>>;
1171
1171
  includePages: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1172
1172
  callback: z.ZodOptional<z.ZodObject<{
1173
- url: z.ZodURL;
1173
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1174
1174
  type: z.ZodOptional<z.ZodString>;
1175
1175
  }, z.core.$strip>>;
1176
1176
  }, z.core.$strip>, z.ZodObject<{
@@ -1766,7 +1766,7 @@ declare namespace index_d_exports$6 {
1766
1766
  export { validateCredential };
1767
1767
  }
1768
1768
  declare const ask$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1769
- url: z.ZodOptional<z.ZodURL>;
1769
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1770
1770
  file: z.ZodOptional<z.ZodFile>;
1771
1771
  base64: z.ZodOptional<z.ZodString>;
1772
1772
  question: z.ZodString;
@@ -1779,7 +1779,7 @@ declare const ask$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1779
1779
  }>>;
1780
1780
  documentId: z.ZodOptional<z.ZodString>;
1781
1781
  callback: z.ZodOptional<z.ZodObject<{
1782
- url: z.ZodURL;
1782
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1783
1783
  type: z.ZodOptional<z.ZodString>;
1784
1784
  }, z.core.$strip>>;
1785
1785
  }, z.core.$strip>, z.ZodObject<{
@@ -1796,7 +1796,7 @@ declare const ask$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1796
1796
  documentId: z.ZodOptional<z.ZodString>;
1797
1797
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1798
1798
  declare const extract$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1799
- url: z.ZodOptional<z.ZodURL>;
1799
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1800
1800
  file: z.ZodOptional<z.ZodFile>;
1801
1801
  base64: z.ZodOptional<z.ZodString>;
1802
1802
  prompt: z.ZodString;
@@ -1810,7 +1810,7 @@ declare const extract$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1810
1810
  }>>;
1811
1811
  documentId: z.ZodOptional<z.ZodString>;
1812
1812
  callback: z.ZodOptional<z.ZodObject<{
1813
- url: z.ZodURL;
1813
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1814
1814
  type: z.ZodOptional<z.ZodString>;
1815
1815
  }, z.core.$strip>>;
1816
1816
  }, z.core.$strip>, z.ZodObject<{
@@ -1827,7 +1827,7 @@ declare const extract$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1827
1827
  documentId: z.ZodOptional<z.ZodString>;
1828
1828
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1829
1829
  declare const parse$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1830
- url: z.ZodOptional<z.ZodURL>;
1830
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1831
1831
  file: z.ZodOptional<z.ZodFile>;
1832
1832
  base64: z.ZodOptional<z.ZodString>;
1833
1833
  model: z.ZodDefault<z.ZodEnum<{
@@ -1837,7 +1837,7 @@ declare const parse$3: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1837
1837
  }>>;
1838
1838
  documentId: z.ZodOptional<z.ZodString>;
1839
1839
  callback: z.ZodOptional<z.ZodObject<{
1840
- url: z.ZodURL;
1840
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1841
1841
  type: z.ZodOptional<z.ZodString>;
1842
1842
  }, z.core.$strip>>;
1843
1843
  }, z.core.$strip>, z.ZodObject<{
@@ -1856,7 +1856,7 @@ declare namespace index_d_exports$5 {
1856
1856
  export { ask$3 as ask, extract$3 as extract, parse$3 as parse };
1857
1857
  }
1858
1858
  declare const ask$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1859
- url: z.ZodOptional<z.ZodURL>;
1859
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1860
1860
  file: z.ZodOptional<z.ZodFile>;
1861
1861
  base64: z.ZodOptional<z.ZodString>;
1862
1862
  question: z.ZodString;
@@ -1869,7 +1869,7 @@ declare const ask$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1869
1869
  }>>>;
1870
1870
  documentId: z.ZodOptional<z.ZodString>;
1871
1871
  callback: z.ZodOptional<z.ZodObject<{
1872
- url: z.ZodURL;
1872
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1873
1873
  type: z.ZodOptional<z.ZodString>;
1874
1874
  }, z.core.$strip>>;
1875
1875
  }, z.core.$strip>, z.ZodObject<{
@@ -1886,7 +1886,7 @@ declare const ask$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1886
1886
  documentId: z.ZodOptional<z.ZodString>;
1887
1887
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1888
1888
  declare const extract$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1889
- url: z.ZodOptional<z.ZodURL>;
1889
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1890
1890
  file: z.ZodOptional<z.ZodFile>;
1891
1891
  base64: z.ZodOptional<z.ZodString>;
1892
1892
  prompt: z.ZodString;
@@ -1900,7 +1900,7 @@ declare const extract$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1900
1900
  }>>>;
1901
1901
  documentId: z.ZodOptional<z.ZodString>;
1902
1902
  callback: z.ZodOptional<z.ZodObject<{
1903
- url: z.ZodURL;
1903
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1904
1904
  type: z.ZodOptional<z.ZodString>;
1905
1905
  }, z.core.$strip>>;
1906
1906
  }, z.core.$strip>, z.ZodObject<{
@@ -1917,7 +1917,7 @@ declare const extract$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1917
1917
  documentId: z.ZodOptional<z.ZodString>;
1918
1918
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1919
1919
  declare const parse$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1920
- url: z.ZodOptional<z.ZodURL>;
1920
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1921
1921
  file: z.ZodOptional<z.ZodFile>;
1922
1922
  base64: z.ZodOptional<z.ZodString>;
1923
1923
  model: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
@@ -1933,7 +1933,7 @@ declare const parse$2: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1933
1933
  }>, z.ZodTransform<boolean, "false" | "true">>]>>>;
1934
1934
  documentId: z.ZodOptional<z.ZodString>;
1935
1935
  callback: z.ZodOptional<z.ZodObject<{
1936
- url: z.ZodURL;
1936
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
1937
1937
  type: z.ZodOptional<z.ZodString>;
1938
1938
  }, z.core.$strip>>;
1939
1939
  }, z.core.$strip>, z.ZodObject<{
@@ -1983,7 +1983,7 @@ declare namespace index_d_exports$4 {
1983
1983
  export { ask$2 as ask, extract$2 as extract, parse$2 as parse };
1984
1984
  }
1985
1985
  declare const bankStatementParse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1986
- url: z.ZodOptional<z.ZodURL>;
1986
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
1987
1987
  file: z.ZodOptional<z.ZodFile>;
1988
1988
  base64: z.ZodOptional<z.ZodString>;
1989
1989
  }, z.core.$strip>, z.ZodObject<{
@@ -1997,7 +1997,7 @@ declare const bankStatementParse: ContractProcedureBuilderWithInputOutput<z.ZodO
1997
1997
  html: z.ZodOptional<z.ZodString>;
1998
1998
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
1999
1999
  declare const documentParse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2000
- url: z.ZodOptional<z.ZodURL>;
2000
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2001
2001
  file: z.ZodOptional<z.ZodFile>;
2002
2002
  base64: z.ZodOptional<z.ZodString>;
2003
2003
  }, z.core.$strip>, z.ZodObject<{
@@ -2054,7 +2054,7 @@ declare namespace index_d_exports$3 {
2054
2054
  export { bankStatementParse, documentParse, generateSchema, publicationPdfUrl, rateLimitStatus };
2055
2055
  }
2056
2056
  declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2057
- url: z.ZodOptional<z.ZodURL>;
2057
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2058
2058
  file: z.ZodOptional<z.ZodFile>;
2059
2059
  base64: z.ZodOptional<z.ZodString>;
2060
2060
  question: z.ZodString;
@@ -2067,7 +2067,7 @@ declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2067
2067
  }>>;
2068
2068
  documentId: z.ZodOptional<z.ZodString>;
2069
2069
  callback: z.ZodOptional<z.ZodObject<{
2070
- url: z.ZodURL;
2070
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2071
2071
  type: z.ZodOptional<z.ZodString>;
2072
2072
  }, z.core.$strip>>;
2073
2073
  }, z.core.$strip>, z.ZodObject<{
@@ -2084,7 +2084,7 @@ declare const ask$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2084
2084
  documentId: z.ZodOptional<z.ZodString>;
2085
2085
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2086
2086
  declare const extract$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2087
- url: z.ZodOptional<z.ZodURL>;
2087
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2088
2088
  file: z.ZodOptional<z.ZodFile>;
2089
2089
  base64: z.ZodOptional<z.ZodString>;
2090
2090
  prompt: z.ZodString;
@@ -2098,7 +2098,7 @@ declare const extract$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2098
2098
  }>>;
2099
2099
  documentId: z.ZodOptional<z.ZodString>;
2100
2100
  callback: z.ZodOptional<z.ZodObject<{
2101
- url: z.ZodURL;
2101
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2102
2102
  type: z.ZodOptional<z.ZodString>;
2103
2103
  }, z.core.$strip>>;
2104
2104
  }, z.core.$strip>, z.ZodObject<{
@@ -2115,7 +2115,7 @@ declare const extract$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2115
2115
  documentId: z.ZodOptional<z.ZodString>;
2116
2116
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2117
2117
  declare const parse$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2118
- url: z.ZodOptional<z.ZodURL>;
2118
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2119
2119
  file: z.ZodOptional<z.ZodFile>;
2120
2120
  base64: z.ZodOptional<z.ZodString>;
2121
2121
  model: z.ZodDefault<z.ZodEnum<{
@@ -2125,7 +2125,7 @@ declare const parse$1: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2125
2125
  }>>;
2126
2126
  documentId: z.ZodOptional<z.ZodString>;
2127
2127
  callback: z.ZodOptional<z.ZodObject<{
2128
- url: z.ZodURL;
2128
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2129
2129
  type: z.ZodOptional<z.ZodString>;
2130
2130
  }, z.core.$strip>>;
2131
2131
  }, z.core.$strip>, z.ZodObject<{
@@ -2145,7 +2145,7 @@ declare namespace index_d_exports$2 {
2145
2145
  export { ask$1 as ask, extract$1 as extract, parse$1 as parse };
2146
2146
  }
2147
2147
  declare const ask: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2148
- url: z.ZodOptional<z.ZodURL>;
2148
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2149
2149
  file: z.ZodOptional<z.ZodFile>;
2150
2150
  base64: z.ZodOptional<z.ZodString>;
2151
2151
  question: z.ZodString;
@@ -2158,7 +2158,7 @@ declare const ask: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2158
2158
  }>>;
2159
2159
  documentId: z.ZodOptional<z.ZodString>;
2160
2160
  callback: z.ZodOptional<z.ZodObject<{
2161
- url: z.ZodURL;
2161
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2162
2162
  type: z.ZodOptional<z.ZodString>;
2163
2163
  }, z.core.$strip>>;
2164
2164
  }, z.core.$strip>, z.ZodObject<{
@@ -2175,7 +2175,7 @@ declare const ask: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2175
2175
  documentId: z.ZodOptional<z.ZodString>;
2176
2176
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2177
2177
  declare const extract: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2178
- url: z.ZodOptional<z.ZodURL>;
2178
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2179
2179
  file: z.ZodOptional<z.ZodFile>;
2180
2180
  base64: z.ZodOptional<z.ZodString>;
2181
2181
  prompt: z.ZodString;
@@ -2189,7 +2189,7 @@ declare const extract: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2189
2189
  }>>;
2190
2190
  documentId: z.ZodOptional<z.ZodString>;
2191
2191
  callback: z.ZodOptional<z.ZodObject<{
2192
- url: z.ZodURL;
2192
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2193
2193
  type: z.ZodOptional<z.ZodString>;
2194
2194
  }, z.core.$strip>>;
2195
2195
  }, z.core.$strip>, z.ZodObject<{
@@ -2206,7 +2206,7 @@ declare const extract: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2206
2206
  documentId: z.ZodOptional<z.ZodString>;
2207
2207
  }, z.core.$strip>, Record<never, never>, Record<never, never>>;
2208
2208
  declare const parse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2209
- url: z.ZodOptional<z.ZodURL>;
2209
+ url: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>>;
2210
2210
  file: z.ZodOptional<z.ZodFile>;
2211
2211
  base64: z.ZodOptional<z.ZodString>;
2212
2212
  model: z.ZodDefault<z.ZodEnum<{
@@ -2216,7 +2216,7 @@ declare const parse: ContractProcedureBuilderWithInputOutput<z.ZodObject<{
2216
2216
  }>>;
2217
2217
  documentId: z.ZodOptional<z.ZodString>;
2218
2218
  callback: z.ZodOptional<z.ZodObject<{
2219
- url: z.ZodURL;
2219
+ url: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodURL>;
2220
2220
  type: z.ZodOptional<z.ZodString>;
2221
2221
  }, z.core.$strip>>;
2222
2222
  }, z.core.$strip>, z.ZodObject<{
package/dist/contract.mjs CHANGED
@@ -2194,11 +2194,22 @@ const paperGraph = oc.input(z.object({
2194
2194
  return op;
2195
2195
  }
2196
2196
  });
2197
+ // ../util/lib/contract/instance/bare-file-name.ts
2198
+ const bareFileName = /^[^/?#]+\.(pdf|docx?|xlsx?|pptx?|csv|tsv|txt|md|rtf|odt|ods|odp|epub|png|jpe?g|tiff?|bmp|heic|heif|html?|xml|bib|zip)$/i;
2199
+ // ../util/lib/contract/instance/with-default-url-scheme.ts
2200
+ const schemeLessHost = /^[a-z\d-]+(\.[a-z\d-]+)*\.[a-z]{2,63}(:\d+)?([/?#]|$)/i;
2201
+ function withDefaultUrlScheme(value) {
2202
+ if (value.startsWith("//")) return `https:${value}`;
2203
+ return schemeLessHost.test(value) && !bareFileName.test(value) ? `https://${value}` : value;
2204
+ }
2197
2205
  // ../util/lib/contract/instance/fetchable-url-schema.ts
2198
- const fetchableUrlSchema = z.url({
2199
- protocol: /^https?$/,
2200
- error: "URL must use http or https"
2201
- });
2206
+ function createFetchableUrlSchema(error) {
2207
+ return z.string().trim().transform(withDefaultUrlScheme).pipe(z.url({
2208
+ protocol: /^https?$/,
2209
+ error: (issue) => error(issue.input)
2210
+ }));
2211
+ }
2212
+ const fetchableUrlSchema = createFetchableUrlSchema(() => "URL must use http or https");
2202
2213
  // ../util/lib/contract/instance/page-markdown-schema.ts
2203
2214
  const pageMarkdownSchema = z.object({
2204
2215
  pageNumber: z.number().int().min(1).describe("1-based page number in the source document"),
@@ -2317,7 +2328,7 @@ const callbackSchema = z.object({
2317
2328
  }).optional().describe("Optional webhook callback for async processing. When provided, the server returns 202 immediately and POSTs the full response payload to the callback URL when processing completes. On error, the callback receives a POST with X-Pdfvector-Callback-Failed: true header and error details in the body. Useful for long-running operations that may exceed client timeout limits.");
2318
2329
  const parseInputSchema$4 = z.object({
2319
2330
  id: z.string({ message: "id must be a string" }).trim().min(1, "id must be a non-empty string").optional().describe("Publication identifier to resolve and parse. Supports DOI, PubMed ID, ArXiv ID, Semantic Scholar ID, ERIC ID, Europe PMC ID, OpenAlex ID."),
2320
- url: fetchableUrlSchema.optional().describe("Publication URL to resolve and parse. Supports known provider URLs such as DOI, ArXiv, PubMed, Semantic Scholar, ERIC, Europe PMC, OpenAlex, Springer, Nature, bioRxiv, and medRxiv."),
2331
+ url: fetchableUrlSchema.optional().describe("Publication URL to resolve and parse. Supports known provider URLs such as DOI, ArXiv, PubMed, Semantic Scholar, ERIC, Europe PMC, OpenAlex, Springer, Nature, bioRxiv, and medRxiv. A URL without a scheme is fetched over https."),
2321
2332
  model: z.enum(["auto", ...pdfvectorModelSchema.options]).optional().default("auto").describe(documentParseModelDescription),
2322
2333
  includePages: z.boolean().optional().default(false).describe("Set to true to include page-separated markdown in the pages array. Existing markdown output is still returned as the full paper text."),
2323
2334
  callback: callbackSchema
@@ -3059,6 +3070,20 @@ const validateCredential = oc.route({
3059
3070
  }).input(inputSchema$4).output(outputSchema$5);
3060
3071
  // ../util/lib/contract/instance/router/authenticate/index.ts
3061
3072
  var authenticate_exports = /* @__PURE__ */ __exportAll({ validateCredential: () => validateCredential });
3073
+ // ../util/lib/contract/instance/local-document-url-hint.ts
3074
+ const localPath = /^(file:|[a-z]:[\\/]|\\\\|\/|~[\\/]|\.\.?[\\/])/i;
3075
+ const sendFileInstead = "Send the document itself instead with the file (multipart upload) or base64 field; in n8n, set Input Type to Binary Data.";
3076
+ function localDocumentUrlHint(input) {
3077
+ if (localPath.test(input) || bareFileName.test(input)) return `This looks like a file on your computer, which PDF Vector cannot read. ${sendFileInstead}`;
3078
+ if (/^blob:/i.test(input)) return `blob: URLs only exist inside your browser, so PDF Vector cannot fetch them. ${sendFileInstead}`;
3079
+ if (/[\r\n]/.test(input) || input.length > 200 && /\s/.test(input)) return `This looks like document text, not a URL. ${sendFileInstead}`;
3080
+ return null;
3081
+ }
3082
+ // ../util/lib/contract/instance/document-url-schema.ts
3083
+ const documentUrlSchema = createFetchableUrlSchema((input) => {
3084
+ const hint = localDocumentUrlHint(String(input));
3085
+ return hint ? `URL must use http or https. ${hint}` : "URL must use http or https";
3086
+ });
3062
3087
  // ../util/lib/contract/instance/router/bankStatement/get-default-spec.ts
3063
3088
  function getDefaultSpec$3(op, requestExamples) {
3064
3089
  op["security"] = [{ bearerAuth: [] }];
@@ -3081,7 +3106,7 @@ function getDefaultSpec$3(op, requestExamples) {
3081
3106
  // ../util/lib/contract/instance/router/bankStatement/ask.ts
3082
3107
  const specializedModelSchema$5 = z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3083
3108
  const askInputSchema$3 = z.object({
3084
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3109
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3085
3110
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3086
3111
  base64: z.string().optional().describe("Base64-encoded bank statement file content"),
3087
3112
  question: z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the bank statement"),
@@ -3134,7 +3159,7 @@ const jsonSchemaInput = z.union([schemaObject, z.string().transform((str, ctx) =
3134
3159
  // ../util/lib/contract/instance/router/bankStatement/extract.ts
3135
3160
  const specializedModelSchema$4 = z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3136
3161
  const extractInputSchema$3 = z.object({
3137
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3162
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3138
3163
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3139
3164
  base64: z.string().optional().describe("Base64-encoded bank statement file content"),
3140
3165
  prompt: z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the bank statement"),
@@ -3197,7 +3222,7 @@ const specializedParseModelSchema$2 = z.enum([
3197
3222
  "auto"
3198
3223
  ], { message: "model must be one of: pro, max, auto" }).default("auto");
3199
3224
  const parseInputSchema$3 = z.object({
3200
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3225
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3201
3226
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3202
3227
  base64: z.string().optional().describe("Base64-encoded bank statement file content"),
3203
3228
  model: specializedParseModelSchema$2.describe(specializedParseModelDescription("bank statement")),
@@ -3267,7 +3292,7 @@ function getDefaultSpec$2(op, requestExamples) {
3267
3292
  }
3268
3293
  // ../util/lib/contract/instance/router/document/ask.ts
3269
3294
  const askInputSchema$2 = z.object({
3270
- url: fetchableUrlSchema.optional().describe("URL of the document file to fetch and parse"),
3295
+ url: documentUrlSchema.optional().describe("URL of the document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3271
3296
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3272
3297
  base64: z.string().optional().describe("Base64-encoded document file content"),
3273
3298
  question: z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the document"),
@@ -3343,7 +3368,7 @@ const ask$2 = oc.route({
3343
3368
  }).input(askInputSchema$2).output(askOutputSchema$2);
3344
3369
  // ../util/lib/contract/instance/router/document/extract.ts
3345
3370
  const extractInputSchema$2 = z.object({
3346
- url: fetchableUrlSchema.optional().describe("URL of the document file to fetch and parse"),
3371
+ url: documentUrlSchema.optional().describe("URL of the document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3347
3372
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3348
3373
  base64: z.string().optional().describe("Base64-encoded document file content"),
3349
3374
  prompt: z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the document"),
@@ -3437,7 +3462,7 @@ const extract$2 = oc.route({
3437
3462
  }).input(extractInputSchema$2).output(extractOutputSchema$2);
3438
3463
  // ../util/lib/contract/instance/router/document/parse.ts
3439
3464
  const parseInputSchema$2 = z.object({
3440
- url: fetchableUrlSchema.optional().describe("URL of the document file to fetch and parse"),
3465
+ url: documentUrlSchema.optional().describe("URL of the document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3441
3466
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3442
3467
  base64: z.string().optional().describe("Base64-encoded document file content"),
3443
3468
  model: z.enum(["auto", ...pdfvectorModelSchema.options]).optional().default("auto").describe(documentParseModelDescription),
@@ -3545,7 +3570,7 @@ var document_exports = /* @__PURE__ */ __exportAll({
3545
3570
  const MB$1 = 1048576;
3546
3571
  const limits$1 = freeTierLimits.bankStatementParse;
3547
3572
  const inputSchema$3 = z.object({
3548
- url: fetchableUrlSchema.optional().describe("URL of the bank statement file to fetch and parse"),
3573
+ url: documentUrlSchema.optional().describe("URL of the bank statement file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3549
3574
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Bank statement file upload via multipart form-data (${supportedFileFormatsDescription})`),
3550
3575
  base64: z.string().optional().describe("Base64-encoded bank statement file content")
3551
3576
  });
@@ -3594,7 +3619,7 @@ const bankStatementParse = oc.route({
3594
3619
  const MB = 1048576;
3595
3620
  const limits = freeTierLimits.documentParse;
3596
3621
  const inputSchema$2 = z.object({
3597
- url: fetchableUrlSchema.optional().describe("URL of the document to fetch and parse"),
3622
+ url: documentUrlSchema.optional().describe("URL of the document to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3598
3623
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3599
3624
  base64: z.string().optional().describe("Base64-encoded document content")
3600
3625
  });
@@ -3866,7 +3891,7 @@ function getDefaultSpec$1(op, requestExamples) {
3866
3891
  // ../util/lib/contract/instance/router/identity/ask.ts
3867
3892
  const specializedModelSchema$3 = z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3868
3893
  const askInputSchema$1 = z.object({
3869
- url: fetchableUrlSchema.optional().describe("URL of the identity document file to fetch and parse"),
3894
+ url: documentUrlSchema.optional().describe("URL of the identity document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3870
3895
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3871
3896
  base64: z.string().optional().describe("Base64-encoded identity document file content"),
3872
3897
  question: z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the identity document"),
@@ -3914,7 +3939,7 @@ const ask$1 = oc.route({
3914
3939
  // ../util/lib/contract/instance/router/identity/extract.ts
3915
3940
  const specializedModelSchema$2 = z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
3916
3941
  const extractInputSchema$1 = z.object({
3917
- url: fetchableUrlSchema.optional().describe("URL of the identity document file to fetch and parse"),
3942
+ url: documentUrlSchema.optional().describe("URL of the identity document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3918
3943
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3919
3944
  base64: z.string().optional().describe("Base64-encoded identity document file content"),
3920
3945
  prompt: z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the identity document"),
@@ -3971,7 +3996,7 @@ const specializedParseModelSchema$1 = z.enum([
3971
3996
  "auto"
3972
3997
  ], { message: "model must be one of: pro, max, auto" }).default("auto");
3973
3998
  const parseInputSchema$1 = z.object({
3974
- url: fetchableUrlSchema.optional().describe("URL of the identity document file to fetch and parse"),
3999
+ url: documentUrlSchema.optional().describe("URL of the identity document file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
3975
4000
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Identity document file upload via multipart form-data (${supportedFileFormatsDescription})`),
3976
4001
  base64: z.string().optional().describe("Base64-encoded identity document file content"),
3977
4002
  model: specializedParseModelSchema$1.describe(specializedParseModelDescription("identity document")),
@@ -4043,7 +4068,7 @@ function getDefaultSpec(op, requestExamples) {
4043
4068
  // ../util/lib/contract/instance/router/invoice/ask.ts
4044
4069
  const specializedModelSchema$1 = z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
4045
4070
  const askInputSchema = z.object({
4046
- url: fetchableUrlSchema.optional().describe("URL of the invoice file to fetch and parse"),
4071
+ url: documentUrlSchema.optional().describe("URL of the invoice file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
4047
4072
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
4048
4073
  base64: z.string().optional().describe("Base64-encoded invoice file content"),
4049
4074
  question: z.string().min(4, "question must be at least 4 characters").describe("The question to answer about the invoice"),
@@ -4082,7 +4107,7 @@ const ask = oc.route({
4082
4107
  // ../util/lib/contract/instance/router/invoice/extract.ts
4083
4108
  const specializedModelSchema = z.enum(["auto", ...pdfvectorModelSchema.options]).default("auto");
4084
4109
  const extractInputSchema = z.object({
4085
- url: fetchableUrlSchema.optional().describe("URL of the invoice file to fetch and parse"),
4110
+ url: documentUrlSchema.optional().describe("URL of the invoice file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
4086
4111
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
4087
4112
  base64: z.string().optional().describe("Base64-encoded invoice file content"),
4088
4113
  prompt: z.string().min(4, "prompt must be at least 4 characters").describe("The prompt instructing the AI how to extract data from the invoice"),
@@ -4169,7 +4194,7 @@ const specializedParseModelSchema = z.enum([
4169
4194
  "auto"
4170
4195
  ], { message: "model must be one of: pro, max, auto" }).default("auto");
4171
4196
  const parseInputSchema = z.object({
4172
- url: fetchableUrlSchema.optional().describe("URL of the invoice file to fetch and parse"),
4197
+ url: documentUrlSchema.optional().describe("URL of the invoice file to fetch and parse. A URL without a scheme (example.com/file.pdf) is fetched over https. For a file on your computer, send it with file or base64 instead."),
4173
4198
  file: z.file().mime([...supportedFileMimes], supportedFileMimeErrorMessage).optional().describe(`Invoice file upload via multipart form-data (${supportedFileFormatsDescription})`),
4174
4199
  base64: z.string().optional().describe("Base64-encoded invoice file content"),
4175
4200
  model: specializedParseModelSchema.describe(specializedParseModelDescription("invoice")),