@pdfvector/util 0.0.15 → 0.0.17

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,19 @@
1
+ export interface FreeTierEndpointLimit {
2
+ dailyLimit: number;
3
+ maxFileSize?: number;
4
+ maxPages?: number;
5
+ }
6
+ export declare const freeTierLimits: {
7
+ readonly bankStatementParse: {
8
+ readonly dailyLimit: 5;
9
+ readonly maxFileSize: number;
10
+ readonly maxPages: 5;
11
+ };
12
+ readonly generateSchema: {
13
+ readonly dailyLimit: 10;
14
+ };
15
+ readonly publicationPdfUrl: {
16
+ readonly dailyLimit: 20;
17
+ };
18
+ };
19
+ export type FreeTierEndpoint = keyof typeof freeTierLimits;
@@ -0,0 +1,14 @@
1
+ const MB = 1024 * 1024;
2
+ export const freeTierLimits = {
3
+ bankStatementParse: {
4
+ dailyLimit: 5,
5
+ maxFileSize: 5 * MB,
6
+ maxPages: 5,
7
+ },
8
+ generateSchema: {
9
+ dailyLimit: 10,
10
+ },
11
+ publicationPdfUrl: {
12
+ dailyLimit: 20,
13
+ },
14
+ };
@@ -1,7 +1,9 @@
1
1
  export * from "./date";
2
2
  export * from "./format";
3
+ export * from "./free-tier";
3
4
  export * from "./get-error-message";
4
5
  export * from "./plan";
6
+ export * from "./tier";
5
7
  export declare const isCI: boolean;
6
8
  export declare const isLocal: boolean;
7
9
  export declare const isLive: boolean;
@@ -12,6 +14,7 @@ export declare const appPort = 37000;
12
14
  export declare const websiteURL: string;
13
15
  export declare const appURL: string;
14
16
  export declare const gatewayServerURL: string;
17
+ export declare const generalInstanceServerURL: string;
15
18
  export declare const productTitle = "PDF Vector";
16
19
  export interface ErrorService {
17
20
  captureError: (error: unknown) => void;
package/.tsc/lib/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from "./date";
2
2
  export * from "./format";
3
+ export * from "./free-tier";
3
4
  export * from "./get-error-message";
4
5
  export * from "./plan";
6
+ export * from "./tier";
5
7
  function getCIWithBun() {
6
8
  try {
7
9
  return Bun.env.CI;
@@ -71,6 +73,9 @@ export const appURL = isLocal
71
73
  export const gatewayServerURL = isLocal
72
74
  ? `http://localhost:${gatewayServerPort}`
73
75
  : "https://gateway.pdfvector.com";
76
+ export const generalInstanceServerURL = isLocal
77
+ ? `http://localhost:${instanceServerPort}`
78
+ : "https://global.pdfvector.com";
74
79
  export const productTitle = "PDF Vector";
75
80
  export const errorService = {
76
81
  captureError: (error) => {
@@ -0,0 +1,42 @@
1
+ export type ModelTier = "nano" | "mini" | "pro" | "max";
2
+ export declare const modelTiers: ModelTier[];
3
+ export interface TierLimit {
4
+ maxFileSize: number;
5
+ maxPages: number;
6
+ }
7
+ export declare const tierLimits: Record<string, TierLimit>;
8
+ export declare const defaultTierLimit: TierLimit;
9
+ /** Document parse: credits per page */
10
+ export declare const documentParseCosts: Record<ModelTier, number>;
11
+ /** Document ask/extract: credits per page */
12
+ export declare const documentAskExtractCosts: Record<ModelTier, number>;
13
+ /** Specialized parse (identity, invoice, bank statement): credits per page.
14
+ * Only pro and max are available — nano/mini return 0. */
15
+ export declare const specializedParseCosts: {
16
+ pro: number;
17
+ max: number;
18
+ } & Record<string, number | undefined>;
19
+ /** Specialized ask/extract (identity, invoice, bank statement): credits per page */
20
+ export declare const specializedAskExtractCosts: Record<ModelTier, number>;
21
+ /** Formats supported by all tiers (nano, mini, pro, max, auto). */
22
+ export declare const allTierFormats: readonly ["PDF", "Word (.docx)", "Excel (.xlsx)", "PowerPoint (.pptx)", "CSV", "Text (.txt, .md, .tsv, .xml)", "HTML", "RTF", "OpenDocument (.odt, .ods, .odp)", "EPUB", "Bibliography (.bib, .ris, .nbib, .enw)"];
23
+ /** Formats added by the pro tier. */
24
+ export declare const proTierAdditionalFormats: readonly ["Image (PNG, JPG)"];
25
+ /** Formats added by the max/auto tier (superset of pro). */
26
+ export declare const maxTierAdditionalFormats: readonly ["Image (PNG, JPG, TIFF, BMP, HEIF)"];
27
+ /** Short human-readable summary of all supported formats. */
28
+ export declare const allSupportedFormatsShort = "PDF, DOCX, XLSX, PPTX, CSV, PNG, JPG, TIFF, BMP, HEIF, TXT, MD, TSV, XML, RTF, HTML, ODT, ODS, ODP, EPUB, BIB, RIS, NBIB, ENW";
29
+ /** Long human-readable summary of all supported formats. */
30
+ export declare const allSupportedFormatsLong: string;
31
+ /** Pre-built format note for API descriptions (used in contract model descriptions). */
32
+ export declare const formatsByTierDescription: string;
33
+ /** Academic/grant API: fixed credits per request */
34
+ export declare const academicCreditCosts: {
35
+ readonly academicSearch: 2;
36
+ readonly academicFetch: 2;
37
+ readonly academicFindCitationsPerSentence: 2;
38
+ readonly academicPaperGraphMin: 2;
39
+ readonly academicPaperGraphDivisor: 50;
40
+ readonly academicSimilarPapers: 3;
41
+ readonly grantSearch: 2;
42
+ };
@@ -0,0 +1,86 @@
1
+ const MB = 1024 * 1024;
2
+ export const modelTiers = ["nano", "mini", "pro", "max"];
3
+ export const tierLimits = {
4
+ nano: { maxFileSize: 40 * MB, maxPages: 30 },
5
+ mini: { maxFileSize: 40 * MB, maxPages: 30 },
6
+ pro: { maxFileSize: 40 * MB, maxPages: 30 },
7
+ max: { maxFileSize: 500 * MB, maxPages: 2000 },
8
+ auto: { maxFileSize: 500 * MB, maxPages: 2000 },
9
+ };
10
+ export const defaultTierLimit = {
11
+ maxFileSize: 500 * MB,
12
+ maxPages: 2000,
13
+ };
14
+ // ─── Credit costs ─────────────────────────────────────────────────────
15
+ /** Document parse: credits per page */
16
+ export const documentParseCosts = {
17
+ nano: 1,
18
+ mini: 2,
19
+ pro: 4,
20
+ max: 8,
21
+ };
22
+ /** Document ask/extract: credits per page */
23
+ export const documentAskExtractCosts = {
24
+ nano: 2,
25
+ mini: 4,
26
+ pro: 8,
27
+ max: 16,
28
+ };
29
+ /** Specialized parse (identity, invoice, bank statement): credits per page.
30
+ * Only pro and max are available — nano/mini return 0. */
31
+ export const specializedParseCosts = {
32
+ pro: 6,
33
+ max: 10,
34
+ };
35
+ /** Specialized ask/extract (identity, invoice, bank statement): credits per page */
36
+ export const specializedAskExtractCosts = {
37
+ nano: 6,
38
+ mini: 10,
39
+ pro: 14,
40
+ max: 18,
41
+ };
42
+ // ─── Supported formats per tier ───────────────────────────────────────
43
+ /** Formats supported by all tiers (nano, mini, pro, max, auto). */
44
+ export const allTierFormats = [
45
+ "PDF",
46
+ "Word (.docx)",
47
+ "Excel (.xlsx)",
48
+ "PowerPoint (.pptx)",
49
+ "CSV",
50
+ "Text (.txt, .md, .tsv, .xml)",
51
+ "HTML",
52
+ "RTF",
53
+ "OpenDocument (.odt, .ods, .odp)",
54
+ "EPUB",
55
+ "Bibliography (.bib, .ris, .nbib, .enw)",
56
+ ];
57
+ /** Formats added by the pro tier. */
58
+ export const proTierAdditionalFormats = ["Image (PNG, JPG)"];
59
+ /** Formats added by the max/auto tier (superset of pro). */
60
+ export const maxTierAdditionalFormats = [
61
+ "Image (PNG, JPG, TIFF, BMP, HEIF)",
62
+ ];
63
+ /** Short human-readable summary of all supported formats. */
64
+ export const allSupportedFormatsShort = "PDF, DOCX, XLSX, PPTX, CSV, PNG, JPG, TIFF, BMP, HEIF, TXT, MD, TSV, XML, RTF, HTML, ODT, ODS, ODP, EPUB, BIB, RIS, NBIB, ENW";
65
+ /** Long human-readable summary of all supported formats. */
66
+ export const allSupportedFormatsLong = "PDF, Word (.docx), Excel (.xlsx), PowerPoint (.pptx), CSV, " +
67
+ "Image (.png, .jpg, .tiff, .bmp, .heif), " +
68
+ "Plain Text (.txt, .md, .tsv, .xml), RTF, HTML, " +
69
+ "OpenDocument (.odt, .ods, .odp), EPUB, " +
70
+ "and Bibliography (.bib, .ris, .nbib, .enw) files";
71
+ /** Pre-built format note for API descriptions (used in contract model descriptions). */
72
+ export const formatsByTierDescription = "Supported formats by tier:\n" +
73
+ `- All tiers: ${allTierFormats.join(", ")}.\n` +
74
+ `- Pro adds: ${proTierAdditionalFormats.join(", ")}.\n` +
75
+ `- Max/Auto adds: ${maxTierAdditionalFormats.join(", ")}.`;
76
+ // ─── Academic credit costs ────────────────────────────────────────────
77
+ /** Academic/grant API: fixed credits per request */
78
+ export const academicCreditCosts = {
79
+ academicSearch: 2,
80
+ academicFetch: 2,
81
+ academicFindCitationsPerSentence: 2,
82
+ academicPaperGraphMin: 2,
83
+ academicPaperGraphDivisor: 50,
84
+ academicSimilarPapers: 3,
85
+ grantSearch: 2,
86
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @pdfvector/util
2
2
 
3
+ ## 0.0.17
4
+ ### Patch Changes
5
+
6
+
7
+
8
+ - [#176](https://github.com/phuctm97/pdfvector/pull/176) [`cfbc548`](https://github.com/phuctm97/pdfvector/commit/cfbc54864ef055bb68ea081b3ead7ba69ca2c819) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add free usage sync, centralize tier limits/credits, deduplicate parse handlers
9
+
10
+ ## 0.0.16
11
+ ### Patch Changes
12
+
13
+
14
+
15
+ - [#125](https://github.com/phuctm97/pdfvector/pull/125) [`0eac9b7`](https://github.com/phuctm97/pdfvector/commit/0eac9b7afdbe9b8a41933fd1f92e48da51fb4480) Thanks [@khanhduyvt0101](https://github.com/khanhduyvt0101)! - Add free public APIs with IP rate limiting and interactive tool pages
16
+
3
17
  ## 0.0.15
4
18
  ### Patch Changes
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfvector/util",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "main": ".tsc/lib/index.js",
6
6
  "files": [