{"_id":"@api-zero/zod","_rev":"6-c8b19ff5f43ed4c7ba20f016af996e44","name":"@api-zero/zod","dist-tags":{"latest":"0.1.5"},"versions":{"0.1.0":{"name":"@api-zero/zod","version":"0.1.0","keywords":["api-zero","zod","validation","schema","typescript","http","client"],"license":"MIT","_id":"@api-zero/zod@0.1.0","maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"homepage":"https://api-zero.vercel.app","bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"dist":{"shasum":"09dfca4cffc865bd618d1602c1a2ecfb6c2c619b","tarball":"https://registry.npmjs.org/@api-zero/zod/-/zod-0.1.0.tgz","fileCount":9,"integrity":"sha512-gK9Gf6FtKwH+AE6c6hGvn7P3Qdl21gvUSByORlD7O4iD1NWxsOd01nH5ZAeHlLzUkjv7AYDgC07hzLv1TuPkeg==","signatures":[{"sig":"MEUCIQCKhIukVBm2s2LoR19TYAG0pQnoCi/XKBlg1OSmTRwXOQIgZsI526qAviyIh3DO0RS9mTFWJp3eHbZPD84g6WLg2o4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-zero%2fzod@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56407},"main":"./dist/index.cjs","type":"module","_from":"file:api-zero-zod-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","lint":"biome check .","test":"vitest run","build":"tsup","format":"biome format --write ."},"_npmUser":{"name":"gorkadev","email":"dev@gorkadev.com"},"_resolved":"/tmp/955070cc595064450fe7e3f8b90ae109/api-zero-zod-0.1.0.tgz","_integrity":"sha512-gK9Gf6FtKwH+AE6c6hGvn7P3Qdl21gvUSByORlD7O4iD1NWxsOd01nH5ZAeHlLzUkjv7AYDgC07hzLv1TuPkeg==","repository":{"url":"git+https://github.com/api-zero/api-zero.git","type":"git","directory":"packages/zod"},"_npmVersion":"11.17.0","description":"Zod runtime contracts and schema validation adapters for api-zero.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.2","tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.9.3","@api-zero/core":"0.1.0"},"peerDependencies":{"zod":"^3.0.0 || ^4.0.0","@api-zero/core":">=0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/zod_0.1.0_1787621524435_0.009377184028530383","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@api-zero/zod","version":"0.1.1","keywords":["api-zero","zod","validation","schema","typescript","http","client"],"license":"MIT","_id":"@api-zero/zod@0.1.1","maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"homepage":"https://api-zero.vercel.app","bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"dist":{"shasum":"2548220aeafa2ab8698cc8b73d2357e3731e71a9","tarball":"https://registry.npmjs.org/@api-zero/zod/-/zod-0.1.1.tgz","fileCount":9,"integrity":"sha512-0UYa44pa0V7m7KdwiwKPlz9UwHUledmWGsK/ulVNhVtbuZSbOtxw0QH1ZSc8qwaJVBy4wIvTgcbtOox7uPksHA==","signatures":[{"sig":"MEUCIQCJM1FGAxC3pfS65BaELfuwQGWBm2TYGI4lYIanJstNAQIgZ+tWHyK9DOIKsMAy5UqqClCZG/xM/acxKnXXoy8ucv0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-zero%2fzod@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56407},"main":"./dist/index.cjs","type":"module","_from":"file:api-zero-zod-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","lint":"biome check .","test":"vitest run","build":"tsup","format":"biome format --write ."},"_npmUser":{"name":"gorkadev","email":"dev@gorkadev.com"},"_resolved":"/tmp/380994d8083ea15d9dcc0e372782d0aa/api-zero-zod-0.1.1.tgz","_integrity":"sha512-0UYa44pa0V7m7KdwiwKPlz9UwHUledmWGsK/ulVNhVtbuZSbOtxw0QH1ZSc8qwaJVBy4wIvTgcbtOox7uPksHA==","repository":{"url":"git+https://github.com/api-zero/api-zero.git","type":"git","directory":"packages/zod"},"_npmVersion":"11.17.0","description":"Zod runtime contracts and schema validation adapters for api-zero.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.2","tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.9.3","@api-zero/core":"0.1.1"},"peerDependencies":{"zod":"^3.0.0 || ^4.0.0","@api-zero/core":">=0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/zod_0.1.1_1787771963696_0.9186696338957312","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@api-zero/zod","version":"0.1.2","keywords":["api-zero","zod","validation","schema","typescript","http","client"],"license":"MIT","_id":"@api-zero/zod@0.1.2","maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"homepage":"https://api-zero.vercel.app","bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"dist":{"shasum":"b5ddf54d7ac7c6043031fb501e48cb705892e6cd","tarball":"https://registry.npmjs.org/@api-zero/zod/-/zod-0.1.2.tgz","fileCount":9,"integrity":"sha512-kaDYkvpCTKc4N+aw3zcy3lBLLxYlQvOEYY71OylQdKCzkuiBW0pkzn7RAFNaQPN7VHXP9qg5ZoIhrPB2YdxmmA==","signatures":[{"sig":"MEUCIQDgUhcR6WLM0yP7yhpWmpUxhM9rFjjQUJXWmH9DcNmhUwIgOu9dzZunKBVHwR6dq9o1wMwku8F0i6LyQUTBwHTYwqs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-zero%2fzod@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56407},"main":"./dist/index.cjs","type":"module","_from":"file:api-zero-zod-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","lint":"biome check .","test":"vitest run","build":"tsup","format":"biome format --write ."},"_npmUser":{"name":"gorkadev","email":"dev@gorkadev.com"},"_resolved":"/tmp/a6050a39921b1ba6264de03297bfd248/api-zero-zod-0.1.2.tgz","_integrity":"sha512-kaDYkvpCTKc4N+aw3zcy3lBLLxYlQvOEYY71OylQdKCzkuiBW0pkzn7RAFNaQPN7VHXP9qg5ZoIhrPB2YdxmmA==","repository":{"url":"git+https://github.com/api-zero/api-zero.git","type":"git","directory":"packages/zod"},"_npmVersion":"11.17.0","description":"Zod runtime contracts and schema validation adapters for api-zero.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.2","tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.9.3","@api-zero/core":"0.1.2"},"peerDependencies":{"zod":"^3.0.0 || ^4.0.0","@api-zero/core":">=0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/zod_0.1.2_1787772563673_0.368052975390889","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@api-zero/zod","version":"0.1.3","keywords":["api-zero","zod","validation","schema","typescript","http","client"],"license":"MIT","_id":"@api-zero/zod@0.1.3","maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"homepage":"https://api-zero.vercel.app","bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"dist":{"shasum":"9378a131235030a42dec4c02e9ddf86508ba0b89","tarball":"https://registry.npmjs.org/@api-zero/zod/-/zod-0.1.3.tgz","fileCount":9,"integrity":"sha512-dwYGUWf/+/WY1zQyAx27/fr7HUjeCb5RiZt81eRrRBvi78v68/E5We6RjsRutxL7WGafkvQpnWQENi26xkMSMQ==","signatures":[{"sig":"MEUCIDDW5ceGpWoOBU0LDlNMfdBvgcUgPZuffTF2WqbNT7b+AiEA0Xtg5d9NP29qdHd7n6BCLvqL5ZiUjZnEqEO3imLxmVA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-zero%2fzod@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56295},"main":"./dist/index.cjs","type":"module","_from":"file:api-zero-zod-0.1.3.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","lint":"biome check .","test":"vitest run","build":"tsup","format":"biome format --write ."},"_npmUser":{"name":"gorkadev","email":"dev@gorkadev.com"},"_resolved":"/tmp/0aa10f7b110290071308f812137582f3/api-zero-zod-0.1.3.tgz","_integrity":"sha512-dwYGUWf/+/WY1zQyAx27/fr7HUjeCb5RiZt81eRrRBvi78v68/E5We6RjsRutxL7WGafkvQpnWQENi26xkMSMQ==","repository":{"url":"git+https://github.com/api-zero/api-zero.git","type":"git","directory":"packages/zod"},"_npmVersion":"11.17.0","description":"Zod runtime contracts and schema validation adapters for api-zero.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.2","tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.9.3","@api-zero/core":"0.1.3"},"peerDependencies":{"zod":"^3.0.0 || ^4.0.0","@api-zero/core":">=0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/zod_0.1.3_1787773901151_0.09562699837763589","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@api-zero/zod","version":"0.1.4","keywords":["api-zero","zod","validation","schema","typescript","http","client"],"license":"MIT","_id":"@api-zero/zod@0.1.4","maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"homepage":"https://api-zero.vercel.app","bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"dist":{"shasum":"87d84ffa0b27fc3e78d7977682105257449d0862","tarball":"https://registry.npmjs.org/@api-zero/zod/-/zod-0.1.4.tgz","fileCount":9,"integrity":"sha512-6Cc/LxWEHpQeS2XdJW4R5ugSUZ6ryuNcddrlLzaCr8djHuvFqAofQi7ywqV5YBC+/VJZRjvQOY0aQp0MQ320ig==","signatures":[{"sig":"MEUCIH6L1Ev+CA+X1kz8/geZ27ytCFYZDLWQn4N5rRshqNaWAiEAx6uhwlw9yprLj7BnY+OnBSR2b78NgVG2/fb3INv0W0A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-zero%2fzod@0.1.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":56295},"main":"./dist/index.cjs","type":"module","_from":"file:api-zero-zod-0.1.4.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","lint":"biome check .","test":"vitest run","build":"tsup","format":"biome format --write ."},"_npmUser":{"name":"gorkadev","email":"dev@gorkadev.com"},"_resolved":"/tmp/e870548bd66deda73fff6a224dc5bcf0/api-zero-zod-0.1.4.tgz","_integrity":"sha512-6Cc/LxWEHpQeS2XdJW4R5ugSUZ6ryuNcddrlLzaCr8djHuvFqAofQi7ywqV5YBC+/VJZRjvQOY0aQp0MQ320ig==","repository":{"url":"git+https://github.com/api-zero/api-zero.git","type":"git","directory":"packages/zod"},"_npmVersion":"11.17.0","description":"Zod runtime contracts and schema validation adapters for api-zero.","directories":{},"sideEffects":false,"_nodeVersion":"24.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.24.2","tsup":"^8.0.0","vitest":"^1.0.0","typescript":"^5.9.3","@api-zero/core":"0.1.4"},"peerDependencies":{"zod":"^3.0.0 || ^4.0.0","@api-zero/core":">=0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/zod_0.1.4_1787792131590_0.5250638319457208","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@api-zero/zod","version":"0.1.5","description":"Zod runtime contracts and schema validation adapters for api-zero.","type":"module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/api-zero/api-zero.git","directory":"packages/zod"},"homepage":"https://api-zero.vercel.app","bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"keywords":["api-zero","zod","validation","schema","typescript","http","client"],"sideEffects":false,"engines":{"node":">=22"},"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"}},"peerDependencies":{"@api-zero/core":">=0.0.1","zod":"^3.0.0 || ^4.0.0"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.9.3","vitest":"^1.0.0","zod":"^3.24.2","@api-zero/core":"0.1.5"},"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","lint":"biome check .","format":"biome format --write ."},"_id":"@api-zero/zod@0.1.5","_integrity":"sha512-qo0k2VAdWWSaWlJkudjyuvM7OaGSVYktgejjuYWswCnUt4BRphBOBV2cWdJj6SoYyix3Qc9XvwgrcAk32OlpdQ==","_resolved":"/tmp/1cf9cface44890f1ece7b6543666e9fa/api-zero-zod-0.1.5.tgz","_from":"file:api-zero-zod-0.1.5.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-qo0k2VAdWWSaWlJkudjyuvM7OaGSVYktgejjuYWswCnUt4BRphBOBV2cWdJj6SoYyix3Qc9XvwgrcAk32OlpdQ==","shasum":"7a5a7cbe8dc3439eefe5132a2b2a93e00f4183c2","tarball":"https://registry.npmjs.org/@api-zero/zod/-/zod-0.1.5.tgz","fileCount":9,"unpackedSize":57913,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@api-zero%2fzod@0.1.5","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFvd5q4rbINrvnSzHCP4AEyzCs0kGqkytkHME9hC2xR9AiBuqXK8ExdTSO0oouFkOkcwHOVcvE9DvGyQgse7H5XO7Q=="}]},"_npmUser":{"name":"gorkadev","email":"dev@gorkadev.com"},"directories":{},"maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zod_0.1.5_1787793180670_0.2012199924392324"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-25T01:32:04.285Z","modified":"2026-08-27T01:13:01.158Z","0.1.0":"2026-08-25T01:32:04.571Z","0.1.1":"2026-08-26T19:19:23.861Z","0.1.2":"2026-08-26T19:29:23.827Z","0.1.3":"2026-08-26T19:51:41.324Z","0.1.4":"2026-08-27T00:55:31.742Z","0.1.5":"2026-08-27T01:13:00.815Z"},"bugs":{"url":"https://github.com/api-zero/api-zero/issues"},"license":"MIT","homepage":"https://api-zero.vercel.app","keywords":["api-zero","zod","validation","schema","typescript","http","client"],"repository":{"type":"git","url":"git+https://github.com/api-zero/api-zero.git","directory":"packages/zod"},"description":"Zod runtime contracts and schema validation adapters for api-zero.","maintainers":[{"name":"gorkadev","email":"dev@gorkadev.com"}],"readme":"# @api-zero/zod\n\nZod runtime contracts and schema validation adapters for `api-zero`.\n\n## Installation\n\n```bash\nnpm install @api-zero/zod @api-zero/core zod\n# or\npnpm add @api-zero/zod @api-zero/core zod\n```\n\n## Features\n\n- 🎯 **Full Type Inference**: Automatically infers TypeScript types using `z.infer<typeof schema>`.\n- ⚡️ **Zero Bloat in Core**: Keep `@api-zero/core` ultralight and install `@api-zero/zod` only when schema validation is desired.\n- 🛡️ **Fail-Fast Outbound Validation**: `zodBody()` validates payloads *before* sending them across the network.\n- 🔄 **Automatic Transforms & Coercion**: Fully supports Zod transforms (`.transform()`, `z.coerce`).\n- 🚨 **Structured Errors**: `ZodValidationError` extends `ApiError` with `.issues`, `.flatten()`, and `.format()`.\n\n## Usage\n\n### 1. `zodResponse` (Inferred Return Types)\n\n```typescript\nimport { createClient } from \"@api-zero/core\";\nimport { zodResponse } from \"@api-zero/zod\";\nimport { z } from \"zod\";\n\nconst UserSchema = z.object({\n  id: z.number(),\n  name: z.string(),\n  email: z.string().email(),\n  createdAt: z.string().transform((iso) => new Date(iso)),\n});\n\nconst client = createClient({ baseURL: \"https://api.example.com\" });\n\n// user is automatically typed as { id: number; name: string; email: string; createdAt: Date }\nconst user = await client.get(\"/users/1\", zodResponse(UserSchema));\n```\n\n### 2. `zodBody` (Fail-Fast Outbound Validation)\n\n```typescript\nimport { zodBody } from \"@api-zero/zod\";\n\nconst CreateUserSchema = z.object({\n  name: z.string().min(2),\n  email: z.string().email(),\n});\n\n// Throws ZodValidationError locally without making a network request if body is invalid\nconst newUser = await client.post(\n  \"/users\",\n  { name: \"A\", email: \"invalid\" },\n  zodBody(CreateUserSchema),\n);\n```\n\n### 3. `withZod` / `createZodClient` (Fluent Client)\n\n```typescript\nimport { createZodClient } from \"@api-zero/zod\";\n\nconst api = createZodClient({ baseURL: \"https://api.example.com\" });\n\n// Direct typed verbs\nconst user = await api.get(\"/users/1\", UserSchema);\nconst created = await api.post(\n  \"/users\",\n  { name: \"Alice\", email: \"alice@example.com\" },\n  { response: UserSchema, body: CreateUserSchema },\n);\n```\n\n### 4. Error Handling with `ZodValidationError`\n\n```typescript\nimport { ZodValidationError } from \"@api-zero/zod\";\n\ntry {\n  await api.get(\"/users/1\", UserSchema);\n} catch (error) {\n  if (error instanceof ZodValidationError) {\n    console.error(\"Target:\", error.target); // 'response' | 'body'\n    console.error(\"Issues:\", error.issues);\n    console.error(\"Field errors:\", error.flatten().fieldErrors);\n  }\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}