{"_id":"@anyformat/sdk","_rev":"5-21a362646447cedc48e6ef3a5eb5d2e6","name":"@anyformat/sdk","dist-tags":{"latest":"0.2.3"},"versions":{"0.1.0":{"name":"@anyformat/sdk","version":"0.1.0","author":{"name":"Anyformat","email":"info@anyformat.ai"},"license":"MIT","_id":"@anyformat/sdk@0.1.0","maintainers":[{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},{"name":"diegopersas","email":"diego@anyformat.ai"},{"name":"andrew0033","email":"andres@anyformat.ai"}],"dist":{"shasum":"4aef81ca0d6f9cbadb00b07660b9cd8d035232f8","tarball":"https://registry.npmjs.org/@anyformat/sdk/-/sdk-0.1.0.tgz","fileCount":8,"integrity":"sha512-tpBKEaR1MBzMpJLoJIkukXPgMyBEX2JLYcApxxkJYs0KU2njlnNnd8SMWAf3RHLWGkjlTeoWwTI1TuDzhuCBpQ==","signatures":[{"sig":"MEUCIQCw56K5cGAa+qVh4Y2b1BLOGoU8CkzW9Fbo0c3GZSkm4gIgI4MDICWb41YZ/UYoPh4BKnpPuoyPgmdKHs853RDmYoc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":349345},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"e7c35ab7b4cd92679c41c5e4f8e88f6016d2817b","scripts":{"gen":"npm run gen:spec && npm run gen:client","test":"vitest run","build":"tsup","gen:spec":"cd ../../services/api && uv run python ../../sdk/js/scripts/dump_openapi.py ../../sdk/js/openapi/v2.json","gen:check":"npm run gen && git diff --exit-code -- openapi/v2.json src/sdk","typecheck":"tsc --noEmit","gen:client":"openapi-ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"andrew0033","email":"andres@anyformat.ai"},"_npmVersion":"11.6.2","description":"TypeScript SDK for the AnyFormat API","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"^2.1.0","typescript":"^5.6.0","@hey-api/openapi-ts":"^0.97.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1779803400490_0.45818963809495616","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anyformat/sdk","version":"0.2.0","author":{"name":"Anyformat","email":"info@anyformat.ai"},"license":"MIT","_id":"@anyformat/sdk@0.2.0","maintainers":[{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},{"name":"diegopersas","email":"diego@anyformat.ai"},{"name":"andrew0033","email":"andres@anyformat.ai"}],"dist":{"shasum":"a9a7af6cb476a8fcbe7939078cad98b12da62f6e","tarball":"https://registry.npmjs.org/@anyformat/sdk/-/sdk-0.2.0.tgz","fileCount":8,"integrity":"sha512-eYlkoFTwgY4Owz71uewdKTVrzmMdIS0QEpP6AUXq6wwqYgmlQNHTgWK+64bLwabA29NSAaoGqXm03RZjPaWGTQ==","signatures":[{"sig":"MEQCIBpmSiUscEvTQac1IWkIX9JY+Zo0bXltZe3l59ZAyGgPAiBm3kjkPaUZBunRi6PQDeYPODAQlc5NnPxxsMr7/lz4Eg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":359037},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"9310be15f4c24e1515f7fbbf28331d881e8f89ac","scripts":{"gen":"npm run gen:spec && npm run gen:client","test":"vitest run","build":"tsup","gen:spec":"cd ../../services/api && uv run python ../../sdk/js/scripts/dump_openapi.py ../../sdk/js/openapi/v2.json","gen:check":"npm run gen && git diff --exit-code -- openapi/v2.json src/sdk","typecheck":"tsc --noEmit","gen:client":"openapi-ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"andrew0033","email":"andres@anyformat.ai"},"_npmVersion":"11.6.2","description":"TypeScript SDK for the AnyFormat API","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^25.9.1","@hey-api/openapi-ts":"^0.97.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1779868343375_0.5734201881000305","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@anyformat/sdk","version":"0.2.1","author":{"name":"Anyformat","email":"info@anyformat.ai"},"license":"MIT","_id":"@anyformat/sdk@0.2.1","maintainers":[{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},{"name":"diegopersas","email":"diego@anyformat.ai"},{"name":"andrew0033","email":"andres@anyformat.ai"}],"dist":{"shasum":"e51bfe2a35a28c3bfbf51ddfb3e0d9efb6e1f5a3","tarball":"https://registry.npmjs.org/@anyformat/sdk/-/sdk-0.2.1.tgz","fileCount":8,"integrity":"sha512-tVwIL8M8i4VOV2OtQsY9cD05KmX6lbyjjzRl9aEYz2YcwvU6iR++ubGYzLsx1u8OQjdMfc4biknQ7X9aI43onQ==","signatures":[{"sig":"MEUCIHINc2UeFYWR/w2Uw8OgCNoIynwMgy5iyUmaaXqJR1cFAiEAi1O9DTK/OE4scKkjkWdyjPZmwWlKwID1cWBwo24lbWE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":359315},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"2d992e9c1e2da859d31ab958a91d825d7a3a5f6a","scripts":{"gen":"npm run gen:spec && npm run gen:client","test":"vitest run","build":"tsup","gen:spec":"cd ../../services/api && uv run python ../../sdk/js/scripts/dump_openapi.py ../../sdk/js/openapi/v2.json","gen:check":"npm run gen && git diff --exit-code -- openapi/v2.json src/sdk","typecheck":"tsc --noEmit","gen:client":"openapi-ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"andrew0033","email":"andres@anyformat.ai"},"_npmVersion":"11.6.2","description":"TypeScript SDK for the AnyFormat API","directories":{},"_nodeVersion":"24.12.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"^2.1.0","typescript":"^5.6.0","@types/node":"^25.9.1","@hey-api/openapi-ts":"^0.97.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.1_1779869632944_0.8508020521251278","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@anyformat/sdk","version":"0.2.2","author":{"name":"Anyformat","email":"info@anyformat.ai"},"license":"MIT","_id":"@anyformat/sdk@0.2.2","maintainers":[{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},{"name":"diegopersas","email":"diego@anyformat.ai"},{"name":"andrew0033","email":"andres@anyformat.ai"}],"dist":{"shasum":"099a3671af2108d48938d6254bd845e99fd64951","tarball":"https://registry.npmjs.org/@anyformat/sdk/-/sdk-0.2.2.tgz","fileCount":8,"integrity":"sha512-6WHinNlh3LUxnZ0nqMatnzmBSOLF7FtzLQskw9jh5AukP05Wi/nKXdJi0VTzJayA6pPjckSV0ufr1OElqAw4BA==","signatures":[{"sig":"MEUCIQDr0fcuKzj7NYiU84mGXggYFVSI8QO70XcIDS2L5+FjlwIgO12QKszyNsVsfBkI2UVfMVYrLcuUTQ6yW1ArrnzCxog=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":390147},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"gen":"npm run gen:spec && npm run gen:client","test":"vitest run","build":"tsup","gen:spec":"ROOT=$(unset GIT_DIR && git rev-parse --show-toplevel) && cd \"$ROOT/anyformat/services/api\" && uv run python \"$ROOT/anyformat/libs/public/sdk-js/scripts/dump_openapi.py\" \"$ROOT/anyformat/libs/public/sdk-js/openapi/v2.json\"","gen:check":"npm run gen && git diff --exit-code -- openapi/v2.json src/sdk","typecheck":"tsc --noEmit","gen:client":"openapi-ts","prepublishOnly":"npm run build"},"_npmUser":{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},"_npmVersion":"11.13.0","description":"TypeScript SDK for the AnyFormat API","directories":{},"_nodeVersion":"23.1.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"^4.1.7","typescript":"^5.6.0","@types/node":"^25.9.1","@hey-api/openapi-ts":"^0.97.3"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.2_1781621349926_0.431930457892161","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@anyformat/sdk","version":"0.2.3","description":"TypeScript SDK for the AnyFormat API","license":"MIT","author":{"name":"Anyformat","email":"info@anyformat.ai"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"engines":{"node":">=18"},"scripts":{"gen:spec":"ROOT=$(unset GIT_DIR && git rev-parse --show-toplevel) && cd \"$ROOT/anyformat/services/api\" && uv run python \"$ROOT/anyformat/libs/public/sdk-js/scripts/dump_openapi.py\" \"$ROOT/anyformat/libs/public/sdk-js/openapi/v2.json\"","gen:client":"openapi-ts","gen":"bun run gen:spec && bun run gen:client","gen:check":"bun run gen && git diff --exit-code -- openapi/v2.json src/sdk","build":"tsup","typecheck":"tsc --noEmit","test":"vitest run","prepublishOnly":"bun run build"},"devDependencies":{"@hey-api/openapi-ts":"^0.99.0","@types/node":"^25.9.1","tsup":"^8.3.0","typescript":"^5.6.0","vitest":"^4.1.7"},"gitHead":"04518c6f42ff9231b2be02c4b7032a2d5bb852f6","_id":"@anyformat/sdk@0.2.3","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-jrsU1VZGspgEhGobyfAjE0U4WFboZXaAL0OkOaXusl7nNgjujXe9J6bE+m/YmEFwlymAlGS9ddSUZqjEJfRELQ==","shasum":"3c59aa63efe50b97f2c317532e42b338632ac57e","tarball":"https://registry.npmjs.org/@anyformat/sdk/-/sdk-0.2.3.tgz","fileCount":8,"unpackedSize":471717,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCkEqvVZ5obYsibstmLHUgJ1JuXTCiCAD8iLOvXrPAi+wIgaQ2lKTLWwtZBJ4jhjX2ho4KGxph9VujrzhLid1kG5s4="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:0b720f62-a8bd-43f0-b5ef-88c304792e3b"}},"directories":{},"maintainers":[{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},{"name":"diegopersas","email":"diego@anyformat.ai"},{"name":"andrew0033","email":"andres@anyformat.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.2.3_1783495220470_0.16648750740967522"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-26T13:50:00.347Z","modified":"2026-07-08T07:20:20.740Z","0.1.0":"2026-05-26T13:50:00.687Z","0.2.0":"2026-05-27T07:52:23.536Z","0.2.1":"2026-05-27T08:13:53.109Z","0.2.2":"2026-06-16T14:49:10.119Z","0.2.3":"2026-07-08T07:20:20.619Z"},"author":{"name":"Anyformat","email":"info@anyformat.ai"},"license":"MIT","description":"TypeScript SDK for the AnyFormat API","maintainers":[{"name":"epapbak-anyformat","email":"bakary@anyformat.ai"},{"name":"diegopersas","email":"diego@anyformat.ai"},{"name":"andrew0033","email":"andres@anyformat.ai"}],"readme":"# @anyformat/sdk\n\nTypeScript SDK for the AnyFormat API. Mirrors the Python SDK's fluent flow.\n\n```ts\nimport { Anyformat, Schema } from \"@anyformat/sdk\";\n\nconst af = new Anyformat({ apiKey: process.env.ANYFORMAT_API_KEY! });\n\nconst result = await af\n  .workflow(\"Invoice\")\n  .parse()\n  .extract([\n    Schema.string(\"vendor\", \"Vendor name on the invoice.\"),\n    Schema.float(\"total\", \"Grand total amount.\"),\n    Schema.enum(\"currency\", \"Currency of the totals.\", [\n      Schema.option(\"USD\", \"US Dollar.\"),\n      Schema.option(\"EUR\", \"Euro.\"),\n    ]),\n  ])\n  .run(file)\n  .wait();\n\nresult.field(\"vendor\")?.value; // -> \"Acme Corp\"\n```\n\n## Quick parse: one call → markdown\n\n`af.parse()` runs the platform's atomic `/parse` operation (a fast lite parse)\nand returns an opaque `jobId`. Poll `getParseMarkdown(jobId)` for the markdown —\nno workflow to author or manage.\n\n```ts\nconst jobId = await af.parse(file); // File | Blob\nlet markdown = await af.getParseMarkdown(jobId);\nwhile (markdown === null) {\n  await new Promise((r) => setTimeout(r, 3000));\n  markdown = await af.getParseMarkdown(jobId); // null until done\n}\nconsole.log(markdown);\n```\n\n## Managing workflows\n\n```ts\nconst workflows = await af.listWorkflows({ pageSize: 50 }); // -> Workflow[]\nfor (const wf of workflows) console.log(wf.id, wf.name);\n\nawait af.deleteWorkflow(workflows[0].id); // -> the deleted id\n```\n\n## Smart lookup\n\nResolve a field by matching the document against a reference file (CSV/catalog) instead of\nreading it off the page — flag the field with `{ lookup: true }` and pass the file via\n`lookupFiles`:\n\n```ts\nawait af\n  .workflow(\"Invoice + vendor lookup\")\n  .parse()\n  .extract(\n    [\n      Schema.string(\"vendor_name\", \"Vendor as printed on the invoice.\"),\n      Schema.string(\"vendor_id\", \"Canonical vendor code from the catalog, joined on vendor_name.\", { lookup: true }),\n    ],\n    { lookupFiles: [\"vendor_catalog.csv\"], lookupSuggestion: \"Join vendor_name → vendor_id.\" },\n  )\n  .run(file)\n  .wait();\n```\n\nFull runnable example: [`examples/smart-lookup.mjs`](examples/smart-lookup.mjs).\n\n## How it's built\n\nThe wire types and the low-level HTTP client are **generated** from the API's\nOpenAPI spec with [Hey API](https://heyapi.dev) — they are not hand-written and\nmust not be edited. Everything in `src/sdk/` is generated; the hand-written\nergonomic layer (`Schema`, `WorkflowBuilder`, `Result`, `Anyformat`) wraps it.\n\n## Regenerating (and the drift guard)\n\n```bash\nbun run gen          # dump the v2 OpenAPI offline + regenerate src/sdk\nbun run gen:check    # regenerate and fail if the committed output drifted\n```\n\n`gen:check` runs in CI and as a pre-commit hook (scoped to changes under\n`anyformat/services/api` and `anyformat/workflow`) so the committed SDK can\nnever fall behind the backend. The SDK's own `tsc` then fails to compile if a\nbackend model change alters a type the hand-written layer relies on — drift is\ncaught as a type error, not just a diff.\n\n## Scripts\n\nInstall deps with `bun install --frozen-lockfile` (matches CI + the frontend\ntoolchain). Then:\n\n| script | what |\n| --- | --- |\n| `bun run gen` | dump spec + regenerate `src/sdk` |\n| `bun run gen:check` | regenerate + assert no drift |\n| `bun run build` | bundle to `dist/` (ESM + CJS + types) via tsup |\n| `bun run typecheck` | `tsc --noEmit` |\n| `bun run test` | vitest |\n\n## Releasing\n\nCut on demand — a maintainer bumps the version in a PR, then pushes a `sdk-js-vX.Y.Z` tag on the release commit. Full flow + one-time setup: [`../RELEASING.md`](../RELEASING.md). Break-glass: `./publish.sh [--build-only|--dry-run]`.\n\n## Node configuration knobs\n\nEvery knob is an option on `.parse({...})` / `.extract(fields, {...})`. `parse` options are a\n`mode`-discriminated union, so a wrong-mode knob is a compile-time error.\n\n**`.parse({...})`** — `mode` (`\"standard\"`/`\"agentic\"`/`\"lite\"`), `promptHint`, `figureEnhancement`,\n`cache`; **agentic-only** `effort` (`\"low\"`/`\"mid\"`/`\"accurate\"`); **lite-only** `ocrEffort`\n(`\"medium\"`/`\"high\"`), `region` (`\"eu\"`/`\"global\"`), `skipRoutingReview`, `figures`,\n`textFormatting`, `routingEffort`.\n\n**`.extract(fields, {...})`** — `mode` (`\"standard\"`/`\"agentic\"`/`\"max\"`/`\"lite\"`), `useImages`,\n`lookupSuggestion`, `lookupReasoningEffort` (`\"minimal\"`/`\"low\"`/`\"medium\"`/`\"high\"`), `lookupFiles`.\n","readmeFilename":"README.md"}