{"_id":"@0xtender/next-api-action-client","name":"@0xtender/next-api-action-client","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@0xtender/next-api-action-client","private":false,"version":"0.0.1","description":"Inspired by [next-safe-action](\"https://next-safe-action.dev/\")","main":"dist/index.js","scripts":{},"keywords":[],"author":"","license":"ISC","devDependencies":{"next":">=13","tsup":"^8.3.5","typescript":"^5.7.2","zod":"^3.24.1"},"peerDependencies":{"next":">=13","zod":"^3.24.1"},"_id":"@0xtender/next-api-action-client@0.0.1","gitHead":"4650980875ed422af7158faefac121b44b3eba03","types":"./dist/index.d.ts","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-xy3Bw7w9f42fTcu1ah85a3y/QSvGkHrRtwDHaL4ZKbizs9L05VFvOxu492sqO2oPU821S7waw055LyOVOUjFBA==","shasum":"5b70f705c983e07633735f84d12647e88e2e4d53","tarball":"https://registry.npmjs.org/@0xtender/next-api-action-client/-/next-api-action-client-0.0.1.tgz","fileCount":5,"unpackedSize":20016,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE6nQPzuOVKKMjcay/DEjWa5LilCZGtoH/hz3nC9iqhHAiEApuAGHUdehFryPNmxJ4VxP3YtZ/jalo/vsVYkFWDJiwQ="}]},"_npmUser":{"name":"aniketbiprojit","email":"aniket_chowdhury@hotmail.com"},"directories":{},"maintainers":[{"name":"aniketbiprojit","email":"aniket_chowdhury@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/next-api-action-client_0.0.1_1735538795234_0.7601353540795517"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-30T06:06:35.232Z","0.0.1":"2024-12-30T06:06:35.401Z","modified":"2024-12-30T06:06:36.028Z"},"maintainers":[{"name":"aniketbiprojit","email":"aniket_chowdhury@hotmail.com"}],"description":"Inspired by [next-safe-action](\"https://next-safe-action.dev/\")","keywords":[],"license":"ISC","readme":"## Replace complex routes with client.\n\nInspired by [next-safe-action](\"https://next-safe-action.dev/\")\n\nView [playground.ts](\"./playground.ts\")\n\n```ts\nexport const GET = (req: NextRequest) =>\n  client({ req })\n    .method(\"GET\")\n    .query(\n      z.object({\n        page: z.coerce.number().default(0),\n        pageSize: z.coerce.number().default(25),\n      }),\n    )\n    .action(({ ctx, parsedQuery }) => {\n      console.log(ctx.user, parsedQuery);\n      return NextResponse.json({ success: true });\n    });\n\nexport const POST = (req: NextRequest) =>\n  authenticatedClient({ req })\n    .method(\"POST\")\n    .json(\n      z.object({\n        title: z.string(),\n      }),\n    )\n    .action(({ ctx, parsedQuery, parsedInput }) => {\n      console.log(ctx, parsedQuery, parsedInput);\n      return NextResponse.json({ success: true });\n    });\n```\n\n","readmeFilename":"README.md"}