{"_id":"@drzl/generator-fast-check","_rev":"2-c179c0f639e0d453f9f45e0344283004","name":"@drzl/generator-fast-check","dist-tags":{"latest":"0.2.1"},"versions":{"0.2.0":{"name":"@drzl/generator-fast-check","version":"0.2.0","keywords":["drizzle","drizzle-orm","fast-check","property-testing","codegen","constraints"],"license":"Apache-2.0","_id":"@drzl/generator-fast-check@0.2.0","maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"dist":{"shasum":"9a57b55acd87ed14620e8334e95c1ae5bf044006","tarball":"https://registry.npmjs.org/@drzl/generator-fast-check/-/generator-fast-check-0.2.0.tgz","fileCount":7,"integrity":"sha512-NsHViubnOgLrnJfUzqDhyFL9nJ2u1rpXQ6EO2Ji49dmlWC7CkLkLYMkBo/3ziahUzJHtH+FyMgm1JzPJAYko8Q==","signatures":[{"sig":"MEYCIQC8IQaQpQQOfcKAwdenIo9GTvcJiwcBY/ogy5FT9SiF1AIhAJjwUHP3vJsMJadfZwGPPOAWpEXJrZWIGBsmquNlFdJf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":50553},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18.17.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"funding":{"url":"https://github.com/sponsors/omar-dulaimi","type":"github"},"private":false,"scripts":{"lint":"eslint . --ext .ts","test":"vitest run --testTimeout=20000","build":"tsup src/index.ts --dts --format esm,cjs --external prettier --clean"},"_npmUser":{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"},"repository":{"url":"https://github.com/use-drzl/drzl","type":"git","directory":"packages/generator-fast-check"},"description":"Generate fast-check arbitraries from a Drizzle schema, bounded by every CHECK the analyzer parsed, so a property test only draws rows the database would accept.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"@drzl/analyzer":"^1.21.5","@drzl/validation-core":"^3.22.6"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","fast-check":"^4.9.0","typescript":"^5.9.3"},"_npmOperationalInternal":{"tmp":"tmp/generator-fast-check_0.2.0_1786499491849_0.1672896786664686","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@drzl/generator-fast-check","version":"0.2.1","private":false,"license":"Apache-2.0","description":"Generate fast-check arbitraries from a Drizzle schema, bounded by every CHECK the analyzer parsed, so a property test only draws rows the database would accept.","keywords":["drizzle","drizzle-orm","fast-check","property-testing","codegen","constraints"],"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"dependencies":{"@drzl/analyzer":"^1.22.0","@drzl/validation-core":"^3.23.0"},"devDependencies":{"fast-check":"^4.9.0","tsup":"^8.5.1","typescript":"^5.9.3"},"engines":{"node":">=18.17.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/","provenance":true},"repository":{"type":"git","url":"https://github.com/use-drzl/drzl","directory":"packages/generator-fast-check"},"funding":{"type":"github","url":"https://github.com/sponsors/omar-dulaimi"},"scripts":{"build":"tsup src/index.ts --dts --format esm,cjs --external prettier --clean","lint":"eslint . --ext .ts","test":"vitest run --testTimeout=20000"},"_nodeVersion":"24.18.0","_id":"@drzl/generator-fast-check@0.2.1","dist":{"integrity":"sha512-6uacftZWyXD+BnSbum1Yk3abDkf0TvdHJSYa61R29czhsNYavQSefBr+cXOhCStBj1C2eZMhEhI7gckbANOyuQ==","shasum":"f3958dd448974d5a331b01c198ce30fa71c209e3","tarball":"https://registry.npmjs.org/@drzl/generator-fast-check/-/generator-fast-check-0.2.1.tgz","fileCount":7,"unpackedSize":50568,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@drzl%2fgenerator-fast-check@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEoJUGdlRj9gvB4Dh6gMZZqUw/glZsSb+OSbaTkNkr74AiEA+vUWDv+541/4PUtDZiQLws2NiDosL0lx0F/LPDrW5aY="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:386637c9-cdd1-45a9-b2fb-21f0a9e5a7b6"}},"directories":{},"maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/generator-fast-check_0.2.1_1786697004488_0.46412052781505153"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-12T01:51:31.670Z","modified":"2026-08-14T08:43:24.996Z","0.2.0":"2026-08-12T01:51:32.055Z","0.2.1":"2026-08-14T08:43:24.627Z"},"license":"Apache-2.0","keywords":["drizzle","drizzle-orm","fast-check","property-testing","codegen","constraints"],"repository":{"type":"git","url":"https://github.com/use-drzl/drzl","directory":"packages/generator-fast-check"},"description":"Generate fast-check arbitraries from a Drizzle schema, bounded by every CHECK the analyzer parsed, so a property test only draws rows the database would accept.","maintainers":[{"name":"omar-dulaimi","email":"o.m.dulaimi@gmail.com"}],"readme":"# @drzl/generator-fast-check\n\nGenerate [fast-check](https://fast-check.dev) arbitraries from a Drizzle schema, one per table,\nbounded by every `CHECK` the analyzer parsed.\n\n## The bug a hand-written arbitrary has\n\nNothing in `fc.integer()` knows the column carries `CHECK (quantity BETWEEN 1 AND 999)`, so a property\ntest spends most of its runs on rows the database would refuse.\n\nWorse, and this is why the generator is worth having: **explicit bounds do not exclude NaN**. Measured\nagainst `fast-check@4.9.0`, `fc.double({ min: 0, max: 100 })` produced 86 NaN in 30,000 samples, about\none in 350, with nothing outside the range. So a bounded float column gets a NaN every few hundred\nruns, the database refuses it, and the failure lands in CI on a case that does not reproduce locally.\nNothing about writing the bounds suggests `noNaN` is also needed.\n\nAlways passing `noNaN: true` is the obvious correction and is also wrong, because some columns really\ndo store NaN. DRZL answers this per column, measured against real servers, and the emitted arbitrary\nfollows it: a column that cannot hold a NaN never gets one, and a column that can, still does.\n\n## Install\n\n```bash\nnpm install -D @drzl/generator-fast-check\nnpm install -D fast-check\n```\n\n```ts\n// drzl.config.ts\nexport default {\n  schema: './src/db/schema.ts',\n  generators: [{ kind: 'fast-check', path: 'src/arbitraries' }],\n};\n```\n\n```ts\nimport fc from 'fast-check';\nimport { productsArbitrary } from './arbitraries';\n\nfc.assert(fc.property(productsArbitrary, (row) => applyDiscount(row).price > row.cost));\n```\n\n## Why a map rather than a filter\n\nA row comparison like `price > cost` cannot be a per-column arbitrary. `fc.pre` or `.filter` is the\nshorter way to express it and makes shrinking worse: a filter shrinks towards values the constraint\nexcludes and then discards them, so the counterexample drifts away from anything the database would\naccept. The emitted code draws both independently and orders the pair with a `.map`, which is total,\nso every shrink step is still a legal row.\n\n## One deliberate difference from the seed generator\n\nAn unconstrained column stays unconstrained here. `@drzl/generator-seed` narrows an unbounded numeric\nto a readable window because a fixture is there to be looked at; a property test wants the awkward\nvalues, so only what the column genuinely cannot hold is excluded.\n\nFull documentation: https://use-drzl.github.io/drzl/generators/fast-check\n\n## Licence\n\nApache-2.0. Generated output is yours under your own project's licence.\n","readmeFilename":""}