okrapdf 0.8.0

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,9 @@
1
+ import { doc } from './url.js';
2
+ import './types-DEYgGUnH.js';
3
+ import 'zod';
4
+
5
+ declare const _default: {
6
+ doc: typeof doc;
7
+ };
8
+
9
+ export { _default as default, doc };
@@ -0,0 +1,16 @@
1
+ import {
2
+ doc
3
+ } from "./chunk-C6ZT7DKX.js";
4
+
5
+ // src/browser.ts
6
+ var runtimeGlobal = globalThis;
7
+ runtimeGlobal.OkraRuntime = {
8
+ ...runtimeGlobal.OkraRuntime || {},
9
+ doc
10
+ };
11
+ var browser_default = { doc };
12
+ export {
13
+ browser_default as default,
14
+ doc
15
+ };
16
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/browser.ts"],"sourcesContent":["import { doc } from './url';\n\ntype BrowserRuntimeGlobal = typeof globalThis & {\n OkraRuntime?: {\n doc: typeof doc;\n };\n};\n\nconst runtimeGlobal = globalThis as BrowserRuntimeGlobal;\nruntimeGlobal.OkraRuntime = {\n ...(runtimeGlobal.OkraRuntime || {}),\n doc,\n};\n\nexport { doc };\nexport default { doc };\n"],"mappings":";;;;;AAQA,IAAM,gBAAgB;AACtB,cAAc,cAAc;AAAA,EAC1B,GAAI,cAAc,eAAe,CAAC;AAAA,EAClC;AACF;AAGA,IAAO,kBAAQ,EAAE,IAAI;","names":[]}
@@ -0,0 +1,84 @@
1
+ import {
2
+ OkraClient
3
+ } from "./chunk-HITG34US.js";
4
+
5
+ // src/providers.ts
6
+ function isPlainObject(value) {
7
+ return !!value && typeof value === "object" && !Array.isArray(value);
8
+ }
9
+ function deepMerge(base, override) {
10
+ const merged = { ...base };
11
+ for (const [key, value] of Object.entries(override)) {
12
+ const existing = merged[key];
13
+ if (isPlainObject(existing) && isPlainObject(value)) {
14
+ merged[key] = deepMerge(existing, value);
15
+ } else {
16
+ merged[key] = value;
17
+ }
18
+ }
19
+ return merged;
20
+ }
21
+ function createOkra(options) {
22
+ if (options.extraction && options.providers) {
23
+ for (const [phase, providerName] of Object.entries(options.extraction)) {
24
+ if (!options.providers[providerName]) {
25
+ throw new Error(
26
+ `Extraction phase '${phase}' references provider '${providerName}' which is not registered. Available: ${Object.keys(options.providers).join(", ")}`
27
+ );
28
+ }
29
+ }
30
+ }
31
+ const capabilities = {};
32
+ if (options.extraction) {
33
+ capabilities.phases = {};
34
+ for (const [phase, providerName] of Object.entries(options.extraction)) {
35
+ capabilities.phases[phase] = {
36
+ vendor: providerName,
37
+ enabled: true
38
+ };
39
+ }
40
+ }
41
+ if (options.middleware) {
42
+ capabilities.middleware = options.middleware.map((m) => ({
43
+ name: m.name,
44
+ ...m.config
45
+ }));
46
+ }
47
+ const client = new OkraClient({
48
+ baseUrl: options.baseUrl,
49
+ apiKey: options.apiKey,
50
+ sharedSecret: options.sharedSecret,
51
+ fetch: options.fetch
52
+ });
53
+ const hasDefaults = Object.keys(capabilities).length > 0 || options.vendorKeys;
54
+ if (hasDefaults) {
55
+ const upload = client.upload.bind(client);
56
+ const defaultVendorKeys = options.vendorKeys;
57
+ client.upload = ((input, uploadOptions = {}) => upload(input, {
58
+ ...uploadOptions,
59
+ capabilities: uploadOptions.capabilities ? deepMerge(capabilities, uploadOptions.capabilities) : Object.keys(capabilities).length > 0 ? capabilities : uploadOptions.capabilities,
60
+ vendorKeys: uploadOptions.vendorKeys ? { ...defaultVendorKeys, ...uploadOptions.vendorKeys } : defaultVendorKeys
61
+ }));
62
+ }
63
+ return client;
64
+ }
65
+ function withCache(opts) {
66
+ return { name: "cache", config: { strategy: opts.by } };
67
+ }
68
+ function withQualityScore(opts) {
69
+ return { name: "quality-score", config: { threshold: opts.threshold } };
70
+ }
71
+ function withSecret(namespace, opts) {
72
+ return {
73
+ name: "secret",
74
+ config: { namespace, required: opts?.required !== false }
75
+ };
76
+ }
77
+
78
+ export {
79
+ createOkra,
80
+ withCache,
81
+ withQualityScore,
82
+ withSecret
83
+ };
84
+ //# sourceMappingURL=chunk-AG3A2T3B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/providers.ts"],"sourcesContent":["import type { OkraClientOptions } from './types';\nimport { OkraClient } from './client';\n\nexport type ExtractionPhase = 'ocr' | 'enhance' | 'metadata' | 'verify';\n\nexport interface OkraProvider {\n name: string;\n supportedPhases: ExtractionPhase[];\n}\n\nexport interface OkraMiddleware {\n name: string;\n config: Record<string, unknown>;\n}\n\nexport interface CreateOkraOptions extends OkraClientOptions {\n providers?: Record<string, OkraProvider>;\n extraction?: Partial<Record<ExtractionPhase, string>>;\n middleware?: OkraMiddleware[];\n vendorKeys?: Record<string, string>;\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction deepMerge(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...base };\n for (const [key, value] of Object.entries(override)) {\n const existing = merged[key];\n if (isPlainObject(existing) && isPlainObject(value)) {\n merged[key] = deepMerge(existing, value);\n } else {\n merged[key] = value;\n }\n }\n return merged;\n}\n\n/**\n * Factory function — AI SDK-style provider abstraction.\n *\n * ```ts\n * import { createOkra } from 'okrapdf';\n *\n * const okra = createOkra({\n * apiKey: 'okra_...',\n * providers: { azureDocAI },\n * extraction: { ocr: 'azureDocAI' },\n * });\n * ```\n */\nexport function createOkra(options: CreateOkraOptions): OkraClient {\n if (options.extraction && options.providers) {\n for (const [phase, providerName] of Object.entries(options.extraction)) {\n if (!options.providers[providerName]) {\n throw new Error(\n `Extraction phase '${phase}' references provider '${providerName}' which is not registered. ` +\n `Available: ${Object.keys(options.providers).join(', ')}`,\n );\n }\n }\n }\n\n const capabilities: Record<string, unknown> = {};\n if (options.extraction) {\n capabilities.phases = {};\n for (const [phase, providerName] of Object.entries(options.extraction)) {\n (capabilities.phases as Record<string, unknown>)[phase] = {\n vendor: providerName,\n enabled: true,\n };\n }\n }\n\n if (options.middleware) {\n capabilities.middleware = options.middleware.map((m) => ({\n name: m.name,\n ...m.config,\n }));\n }\n\n const client = new OkraClient({\n baseUrl: options.baseUrl,\n apiKey: options.apiKey,\n sharedSecret: options.sharedSecret,\n fetch: options.fetch,\n });\n\n const hasDefaults = Object.keys(capabilities).length > 0 || options.vendorKeys;\n if (hasDefaults) {\n const upload = client.upload.bind(client);\n const defaultVendorKeys = options.vendorKeys;\n client.upload = ((input: Parameters<OkraClient['upload']>[0], uploadOptions: Parameters<OkraClient['upload']>[1] = {}) =>\n upload(input, {\n ...uploadOptions,\n capabilities: uploadOptions.capabilities\n ? deepMerge(capabilities, uploadOptions.capabilities)\n : Object.keys(capabilities).length > 0\n ? capabilities\n : uploadOptions.capabilities,\n vendorKeys: uploadOptions.vendorKeys\n ? { ...defaultVendorKeys, ...uploadOptions.vendorKeys }\n : defaultVendorKeys,\n })) as OkraClient['upload'];\n }\n\n return client;\n}\n\n// ─── Built-in middleware constructors ──────────────────────────────────────\n\nexport function withCache(opts: { by: 'pdf-hash' | 'content-hash' }): OkraMiddleware {\n return { name: 'cache', config: { strategy: opts.by } };\n}\n\nexport function withQualityScore(opts: { threshold: number }): OkraMiddleware {\n return { name: 'quality-score', config: { threshold: opts.threshold } };\n}\n\nexport function withSecret(namespace: string, opts?: { required?: boolean }): OkraMiddleware {\n return {\n name: 'secret',\n config: { namespace, required: opts?.required !== false },\n };\n}\n"],"mappings":";;;;;AAsBA,SAAS,cAAc,OAAkD;AACvE,SAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AACrE;AAEA,SAAS,UAAU,MAA+B,UAA4D;AAC5G,QAAM,SAAkC,EAAE,GAAG,KAAK;AAClD,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,QAAQ,GAAG;AACnD,UAAM,WAAW,OAAO,GAAG;AAC3B,QAAI,cAAc,QAAQ,KAAK,cAAc,K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;AAAA,MACZ,GAAG;AAAA,MACH,cAAc,cAAc,eACxB,UAAU,cAAc,cAAc,YAAY,IAClD,OAAO,KAAK,YAAY,EAAE,SAAS,IACjC,eACA,cAAc;AAAA,MACpB,YAAY,cAAc,aACtB,EAAE,GAAG,mBAAmB,GAAG,cAAc,WAAW,IACpD;AAAA,IACN,CAAC;AAAA,EACL;AAEA,SAAO;AACT;AAIO,SAAS,UAAU,MAA2D;AACnF,SAAO,EAAE,MAAM,SAAS,QAAQ,EAAE,UAAU,KAAK,GAAG,EAAE;AACxD;AAEO,SAAS,iBAAiB,MAA6C;AAC5E,SAAO,EAAE,MAAM,iBAAiB,QAAQ,EAAE,WAAW,KAAK,UAAU,EAAE;AACxE;AAEO,SAAS,WAAW,WAAmB,MAA+C;AAC3F,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ,EAAE,WAAW,UAAU,MAAM,aAAa,MAAM;AAAA,EAC1D;AACF;","names":[]}
@@ -0,0 +1,113 @@
1
+ // src/url.ts
2
+ var DEFAULT_BASE_URL = "https://api.okrapdf.com";
3
+ var FORMAT_TO_EXT = {
4
+ json: "json",
5
+ csv: "csv",
6
+ html: "html",
7
+ markdown: "md",
8
+ png: "png"
9
+ };
10
+ function slugifyFileStem(fileName) {
11
+ const leaf = fileName.split("/").pop() || fileName;
12
+ const noExt = leaf.replace(/\.[A-Za-z0-9]{1,8}$/, "");
13
+ const slug = noExt.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
14
+ return slug || "document";
15
+ }
16
+ function extensionFor(format, fallback) {
17
+ if (!format) return fallback;
18
+ const lower = format.toLowerCase();
19
+ if (lower === "markdown") return "md";
20
+ return FORMAT_TO_EXT[lower] || lower;
21
+ }
22
+ function doc(documentId, baseUrlOrOptions = DEFAULT_BASE_URL, maybeOptions = {}) {
23
+ const baseUrl = typeof baseUrlOrOptions === "string" ? baseUrlOrOptions : DEFAULT_BASE_URL;
24
+ const options = typeof baseUrlOrOptions === "string" ? maybeOptions : baseUrlOrOptions;
25
+ const base = baseUrl.replace(/\/+$/, "");
26
+ const defaultProvider = options.provider;
27
+ const defaultImage = options.defaultImage;
28
+ const providerSegment = (p) => {
29
+ const provider = p || defaultProvider;
30
+ return provider ? `/t_${provider}` : "";
31
+ };
32
+ const defaultImageSegment = () => defaultImage ? `/d_${defaultImage}` : "";
33
+ const docBase = `${base}/v1/documents/${encodeURIComponent(documentId)}`;
34
+ const artifactBase = options.fileName ? slugifyFileStem(options.fileName) : "document";
35
+ const withArtifact = (path, ext, qs = "") => `${path}/${artifactBase}.${ext}${qs}`;
36
+ const withProvider = (path, provider) => {
37
+ const seg = providerSegment(provider) + defaultImageSegment();
38
+ if (!seg) return path;
39
+ return path.replace(docBase, `${docBase}${seg}`);
40
+ };
41
+ const formatParams = (opts) => {
42
+ const params = new URLSearchParams();
43
+ if (opts?.format) params.set("format", opts.format);
44
+ if (opts?.include?.length) params.set("include", opts.include.join(","));
45
+ const qs = params.toString();
46
+ return qs ? `?${qs}` : "";
47
+ };
48
+ const makeEntityCollection = (type) => {
49
+ return new Proxy({}, {
50
+ get(_target, prop) {
51
+ if (prop === "url") {
52
+ return (opts) => withProvider(
53
+ withArtifact(
54
+ `${docBase}/entities/${type}`,
55
+ extensionFor(opts?.format, "json"),
56
+ formatParams(opts)
57
+ ),
58
+ opts?.provider
59
+ );
60
+ }
61
+ const index = typeof prop === "string" ? parseInt(prop, 10) : NaN;
62
+ if (!isNaN(index)) {
63
+ return {
64
+ url: (opts) => {
65
+ const params = opts?.format ? `?format=${opts.format}` : "";
66
+ return withProvider(
67
+ withArtifact(
68
+ `${docBase}/entities/${type}/${index}`,
69
+ extensionFor(opts?.format, "json"),
70
+ params
71
+ ),
72
+ opts?.provider
73
+ );
74
+ }
75
+ };
76
+ }
77
+ return void 0;
78
+ }
79
+ });
80
+ };
81
+ const pg = new Proxy({}, {
82
+ get(_target, prop) {
83
+ const pageNum = typeof prop === "string" ? parseInt(prop, 10) : NaN;
84
+ if (!isNaN(pageNum)) {
85
+ return {
86
+ png: () => withProvider(withArtifact(`${docBase}/pg_${pageNum}`, "png")),
87
+ md: () => withProvider(withArtifact(`${docBase}/pg_${pageNum}`, "md")),
88
+ json: () => withProvider(withArtifact(`${docBase}/pg_${pageNum}`, "json"))
89
+ };
90
+ }
91
+ return void 0;
92
+ }
93
+ });
94
+ return {
95
+ url: (opts) => withProvider(
96
+ withArtifact(docBase, extensionFor(opts?.format, "json"), formatParams(opts)),
97
+ opts?.provider
98
+ ),
99
+ thumbnail: {
100
+ url: () => withProvider(withArtifact(`${docBase}/pg_1`, "png"))
101
+ },
102
+ pg,
103
+ entities: {
104
+ tables: makeEntityCollection("tables"),
105
+ figures: makeEntityCollection("figures")
106
+ }
107
+ };
108
+ }
109
+
110
+ export {
111
+ doc
112
+ };
113
+ //# sourceMappingURL=chunk-C6ZT7DKX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/url.ts"],"sourcesContent":["import type { DocUrlOptions, UrlBuilderOptions } from './types';\n\nconst DEFAULT_BASE_URL = 'https://api.okrapdf.com';\n\ninterface PgPage {\n png: () => string;\n md: () => string;\n json: () => string;\n}\n\ninterface PgProxy {\n [index: number]: PgPage;\n}\n\ninterface DocumentUrl {\n /** Base document URL */\n url: (opts?: UrlBuilderOptions) => string;\n /** Thumbnail image URL (pg_1.png) */\n thumbnail: { url: () => string };\n /** Page access: d.pg[1].png(), d.pg[1].md(), d.pg[1].json() */\n pg: PgProxy;\n /** Entity-level access */\n entities: EntitiesProxy;\n}\n\ninterface EntitiesProxy {\n tables: EntityCollectionProxy;\n figures: EntityCollectionProxy;\n}\n\ninterface EntityCollectionProxy {\n [index: number]: {\n url: (opts?: { format?: 'json' | 'csv' | 'html' }) => string;\n };\n url: (opts?: UrlBuilderOptions) => string;\n}\n\nconst FORMAT_TO_EXT: Record<NonNullable<UrlBuilderOptions['format']>, string> = {\n json: 'json',\n csv: 'csv',\n html: 'html',\n markdown: 'md',\n png: 'png',\n};\n\nfunction slugifyFileStem(fileName: string): string {\n const leaf = fileName.split('/').pop() || fileName;\n const noExt = leaf.replace(/\\.[A-Za-z0-9]{1,8}$/, '');\n const slug = noExt\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 48);\n return slug || 'document';\n}\n\nfunction extensionFor(format: string | undefined, fallback: string): string {\n if (!format) return fallback;\n const lower = format.toLowerCase();\n if (lower === 'markdown') return 'md';\n return FORMAT_TO_EXT[lower as keyof typeof FORMAT_TO_EXT] || lower;\n}\n\n/**\n * Build-time URL builder — Cloudinary for documents.\n *\n * ```tsx\n * import { doc } from 'okrapdf';\n * const d = doc('doc_7fK3x');\n * <Image src={d.thumbnail.url()} />\n * <a href={d.entities.tables[0].url({ format: 'csv' })}>CSV</a>\n * ```\n */\nexport function doc(\n documentId: string,\n baseUrlOrOptions: string | DocUrlOptions = DEFAULT_BASE_URL,\n maybeOptions: DocUrlOptions = {},\n): DocumentUrl {\n const baseUrl = typeof baseUrlOrOptions === 'string' ? baseUrlOrOptions : DEFAULT_BASE_URL;\n const options = typeof baseUrlOrOptions === 'string' ? maybeOptions : baseUrlOrOptions;\n\n const base = baseUrl.replace(/\\/+$/, '');\n const defaultProvider = options.provider;\n const defaultImage = options.defaultImage;\n const providerSegment = (p?: string) => {\n const provider = p || defaultProvider;\n return provider ? `/t_${provider}` : '';\n };\n const defaultImageSegment = () => defaultImage ? `/d_${defaultImage}` : '';\n const docBase = `${base}/v1/documents/${encodeURIComponent(documentId)}`;\n const artifactBase = options.fileName\n ? slugifyFileStem(options.fileName)\n : 'document';\n\n const withArtifact = (path: string, ext: string, qs: string = '') =>\n `${path}/${artifactBase}.${ext}${qs}`;\n\n const withProvider = (path: string, provider?: string) => {\n const seg = providerSegment(provider) + defaultImageSegment();\n if (!seg) return path;\n return path.replace(docBase, `${docBase}${seg}`);\n };\n\n const formatParams = (opts?: UrlBuilderOptions) => {\n const params = new URLSearchParams();\n if (opts?.format) params.set('format', opts.format);\n if (opts?.include?.length) params.set('include', opts.include.join(','));\n const qs = params.toString();\n return qs ? `?${qs}` : '';\n };\n\n const makeEntityCollection = (type: string): EntityCollectionProxy => {\n return new Proxy({} as EntityCollectionProxy, {\n get(_target, prop) {\n if (prop === 'url') {\n return (opts?: UrlBuilderOptions) =>\n withProvider(\n withArtifact(\n `${docBase}/entities/${type}`,\n extensionFor(opts?.format, 'json'),\n formatParams(opts),\n ),\n opts?.provider,\n );\n }\n const index = typeof prop === 'string' ? parseInt(prop, 10) : NaN;\n if (!isNaN(index)) {\n return {\n url: (opts?: { format?: string; provider?: string }) => {\n const params = opts?.format ? `?format=${opts.format}` : '';\n return withProvider(\n withArtifact(\n `${docBase}/entities/${type}/${index}`,\n extensionFor(opts?.format, 'json'),\n params,\n ),\n opts?.provider,\n );\n },\n };\n }\n return undefined;\n },\n });\n };\n\n const pg: PgProxy = new Proxy({} as PgProxy, {\n get(_target, prop) {\n const pageNum = typeof prop === 'string' ? parseInt(prop, 10) : NaN;\n if (!isNaN(pageNum)) {\n return {\n png: () => withProvider(withArtifact(`${docBase}/pg_${pageNum}`, 'png')),\n md: () => withProvider(withArtifact(`${docBase}/pg_${pageNum}`, 'md')),\n json: () => withProvider(withArtifact(`${docBase}/pg_${pageNum}`, 'json')),\n } satisfies PgPage;\n }\n return undefined;\n },\n });\n\n return {\n url: (opts?: UrlBuilderOptions) =>\n withProvider(\n withArtifact(docBase, extensionFor(opts?.format, 'json'), formatParams(opts)),\n opts?.provider,\n ),\n thumbnail: {\n url: () => withProvider(withArtifact(`${docBase}/pg_1`, 'png')),\n },\n pg,\n entities: {\n tables: makeEntityCollection('tables'),\n figures: makeEntityCollection('figures'),\n },\n };\n}\n"],"mappings":";AAEA,IAAM,mBAAmB;AAmCzB,IAAM,gBAA0E;AAAA,EAC9E,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AACP;AAEA,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