{"_id":"@ailawtracker/ai-law-tracker","name":"@ailawtracker/ai-law-tracker","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@ailawtracker/ai-law-tracker","version":"0.1.0","description":"Official Node/TypeScript SDK for the AI Law Tracker API — audited AI-regulation data (US state + federal, EU, global) in three lines.","keywords":["ai law","ai regulation","compliance","legal","eu ai act","api","sdk","typescript"],"homepage":"https://ai-law-tracker.com","bugs":{"url":"https://github.com/Awesome28208/ai-law-tracker/issues"},"repository":{"type":"git","url":"git+https://github.com/Awesome28208/ai-law-tracker.git","directory":"sdk/node"},"license":"MIT","author":{"name":"AI Law Tracker","email":"hello@ai-law-tracker.com"},"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"},"./package.json":"./package.json"},"engines":{"node":">=18"},"sideEffects":false,"scripts":{"build":"tsup","typecheck":"tsc --noEmit","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","typescript":"^5.4.0","vitest":"^2.0.0"},"publishConfig":{"access":"public"},"gitHead":"6afb0bcbcd5c359e0b8196a0c8d2a2f2e7c7422b","_id":"@ailawtracker/ai-law-tracker@0.1.0","_nodeVersion":"20.20.2","_npmVersion":"11.18.0","dist":{"integrity":"sha512-1YPvzJf/T5vUrEgCNU0EChoHxkCz4x4N0senBFDvJIe0n1GmZmf3b3AoZrLFV9P9jblZLAQ0gv4nXmCtK7MeWg==","shasum":"4e59090342b06a6b40a6bbb16e8e9e1861051a11","tarball":"https://registry.npmjs.org/@ailawtracker/ai-law-tracker/-/ai-law-tracker-0.1.0.tgz","fileCount":9,"unpackedSize":128518,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEFGtRQ1Q3uE9bxSpdnHILuXx3GoZq0hWcmVUewhgXpMAiAUvE4VeVwH7bDhv/yAHG96+U2bOy7T8VjpuF+6mtrrtw=="}]},"_npmUser":{"name":"ailawtracker","email":"asim@ai-law-tracker.com"},"directories":{},"maintainers":[{"name":"ailawtracker","email":"asim@ai-law-tracker.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-law-tracker_0.1.0_1784840256666_0.9922289564220288"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-23T20:57:36.505Z","0.1.0":"2026-07-23T20:57:36.809Z","modified":"2026-07-23T20:57:37.004Z"},"maintainers":[{"name":"ailawtracker","email":"asim@ai-law-tracker.com"}],"description":"Official Node/TypeScript SDK for the AI Law Tracker API — audited AI-regulation data (US state + federal, EU, global) in three lines.","homepage":"https://ai-law-tracker.com","keywords":["ai law","ai regulation","compliance","legal","eu ai act","api","sdk","typescript"],"repository":{"type":"git","url":"git+https://github.com/Awesome28208/ai-law-tracker.git","directory":"sdk/node"},"author":{"name":"AI Law Tracker","email":"hello@ai-law-tracker.com"},"bugs":{"url":"https://github.com/Awesome28208/ai-law-tracker/issues"},"license":"MIT","readme":"# AI Law Tracker — Node / TypeScript SDK\n\n[![npm](https://img.shields.io/npm/v/@ailawtracker/ai-law-tracker.svg)](https://www.npmjs.com/package/@ailawtracker/ai-law-tracker)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)\n\nOfficial Node/TypeScript client for the [AI Law Tracker](https://ai-law-tracker.com)\nAPI — the audited dataset of AI regulation across **US state + federal, the EU,\nand global** jurisdictions. Laws, news, changelogs, obligations, penalties,\ncompliance assessment, deadlines, and webhooks. Ships **ESM + CJS** with full\nTypeScript types; zero runtime dependencies (uses the built-in `fetch`, Node 18+).\n\n```bash\nnpm install @ailawtracker/ai-law-tracker\n```\n\n## Quick start (3 lines)\n\n```ts\nimport { Client } from '@ailawtracker/ai-law-tracker';\n\nconst alt = new Client();                              // anonymous tier; no key\nconst laws = await alt.laws.list({ scope: 'federal' }); // -> { data, meta }\n```\n\nCommonJS works too:\n\n```js\nconst { Client } = require('@ailawtracker/ai-law-tracker');\n```\n\n## Authentication\n\nThe API has a free **anonymous** tier (rate-limited by IP). For higher limits,\nricher fields, and the changelog/webhook endpoints, use a **free API key** (no\ncard required):\n\n```ts\nimport { Client } from '@ailawtracker/ai-law-tracker';\n\n// 1) Issue a free key by email (an anonymous call is fine)\nawait new Client().account.createKey('you@example.com'); // emails you a key\n\n// 2) Use it — explicitly, or via the ALT_API_KEY env var\nconst alt = new Client({ apiKey: 'alt_live_...' });\nconsole.log(await alt.account.get()); // your tier, limits, and live usage\n```\n\nSet `ALT_API_KEY` in your environment and `new Client()` picks it up\nautomatically. Paid tiers ($29 / $99 / $299 a month) raise quotas and unlock\nPro-only endpoints — see <https://ai-law-tracker.com/pricing>.\n\n## Pagination\n\nList endpoints return `{ data, meta }`, where `meta` carries\n`total`, `limit`, `offset`:\n\n```ts\nconst page = await alt.laws.list({ scope: 'state', jurisdiction: 'colorado', limit: 50 });\nconsole.log(page.meta.total, 'records match;', page.data.length, 'on this page');\n```\n\nTo sweep every matching record without managing offsets, use the async\ngenerator `iterate(...)`:\n\n```ts\nfor await (const law of alt.laws.iterate({ scope: 'eu', in_force: true })) {\n  // ...\n}\n\nfor await (const hit of alt.search.iterate('facial recognition', { scope: 'state' })) {\n  // ...\n}\n```\n\n## Endpoints\n\nGrouped as resources on the client:\n\n| Resource | Methods |\n| --- | --- |\n| `alt.laws` | `list`, `iterate`, `get(id)`, `history(id)`, `sources(id)`, `citations(id)` |\n| `alt.search` | `query(q, params)`, `iterate(q, params)` |\n| `alt.news` | `list`, `iterate` |\n| `alt.changes` | `list`, `iterate` (poll `since` for what changed) |\n| `alt.feed` | `list` (lean recent-changes stream) |\n| `alt.jurisdictions` | `list`, `countries`, `states` |\n| `alt.sectors` | `list`, `get(sector)` |\n| `alt.compliance` | `obligations`, `penalties`, `assess`, `report` |\n| `alt.deadlines` | `list` (JSON or iCal via `format: 'ical'`) |\n| `alt.bills` | `list`, `get(slug)` |\n| `alt.webhooks` | `list`, `get(id)`, `create`, `delete` (Pro+) |\n| `alt.account` | `get`, `revoke`, `createKey(email)`, `createToken(email)` |\n| top level | `alt.health()`, `alt.accuracy()`, `alt.categories()`, `alt.openapi()` |\n\nExamples:\n\n```ts\n// Poll the changelog for everything that moved since a timestamp\nconst changes = await alt.changes.list({ since: '2026-07-01T00:00:00Z', scope: 'federal' });\n\n// Compliance obligations for a sector + jurisdiction\nconst obligations = await alt.compliance.obligations({ jurisdiction: 'colorado', sector: 'hr' });\n\n// Risk assessment from a company profile\nconst result = await alt.compliance.assess({ state: 'CA', sector: 'hr', aiUse: 'resume_screening' });\n\n// The report endpoint can stream a PDF (ArrayBuffer) when format: 'pdf'\nconst pdf = await alt.compliance.report({ state: 'CA', sector: 'hr', format: 'pdf' });\n```\n\n## Error handling\n\nEvery non-2xx response throws a typed error carrying `.status`, `.code`,\n`.message`, and `.docs`:\n\n```ts\nimport { NotFoundError, RateLimitError } from '@ailawtracker/ai-law-tracker';\n\ntry {\n  await alt.laws.get('does-not-exist');\n} catch (e) {\n  if (e instanceof NotFoundError) console.log(e.code, e.message);\n  else if (e instanceof RateLimitError) console.log('retry after', e.retryAfter, 's');\n  else throw e;\n}\n```\n\nAll extend `ALTError`. Transient failures (timeouts, 5xx, 429) on `GET`/`DELETE`\nare retried automatically with exponential backoff (`new Client({ maxRetries })`).\n\n## Configuration\n\n```ts\nnew Client({\n  apiKey: undefined,                              // or set ALT_API_KEY\n  baseURL: 'https://ai-law-tracker.com/api/v1',\n  timeout: 30_000,                                // ms\n  maxRetries: 2,                                  // transient GET/DELETE retries\n  fetch: undefined,                               // custom fetch impl (optional)\n});\n```\n\n## Responsible use\n\nThis SDK is designed to be a well-behaved API citizen and does **not** provide\nany way to bypass the server's tier gating or rate limits:\n\n- Requests are **sequential** with a single connection — no parallel fan-out or\n  concurrent request flooding.\n- Retries are **conservative**: a small default (`maxRetries: 2`), exponential\n  backoff with jitter, and only on idempotent `GET`/`DELETE`. Writes/POSTs are\n  never retried automatically.\n- `429` responses and their `Retry-After` header are **respected**; a persisted\n  rate limit surfaces as a `RateLimitError` (with `.retryAfter`) rather than\n  being retried away.\n- `iterate(...)` pages **one page at a time, in order**, through the same\n  rate-limited transport. It is a convenience for legitimate paging, not a bulk\n  scraper — please honour your tier's quotas.\n\nIf you need high-volume or bulk access, use an appropriate paid tier or contact\n<hello@ai-law-tracker.com> rather than working around the limits.\n\n## Links\n\n- API docs & playground: <https://ai-law-tracker.com/developers>\n- OpenAPI 3.1 spec: <https://ai-law-tracker.com/api/v1/openapi.json>\n- Get a free key: <https://ai-law-tracker.com>\n- Python SDK: [`ai-law-tracker` on PyPI](https://pypi.org/project/ai-law-tracker/)\n\n## License\n\nMIT (SDK code). API **data** is CC BY 4.0 — attribution required, informational\nonly, not legal advice.\n","readmeFilename":"README.md","_rev":"1-7595d22f98a053f5824490ccddff8f90"}