{"_id":"@9jacheckr/sdk","_rev":"4-5af0cb88fb17de5c5d9e5ef2d42bcf06","name":"@9jacheckr/sdk","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"@9jacheckr/sdk","version":"0.1.0","keywords":["nafdac","9ja-checkr","nigeria"],"license":"MIT","_id":"@9jacheckr/sdk@0.1.0","maintainers":[{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"}],"dist":{"shasum":"923ea607fbc9bd2b917f0ddd6729bbd1c374aecb","tarball":"https://registry.npmjs.org/@9jacheckr/sdk/-/sdk-0.1.0.tgz","fileCount":8,"integrity":"sha512-6IqrQo2LdDskS7vrJkcjQ40P7Z8D37ZB85AHSjdBLKwZvQRjDTHE84P9mkW1NK/VbwqpiAzVBs9l4sHrvaZlXw==","signatures":[{"sig":"MEUCIDaiZ/BsLhKBN+jJp1PPN4nuV2VlW8ehUpsucDK/4x7qAiEA4sWU9k7TxX+gRNIjFjyVPb53q4G5ted4HuseAOg6KnQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26383},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"9312b64ec21ba2bd34372907d367bb12c89d5e96","scripts":{"lint":"npm run check-types","build":"tsup","check-types":"tsc --noEmit"},"_npmUser":{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"},"_npmVersion":"11.10.1","description":"Client for the 9ja Checkr NAFDAC verify API","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"5.9.2","@types/node":"^24.10.1"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1774124265806_0.7547570299223683","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@9jacheckr/sdk","version":"0.2.0","keywords":["nafdac","9ja-checkr","nigeria"],"license":"MIT","_id":"@9jacheckr/sdk@0.2.0","maintainers":[{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"}],"dist":{"shasum":"4b42fa3b90021b170c5a5d668b9e1b8fbe4fd506","tarball":"https://registry.npmjs.org/@9jacheckr/sdk/-/sdk-0.2.0.tgz","fileCount":8,"integrity":"sha512-PKB8iCjS+ISHkQNDeVFSbfg14TEP9NZ9GTTFRhe6dJndEuMxaX+xc6mcfLOtJNAV+1/h1nmQTC6vA73Z8GR2KQ==","signatures":[{"sig":"MEYCIQCOYvBHtyp8n9iBr11+bp707UW9LkYuJ2SDmj1aQQyn2QIhAOnfV/DNQBYVirULes0uh7Iqs4Ckm6G0RexW91E9mVgC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59220},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"51900ba9e09dcbc09aac9f47d8a2d8de32973138","scripts":{"lint":"npm run check-types","build":"tsup","check-types":"tsc --noEmit"},"_npmUser":{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"},"_npmVersion":"11.10.1","description":"Client for the 9ja Checkr NAFDAC verify API (single verify, batch verify, product search)","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"5.9.2","@types/node":"^24.10.1"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1774184948799_0.7646504216409415","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@9jacheckr/sdk","version":"0.2.1","keywords":["nafdac","9ja-checkr","nigeria"],"license":"GPL-3.0-only","_id":"@9jacheckr/sdk@0.2.1","maintainers":[{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"}],"dist":{"shasum":"3165a9aa0ec07c378dd781749c318cba7c362ce1","tarball":"https://registry.npmjs.org/@9jacheckr/sdk/-/sdk-0.2.1.tgz","fileCount":8,"integrity":"sha512-y4IpXQzxCqXRnruBFHISFaTBCxB7K3VyyFrcU4UpnZOIjyS30RPsaVw4o5jTsNqYhPQ9zLLXEuAIJFuWiQLQAw==","signatures":[{"sig":"MEQCIFxpF6s+i99PNmj7OKnBuwcUGbmtIBZV0BkWZBnjovXRAiBa6vO0ZLT6mROi0e+h9gpu4FYbtCHUhoJTl8klbeEwog==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59652},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"91926e05bccee36c708e1160471339ab7870430e","scripts":{"lint":"npm run check-types","build":"tsup","check-types":"tsc --noEmit"},"_npmUser":{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"},"_npmVersion":"11.10.1","description":"Client for the 9ja Checkr NAFDAC verify API (single verify, batch verify, product search)","directories":{},"_nodeVersion":"24.13.1","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"5.9.2","@types/node":"^24.10.1"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.1_1774334790506_0.01457741405456181","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@9jacheckr/sdk","version":"0.2.2","description":"Client for the 9ja Checkr NAFDAC verify API (single verify, batch verify, product search)","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsup","check-types":"tsc --noEmit","lint":"npm run check-types"},"engines":{"node":">=18"},"keywords":["nafdac","9ja-checkr","nigeria"],"license":"AGPL-3.0-only","devDependencies":{"@types/node":"^24.10.1","tsup":"^8.5.1","typescript":"5.9.2"},"gitHead":"91926e05bccee36c708e1160471339ab7870430e","_id":"@9jacheckr/sdk@0.2.2","_nodeVersion":"24.13.1","_npmVersion":"11.10.1","dist":{"integrity":"sha512-SntzzGtOlcC5a6RDG3xvwOOifdLHMlBLOZHakTEuF3UGhyL/+J4r/g5iuep6BwCs8t0bhe12kFs4C/6SJPJxsQ==","shasum":"4c3d905e351b1932e15bacea93b57711ed421bec","tarball":"https://registry.npmjs.org/@9jacheckr/sdk/-/sdk-0.2.2.tgz","fileCount":8,"unpackedSize":59704,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC8HLLTIel8H4SNYXBpyo7Ky7u0T3co+k2jay0HG5SctwIhAMoAOxp2BGxhk95tdSIpzrou2nJjRJcuhfDKb4b/AfHs"}]},"_npmUser":{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"},"directories":{},"maintainers":[{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.2.2_1774335255087_0.10582673542448728"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-21T20:17:45.679Z","modified":"2026-03-24T06:54:15.389Z","0.1.0":"2026-03-21T20:17:45.956Z","0.2.0":"2026-03-22T13:09:08.968Z","0.2.1":"2026-03-24T06:46:30.649Z","0.2.2":"2026-03-24T06:54:15.241Z"},"license":"AGPL-3.0-only","keywords":["nafdac","9ja-checkr","nigeria"],"description":"Client for the 9ja Checkr NAFDAC verify API (single verify, batch verify, product search)","maintainers":[{"name":"emmanueltaiwo","email":"devemmanuel1@gmail.com"}],"readme":"# 9jaCheckr\n\n## @9jacheckr/sdk\n\nNode.js client for the [9ja Checkr](https://9jacheckr.xyz) NAFDAC **registration lookup** API (independent service — not NAFDAC; see [disclaimer](https://9jacheckr.xyz/disclaimer)): single lookup (`verify`), batch lookup (API Pro), and product search (API Pro). Monthly **API usage** quotas are enforced server-side: each lookup row (incl. batch) and each successful search count toward the same cap (e.g. Free 300 / Pro 50,000 per UTC month — see product docs).\n\n## Requirements\n\n- Node.js 18+ (global `fetch`)\n\n## Install\n\n```bash\nnpm install @9jacheckr/sdk\n```\n\n## Usage\n\n**ESM**\n\n```ts\nimport { CheckrClient } from '@9jacheckr/sdk';\n\nconst client = new CheckrClient({\n  apiKey: process.env.NAIJA_CHECKR_API_KEY!,\n});\n\nconst result = await client.verify('01-5713');\n\nif (result.ok) {\n  console.log(result.product.name, result.product.manufacturer);\n} else {\n  console.error(result.code, result.message);\n}\n```\n\n**Batch lookup (API Pro)** — up to 40 NAFDAC numbers per request; each row counts toward your monthly API usage quota.\n\n```ts\nconst batch = await client.verifyBatch(['01-5713', '04-8127']);\n\nif (batch.ok) {\n  for (const row of batch.results) {\n    if (row.ok) console.log(row.nafdac, row.product.name);\n    else console.log(row.nafdac, row.code, row.message);\n  }\n} else {\n  console.error(batch.code, batch.message);\n}\n```\n\n**Product search (API Pro)** — full-text search over indexed products. Each successful search counts toward the same monthly API usage quota as lookups.\n\n```ts\nconst search = await client.searchProducts('sardine', { limit: 10 });\n\nif (search.ok) {\n  for (const hit of search.results) {\n    console.log(hit.nafdac, hit.name, hit.manufacturer);\n  }\n} else {\n  console.error(search.code, search.message);\n}\n```\n\n**CommonJS**\n\n```js\nconst { CheckrClient } = require('@9jacheckr/sdk');\n\nasync function main() {\n  const client = new CheckrClient({\n    apiKey: process.env.NAIJA_CHECKR_API_KEY,\n  });\n  const result = await client.verify('01-5713');\n  // ...\n}\n```\n\nUse your API key from the dashboard. Do not expose it in browser bundles.\n\n## API\n\n### `new CheckrClient(options)`\n\n- `apiKey` (required) — throws if missing or whitespace-only.\n\nThe client calls `DEFAULT_API_ORIGIN` (`https://api.9jacheckr.xyz`), same as before.\n\n### `client.verify(nafdac)`\n\n`Promise<VerifyResult>` — `GET /api/verify/:nafdac`\n\n### `client.verifyBatch(nafdac[])`\n\n`Promise<BatchVerifyResult>` — `POST /api/verify/batch` with body `{ nafdac: string[] }`.\n\nRequires **API Pro**. On success, `result.ok` is `true` and `result.results` has one entry per requested number (each item is either a product hit or a per-row error such as `NOT_FOUND`).\n\n### `client.searchProducts(query, options?)`\n\n`Promise<SearchResult>` — `GET /api/products/search?q=...&limit=...`\n\nRequires **API Pro**. `query` must be at least 2 characters (each keyword ≥ 2 chars when you use several). Multiple keywords are matched with **AND** across NAFDAC, name, category, manufacturer, source, and ingredients; order does not matter. `options.limit` is optional (1–50, default 20).\n\n### Behaviour\n\nAll methods **resolve** (they do not throw for API or network failures). Narrow on `result.ok`.\n\nTimeout is ~25s per request.\n\n## Responses\n\n### Single verify (`VerifyResult`)\n\nSame shape as before: success `{ ok: true, product }` or `{ ok: false, code, message, nafdac? }`.\n\n### Batch (`BatchVerifyResult`)\n\n- Success: `{ ok: true, results: BatchItemResult[] }` where each element is either `{ nafdac, ok: true, product }` or `{ nafdac, ok: false, code, message }`.\n- HTTP/API failure: `{ ok: false, code, message }` (e.g. `FEATURE_REQUIRES_PRO`, `PLAN_QUOTA_EXCEEDED`, `INVALID_BODY`).\n\n### Search (`SearchResult`)\n\n- Success: `{ ok: true, results: SearchHit[] }` with `nafdac`, `name`, `category`, `manufacturer`.\n- Failure: `{ ok: false, code, message }`.\n\n### Errors (`ok: false`)\n\n```json\n{\n  \"ok\": false,\n  \"code\": \"NOT_FOUND\",\n  \"message\": \"Product not found for this NAFDAC number\"\n}\n```\n\nOptional `nafdac` may appear on single-verify errors.\n\n#### From the API (examples)\n\n| HTTP | `code`                                | Notes                                                           |\n| ---- | ------------------------------------- | --------------------------------------------------------------- |\n| 400  | `INVALID_NAFDAC`                      | Single verify: bad path param                                   |\n| 400  | `INVALID_BODY`                        | Batch: missing/empty `nafdac` array                             |\n| 400  | `INVALID_QUERY`                       | Search: `q` too short (SDK also validates)                      |\n| 401  | `MISSING_API_KEY` / `INVALID_API_KEY` | Key header                                                      |\n| 403  | `FEATURE_REQUIRES_PRO`                | Batch or search on Free plan                                    |\n| 403  | `KEY_PLAN_DISABLED`                   | Non-primary API key while on Free plan (use primary or upgrade) |\n| 404  | `NOT_FOUND`                           | Single verify                                                   |\n| 429  | `PLAN_QUOTA_EXCEEDED`                 | Monthly API usage cap (verifies + searches)                     |\n| 429  | `RATE_LIMITED`                        | Per-plan rate limit                                             |\n| 500  | `INTERNAL_ERROR`                      | Server error                                                    |\n\n`message` may change; prefer `code` for branching.\n\n#### From the SDK only\n\n| `code`             | When                                    |\n| ------------------ | --------------------------------------- |\n| `INVALID_NAFDAC`   | Empty single-verify input (not sent).   |\n| `INVALID_BODY`     | Empty batch list after trim (not sent). |\n| `INVALID_QUERY`    | Search query &lt; 2 chars (not sent).   |\n| `INVALID_RESPONSE` | Body is not JSON or unexpected shape.   |\n| `TIMEOUT`          | Request exceeded ~25s.                  |\n| `NETWORK_ERROR`    | Network failure before a parsed body.   |\n\n## License\n\n**GNU AGPLv3** — GNU Affero General Public License v3.0 only (SPDX `AGPL-3.0-only`). Strong copyleft like the GPL, plus **network/server** obligations when users interact with a **modified** version remotely. Distribution and SaaS-style use have **source** and **same-license** requirements; no warranty. Full text: monorepo root [`LICENSE`](../../LICENSE).\n\n## Changelog\n\n### 0.2.0\n\n- `verifyBatch(nafdac[])` — `POST /api/verify/batch` (API Pro).\n- `searchProducts(query, { limit? })` — `GET /api/products/search` (API Pro).\n- Types exported for batch and search results.\n\n### 0.1.0\n\n- Initial release with `verify()`.\n","readmeFilename":"README.md"}