{"_id":"@ekhein/prisma-extension-random","_rev":"6-6eddebf3fd685e3a40d1680a89579bc1","name":"@ekhein/prisma-extension-random","dist-tags":{"latest":"1.0.2"},"versions":{"0.2.2":{"name":"@ekhein/prisma-extension-random","version":"0.2.2","keywords":["prisma","@prisma/client","extension","random"],"license":"MIT","_id":"@ekhein/prisma-extension-random@0.2.2","maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"homepage":"https://github.com/nkeil/prisma-extension-random#readme","bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"dist":{"shasum":"cadf111b7887237c1a3a4e15fe4b5a99d2f376d0","tarball":"https://registry.npmjs.org/@ekhein/prisma-extension-random/-/prisma-extension-random-0.2.2.tgz","fileCount":7,"integrity":"sha512-IZUWrPbKdDVAdhui6smD/bUKbsqhdu113afLQSSrpdA18RXEUt243w9JTobx1D8bqeMVwGFiFCDpY4Id0N8d6g==","signatures":[{"sig":"MEUCIQChvf1DepF1ucxAReeBhZWfZgpumiryM/cXcn1ySdIDeQIgE6Y/WvZZ0P6qEhpwb9x+EmrIXGcEQ/+GaCUBh3bU3Ks=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8087},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","prisma":{"seed":"tsx example/seed.ts"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"557e1f783a0dcf942a81f1c59d75d873357b67d1","scripts":{"dev":"tsx example/index.ts","test":"npx prisma db push && vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"pnpm build --watch src","format":"prettier --write \"**/*.ts\" \"**/*.md\" --ignore-unknown --no-error-on-unmatched-pattern","type-check":"tsc --noEmit"},"_npmUser":{"name":"ekhein","email":"1373657363@qq.com"},"repository":{"url":"git+https://github.com/nkeil/prisma-extension-random.git","type":"git"},"_npmVersion":"10.8.2","description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","directories":{},"sideEffects":false,"_nodeVersion":"18.20.7","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","tsup":"^8.0.2","prisma":"^5.11.0","vitest":"^1.4.0","prettier":"^3.2.5","typescript":"5.4.3","@types/node":"^20.12.2","@prisma/client":"^5.11.0"},"peerDependencies":{"@prisma/client":"*"},"_npmOperationalInternal":{"tmp":"tmp/prisma-extension-random_0.2.2_1747237992728_0.151592548628946","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@ekhein/prisma-extension-random","version":"0.2.3","keywords":["prisma","@prisma/client","extension","random"],"license":"MIT","_id":"@ekhein/prisma-extension-random@0.2.3","maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"homepage":"https://github.com/nkeil/prisma-extension-random#readme","bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"dist":{"shasum":"c4c30c3ddba90c92e6f3073263028fcaef845e4d","tarball":"https://registry.npmjs.org/@ekhein/prisma-extension-random/-/prisma-extension-random-0.2.3.tgz","fileCount":7,"integrity":"sha512-v41BzkRfm0DxhNpQ2RgORC7fO7LGVnv95deuBeNuZqD/gp/54l5BHdeP4yP9Y7GeU0lCul7PHBdHuK0Px/PWMQ==","signatures":[{"sig":"MEYCIQCYBTnfO3HNTrqncr86PZ9jr8hLJoKa4AZuKyG18GMPRAIhANzEm6cP6Tf4I7x5fw2ffO/l1qttrLUPyHtxlNjthDUl","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7475},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","prisma":{"seed":"tsx example/seed.ts"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"557e1f783a0dcf942a81f1c59d75d873357b67d1","scripts":{"dev":"tsx example/index.ts","test":"npx prisma db push && vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"pnpm build --watch src","format":"prettier --write \"**/*.ts\" \"**/*.md\" --ignore-unknown --no-error-on-unmatched-pattern","type-check":"tsc --noEmit"},"_npmUser":{"name":"ekhein","email":"1373657363@qq.com"},"repository":{"url":"git+https://github.com/nkeil/prisma-extension-random.git","type":"git"},"_npmVersion":"10.8.2","description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","directories":{},"sideEffects":false,"_nodeVersion":"18.20.7","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","tsup":"^8.0.2","prisma":"^5.11.0","vitest":"^1.4.0","prettier":"^3.2.5","typescript":"5.4.3","@types/node":"^20.12.2","@prisma/client":"^5.11.0"},"peerDependencies":{"@prisma/client":"*"},"_npmOperationalInternal":{"tmp":"tmp/prisma-extension-random_0.2.3_1747238233279_0.6210336382880601","host":"s3://npm-registry-packages-npm-production"}},"0.2.5":{"name":"@ekhein/prisma-extension-random","version":"0.2.5","keywords":["prisma","@prisma/client","extension","random"],"license":"MIT","_id":"@ekhein/prisma-extension-random@0.2.5","maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"homepage":"https://github.com/nkeil/prisma-extension-random#readme","bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"dist":{"shasum":"ef6caadb4f7c299e04ad842925d1100e94def8ea","tarball":"https://registry.npmjs.org/@ekhein/prisma-extension-random/-/prisma-extension-random-0.2.5.tgz","fileCount":7,"integrity":"sha512-Tz5hzZBHo1ZLBRquRIP2LKNZ0Y2jy8Wcxpma/L6qBg1mVC/32df8OCfiZ2UbxxVdIiRrYLTacqPF1CHmb1PZ+Q==","signatures":[{"sig":"MEYCIQDktE52mM3LDyhX/jPi42X5EgiOuoo4lO6QxX86SX4nzAIhAKHej4lYYpMETLodE9LlR68XWin8DyUr+kIenBQrxwnc","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7475},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","prisma":{"seed":"tsx example/seed.ts"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"557e1f783a0dcf942a81f1c59d75d873357b67d1","scripts":{"dev":"tsx example/index.ts","test":"npx prisma db push && vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"pnpm build --watch src","format":"prettier --write \"**/*.ts\" \"**/*.md\" --ignore-unknown --no-error-on-unmatched-pattern","type-check":"tsc --noEmit"},"_npmUser":{"name":"ekhein","email":"1373657363@qq.com"},"repository":{"url":"git+https://github.com/nkeil/prisma-extension-random.git","type":"git"},"_npmVersion":"10.8.2","description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","directories":{},"sideEffects":false,"_nodeVersion":"18.20.7","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","tsup":"^8.0.2","prisma":"^5.11.0","vitest":"^1.4.0","prettier":"^3.2.5","typescript":"5.4.3","@types/node":"^20.12.2","@prisma/client":"^5.11.0"},"peerDependencies":{"@prisma/client":"*"},"_npmOperationalInternal":{"tmp":"tmp/prisma-extension-random_0.2.5_1747238394212_0.5893128551574536","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@ekhein/prisma-extension-random","version":"1.0.0","keywords":["prisma","@prisma/client","extension","random"],"license":"MIT","_id":"@ekhein/prisma-extension-random@1.0.0","maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"homepage":"https://github.com/nkeil/prisma-extension-random#readme","bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"dist":{"shasum":"dad65fb51a6c0945146e19eba6630f6ee0e4bd5f","tarball":"https://registry.npmjs.org/@ekhein/prisma-extension-random/-/prisma-extension-random-1.0.0.tgz","fileCount":7,"integrity":"sha512-+f4G1ptKQ+AyJd5XtCyeEngVaaIek95FLxpbdpZ+Nzv0mbghGO7UFDMmJv/9opwUeal7huAPPee+19TIhi7SlA==","signatures":[{"sig":"MEQCIDeLkzbSkebcxC7cpAIrAAK4SCAuEJ4rhgGATHx1LfeFAiAESRp7M4OrFCj9eceXuh0Z19lGAQLaISOiER3OznJpNg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8321},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","prisma":{"seed":"tsx example/seed.ts"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"557e1f783a0dcf942a81f1c59d75d873357b67d1","scripts":{"dev":"tsx example/index.ts","test":"npx prisma db push && vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"pnpm build --watch src","format":"prettier --write \"**/*.ts\" \"**/*.md\" --ignore-unknown --no-error-on-unmatched-pattern","type-check":"tsc --noEmit"},"_npmUser":{"name":"ekhein","email":"1373657363@qq.com"},"repository":{"url":"git+https://github.com/nkeil/prisma-extension-random.git","type":"git"},"_npmVersion":"10.8.2","description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","directories":{},"sideEffects":false,"_nodeVersion":"18.20.7","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","tsup":"^8.0.2","prisma":"^5.11.0","vitest":"^1.4.0","prettier":"^3.2.5","typescript":"5.4.3","@types/node":"^20.12.2","@prisma/client":"^5.11.0"},"peerDependencies":{"@prisma/client":"*"},"_npmOperationalInternal":{"tmp":"tmp/prisma-extension-random_1.0.0_1747238826287_0.8887904847465218","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ekhein/prisma-extension-random","version":"1.0.1","keywords":["prisma","@prisma/client","extension","random"],"license":"MIT","_id":"@ekhein/prisma-extension-random@1.0.1","maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"homepage":"https://github.com/nkeil/prisma-extension-random#readme","bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"dist":{"shasum":"217f37c15fca8b97dda33870eedb23f4ba76a5e4","tarball":"https://registry.npmjs.org/@ekhein/prisma-extension-random/-/prisma-extension-random-1.0.1.tgz","fileCount":7,"integrity":"sha512-OdZpEEbGfU76nTDB4PZf9baluFOPM5g2Xb1uWc6GbxknGxfiQ9yrtGam+iN4HhQcNZtNIIAR9NNyoU8c+DozFA==","signatures":[{"sig":"MEUCIQDWY8LJ4NQu6OdaJsTTxASG05lPt1rp4MscFZASp3S4ewIgbbqZuyitmlxUAgVhvWSQQNOHB/jBNAQLhIDpdMerf9Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8199},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","prisma":{"seed":"tsx example/seed.ts"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"557e1f783a0dcf942a81f1c59d75d873357b67d1","scripts":{"dev":"tsx example/index.ts","test":"npx prisma db push && vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"pnpm build --watch src","format":"prettier --write \"**/*.ts\" \"**/*.md\" --ignore-unknown --no-error-on-unmatched-pattern","type-check":"tsc --noEmit"},"_npmUser":{"name":"ekhein","email":"1373657363@qq.com"},"repository":{"url":"git+https://github.com/nkeil/prisma-extension-random.git","type":"git"},"_npmVersion":"10.8.2","description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","directories":{},"sideEffects":false,"_nodeVersion":"18.20.7","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.7.1","tsup":"^8.0.2","prisma":"^5.11.0","vitest":"^1.4.0","prettier":"^3.2.5","typescript":"5.4.3","@types/node":"^20.12.2","@prisma/client":"^5.11.0"},"peerDependencies":{"@prisma/client":"*"},"_npmOperationalInternal":{"tmp":"tmp/prisma-extension-random_1.0.1_1747239325438_0.2600205240596176","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@ekhein/prisma-extension-random","version":"1.0.2","type":"module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/nkeil/prisma-extension-random.git"},"bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"homepage":"https://github.com/nkeil/prisma-extension-random#readme","keywords":["prisma","@prisma/client","extension","random"],"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"}}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","watch":"pnpm build --watch src","dev":"tsx example/index.ts","test":"npx prisma db push && vitest","format":"prettier --write \"**/*.ts\" \"**/*.md\" --ignore-unknown --no-error-on-unmatched-pattern","type-check":"tsc --noEmit"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^5.11.0","@types/node":"^20.12.2","prettier":"^3.2.5","prisma":"^5.11.0","tsup":"^8.0.2","tsx":"^4.7.1","typescript":"5.4.3","vitest":"^1.4.0"},"prisma":{"seed":"tsx example/seed.ts"},"_id":"@ekhein/prisma-extension-random@1.0.2","gitHead":"557e1f783a0dcf942a81f1c59d75d873357b67d1","description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","_nodeVersion":"18.20.7","_npmVersion":"10.8.2","dist":{"integrity":"sha512-1LVVNnHX7e4dzmqBF5RLaDSTS5UttJFYnzezk7ezVuTe0nKmnUwbAwOTFm7np+2uwrs1EhIyD3n+sd9+oXUHTg==","shasum":"c217487b880ff19f1af177ebb1b6c9f3a3cda14e","tarball":"https://registry.npmjs.org/@ekhein/prisma-extension-random/-/prisma-extension-random-1.0.2.tgz","fileCount":7,"unpackedSize":11063,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA8KzcqxlcZBNE404RTnmAMOsx+7bPCfpIHL1citsQ1IAiAKecmudam6dLNSITxcAewtz/duLG2GyzDZgRpjqgqXug=="}]},"_npmUser":{"name":"ekhein","email":"1373657363@qq.com"},"directories":{},"maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prisma-extension-random_1.0.2_1753360365754_0.13724256810822677"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-14T15:53:12.603Z","modified":"2025-07-24T12:32:46.106Z","0.2.2":"2025-05-14T15:53:12.909Z","0.2.3":"2025-05-14T15:57:13.460Z","0.2.5":"2025-05-14T15:59:54.387Z","1.0.0":"2025-05-14T16:07:06.456Z","1.0.1":"2025-05-14T16:15:25.616Z","1.0.2":"2025-07-24T12:32:45.946Z"},"bugs":{"url":"https://github.com/nkeil/prisma-extension-random/issues"},"license":"MIT","homepage":"https://github.com/nkeil/prisma-extension-random#readme","keywords":["prisma","@prisma/client","extension","random"],"repository":{"type":"git","url":"git+https://github.com/nkeil/prisma-extension-random.git"},"description":"<div align=\"center\">   <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />   <h1>🎲 prisma-extension-random 🎲</h1>   <h3>Let me tell you the definition of insanity...</h3> </div>","maintainers":[{"name":"ekhein","email":"1373657363@qq.com"}],"readme":"<div align=\"center\">\n  <img src=\"logo.svg\" width=\"200px\" align=\"center\" alt=\"zod-redis logo\" />\n  <h1>🎲 prisma-extension-random 🎲</h1>\n  <h3>Let me tell you the definition of insanity...</h3>\n</div>\n\nBored of fetching the same old data from your database over and over again? Tired of subscribing to 3 year old GitHub issue threads waiting for Prisma to add that feature you want? Well I've got just what you need! Spice up your life with `prisma-extension-random`, your one stop shop for all your random query needs. \n\n## Features\n\n- Random row retrieval: easily retrieve a random row from your database table using `findRandom()`.\n- Random multi-row retrieval: use `findManyRandom()` to query for a random subset of a `findMany()` query.\n\n## Installation\n\n```bash\nnpm install prisma-extension-random\nyarn add prisma-extension-random\nbun add prisma-extension-random\npnpm add prisma-extension-random\n```\n\n## Usage\n\n1. Import the extension and add it to your Prisma client:\n\n```typescript\nimport { PrismaClient } from '@prisma/client';\nimport prismaRandom from 'prisma-extension-random';\n\nconst prisma = new PrismaClient().$extends(prismaRandom());\n```\n\n2. Use the `findRandom` method to fetch random rows from your database:\n\n```typescript\n// Find a random post from an author whose firstname starts with \"B\"\nconst post = await prisma.post.findRandom({\n  select: { id: true, title: true },\n  where: { author: { firstName: { startsWith: 'B' } } },\n});\n```\n\n3. Use the `findManyRandom` method to fetch a random subset of rows from a `findMany`-esque query.\n\n```typescript\n// Find 5 random movies with a rating greater than 0.8\nconst movies = await prisma.movie.findManyRandom(5, {\n  select: { id: true, title: true },\n  where: { rating: { gte: 0.8 } },\n});\n```\n\nNote: when using models with a non-standard id field, you must specify the name of that field using `custom_uniqueKey` as below. If not specified, the name is assumed to be \"id\".\n\n```typescript\n// Assuming the User table's `@id` column is called 'email'\nconst users = await prisma.user.findManyRandom(5, {\n  select: { name: true },\n  custom_uniqueKey: 'email',\n});\n```\n\n## Contributing\n\nIssues and pull requests are welcome. I'll review them as soon as possible!\n","readmeFilename":"README.md"}