{"_id":"prisma-soft-delete-middleware","_rev":"8-c98754aa7320300f0baedec4b9234709","name":"prisma-soft-delete-middleware","dist-tags":{"latest":"1.3.1"},"versions":{"1.0.0":{"name":"prisma-soft-delete-middleware","version":"1.0.0","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^3.0.0"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^4.8.1","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"94ba103ecb8a3a2f2d812a3675b48bcd602d82ca","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.0.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-OC33dCiIyfTXqMh5JW09v8OugmJRZbDwSmlpSCkwmBR9xTbBW4qMa7AagQ1z9nHl8PWZft3kuOVmGPG+d0SD+g==","shasum":"7303c31d9931e234d5195080f2399d9ec5aaa02b","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.0.0.tgz","fileCount":27,"unpackedSize":76379,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCs6tA+nnNn5lRbYimPaktUwiUxV1W05hry4BclMDzCxQIgTY1XtgZXgFzEddqXMleArmaFS+SN/ZP57vZHM3gO7VA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJJTUACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrnJQ/+MKPB7M5n8FU+KnKSDP4GN366N2iKAx4PPb/PopNDxYe1hS8N\r\nIJfsdzSjDQ/dMH1ZtyLgCnhP4OHhr2Vhs5gt9e/JE2auSgCywrzW1B53HKgO\r\nnwcxgb//f1TjOJ0D/C5NNXYl96Jp4YTLOcpAT5FjbX8XXWgOKSEbyPeoiNPp\r\nAP5W7hIbyVK1iQr/Tc/srAD4V2HikjdhvfPxDg0PYqB66IwiXACGEjFy5RSf\r\ngS3o8FfjLAejTGPaqbCR00ie2htDdobu9oQ+CXXeggb6KwAey00prl2FeOcd\r\n2L2Bn2TwA1BAK1BZSB6ah5eZTCmYrDnC3VbBX9pIWgou62CtWYWV+yKG7wlD\r\nbiCttu3P0c4M7pj/2DE9VsXrQEmiNWlxOEHulU6IotthygGY4UAchKa/RcG4\r\nOBZ6HwPdKbu8FBmyjvXgOobg4Iad1zx2zZI61R+mNHzwjDnQdUEP2db9n11u\r\nZe/uEb5v+0t5D9EEFoPmD8Bhh0OaRcHVpUGZ0G3GmHC4DoeVQ+9LQ3n6Y473\r\nagBgmRo9ibsAOsGA4l+ANdfbqiOK5FycrZf1eoZ5lXZikEdafoqdgEpWyFHp\r\n6cpOEM7v/yS24kk6zZiwxMLGuoCxbKXboNZDMnWnuUWJDYUD/xE7s7f//Q1K\r\ndJwxsNmQRRANltOGRwhqEP5unpKIAY36JtQ=\r\n=tRmK\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.0.0_1680118996145_0.07656703796063602"},"_hasShrinkwrap":false},"1.0.1":{"name":"prisma-soft-delete-middleware","version":"1.0.1","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^3.0.0"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^4.8.1","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"82561f6ec41329feb8ea44c0e5613ab5ac12adeb","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.0.1","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-/qyu1+HXdNkuwiwL7/m2oHgaYOyXxlsAN68O7G2H7eoV+/Hhljim6zv4fY7FJc0A4h+vkMfrJFx/Zf3cbU4LJw==","shasum":"fba514f6c0cc0e8161721f2fa8862835b1e05001","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.0.1.tgz","fileCount":27,"unpackedSize":79582,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID8nBO/PT0GSB3lyjHzsJ7S8kKBDRMWwiMDakx3G0oAlAiAWnRHnfMnPkqVxxNeps7wcMuk00d1tT0WEwG/22C2agA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkPtZOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo3ag/+JtBEAbgXIX8FEr9yG7nCYub1y/UDXGsNQKXVoyHozgjDdNRJ\r\n+JpgRRrDNPwuNAbiw/BUzvap1o+OHj2C2TqHVsA6NyxXRdD6k2yaMKEhvqm8\r\nR/Q2dBlOF1/aBFiVx4JGn/VrLJIaOs1LZJI24PQUPH/2vdlT8uK0E2ectBMs\r\nOQD1wxkyaaMgFpOKXEbmflyIj4OeBgNd6J1GpFsiXuDYoh/8HnZJ9nIfAVTW\r\nNt8MTxDeT8UzamwlTVLP6KJrERLhETH8c8Ym6rXkQk3NvQ2r7MctkflKS09+\r\nY6/Qcz1yVw4cPK9UFpGxVQUA2fFDa6RkUGNG+Nzyq9x662R8zaAtxxPl78WV\r\nHDCS7mfwV0iZfRvGis8QK8pIHCdQ5jYZXD76xnBZHJ2cQVOzh7YTiD1NFyoU\r\nTLE+HD7KME1o1Djtfb1duCYFlRCMHS85b9HSB2sFKxtVWOopGkGJozPUA1LT\r\ngtnKxW+JkCOm6xKHTKwuj1F+9ZGfba9qa7bvdtQv85MBs1t0h5SKh71MMLjd\r\nWZMrLmOZZX6FTD4mfEjvExlUvX0RLtDfARSXIyGP0jgg04hxjKdlNzoLNmVO\r\nvSeDWB4hrg0IFPUPY195vZO4Fwb2CPJ6mYHxA1KlQ/6RV15oS6lv/BAPA/Oq\r\nY1QsJGVWmVHyZ7LBvoA5Uzo61Jad87YN1yg=\r\n=/dpy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.0.1_1681839694104_0.06689760414544854"},"_hasShrinkwrap":false},"1.1.0":{"name":"prisma-soft-delete-middleware","version":"1.1.0","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^3.0.3"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^4.8.1","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"35f2bc75b3b1af8ee44e93447410da258ab1a9fd","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.1.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-3F60tu0gSqlbRxq0YY2zMFafiJUcnvKv1lmHMybSIBlP87/UebWtgrEEZOfs63uVXhXvBvlFYT4/eRL38bdWbg==","shasum":"3c41d5e4837a67dc0b8abf2d055943e8dddfb707","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.1.0.tgz","fileCount":27,"unpackedSize":81529,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDYXRnXuLHq4vUXPo02TIVT2G2+AGQEvht2XmdIz+ceIwIhANdCieUYXyN1u1eum4gkc+HD8XkN6MRgpfYY6XaeVtJF"}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.1.0_1685129807512_0.29275339844243686"},"_hasShrinkwrap":false},"1.1.1":{"name":"prisma-soft-delete-middleware","version":"1.1.1","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^3.0.3"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^4.8.1","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"d7e41a160bbcbbf3bd1942c96d88979cc8c1498a","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.1.1","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-2zW7cLhzwMLt9VW8BDRJ1yTOtEAxxf98lUauZWxNEojMDYOLb68RsFtl4ba6OF2vnje9a3CO0hl76acpt6bMIA==","shasum":"2c31dfd4f7d80ed148ea84cf80cbc46e60018061","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.1.1.tgz","fileCount":27,"unpackedSize":83971,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDj3Wc30V4Pe81VDys1JfPo4LsY9/SohzQmnUvIvPKh+gIgIp4XTa6gpYvV9nXc+S0QHY9RTc86qO61dk6/dEoh6m8="}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.1.1_1685922024954_0.9712993948601409"},"_hasShrinkwrap":false},"1.1.2":{"name":"prisma-soft-delete-middleware","version":"1.1.2","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^3.0.3"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^4.8.1","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"8fc3652f350042c59f064fe4150b349840ffba0b","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.1.2","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-y/AwQnOQSD+GE5raFdkOcP0QQ9QPzIbNGXnn45CtIdoPlo4XaIwLzozMO/34TPvRC8qmwjYhRtyGIOID/sD5Yg==","shasum":"b60191e8127d162dd29dac5b52fd215f3798a7d1","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.1.2.tgz","fileCount":27,"unpackedSize":87652,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9bcEjMQoTMiaKemAAn5Q71+HGT5VHohvTUdYGRKtvPwIgAw2d8Mq5RF5aTAyoShCgQo1TLCcVcmn5AAyzqPpc5oA="}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.1.2_1685925338577_0.25150569408770385"},"_hasShrinkwrap":false},"1.2.0":{"name":"prisma-soft-delete-middleware","version":"1.2.0","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^3.0.3"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^5.4.2","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^5.4.2","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"c5b143efb82304c3eef88a5f41b17b6bd7e2c31a","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.2.0","_nodeVersion":"16.20.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-BfiHNbdSMjmFXb4xJ/+j2JyZoS3zolUW3PKYaI75NH6uzjQWIoI4mOZ7RHlID5to5jf0RZ/8owSO7g4zC2H5sA==","shasum":"99c738a9f5c6f7f61c631d7b92c76d89f1f6cd13","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.2.0.tgz","fileCount":27,"unpackedSize":93134,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzqOw8ynXSCKgK7iyy/fFWBgST0g0TPyk3bLiKLifMmAIgLdYVhuBtqeIN8eQvpBT/TEn47zbg0SGlcOI+c0XVIpw="}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.2.0_1698592208628_0.11408680050745335"},"_hasShrinkwrap":false},"1.2.1":{"name":"prisma-soft-delete-middleware","version":"1.2.1","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^4.0.0"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^5.4.2","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^5.4.2","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"76f54be9262fd90dc00a4086ba26d158a97f6e0a","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.2.1","_nodeVersion":"16.20.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-RjOUcS5bR9U794lU/sLdFXqJdK4/TAsdvZ5Q9qQQpfs5jhp3v9Bw0NLnTLUvBr/R8a5oQqwfTVr6hD/09x5DkA==","shasum":"c7b30fab06674c40e28853973515b2950a7b1006","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.2.1.tgz","fileCount":27,"unpackedSize":93119,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFwrri6vtyqtpo+DFaO0dMRcsaTxBz32q142sytlG6dxAiBUfuGkggbiusgBdhKPobP5hsNhjG8rdHQzAO0DwVAUbQ=="}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.2.1_1705164968960_0.42616877163648237"},"_hasShrinkwrap":false},"1.3.0":{"name":"prisma-soft-delete-middleware","version":"1.3.0","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^4.0.0"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^5.4.2","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^5.4.2","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"d1f62bcc88e496ee5974bf961999b2bef76d70ba","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.3.0","_nodeVersion":"16.20.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-6CXtUWvclBYMQCknDtqeyMXJm88qje5spTmI6eOtoTkTAf297jdE3oACQIKRYyOh358qXsuJq4dX+a/gAEn4EQ==","shasum":"a279604a89790d880101e59c731c8ead86d3ce19","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.3.0.tgz","fileCount":27,"unpackedSize":94400,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCE58cIkEjwM3zGQ0IBwT72o1g8Svm8Uax+s8fllLtvyQIgCpcPpwMsMDU+vN6CsPatWpundl9Zt1ai6UzTVbYwx6g="}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.3.0_1705171263593_0.42923728321137067"},"_hasShrinkwrap":false},"1.3.1":{"name":"prisma-soft-delete-middleware","version":"1.3.1","description":"Prisma middleware for soft deleting records","main":"dist/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"npm-run-all build:cjs build:esm","build:cjs":"tsc -p tsconfig.build.json","build:esm":"tsc -p tsconfig.esm.json","test:unit":"prisma generate && jest --config jest.config.unit.js","test:e2e":"./test/scripts/run-with-postgres.sh jest --config jest.config.e2e.js --runInBand","test":"./test/scripts/run-with-postgres.sh jest --runInBand","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck,test","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"prisma-nested-middleware":"^4.0.0"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^5.4.2","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.192","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","lodash":"^4.17.21","npm-run-all":"^4.1.5","prisma":"^5.4.2","semantic-release":"^17.0.2","ts-jest":"^29.0.3","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"release":{"branches":["main",{"name":"prerelease","prerelease":true},{"name":"next","prerelease":true}]},"publishConfig":{"access":"public"},"gitHead":"04ddd6ce28b771a27069ec9bf59d99bb552425a3","bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","_id":"prisma-soft-delete-middleware@1.3.1","_nodeVersion":"16.20.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-oQ2Ba8wb23ho6PqMXkOSTQTXNKouLmZuILYDHrnKk1Ui3cGIXuj9zNWyJkoaTcWHznsiAaoP1Oy8ytDhwQNQqA==","shasum":"32e7361c37418856835247a0cdcf8fb15e31ad50","tarball":"https://registry.npmjs.org/prisma-soft-delete-middleware/-/prisma-soft-delete-middleware-1.3.1.tgz","fileCount":27,"unpackedSize":94794,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHOdrU0XohZjQLhODQUd5NMZefYzOe0yzQnkFOyvIFzwIhAN5qBeN6qhs+2Vq4C7Q/uUVJho3BXdx9ZOSzthM8cKlu"}]},"_npmUser":{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"},"directories":{},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/prisma-soft-delete-middleware_1.3.1_1705312249625_0.4689172703999551"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-29T19:43:16.065Z","1.0.0":"2023-03-29T19:43:16.311Z","modified":"2024-01-15T09:50:49.922Z","1.0.1":"2023-04-18T17:41:34.277Z","1.1.0":"2023-05-26T19:36:47.706Z","1.1.1":"2023-06-04T23:40:25.139Z","1.1.2":"2023-06-05T00:35:38.818Z","1.2.0":"2023-10-29T15:10:09.001Z","1.2.1":"2024-01-13T16:56:09.131Z","1.3.0":"2024-01-13T18:41:03.743Z","1.3.1":"2024-01-15T09:50:49.771Z"},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"description":"Prisma middleware for soft deleting records","homepage":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware#readme","keywords":["prisma","client","middleware"],"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-soft-delete-middleware.git"},"author":{"name":"Olivier Wilkinson"},"bugs":{"url":"https://github.com/olivierwilkinson/prisma-soft-delete-middleware/issues"},"license":"Apache-2.0","readme":"<div align=\"center\">\n<h1>Prisma Soft Delete Middleware</h1>\n\n<p>Prisma middleware for soft deleting records.</p>\n\n<p>\n  Soft deleting records is a common pattern in many applications. This library provides middleware for Prisma that\n  allows you to soft delete records and exclude them from queries. It handles deleting records through relations and\n  excluding soft deleted records when including relations or referencing them in where objects. It does this by using\n  the <a href=\"https://github.com/olivierwilkinson/prisma-nested-middleware\">prisma-nested-middleware</a> library to\n  handle nested relations.\n</p>\n\n</div>\n\n<hr />\n\n[![Build Status][build-badge]][build]\n[![version][version-badge]][package]\n[![MIT License][license-badge]][license]\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![PRs Welcome][prs-badge]][prs]\n\n## Table of Contents\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n\n- [Prisma Middleware Deprecation](#prisma-middleware-deprecation)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Middleware Setup](#middleware-setup)\n  - [Prisma Schema Setup](#prisma-schema-setup)\n- [Behaviour](#behaviour)\n  - [Deleting Records](#deleting-records)\n    - [Deleting a Single Record](#deleting-a-single-record)\n    - [Deleting Multiple Records](#deleting-multiple-records)\n    - [Deleting Through a relationship](#deleting-through-a-relationship)\n    - [Hard Deletes](#hard-deletes)\n  - [Excluding Soft Deleted Records](#excluding-soft-deleted-records)\n    - [Excluding Soft Deleted Records in a `findFirst` Operation](#excluding-soft-deleted-records-in-a-findfirst-operation)\n    - [Excluding Soft Deleted Records in a `findMany` Operation](#excluding-soft-deleted-records-in-a-findmany-operation)\n    - [Excluding Soft Deleted Records in a `findUnique` Operation](#excluding-soft-deleted-records-in-a-findunique-operation)\n  - [Updating Records](#updating-records)\n    - [Explicitly Updating Many Soft Deleted Records](#explicitly-updating-many-soft-deleted-records)\n  - [Where objects](#where-objects)\n    - [Explicitly Querying Soft Deleted Records](#explicitly-querying-soft-deleted-records)\n  - [Including or Selecting Soft Deleted Records](#including-or-selecting-soft-deleted-records)\n    - [Including or Selecting toMany Relations](#including-or-selecting-tomany-relations)\n    - [Including or Selecting toOne Relations](#including-or-selecting-toone-relations)\n    - [Explicitly Including Soft Deleted Records in toMany Relations](#explicitly-including-soft-deleted-records-in-tomany-relations)\n- [LICENSE](#license)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n## Prisma Middleware Deprecation\n\nSince Prisma middleware is deprecated this library has been ported to an extension:\n[prisma-extension-soft-delete](https://github.com/olivierwilkinson/prisma-extension-soft-delete).\n\nWhile middleware is still supported this library will continue to be maintained, however it is recommended to use the\nextension instead.\n\n## Installation\n\nThis module is distributed via [npm][npm] and should be installed as one of your\nproject's dependencies:\n\n```\nnpm install --save prisma-soft-delete-middleware\n```\n\n`@prisma/client` is a peer dependency of this library, so you will need to\ninstall it if you haven't already:\n\n```\nnpm install --save @prisma/client\n```\n\n## Usage\n\n### Middleware Setup\n\nTo add soft delete functionality to your Prisma client create the middleware using the `createSoftDeleteMiddleware`\nfunction and `$use` it with your client.\n\nThe `createSoftDeleteMiddleware` function takes a config object where you can define the models you want to use soft\ndelete with.\n\n```typescript\nimport { PrismaClient } from \"@prisma/client\";\n\nconst client = new PrismaClient();\n\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: true,\n    },\n  })\n);\n```\n\nBy default the middleware will use a `deleted` field of type `Boolean` on the model. If you want to use a custom field\nname or value you can pass a config object for the model. For example to use a `deletedAt` field where the value is null\nby default and a `DateTime` when the record is deleted you would pass the following:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: {\n        field: \"deletedAt\",\n        createValue: (deleted) => {\n          if (deleted) return new Date();\n          return null;\n        },\n      },\n    },\n  })\n);\n```\n\nThe `field` property is the name of the field to use for soft delete, and the `createValue` property is a function that\ntakes a deleted argument and returns the value for whether the record is soft deleted or not.\n\nThe `createValue` method must return a deterministic value if the record is not deleted. This is because the middleware\nuses the value returned by `createValue` to modify the `where` object in the query, or to manually filter the results\nwhen including or selecting a toOne relationship. If the value for the field can have multiple values when the record is\nnot deleted then this filtering will fail. Examples for good values to use when the `deleted` arg in `createValue` is\nfalse are `false`, `null`, `0` or `Date(0)`.\n\nIt is possible to setup soft delete for multiple models at once by passing a config for each model in the `models`\nobject:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: true,\n      Post: true,\n    },\n  })\n);\n```\n\nTo modify the default field and type for all models you can pass a `defaultConfig`:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: true,\n      Post: true,\n    },\n    defaultConfig: {\n      field: \"deletedAt\",\n      createValue: (deleted) => {\n        if (deleted) return new Date();\n        return null;\n      },\n    },\n  })\n);\n```\n\nWhen using the default config you can also override the default config for a specific model by passing a config object\nfor that model:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: true,\n      Post: {\n        field: \"deleted\",\n        createValue: Boolean,\n      },\n    },\n    defaultConfig: {\n      field: \"deletedAt\",\n      createValue: (deleted) => {\n        if (deleted) return new Date();\n        return null;\n      },\n    },\n  })\n);\n```\n\nThe config object also has a `allowToOneUpdates` option that can be used to allow updates to toOne relationships through\nnested updates. By default this is set to `false` and will throw an error if you try to update a toOne relationship\nthrough a nested update. If you want to allow this you can set `allowToOneUpdates` to `true`:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: {\n        field: \"deleted\",\n        createValue: Boolean,\n        allowToOneUpdates: true,\n      },\n    },\n  })\n);\n```\n\nFor more information for why updating through toOne relationship is disabled by default see the\n[Updating Records](#updating-records) section.\n\nSimilarly to `allowToOneUpdates` there is an `allowCompoundUniqueIndexWhere` option that can be used to allow using\nwhere objects with compound unique index fields when using `findUnique` queries. By default this is set to `false` and\nwill throw an error if you try to use a where with compound unique index fields. If you want to allow this you can set\n`allowCompoundUniqueIndexWhere` to `true`:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      Comment: {\n        field: \"deleted\",\n        createValue: Boolean,\n        allowCompoundUniqueIndexWhere: true,\n      },\n    },\n  })\n);\n```\n\nFor more information for why updating through toOne relationship is disabled by default see the\n[Excluding Soft Deleted Records in a `findUnique` Operation](#excluding-soft-deleted-records-in-a-findunique-operation) section.\n\nTo allow to one updates or compound unique index fields globally you can use the `defaultConfig` to do so:\n\n```typescript\nclient.$use(\n  createSoftDeleteMiddleware({\n    models: {\n      User: true,\n      Comment: true,\n    },\n    defaultConfig: {\n      field: \"deleted\",\n      createValue: Boolean,\n      allowToOneUpdates: true,\n      allowCompoundUniqueIndexWhere: true,\n    },\n  })\n);\n```\n\n### Prisma Schema Setup\n\nThe Prisma schema must be updated to include the soft delete field for each model you want to use soft delete with.\n\nFor models configured to use the default field and type you must add the `deleted` field to your Prisma schema manually.\nUsing the Comment model configured in [Middleware Setup](#middleware-setup) you would need add the following to the\nPrisma schema:\n\n```prisma\nmodel Comment {\n  deleted   Boolean  @default(false)\n  [other fields]\n}\n```\n\nIf the Comment model was configured to use a `deletedAt` field where the value is null by default and a `DateTime` when\nthe record is deleted you would need to add the following to your Prisma schema:\n\n```prisma\nmodel Comment {\n  deletedAt DateTime?\n  [other fields]\n}\n```\n\nIf the Comment model was configured to use a `deletedAt` field where the value is `Date(0)` by default and a `Date()`\nwhen the record is deleted you would need to add the following to your Prisma schema:\n\n```prisma\nmodel Comment {\n  deletedAt DateTime @default(dbgenerated(\"to_timestamp(0)\"))\n  // Note that the example above is for PostgreSQL, you will need to use the appropriate default function for your db.\n  [other fields]\n}\n```\n\nModels configured to use soft delete that are related to other models through a toOne relationship must have this\nrelationship defined as optional. This is because the middleware will exclude soft deleted records when the relationship\nis included or selected. If the relationship is not optional the types for the relation will be incorrect and you may\nget runtime errors.\n\nFor example if you have an `author` relationship on the Comment model and the User model is configured to use soft\ndelete you would need to change the relationship to be optional:\n\n```prisma\nmodel Comment {\n  authorId Int?\n  author   User?   @relation(fields: [authorId], references: [id])\n  [other fields]\n}\n```\n\n`@unique` fields on models that are configured to use soft deletes may cause problems due to the records not actually\nbeing deleted. If a record is soft deleted and then a new record is created with the same value for the unique field,\nthe new record will not be created.\n\n## Behaviour\n\nThe main behaviour of the middleware is to replace delete operations with update operations that set the soft delete\nfield to the deleted value.\n\nThe middleware also prevents accidentally fetching or updating soft deleted records by excluding soft deleted records\nfrom find queries, includes, selects and bulk updates. The middleware does allow explicit queries for soft deleted\nrecords and allows updates through unique fields such is it's id. The reason it allows updates through unique fields is\nbecause soft deleted records can only be fetched explicitly so updates through a unique fields should be intentional.\n\n### Deleting Records\n\nWhen deleting a record using the `delete` or `deleteMany` operations the middleware will change the operation to an\n`update` operation and set the soft delete field to be the deleted value defined in the config for that model.\n\nFor example if the Comment model was configured to use the default `deleted` field of type `Boolean` the middleware\nwould change the `delete` operation to an `update` operation and set the `deleted` field to `true`.\n\n#### Deleting a Single Record\n\nWhen deleting a single record using the `delete` operation:\n\n```typescript\nawait client.comment.delete({\n  where: {\n    id: 1,\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.comment.update({\n  where: {\n    id: 1,\n  },\n  data: {\n    deleted: true,\n  },\n});\n```\n\n#### Deleting Multiple Records\n\nWhen deleting multiple records using the `deleteMany` operation:\n\n```typescript\nawait client.comment.deleteMany({\n  where: {\n    id: {\n      in: [1, 2, 3],\n    },\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.comment.updateMany({\n  where: {\n    id: {\n      in: [1, 2, 3],\n    },\n  },\n  data: {\n    deleted: true,\n  },\n});\n```\n\n#### Deleting Through a relationship\n\nWhen using a nested delete through a relationship the middleware will change the nested delete operation to an update\noperation:\n\n```typescript\nawait client.post.update({\n  where: {\n    id: 1,\n  },\n  data: {\n    comments: {\n      delete: {\n        where: {\n          id: 2,\n        },\n      },\n    },\n    author: {\n      delete: true,\n    },\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.post.update({\n  where: {\n    id: 1,\n  },\n  data: {\n    comments: {\n      update: {\n        where: {\n          id: 2,\n        },\n        data: {\n          deleted: true,\n        },\n      },\n    },\n    author: {\n      update: {\n        deleted: true,\n      },\n    },\n  },\n});\n```\n\nThe same behaviour applies when using a nested `deleteMany` with a toMany relationship.\n\n#### Hard Deletes\n\nHard deletes are not currently supported by this middleware, when the `extendedWhereUnique` feature is supported\nit will be possible to explicitly hard delete a soft deleted record. In the meantime you can use the `executeRaw`\noperation to perform hard deletes.\n\n### Excluding Soft Deleted Records\n\nWhen using the `findUnique`, `findFirst` and `findMany` operations the middleware will modify the `where` object passed\nto exclude soft deleted records. It does this by adding an additional condition to the `where` object that excludes\nrecords where the soft delete field is set to the deleted value defined in the config for that model.\n\n#### Excluding Soft Deleted Records in a `findFirst` Operation\n\nWhen using a `findFirst` operation the middleware will modify the `where` object to exclude soft deleted records, so for:\n\n```typescript\nawait client.comment.findFirst({\n  where: {\n    id: 1,\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.comment.findFirst({\n  where: {\n    id: 1,\n    deleted: false,\n  },\n});\n```\n\n#### Excluding Soft Deleted Records in a `findMany` Operation\n\nWhen using a `findMany` operation the middleware will modify the `where` object to exclude soft deleted records, so for:\n\n```typescript\nawait client.comment.findMany({\n  where: {\n    id: 1,\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.comment.findMany({\n  where: {\n    id: 1,\n    deleted: false,\n  },\n});\n```\n\n#### Excluding Soft Deleted Records in a `findUnique` Operation\n\nWhen using a `findUnique` operation the middleware will change the query to use `findFirst` so that it can modify the\n`where` object to exclude soft deleted records, so for:\n\n```typescript\nawait client.comment.findUnique({\n  where: {\n    id: 1,\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.comment.findFirst({\n  where: {\n    id: 1,\n    deleted: false,\n  },\n});\n```\n\nWhen querying using a compound unique index in the where object the middleware will throw an error by default. This\nis because it is not possible to use these types of where object with `findFirst` and it is not possible to exclude\nsoft-deleted records when using `findUnique`. For example take the following query:\n\n```typescript\nawait client.user.findUnique({\n  where: {\n    name_email: {\n      name: \"foo\",\n      email: \"bar\",\n    },\n  },\n});\n```\n\nSince the compound unique index `@@unique([name, email])` is being queried through the `name_email` field of the where\nobject the middleware will throw to avoid accidentally returning a soft deleted record.\n\nIt is possible to override this behaviour by setting `allowCompoundUniqueIndexWhere` to `true` in the model config.\n\n### Updating Records\n\nUpdating records is split into three categories, updating a single record using a root operation, updating a single\nrecord through a relation and updating multiple records either through a root operation or a relation.\n\nWhen updating a single record using a root operation such as `update` or `upsert` the middleware will not modify the\noperation. This is because unless explicitly queried for soft deleted records should not be returned from queries,\nso if these operations are updating a soft deleted record it should be intentional.\n\nWhen updating a single record through a relation the middleware will throw an error by default. This is because it is\nnot possible to filter out soft deleted records for nested toOne relations. For example take the following query:\n\n```typescript\nawait client.post.update({\n  where: {\n    id: 1,\n  },\n  data: {\n    author: {\n      update: {\n        name: \"foo\",\n      },\n    },\n  },\n});\n```\n\nSince the `author` field is a toOne relation it does not support a where object. This means that if the `author` field\nis a soft deleted record it will be updated accidentally.\n\nIt is possible to override this behaviour by setting `allowToOneUpdates` to `true` in the middleware config.\n\nWhen updating multiple records using `updateMany` the middleware will modify the `where` object passed to exclude soft\ndeleted records. For example take the following query:\n\n```typescript\nawait client.comment.updateMany({\n  where: {\n    id: 1,\n  },\n  data: {\n    content: \"foo\",\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.comment.updateMany({\n  where: {\n    id: 1,\n    deleted: false,\n  },\n  data: {\n    content: \"foo\",\n  },\n});\n```\n\nThis also works when a toMany relation is updated:\n\n```typescript\nawait client.post.update({\n  where: {\n    id: 1,\n  },\n  data: {\n    comments: {\n      updateMany: {\n        where: {\n          id: 1,\n        },\n        data: {\n          content: \"foo\",\n        },\n      },\n    },\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.post.update({\n  where: {\n    id: 1,\n  },\n  data: {\n    comments: {\n      updateMany: {\n        where: {\n          id: 1,\n          deleted: false,\n        },\n        data: {\n          content: \"foo\",\n        },\n      },\n    },\n  },\n});\n```\n\n#### Explicitly Updating Many Soft Deleted Records\n\nWhen using the `updateMany` operation it is possible to explicitly update many soft deleted records by setting the\ndeleted field to the deleted value defined in the config for that model. An example that would update soft deleted\nrecords would be:\n\n```typescript\nawait client.comment.updateMany({\n  where: {\n    content: \"foo\",\n    deleted: true,\n  },\n  data: {\n    content: \"bar\",\n  },\n});\n```\n\n### Where objects\n\nWhen using a `where` query it is possible to reference models configured to use soft deletes. In this case the\nmiddleware will modify the `where` object to exclude soft deleted records from the query, so for:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    comments: {\n      some: {\n        content: \"foo\",\n      },\n    },\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    comments: {\n      some: {\n        content: \"foo\",\n        deleted: false,\n      },\n    },\n  },\n});\n```\n\nThis also works when the where object includes logical operators:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    OR: [\n      {\n        comments: {\n          some: {\n            author: {\n              name: \"Jack\",\n            },\n          },\n        },\n      },\n      {\n        comments: {\n          none: {\n            author: {\n              name: \"Jill\",\n            },\n          },\n        },\n      },\n    ],\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    OR: [\n      {\n        comments: {\n          some: {\n            deleted: false,\n            author: {\n              name: \"Jack\",\n            },\n          },\n        },\n      },\n      {\n        comments: {\n          none: {\n            deleted: false,\n            author: {\n              name: \"Jill\",\n            },\n          },\n        },\n      },\n    ],\n  },\n});\n```\n\nWhen using the `every` modifier the middleware will modify the `where` object to exclude soft deleted records from the\nquery in a different way, so for:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    comments: {\n      every: {\n        content: \"foo\",\n      },\n    },\n  },\n});\n```\n\nThe middleware would change the operation to:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    comments: {\n      every: {\n        OR: [{ deleted: { not: false } }, { content: \"foo\" }],\n      },\n    },\n  },\n});\n```\n\nThis is because if the same logic that is used for `some` and `none` were to be used with `every` then the query would\nfail for cases where there are deleted models.\n\nThe deleted case uses the `not` operator to ensure that the query works for custom fields and types. For example if the\nfield was configured to be `deletedAt` where the type is `DateTime` when deleted and `null` when not deleted then the\nquery would be:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n    comments: {\n      every: {\n        OR: [{ deletedAt: { not: null } }, { content: \"foo\" }],\n      },\n    },\n  },\n});\n```\n\n#### Explicitly Querying Soft Deleted Records\n\nIt is possible to explicitly query soft deleted records by setting the configured field in the `where` object. For\nexample the following will include deleted records in the results:\n\n```typescript\nawait client.comment.findMany({\n  where: {\n    deleted: true,\n  },\n});\n```\n\nIt is also possible to explicitly query soft deleted records through relationships in the `where` object. For example\nthe following will also not be modified:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    comments: {\n      some: {\n        deleted: true,\n      },\n    },\n  },\n});\n```\n\n### Including or Selecting Soft Deleted Records\n\nWhen using `include` or `select` the middleware will modify the `include` and `select` objects passed to exclude soft\ndeleted records.\n\n#### Including or Selecting toMany Relations\n\nWhen using `include` or `select` on a toMany relationship the middleware will modify the where object to exclude soft\ndeleted records from the query, so for:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n  },\n  include: {\n    comments: true,\n  },\n});\n```\n\nIf the Comment model was configured to be soft deleted the middleware would modify the `include` action where object to\nexclude soft deleted records, so the query would be:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n  },\n  include: {\n    comments: {\n      where: {\n        deleted: false,\n      },\n    },\n  },\n});\n```\n\nThe same applies for `select`:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n  },\n  select: {\n    comments: true,\n  },\n});\n```\n\nThis also works for nested includes and selects:\n\n```typescript\nawait client.user.findMany({\n  where: {\n    id: 1,\n  },\n  include: {\n    posts: {\n      select: {\n        comments: {\n          where: {\n            content: \"foo\",\n          },\n        },\n      },\n    },\n  },\n});\n```\n\nThe middleware would modify the query to:\n\n```typescript\nawait client.user.findMany({\n  where: {\n    id: 1,\n  },\n  include: {\n    posts: {\n      select: {\n        comments: {\n          where: {\n            deleted: false,\n            content: \"foo\",\n          },\n        },\n      },\n    },\n  },\n});\n```\n\n#### Including or Selecting toOne Relations\n\nRecords included through a toOne relation are also excluded, however there is no way to explicitly include them. For\nexample the following query:\n\n```typescript\nawait client.post.findFirst({\n  where: {\n    id: 1,\n  },\n  include: {\n    author: true,\n  },\n});\n```\n\nThe middleware would not modify the query since toOne relations do not support where clauses. Instead the middleware\nwill manually filter results based on the configured deleted field.\n\nSo if the author of the Post was soft deleted the middleware would filter the results and remove the author from the\nresults:\n\n```typescript\n{\n  id: 1,\n  title: \"foo\",\n  author: null\n}\n```\n\nWhen selecting specific fields on a toOne relation the middleware will manually add the configured deleted field to the\nselect object, filter the results and finally strip the deleted field from the results before returning them.\n\nFor example the following query would behave that way:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n  },\n  select: {\n    author: {\n      select: {\n        name: true,\n      },\n    },\n  },\n});\n```\n\n#### Explicitly Including Soft Deleted Records in toMany Relations\n\nIt is possible to explicitly include soft deleted records in toMany relations by adding the configured deleted field to\nthe `where` object. For example the following will include deleted records in the results:\n\n```typescript\nawait client.post.findMany({\n  where: {\n    id: 1,\n  },\n  include: {\n    comments: {\n      where: {\n        deleted: true,\n      },\n    },\n  },\n});\n```\n\n## LICENSE\n\nApache 2.0\n\n[npm]: https://www.npmjs.com/\n[node]: https://nodejs.org\n[build-badge]: https://github.com/olivierwilkinson/prisma-soft-delete-middleware/workflows/prisma-soft-delete-middleware/badge.svg\n[build]: https://github.com/olivierwilkinson/prisma-soft-delete-middleware/actions?query=branch%3Amaster+workflow%3Aprisma-soft-delete-middleware\n[version-badge]: https://img.shields.io/npm/v/prisma-soft-delete-middleware.svg?style=flat-square\n[package]: https://www.npmjs.com/package/prisma-soft-delete-middleware\n[downloads-badge]: https://img.shields.io/npm/dm/prisma-soft-delete-middleware.svg?style=flat-square\n[npmtrends]: http://www.npmtrends.com/prisma-soft-delete-middleware\n[license-badge]: https://img.shields.io/npm/l/prisma-soft-delete-middleware.svg?style=flat-square\n[license]: https://github.com/olivierwilkinson/prisma-soft-delete-middleware/blob/main/LICENSE\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[prs]: http://makeapullrequest.com\n[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square\n[coc]: https://github.com/olivierwilkinson/prisma-soft-delete-middleware/blob/main/other/CODE_OF_CONDUCT.md\n","readmeFilename":"README.md"}