{"_id":"@alt-stack/client","_rev":"4-7bceb403e4ea3cb20602491ebb82d6af","name":"@alt-stack/client","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.1":{"name":"@alt-stack/client","version":"1.0.1","keywords":[],"author":"","license":"UNLICENSED","_id":"@alt-stack/client@1.0.1","maintainers":[{"name":"aaltieri","email":"anthony@timebyping.com"}],"dist":{"shasum":"e49dcc384e836fa69e3cd1e00fd214a20c37eadf","tarball":"https://registry.npmjs.org/@alt-stack/client/-/client-1.0.1.tgz","fileCount":7,"integrity":"sha512-4xHCtSYDeMlPZAne1eNOBIhKmSmbdXr8YboaWpu6M+m8TuQIHk0P+54lUx64P4W11NDajCWHy7hnStbBXYZ3LA==","signatures":[{"sig":"MEUCIFmDtMjtNvlfgmT+vksU+BsOLt5q3McXwEWWMxa5APyEAiEAqq/oOuagA1ZTH+rTXUu5TWjpRr90ebZIG5lQZ+hfXC0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24189},"main":"./src/index.ts","type":"module","_from":"file:alt-stack-client-1.0.1.tgz","types":"./src/index.ts","exports":{".":{"types":"./src/index.ts","default":"./src/index.ts"}},"scripts":{"test":"vitest","check-types":"tsc --noEmit"},"_npmUser":{"name":"aaltieri","email":"anthony@timebyping.com"},"_resolved":"/tmp/c324b40b2cd2b4bda65f743c35f8803b/alt-stack-client-1.0.1.tgz","_integrity":"sha512-4xHCtSYDeMlPZAne1eNOBIhKmSmbdXr8YboaWpu6M+m8TuQIHk0P+54lUx64P4W11NDajCWHy7hnStbBXYZ3LA==","_npmVersion":"10.8.2","description":"Type-safe API client that integrates with zod-openapi generated Request/Response objects","directories":{},"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"oxlint":"^1.24.0","vitest":"^4.0.3"},"peerDependencies":{"zod":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_1.0.1_1762392279074_0.11589243354472512","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @alt-stack/http-client-core with @alt-stack/http-client-fetch or @alt-stack/http-client-ky."},"1.0.2":{"name":"@alt-stack/client","version":"1.0.2","keywords":[],"author":"","license":"MIT","_id":"@alt-stack/client@1.0.2","maintainers":[{"name":"aaltieri","email":"anthony@timebyping.com"}],"dist":{"shasum":"6e7f2f4bcc24b7cb2372d3e83d3216cc50b804ec","tarball":"https://registry.npmjs.org/@alt-stack/client/-/client-1.0.2.tgz","fileCount":7,"integrity":"sha512-TRxCBxMCZPSem6rLphcz/vOmBxsuTEuhhfo/23lVxXefdUzRwjTkZf5wtGyAPYYYyMfIhxJpT/QOmlNV05wg8w==","signatures":[{"sig":"MEQCICA895rzZnCwVyBVYwTGbHA002BFytPoNDGRCmwVrtFWAiBkpMHHnWYB4ybgNKc1PHBBV7qD/6BLDTbEl3bqJsqZWg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24182},"main":"./src/index.ts","type":"module","_from":"file:alt-stack-client-1.0.2.tgz","types":"./src/index.ts","exports":{".":{"types":"./src/index.ts","default":"./src/index.ts"}},"scripts":{"test":"vitest","check-types":"tsc --noEmit"},"_npmUser":{"name":"aaltieri","email":"anthony@timebyping.com"},"_resolved":"/tmp/4fe19f5e0b83040256ebce8899d6047b/alt-stack-client-1.0.2.tgz","_integrity":"sha512-TRxCBxMCZPSem6rLphcz/vOmBxsuTEuhhfo/23lVxXefdUzRwjTkZf5wtGyAPYYYyMfIhxJpT/QOmlNV05wg8w==","_npmVersion":"10.8.2","description":"Type-safe API client that integrates with zod-openapi generated Request/Response objects","directories":{},"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"oxlint":"^1.24.0","vitest":"^4.0.3"},"peerDependencies":{"zod":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_1.0.2_1762392506848_0.468499950805078","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @alt-stack/http-client-core with @alt-stack/http-client-fetch or @alt-stack/http-client-ky."},"2.0.0":{"name":"@alt-stack/client","version":"2.0.0","keywords":[],"author":"","license":"MIT","_id":"@alt-stack/client@2.0.0","maintainers":[{"name":"aaltieri","email":"anthony@timebyping.com"}],"dist":{"shasum":"977c7b02a0d8c4055874ad2062be3842e8f37812","tarball":"https://registry.npmjs.org/@alt-stack/client/-/client-2.0.0.tgz","fileCount":16,"integrity":"sha512-2TyCIch80bPRCdbq5PGXzcMj/hd87rOsyWKTahjBJqwThUR5FUTGHiUA/PCdIGDj04+18LRTqNWg2KtpJhAQ9g==","signatures":[{"sig":"MEUCIQCdia3QyqsTaRvAF1eNBwa4ef9yOHSoaWhUUnv6M68rOwIgQ6xiVY/bBR0h2bdGNUAXhSpwzu7u4+BtYjZZIuHiXyM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":152759},"main":"./dist/index.cjs","_from":"file:alt-stack-client-2.0.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"test":"vitest","build":"tsup","check-types":"tsc --noEmit"},"_npmUser":{"name":"aaltieri","email":"anthony@timebyping.com"},"_resolved":"/tmp/37206bc3899103a8fdf84a0a9dba22bb/alt-stack-client-2.0.0.tgz","_integrity":"sha512-2TyCIch80bPRCdbq5PGXzcMj/hd87rOsyWKTahjBJqwThUR5FUTGHiUA/PCdIGDj04+18LRTqNWg2KtpJhAQ9g==","_npmVersion":"10.8.2","description":"Type-safe API client that integrates with zod-openapi generated Request/Response objects","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","oxlint":"^1.24.0","vitest":"^4.0.3","typescript":"^5.9.2"},"peerDependencies":{"zod":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/client_2.0.0_1764350252180_0.4296410855096413","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Deprecated: use @alt-stack/http-client-core with @alt-stack/http-client-fetch or @alt-stack/http-client-ky."}},"time":{"created":"2025-11-06T01:24:38.988Z","modified":"2026-07-09T21:50:42.055Z","1.0.1":"2025-11-06T01:24:39.262Z","1.0.2":"2025-11-06T01:28:27.066Z","2.0.0":"2025-11-28T17:17:32.367Z"},"license":"MIT","keywords":[],"description":"Type-safe API client that integrates with zod-openapi generated Request/Response objects","maintainers":[{"name":"aaltieri","email":"anthony@timebyping.com"}],"readme":"# @alt-stack/client\n\nType-safe API client with full TypeScript inference from zod-openapi generated Request/Response schemas.\n\n## Installation\n\n```bash\npnpm add @alt-stack/client zod\n```\n\n## Features\n\n- **Type inference** from Request/Response schemas\n- **Discriminated responses** typed by status code\n- **Automatic validation** of params, query, body, and responses\n- **Retry logic** with exponential backoff\n- **Timeout support**\n\n## Usage\n\n```typescript\nimport { createApiClient } from \"@alt-stack/client\";\nimport { Request, Response } from \"./generated-types.js\";\n\nconst client = createApiClient({\n  baseUrl: \"http://localhost:3000\",\n  Request,\n  Response,\n  headers: { Authorization: \"Bearer token\" },\n});\n\nconst result = await client.get(\"/users/{id}\", {\n  params: { id: \"123\" },\n});\n\nif (result.success) {\n  console.log(result.body); // Typed response body\n} else {\n  console.error(result.error); // Typed error\n}\n```\n\n## Request Options\n\n| Option | Type | Description |\n|--------|------|-------------|\n| `params` | `object` | Path parameters |\n| `query` | `object` | Query parameters |\n| `body` | `object` | Request body (POST, PUT, PATCH) |\n| `headers` | `object` | Additional headers |\n| `timeout` | `number` | Timeout in milliseconds |\n| `retries` | `number` | Number of retry attempts |\n| `shouldRetry` | `function` | Custom retry logic |\n\n## Custom Retry Logic\n\n```typescript\nawait client.get(\"/users\", {\n  retries: 3,\n  shouldRetry: ({ attempt, error, response }) => {\n    if (response?.status >= 500) return true; // Server errors\n    if (response?.status === 429) return true; // Rate limiting\n    if (error) return true; // Network errors\n    return false;\n  },\n});\n```\n\n## Error Classes\n\n| Class | Description |\n|-------|-------------|\n| `ValidationError` | Schema validation failed |\n| `TimeoutError` | Request exceeded timeout |\n| `UnexpectedApiClientError` | Network error or unexpected response |\n| `ApiClientError` | Base class for all errors |\n\n","readmeFilename":"README.md"}