{"_id":"@animal-id/partner-core","_rev":"2-81a06ba3d2ee0448227d8ed32e1fd1c6","name":"@animal-id/partner-core","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@animal-id/partner-core","version":"0.1.0","keywords":["animal-id","partner-api","sdk","hmac","veterinary","microchip"],"license":"MIT","_id":"@animal-id/partner-core@0.1.0","maintainers":[{"name":"animal-id","email":"vm@animal-id.net"}],"dist":{"shasum":"2fad16c96640a780ca458686413ecafe00665c8c","tarball":"https://registry.npmjs.org/@animal-id/partner-core/-/partner-core-0.1.0.tgz","fileCount":8,"integrity":"sha512-CRCi7Hxdaj84JbTTIN2xjDDnB5mgUDPad9af2uacBdJUO+t1uFml4KNVYAr8mKvDWb2qbs7regARglO8KhP+Fg==","signatures":[{"sig":"MEUCIQDzZeO0fQeTBc59mhlL/AqUAGsO5xMuJ0h07F2+LC3J3QIgLzUEhIKiLfdkf48+ZouBinLlBb9PcaFC4ydMa1KlxBw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":186173},"main":"./dist/index.cjs","type":"module","_from":"file:animal-id-partner-core-0.1.0.tgz","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"},"./package.json":"./package.json"},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit -p tsconfig.json"},"_npmUser":{"name":"animal-id","email":"vm@animal-id.net"},"_resolved":"/private/var/folders/bd/q0ht6d8n3nn7p95597z0t7p40000gn/T/4f1eb1e67dab7a1c87fa3fa664a8e1db/animal-id-partner-core-0.1.0.tgz","_integrity":"sha512-CRCi7Hxdaj84JbTTIN2xjDDnB5mgUDPad9af2uacBdJUO+t1uFml4KNVYAr8mKvDWb2qbs7regARglO8KhP+Fg==","_npmVersion":"10.9.2","description":"Isomorphic TypeScript client for the Animal-ID Partner API (HMAC-SHA256 signing, zero runtime dependencies).","directories":{},"sideEffects":false,"_nodeVersion":"22.16.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/partner-core_0.1.0_1781806627686_0.8929160443321316","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@animal-id/partner-core","version":"0.2.0","description":"Isomorphic TypeScript client for the Animal-ID Partner API (HMAC-SHA256 signing, zero runtime dependencies).","license":"MIT","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"},"sideEffects":false,"engines":{"node":">=18"},"keywords":["animal-id","partner-api","sdk","hmac","veterinary","microchip"],"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.0"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit -p tsconfig.json","clean":"rm -rf dist"},"_id":"@animal-id/partner-core@0.2.0","_integrity":"sha512-L5MKK/rn1XfEP5NDmTR/O+JdiFlh7msqdCxv+5ynjzcmbaKJowwkjJq3z9RNVy3/tPR0kv5BYVa3b5dfVQamnQ==","_resolved":"/private/var/folders/bd/q0ht6d8n3nn7p95597z0t7p40000gn/T/146b37afec1c46a88a2ee74e6e72c5aa/animal-id-partner-core-0.2.0.tgz","_from":"file:animal-id-partner-core-0.2.0.tgz","_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-L5MKK/rn1XfEP5NDmTR/O+JdiFlh7msqdCxv+5ynjzcmbaKJowwkjJq3z9RNVy3/tPR0kv5BYVa3b5dfVQamnQ==","shasum":"fa2be60f453cc4e61c0c1220aefe4e63c0e8bd61","tarball":"https://registry.npmjs.org/@animal-id/partner-core/-/partner-core-0.2.0.tgz","fileCount":8,"unpackedSize":243317,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIC2COaumZo6LLP3djia7cBHlUhfmGkzNjX3vCTHjXiZfAiEA8HH4QAjatvWVY08wdSgd2eOK4y7qzBrDC4kHWuSei34="}]},"_npmUser":{"name":"animal-id","email":"vm@animal-id.net"},"directories":{},"maintainers":[{"name":"animal-id","email":"vm@animal-id.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/partner-core_0.2.0_1782836436082_0.3441032941083437"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-18T18:17:07.537Z","modified":"2026-06-30T16:20:36.755Z","0.1.0":"2026-06-18T18:17:07.853Z","0.2.0":"2026-06-30T16:20:36.285Z"},"license":"MIT","keywords":["animal-id","partner-api","sdk","hmac","veterinary","microchip"],"description":"Isomorphic TypeScript client for the Animal-ID Partner API (HMAC-SHA256 signing, zero runtime dependencies).","maintainers":[{"name":"animal-id","email":"vm@animal-id.net"}],"readme":"# @animal-id/partner-core\n\nIsomorphic TypeScript client for the **Animal-ID Partner API** — zero runtime\ndependencies, runs on Node, browsers, Deno, Bun and edge runtimes. Handles\nHMAC-SHA256 signing, idempotency keys, the response envelope, and typed errors.\n\n```bash\npnpm add @animal-id/partner-core\n```\n\n```ts\nimport { AnimalIdClient } from '@animal-id/partner-core';\n\nconst client = new AnimalIdClient({\n  credentials: { appId: 'aid_app_xxx', publicKey: 'pk_xxx', privateKey: 'sk_xxx' }, // server-side only\n  // baseUrl defaults to https://gw.animal-id.net\n});\n\nconst dicts = await client.dictionaries.get({ lang: 'uk' });\nconst owner = await client.owners.create({ email: 'jane@example.com', consent: { account_creation: true } });\nconst animal = await client.animals.create({ species: 3, is_microchip: false, nickname: 'Барсік' });\nconst found = await client.animals.findByIdentifier('microchip', '900263000123456');\n```\n\n## Configuration (`AnimalIdClientConfig`)\n\n| Option | Default | Notes |\n| --- | --- | --- |\n| `baseUrl` | `https://gw.animal-id.net` | gateway origin; `/v1/partner` is added automatically |\n| `credentials` | — | `{ appId, publicKey, privateKey }` → built-in HMAC signing (**server-side only**) |\n| `signer` | — | custom `Signer` (e.g. backend proxy) — takes precedence over `credentials` |\n| `version` | — | `X-Eternity-Animal-ID-Version` (YYYY-MM-DD) |\n| `fetch` | `globalThis.fetch` | inject undici/node-fetch/a mock |\n| `subtle` | `globalThis.crypto.subtle` | inject Web Crypto (needed on Node 18) |\n| `timeoutMs` | — | per-request timeout |\n| `idempotencyKeyFactory` | random UUID v4 | override the idempotency key generator |\n| `defaultHeaders` | — | extra headers on every request |\n\n## Resources\n\n- `dictionaries.get(params?)` — public, ETag-cacheable (`ifNoneMatch` → `notModified`).\n- `owners.create(input)`, `owners.search(emailOrPhone)` *(→ `null` on 404)*.\n- `animals.create(input)`, `animals.get(id)` *(→ `null`)*, `animals.findByIdentifier(type, value)`,\n  `animals.findByIdentifierAny(value)`, `animals.findByOwner(emailOrPhone)`, `animals.update(id, input)`.\n- `procedures.create(animalId, body)`, `procedures.list(animalId, params?)`, `procedures.get(id)` *(→ `null`)*.\n- `photos.upload(animalId, { file, kind? })`, `photos.delete(animalId, photoId)`.\n\nEvery method accepts a final `RequestOptions` argument: `{ idempotencyKey?, signal?, headers?, version? }`.\n\n## Errors\n\n`AnimalIdApiError` (with `.status`, `.payload`, `.requestId`), `AnimalIdValidationError`\n(422), `AnimalIdNetworkError`, `AnimalIdConfigError` — all extend `AnimalIdError`.\n\n## Signing helpers\n\n`createHmacSigner(credentials)` and `buildStringToSign(input)` are exported so you\ncan mount a signing proxy for browser clients. See the repo README for the pattern.\n","readmeFilename":"README.md"}