{"_id":"prisma-nested-middleware","_rev":"14-7d7975f86efa0e78b52cb5afcb4bbe6a","name":"prisma-nested-middleware","dist-tags":{"latest":"4.0.0","next":"1.1.1"},"versions":{"1.0.0":{"name":"prisma-nested-middleware","version":"1.0.0","description":"Util for calling Prisma middleware for nested write operations","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","lint":"eslint ./src  --fix --ext .ts","typecheck":"npm run build:cjs -- --noEmit && npm run build:esm -- --noEmit","validate":"kcd-scripts validate lint,typecheck","semantic-release":"semantic-release","doctoc":"doctoc ."},"keywords":["prisma","client","middleware"],"author":{"name":"Olivier Wilkinson"},"license":"Apache-2.0","dependencies":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","eslint":"^7.6.0","kcd-scripts":"^5.0.0","npm-run-all":"^4.1.5","semantic-release":"^17.0.2","ts-node":"^9.1.1","typescript":"^4.1.3"},"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"ed49d7884680e6c066ec73b8d14b4a0d3fe82c8c","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@1.0.0","_nodeVersion":"14.20.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-WrreXPaDICufM6U1DHj9pBAt/Sp1PoYHE8Ho92hkK+/R9sE+lq03Z1/8v39EPUC92mmCaJ9dtHh+fQEshJ3Yng==","shasum":"5cc61add5a787b21982fc5b494c75d59169d0f25","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-1.0.0.tgz","fileCount":7,"unpackedSize":31925,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGWm1kcAlXsDkhY+VEGjQ9M5rN8QH5zG8EwaSEro1OY/AiA8KWGYpWK4xlLY0yapFjYuICGTo/Gz5hdgUAR3/ss+NQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjKt/NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrmphAApFqU4SPY85E+ciifHQR2RhBjONJU+GLeoKc70yw5wkDHOqXN\r\n43b4Bma+AXHrvjYBXUbuZk9rukCmFhHNb5LCOuJq//XPtv9fThfA5MwGwc6T\r\nOy2UJ328uBQxPQ8OZUhkM/OjlxSTeq3EB3mWmmkVRMqqsVva5ceNHEPrsiVA\r\neVd0oP5U+a7KgeWDfKEriKVQKoJflH1XhQZ365w0slFqB+7+qFbP4GDtKJlu\r\nBVSWM9YBVA59w6sBypsxC7rpGfKiTkthlqP8EKMSrhQHHv+H8eP1ytzyVLt9\r\nisH7N04Nz8s/oyxCisdOzVbQtpcwRpmqMjJDcZmY0pjkhQIP8FUiJ4NcExGu\r\nv6oHI0RHbioWXIhMu5t6q24CAXqfqNUZjqgHfq+q8YtcLMbFHPS7CpgfjKkj\r\nbEGli0RBtDZYasJGEle4AIqmXbebO5xGhyi10Em8U9+yhQEmkqgrUVZMt6J+\r\nndyWpC94qFGdVwTRD7fN/i831xBnUxC/+XZpzXaeW7rgjDqt0ltK2yKlHPXh\r\nAL66mbpUDcVljLglq9HZLSQmcKmRRm96+N8Bfoi5VPQ2pju8mFeR2oFMD4Ow\r\nNgmQWCBkns6vyjmRn1beuh2z2NtkAQmkleuQG0r6BoOlE1EvVvW2bcOPTlXg\r\nwE0fvDhZjqbTi09veUfcsnTKzmMqgQvTDiQ=\r\n=f44J\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-nested-middleware_1.0.0_1663754188800_0.7272851404147953"},"_hasShrinkwrap":false},"1.0.1":{"name":"prisma-nested-middleware","version":"1.0.1","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"753bf7b6344e4ed3bb781dda9fb7a3f26b0f283b","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@1.0.1","_nodeVersion":"14.21.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-Rt1rfrWiV7O3bINgIzWPxv9uMNJtHYo4GGmqVM1xl6A4a+7z+NKNM2qMk+dOPVhrlBXIXHpjMfevxji3YBgkDg==","shasum":"98da56f96660c02bcbf9644385cf77ad1b4ba7a8","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-1.0.1.tgz","fileCount":7,"unpackedSize":37305,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCr3kICp1k+R1oN9etJ3cgP3KggHdQEccu5eVw6HDPr/AIgaz1h1sMAJfVL7hKNYlBQLqdxBcRE/kUu4R6M4e2msPA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvF2OACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphLw//UBIoGYdgEdWn1qRs2ytm9tJXC0R0DykQzmNHUHXa3nzb6g5P\r\nWttMw+mzH1zO+h67t9QQv5Di2ag6EhYY6Ur7iVVGwcAkwYayG7pAnx8o+q+T\r\nlWqLIrlMIYTdxJ1DJNj2f8Hel8SbvVCXC7lxKcljsVlS5QeiXDlGxEwQYZOZ\r\nx8sD8C6nVG/o+lp2GoHfw9x4Nka2ugoPFgelu3BzcIcuDy/TtCqksniTTC3l\r\n1UNhHfhi93ToXJ6IGYU/oX64Bji3bA/WYVztSJXX2+JtWni44hqEcDzhfhx5\r\nU3FpLeKpqTxdiQHS7/z5uGWtRIP8Pu6tdiiTwYLqJ4c1d/W3L0YQC7hCL6pR\r\nJfyX48k3X6F8X6/AKBbnitfO2R5RJvwP9uqB8S8wmZG/S2F06f42NaFUBF5+\r\n5GDkCJW6pM5yODMSWfK7fUyss3Rg1IK65NtbW4Mgyh/Szk/Vtu5CAWNMMHWL\r\n+iUcC1nxY8djlIXXFD8V6MWrtwc4tPyasbLfdNaOFUC+lB1mhIEP5HK2dmaO\r\n48QajwWohWEirCEE2ojzh6+r4BnofNGyuSWfrs250adFYkGGi/0uWve5u+DJ\r\nY2HS2j6NE9PLaO/oWwyCu11GhBZAH0U7yeceV995P5OFW7+TPt/34Dds7DCH\r\nM3U7uHOVVkZQ5opYF9aO0F2lakkxi81Vu30=\r\n=dSHl\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-nested-middleware_1.0.1_1673289101778_0.9545415421929602"},"_hasShrinkwrap":false},"1.1.0":{"name":"prisma-nested-middleware","version":"1.1.0","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"f32ba66598fe6e6f1bf240605d715b0f2eedd08c","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@1.1.0","_nodeVersion":"14.21.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-FEsWvvF8sGxSGrHXC6+jLZEJOrMXUsPbGtpQ1OK7IGrFUxvNAIuS3aDsbDswlQLpzX+dWStifLS+xTyjjZU04Q==","shasum":"779cb956a458e12d2aadcb227bfd822c94d18fc5","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-1.1.0.tgz","fileCount":7,"unpackedSize":40136,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXSewwDXUCNnojK0ozEnY+Be3oPwys19DEe2dr5HbVogIgLxozXmht2KXHR/pIvkj83XKjQNbUToivi0IHIn4jg7I="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvb/GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoyBQ//dPoL7QZnNkOEvwKfujvl83jSN7V65xy2oOGeTI9VS4oOgtDp\r\ntN2BeWa9KP4hC2Vxs/ejSpR7sCgIgc2EBXp968gxCTfnrb+ag3nk8+a5zYwK\r\n8INK5Yr0s29anzb879croZ7BdWSFRvQGJTO7izlgkRSMl9bqatp5JXVqPB5J\r\nc47OLaEWjReGJWJXsd9TN7F7iTU+iEcvnPsFmAbrt2i6AhC9dW0lqBQLYCx9\r\nDVoDUqVlJm0DnL/mRDTJI2zBcsUNxhthA7iY1849geLQbzXdA4N4V8WyiIfz\r\n6oaVaGklNCMDZ5Q9747Xr2JSHOazmOnm1mCFR4xfQOMfadl4yq4cul5vEezW\r\nJqVcuKVIElCDaGIymvMqUkNU7EdkiJ2diHrQspYGlYfs0yswxECB3vo4RKP9\r\n0Uw6KsJuG7rvzVYEgTRQH7FOy4C8jFh4xt5cGIfwvhh/DMYdPwmSZ+Fqv5/b\r\n7cGkcrZWYUDwcYtMDLrolL6UDd0PYJaPMivy/UEyubUdAzz1GavOlLkGqRtY\r\nPtzlHyXtsggZMUhnpRvmOr2906BjMuXw7DT6P90Yv6pNAgIh1ErUNcJaojc3\r\nbooHyy9CKMABkCPWh8U+re5RiYpRiUEBx7oEMOgUaRBfjDJ/0blgFPrhxWZd\r\nzZPUotzXnLmxFNJ+LJD6cDqSLs/wCNTFuR8=\r\n=7sIF\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-nested-middleware_1.1.0_1673379782752_0.07365125837286257"},"_hasShrinkwrap":false},"1.1.1":{"name":"prisma-nested-middleware","version":"1.1.1","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"readme":"<div align=\"center\">\n<h1>Prisma Nested Middleware</h1>\n\n<p>Util for calling Prisma middleware for nested write operations.</p>\n\n<p>Existing Prisma middleware is called once for every operation, but due to some operations containing <a href=\"https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-writes\">nested writes</a> it can become complex to ensure middleware is applied in all scenarios. See the <a href=\"https://github.com/prisma/prisma/issues/4211\">existing issue regarding nested middleware</a> for more information.\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- [Installation](#installation)\n- [Usage](#usage)\n  - [Lifecycle](#lifecycle)\n  - [Operations Nested in Lists](#operations-nested-in-lists)\n- [LICENSE](#license)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n## Installation\n\nThis module is distributed via [npm][npm] which is bundled with [node][node] and\nshould be installed as one of your project's dependencies:\n\n```\nnpm install --save prisma-nested-middleware\n```\n\n## Usage\n\nPass a [middleware function](https://www.prisma.io/docs/concepts/components/prisma-client/middleware) to `createNestedMiddleware`, the returned middleware can be passed to Prisma client's `$use` method:\n\n```javascript\nimport { createNestedMiddleware } from 'prisma-nested-middleware'\n\nclient.$use(createNestedMiddleware(async (params, next) => {\n  // update params here\n  const result = await next(params)\n  // update result here\n  return result;\n));\n```\n\nThe middleware function passed to `createNestedMiddleware` is called for every\n[nested write](https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-writes) operation.\n\nThere are some differences to note when using nested middleware:\n\n- the list of actions that might be in params is expanded to include `connectOrCreate`, `include` and `select`.\n- The parent operation's params have been added to the params of nested middleware as a `scope` object. This is useful when the parent is relevant, for example when handling a `connectOrCreate` and you need to know the parent being connected to.\n- when handling a nested `create` action `params.args` does not include a `data` field, that must be handled manually. You can use the existence of `params.scope` to know when to handle a nested `create`.\n- the return value of `next` matches the part of the response that the middleware was called for. For example if the middleware function is called for a nested create, the `next` function resolves with the value of that create.\n- if a relation is not included using `include` then that middleware's `next` function will resolve with `undefined`.\n- if a nested operation's result is within an array then the nested operation's `next` function returns a flattened array of all the models found in the parent array. See [Operations Nested in Lists](#operations-nested-in-lists) for more information.\n\n### Lifecycle\n\nIt is helpful to walk through the lifecycle of an operation:\n\nFor the following update\n\n```javascript\nclient.user.update({\n  where: { id: 1 },\n  data: {\n    comments: {\n      update: {\n        where: { id: 2 },\n        data: {\n          post: {\n            connectOrCreate: {\n              where: { id: 3 },\n              create: {\n                title: 'Hello World',\n              },\n            },\n          },\n        },\n      },\n    },\n  },\n  include: {\n    comments: {\n      include: {\n        post: {\n          select: {\n            title: true,\n          },\n        },\n      },\n    },\n  },\n});\n```\n\n`createNestedMiddleware` calls the passed middleware function from the most deeply nested operation up to the top level operation. For the above example the middleware function is called in the following order:\n\n1. `{ model: 'Post', action: 'connectOrCreate', args: { create: {...}, connect: {...} } }`\n2. `{ model: 'Post', action: 'select', args: { title: true } }`\n3. `{ model: 'Post', action: 'include', args: { select: { title: true } } }`\n4. `{ model: 'Comment', action: 'update', args: { where: { id: 2 }, data: {...} } }`\n5. `{ model: 'Comment', action: 'include', args: { include: { post: { select: { title: true } } } } }`\n6. `{ model: 'User', action: 'update', args: { where: { id: 1 }, data: {...} } }`\n\nThe params object passed to the `next` function will modify the relevant part of the original params object. Once all the middleware calls have called `next` the updated params object is passed to the Prisma client.\n\nThe result of the Prisma client operation is then returned from the `next` functions according to the part of the result they are concerned with. So the `next` function called for the `User` model resolves with the `User` model's result, the `next` function called for the `Comment` model resolves with the `Comment` model's result, and so on.\n\nModifications to the result are made in the same way as modifications to the params. Once all the middleware calls have returned their slice of the result the combined result object is returned from the Prisma client method, in this case `client.user.update`.\n\nIf any middleware throws an error at any point then `client.country.update` will throw with that error.\n\n### Operations Nested in Lists\n\nWhen a `next` function needs to return a relation that is nested within a list it combines all the relation values into a single flat array. This means middleware only has to handle flat arrays of results which makes modifying the result before it is returned easier. If the result's parent is needed then it is possible to go through the parent middleware and traverse that relation; only a single depth of relation needs to be traversed as the middleware will be called for each layer.\n\nFor example if a comment is created within an array of posts, the `next` function for comments returns a flattened array of all the comments found within the posts array. When the flattened array is returned at the end of the middleware function the comments are put back into their corresponding posts.\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-nested-middleware/workflows/prisma-nested-middleware/badge.svg\n[build]: https://github.com/olivierwilkinson/prisma-nested-middleware/actions?query=branch%3Amaster+workflow%3Aprisma-nested-middleware\n[version-badge]: https://img.shields.io/npm/v/prisma-nested-middleware.svg?style=flat-square\n[package]: https://www.npmjs.com/package/prisma-nested-middleware\n[downloads-badge]: https://img.shields.io/npm/dm/prisma-nested-middleware.svg?style=flat-square\n[npmtrends]: http://www.npmtrends.com/prisma-nested-middleware\n[license-badge]: https://img.shields.io/npm/l/prisma-nested-middleware.svg?style=flat-square\n[license]: https://github.com/olivierwilkinson/prisma-nested-middleware/blob/master/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-nested-middleware/blob/master/other/CODE_OF_CONDUCT.md\n","readmeFilename":"README.md","gitHead":"694381ae59c8392c461d9d0e00eebaa2d5138d22","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@1.1.1","_nodeVersion":"14.21.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-I+a6VWaHhuoPQoEsMbtnUDMsqWbEZL4yFOfULTE/IkSULbjeJOehi+PGBLSCMVYmWlNF+EluHCfK8YUBYA+mbg==","shasum":"02df263be10326b39ccd13ecd9a253fc39637542","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-1.1.1.tgz","fileCount":7,"unpackedSize":40188,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDxgM12kzFWV6ED+tFI5CtjTDiNomzehTx1rO4XzY//MAiEAylvawtAIwhy733pLMkxlPsWgOJZFx4fCz4rsNc/Zs2o="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwE7XACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq3Kw//VGnVb/Pa6/3m44mqMP58VOXKGS0aeWVsuMiIXw2HGlVcNP87\r\n36wqVIYweSMtt/gp8RfRiYzO2pCyCRfEVHY5vA3GQEKMEF7Chxu9xsNqvMbZ\r\n6z+sssQHLLwTKYB3npex2ZzgdGIM+wLpymU/iT6yx7MGab4ywysU8gTPb0HY\r\nEUbXhQVy1zvlKbeOf/UTE5FHH8bR4gDsUGIZtKImtJ3edk+IsGNY0E92+Cgn\r\nK2kiysPqF4Vy7Z+7zDzmRLErVUsL1Y830unagTH6GRbr8TogvWWAJEk1t6gJ\r\nG7666yUD8hRnyzFrzh71LCmqBpz6Mhn/dUMP3/p+6SSeqOcF5tvupcPh9OYx\r\niBzpo4oHCklJGPCXGICe6es3olyNekXa9+y7k8ZFZ9GOJGAUmjeC1dMBkD4/\r\naeFlYPJy2iGSe5KB/rUhKvEQUiqeYQhraL4g7MuWSs3A4PZegBwPGLBEmV1t\r\nfyFLrg74JdKGpDDJ87JE4DdFGJnUHaudevGLP83Fxa4G33XnpyNY3UuIKFHO\r\nINTujOwKAy/3/y8VN0BnTgpRo+qbFSERen6GcpXcbYMJv8XFCzn8/mrChGJ7\r\nDpjnYayvHkDz8I9c+46t/zpN82/TbQVIyx134rdxgcYv/ka/ISFnXGm8bYWW\r\nnyHcngcZ7XR2eclOw7syAygNRvfs/BQtylg=\r\n=NaAq\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-nested-middleware_1.1.1_1673547479719_0.12987528365653156"},"_hasShrinkwrap":false},"1.1.2":{"name":"prisma-nested-middleware","version":"1.1.2","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"e32d3b5c2cf6fa74d31e21e183d91a2a7ddfb02a","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@1.1.2","_nodeVersion":"14.21.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-PSWu5yIdOWeOsJH2KHMkY1YlveHNcBFTnKwvT4JVUa/qtOd4hQ12jt7D+Br44EwR+KoU78qPCRuvrisTpzZNhA==","shasum":"c05831a43398070500f0e9cc56534daf24527e04","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-1.1.2.tgz","fileCount":7,"unpackedSize":40188,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCi758lrxGHRe92ngSQBF7+Q0t57ZTSG0z4DE7JbO8kBwIhAPdbkv+KHZvbn7ejqJtHSYroFpbN91MurZAWQubu0l7p"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwXotACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowOw/9HlotCLobAY/na2o0PTuN5QWWYvV1StKUWLLYs5hvRUCiMeqh\r\n6x4GNAYcPHQ1MjrLqhWqKtUIhNmcBnM65kufgpipu6kyNpjYIakhFtI++8i9\r\nquEM6EckBiQIYssXHjkHeNCtAMU45+SPBqIvdsrmM4sKdtBUUhNA5G79t+Ps\r\nbOTX/GY3mnVE1CZEpBHkx3VUCAcyxTs6JKSIYeff62MJbqM4pLFyytTickpT\r\nbyXDyjsrkYdeuMpE+v2vx9XjjjdAeCvF4Rt+xjd8Vt6z9Afg9zMkmAD9fLCe\r\nJ+TtpWeKJ2pLdSOljeXVZ2hnFssUqfcYQMxWQKJTUOcuw0GQ0kPCOdurgkJG\r\nbUdN2xzSVksAyfU090EtVt/8GzAebjpbfYwkq9tIuYYT6BOZtmlYm7BnnMtB\r\nN22co6V0bzo1vn5ERFEjmuGkQe+UKcTmTOLTBXrOTX/eruo8GvT0AGLqJ+AP\r\n3FKPoeE+T8TXioR9K4G6gnge8cpfmHyVmZzbB0iWjmoOioWjtQ2zochXewiN\r\n3IvT1zEAoSxm75DEbUdRyXRprv4+rKD+PU1LIbH5SJR2RVwm+SxDWHTRf0ja\r\nMHIY56A9vSVKb7RFYKDxYfneNSlXd3ZzQW4Oj71fwo6XZaLZFXZ7nxNcy8wj\r\n3sIe402745acsKqAB/rGTHSfNMYvPl7XTGs=\r\n=wfaB\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-nested-middleware_1.1.2_1673624109649_0.1754837406757057"},"_hasShrinkwrap":false},"1.2.0":{"name":"prisma-nested-middleware","version":"1.2.0","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"1325c11320626d08e41a1f85e43570e90c5c9e9d","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@1.2.0","_nodeVersion":"14.21.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-cWLH8Bt5KjpeObr1y7yn51gbsCSdFX7mU6U+fTFsD3fP8gMuHKNFm3z823PiOmNF6IpCcPC3b7hMDN+Ak4jV+w==","shasum":"af29e0b21dee66800893bf613eb15c252bc94060","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-1.2.0.tgz","fileCount":7,"unpackedSize":41076,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/Cz5E1uqSRiZwvoHZpF75IwyNNqihmrKSFfvdD7S2ygIgODc3n/LD72W0zw48FqFh3gmVMgSXU2jEa43CcIkhvyU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4tUkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmosrBAAknfccgYY1UaDRyKSt0ouvM1OKaB2UzHY/nKIs/VsIj6ZC5de\r\nDeylAIpzMQ1Z3Q3j8D5t0XMp5IYMr3yWWeksvVs7GCXvVp0EoBsDzbBLh+VG\r\nKVfwfz0nicKjUJsurwlNZ329aVIAGVYtimv0YsEISea1EbavMaXb43qTyEnx\r\nViEo85D3Lb6B/cQQRvfWzHhFRAkShNNp6COfm8WjTIfqrFjoehDmAJQW1ScX\r\n5Z2cuuWZqo7xJjVZWeNSlHwuxfjThMYwEwtRgTjLmS24ghIrf6RKXL1y2axN\r\nKGs4NxCM3fdF0yw2x8d+/xBrpVs9ewATnPtZgPlPstj2Xll/yo9kqKHVGdJT\r\n/av9tb6RBCb23CQBsQONIKoMo2TevBUdJ/S/LvhLYz73JXoko2Axw5OGanGn\r\nPWsAXFdkmBydmUoL0Sc4fE9ryehganKoiTh3Yi1DsWVylbkkqUny8MLyjNRE\r\nc7j/FHZo6Z2n7qpCR6MPHb1NBoHTK3YylbYiSTiFl4210zIorGvZm5kDKoJk\r\nbhmy8/aDZBbU62ebaWFgazBAkY+h4N2nYuEWR1WjlrbivT5uikd0s8PbDxkG\r\nkzFl3Pi2B3CUcOS/9caAaKR1SQfKHkjLdLo6ZM06We6d9gyeppKDXHTMgldG\r\ng36oAg7w5r24UNguVCnDond55oiWyn/os0Q=\r\n=BDqy\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-nested-middleware_1.2.0_1675810084690_0.035512747940618095"},"_hasShrinkwrap":false},"2.0.0":{"name":"prisma-nested-middleware","version":"2.0.0","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"bbca4e6d63936be4cbffc353de0f8a55d633d311","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@2.0.0","_nodeVersion":"14.21.2","_npmVersion":"7.24.2","dist":{"integrity":"sha512-JaGf9Dzkty5Y0SOFcpKq0Vo7QE288JiqZ3tZxvDsmSj2/uwvIkGXN1OOmt4SMemjoK9E1DtZw7RuRPt92uGgiQ==","shasum":"87fa7be6aaa4c697d9bd21e7c6c8126cac9bcfed","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-2.0.0.tgz","fileCount":7,"unpackedSize":41432,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDM3/tR1I2mzbeJx6cbUnegBQLfG4Y/Ls9mLpQvDhlubwIhAKT69HArVDSLkhc3z1t++H6zmSEMGtijEKCEnrpFnFp/"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj4tifACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrCiRAAoVIq8aqg/0b5apr1Xa2w8+2+X9jl56YtJj+a2160X9eIHtQq\r\n1lb2adTgETmd9vY0lxlrid2iclMw1Rueh7LCDWN91rKPK69Y7Yc4ywHC6jd+\r\ne2zJ6d0iFInlIjw5YvYaxj60r5orxasEz2gEgPfIl4DNB0j3HH9/AMk/itbY\r\ngvkkR8vi+4B1+kQfvo+9IVr7wfOWS7vzG2bOKUXzSsVUCh52qlRfU1YTVZ5U\r\nBEpCiWybupC0ndZn7EelSeAsVSVw7vUA7y/MGkl023xU5OYKZgJXZxEvsgS/\r\nyfI0yQ2B1ZmU1p1tPm7G3gSOo2kYipjMJ8no6cqcbBdKcVPNKKml+sYg441u\r\nRAyCXRSzaACYkvx1PBcXlwQzzDG237nkWHjrAPHrJdkDMfyjt0gHSGojuQkH\r\nnALslLMrtOhnkadpedBbtf2BAyMFAbz4vXoosFfyU6g6AmV9nxGUV0+lgUPN\r\naxhXIYxmorNb+B++5eKvocx92JobF3K4n2HYOx1mY7pDRKK6thL8ecyEWt5D\r\nuYY1HhK4misV6Ynq0UWWC+dMqM1ltlhZn7mS9wJZW/2wLoXaLY4en3jgrQ2L\r\nGz6UFfoLoHshkvsoU5Y4AYHumPe3ftlY5IZ2yL0p6tOSWd73N2qdHuv9Bfgl\r\nWY7SjEWmScLMILlkbDeub952TGxccBvHIsc=\r\n=ztWx\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-nested-middleware_2.0.0_1675810975560_0.32664747527096205"},"_hasShrinkwrap":false},"2.1.0":{"name":"prisma-nested-middleware","version":"2.1.0","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"8a3dcd6ef31c2e4eeb57abb8e9eafb44681f8fc8","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@2.1.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-9XBKUAYRc4/k2d6m8AZ8mmZfoznOWuJrNfy28T7A6/2YcO3VN/GFfgH7Ko/ol7AWZS909B2uSxAQCmj5e+RelQ==","shasum":"b833d5d8ea4bb74d4d90530c323118021de65545","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-2.1.0.tgz","fileCount":7,"unpackedSize":41757,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCS2bdkSLUmiqmnJlRxwjMMv0uobpXrbzLibBafDgPORQIhAK3/YpODUUrrvOOudSh5cVAPR5zIgxaKHaniUTMSyrw5"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAQkxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrAjA//YoEwaUB/syPweFtLVEFGU4xPSyDryjlACI1rWc1o37eLtxpW\r\nr1iVJptNkklpR0sCZRR3e5dzGxdHadMCvwWrRmF/vaXGTz76hU++R0nKxZDz\r\nrNZA0JDs9YZ8UEyTWiwjn1EFD1ezOFsjpI2hKEjZmxDEqZfBEZf6Ij7tDJSH\r\nYNHDjfOjYxr7ihMKpUtUe4C42w6kpcRbSM3eQoczBtrbTDtg3IFVP7iNsi0h\r\njwKg5xkw2a6HPr6lXWwKvCeDwGI1tyo3+oNu6lOT7X1xGrYnlu/FGuaATndQ\r\nO1lih5PY1vU8h0PiQcX9S6LhJKCW3zbIv0XIQItJ1+JDrQiryFLk+BbLEg6z\r\nZXz7GGNDhM6YFiitSIUarPVK/vDcqSgH/KZZWQdZuJNBa+VG8hz8+wjGBuBo\r\neC5AQgYNxlHXq6Pb5UOCPb15CsmvXx2/YcgVuPphia8NSzLsvIKdhxqHy5vG\r\n3a/QlBuScr+9ZN5YBsWehkOCB95wIaZqAI1LolfIDTt9hnmbFLVtyA9TF0So\r\nFZyGiIYv7MGGavqW2K2PWMcjYUUbjfeY3+vj3QDpcQQXOSwwfN4UdwC47mpx\r\nwtD1hp+P4WAl43Itcq8hMQG9tS24/Imp/mD33s9zH6XhLkIPN35X42e466Pc\r\n1OT8WaNHW9j6999eNB90vsPIUbmW1irYKVc=\r\n=zxH7\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-nested-middleware_2.1.0_1677789489071_0.2709093750278202"},"_hasShrinkwrap":false},"2.2.0":{"name":"prisma-nested-middleware","version":"2.2.0","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"aabf8c79ff8ff9dbf10a213974beaed1f547b0f5","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@2.2.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-EhFxd5sa8I2hkTFZIuEb8txfyJn3uya1ayCKXIv3vqgy81Y03vcVQjK8FWYrmoi6sbFXBnMjPz32CyquTPhEJA==","shasum":"d18b27bb41b2fd21767c8ccb96a243d7a7337f7b","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-2.2.0.tgz","fileCount":39,"unpackedSize":66000,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNNXbYF1TEQzbltlk8LOuh/v++TjjXu94zLl+MfE+QVgIhAJyjXcC0EMBRA2BMl8ECMmbsFTmIO5nzUjOQL6m07Wpv"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIU/NACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpmHw/5AUfL4yWZmDRsY//CgEnberkel45grN1vcW0eydga1sy3kwob\r\nYt0tKYZ6Pe3TXRvMmY+7HGjqwfGMlhl783JWIr9uy+r3/B3rIgcFJNflRqQu\r\nWEqtMpVP2cgfRhuFaeRheBQAvdlxaNqPbUNfXx1U0W0FUdLJT6VK+6GzCMOa\r\neBSqQj5eWBLOHWNsNahd+/5URq49Q7CtWxe35wNgM1fOlhAeWzMJR5pF1p4T\r\nc27cJSozOS09K/b28IqthZP9Zbi9HoNDufPmByhmUS/pmfUmRaHLeqI06O7C\r\noJUKKQwYiq8B+rppW85BSS/Af9nagyb/KczfKz5898TO0Go4vY8MNxtdmOGu\r\nSd3gFXXeO6LKV3T1BPd59NOfT0QbJYsY48E8GNWpbaEcEHks/REnE2dzJPp5\r\nLMcTCCeB6kiacJHk76F05R8jaf+bPkcWlAm6y/tCpC9FrnsGts+Egoe8cB2a\r\nDzCa+mjxRYEvHuKqnipo09xhnT0PQdoIhcKyKINJh7310hhPpMZlZ0sWF3w1\r\njonXF4bFjs6qbeDud2/j3UaErkRYCM1PCDX9GbXuDVUr5NFU4lXFy5YHwgoR\r\no4Qc9b1MhrzdXv0cbiPxtmn0KifH6S1GEnXGCmaPrqbQ0jkq+DS4ROU0YGOX\r\narHKkHMQbmW1cnsCFsy/bNr2iphDwPJk4/s=\r\n=ir3Q\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-nested-middleware_2.2.0_1679904717171_0.20179667753779928"},"_hasShrinkwrap":false},"2.3.0":{"name":"prisma-nested-middleware","version":"2.3.0","description":"Util for calling Prisma middleware for nested write operations","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":"prisma generate && jest","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.8.1","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"f78957365c319130b8738e184eae219b8137e18c","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@2.3.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-U/bak/zrFTOjyKgxT/sVIFe5inNiYnuGGwcbsoA0v4R/LWRfP7EGsEVfzg9SV+X2K9ZxfMdLwHryLYe2Yg51GA==","shasum":"9d6096fe74deb930be2cd8502e00836e07eb2847","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-2.3.0.tgz","fileCount":39,"unpackedSize":66512,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGtnA/Uol3bI0ESwmdMZ099l//VxVr4IKMbRT3a04oTSAiA5NzTlU4sIGIJpiS4rqXua8HJt96/XhEP3Nx+wkTST0Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkIVFmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrcdQ//VX2ygicFB9eAnZfJ4nloMBs05zXqlDmabONoPiiLmjaariXt\r\n1X95llgkeXXq6gE1qRQ7QelrJYOI/zW6CysShYBKptSbkJBbiZ0eqCGSvFZU\r\nkTq2jTzjq1FcuaE8q1Mn4FMTVI4NgWxTwGxfTgMMAvqveFq+EVLhZCfyImvp\r\n7ze5uZyR6P0liaI2KUTlNY52v6ZHO+F5CC35l8zfQaFBvmDaWHbYt1vi0IiK\r\nEoTlHwWEp9ORJ0b7FTsatfFTVFEa8bInThHZz3JZ0Xm+dun1aJ6v5wW28DxC\r\nJjXxQ/Bqq65SJ1zgxQw3MRsuWxpd6sUQHXUERtWlQQUFswfWGDv0xHKlko9t\r\nJAvn/GyrsRMvbw9t7NEtQviE2UQfL+e+/eHxY9J8voBp9Vwq+aC1FA9VCmh1\r\n9IyfnFQUjpbTrMyll7wy/ZfWMl8NitVVXmRmjyMFTiDrL8tvUecW7iDw8QHi\r\npk5F7aEt1hXPR6SeKyWWSQSCAfaWonOrTKRnYsJ1LAx6FTf2UcTXMXjuAmYi\r\nqhkRFKSw1i8Eoy2TUFsyQc2UAiOVkZnfCWh5+r95Zsf1ixyoI98R9qhMxe0H\r\n7+TwYOOH/MQDNhaxAtMODgUVtZ0JJODYLP/73t9mucdKVAv9uvvSpJpKY6mp\r\nYkBe9X6n0sy2C8ZJPi//9q4yuxH9uL1icHg=\r\n=AaHv\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-nested-middleware_2.3.0_1679905125814_0.47721050409190946"},"_hasShrinkwrap":false},"3.0.0":{"name":"prisma-nested-middleware","version":"3.0.0","description":"Util for calling Prisma middleware for nested write operations","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.11.0","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","npm-run-all":"^4.1.5","prisma":"^4.11.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"e37323d801b6c86e5b97f687dcf4e52f9b8cf4b2","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@3.0.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-zyko1QKFsBzIzzX/fUNCzWF1HFFT5we/eTxIk4uERBe0axwinTBjVpzQ9nxyKoKJe+aZGWrjtzgGJG5H6E1FFg==","shasum":"30f71f85c40235f609064e2bb39283cf5b07466f","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-3.0.0.tgz","fileCount":43,"unpackedSize":141693,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjWsiy+7oJ5qmQMEIctD0ZWLEXmMVMLfA4LT0Ggu7lsAIgdFFZNtUmPwlFDFRIWhn1oZM5gfeoqm8F6JzIu2EmRTM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkI3pwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrJCg//bhsALdTZPPyQy5zbStTG5oVQs+Nh5PFscZzb4y/VLvNSCVf/\r\nd0YsyR3CcDE7S5CljAk4sp7XqCd1vYdBXA6Ho+TiiFRG9NTHgJqDYehQw0gH\r\n735Jt2vgINr6SyA7IXY31U70WP3OfXbHd869ZTiThfQfyUhhc83Si08fyRQi\r\n99WzzB9HAKhZoZvl2E/eGBGwsQoLuAZmyg1LEMYhg7dqnE3yTwB8dwI94r3W\r\nJhbPMb/me/0Sbv04qDiap3YI7jRBxAWeTHoUEwmmyWF9IoS40E/sKoTFABrC\r\nA+NyI1qbf7VhyOusZBe7Sd/QU4xtYnUo+sS8YZJH0Rm7vfBv7z+x2oAD1Y2A\r\naYcf4qu5U3nVfUMyHglBaFwRqFNgSFncafMflah9BwNsDhUKWkxkOmaW0Ht8\r\nQNqbK4d5Fd7EIQdC3jQarRcipuhCsLUMwqL1L5wgP+iwli97yxz4bXUbZiom\r\n0+OK6CG1NSRzIbfa7Gg8+dpPLCpwUqfnVLTuKqVlE9RGzfVFjqP3+4zF1Dxo\r\n8BDvlZrgfyZ1i5PkWMSb7ZqNT8tZlb6ZKoOhL8DRTAc3FopmtbPWDwA7InJP\r\nhYGD2bYZH/TzTlA/wAvS6rOO2p8tzIOCg6Dnw95kEFmJLdLtv7Wjd64OiHak\r\nWswggjNrIoS1Xu5V+7RBa23Nyv5ArQ332zE=\r\n=XO3V\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-nested-middleware_3.0.0_1680046704092_0.4435402675548723"},"_hasShrinkwrap":false},"3.0.1":{"name":"prisma-nested-middleware","version":"3.0.1","description":"Util for calling Prisma middleware for nested write operations","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.11.0","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","npm-run-all":"^4.1.5","prisma":"^4.11.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"fff70f4dc42f70b67f86a753a925cdba5b9c76a3","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@3.0.1","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-bNrDSWueM4RGnDLZztQuDs5nQP5RHwt5vBQZTC34bon5xgS4w381U57XNhwm5F/VOwiWT5Mtt6ZZ6N1Dgyb5rA==","shasum":"b5dfff085ed5034176ff71b570014114458210e1","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-3.0.1.tgz","fileCount":47,"unpackedSize":143483,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpxTJYnsEOHjjtc1uWeDIQkDrg5J0eiQmRrG/BcBRUlQIhAPHrUnP2ZIsGeoGRbMA96Nn8NUMJc3wFIdAg74wWoMJ3"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQCazACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqmEg/+KzGAAEW/iAo4+IcRmWWINAYCazyR8/o64VGBjGwsefLSuEyj\r\n2ni+xTwec+4GvwTmqK/GSkmhUi6IkOtPF3OFzDqKwWtNhCXQAM/niw2qXgnL\r\n9gqwOqmLG3wS5no/5UNiFC/LH2NsrHCIvO7m7KytdebKsSeuqAzAT8NBsmeV\r\nyLIOJPtSD+A5Oj7SVxiIaxphmD8H0RdwQ+1DP9xx/iWX27Z4PbyfHc/RVrP7\r\nFaOvrB1I3RxTjptlvaz5Wv3wTtTwQaKS224LcAWS45847Xv3+vbUUbUebfkZ\r\nHQVd5c5456yLK36wpYmBeQGXqFJSrPTLSdA6HmQhphR1joVZrYciNAlOk+Ko\r\n7BlbSqbamVK44wufqYgj0ndjWBB9RKs2xBPiLUGQ9fqRxYYkC/F2nzivs0nF\r\naBfUZrF1YA2WuGzsCXTFuIzb3aOyaPyH56iKmfRdRIQu9Kd3fAtjeavZ0+nV\r\nDNVQK8tAzsayUXkVv1dCYaK4W9eCMdNfrPj7VTuVegvWOq3CFwDjU9LqYW9x\r\ndrzlQ/GaveyjSarLPijr2XUot0k+ua9ued1UEAHKCtFN56e4PcKHy6OVTV70\r\nxgE8tiA/8RxQ8T8gjA/c+7dRyg4v4nHoPfmQAnHYYMaNRf6xh4zfYaGEzu4B\r\nZEjweNTe4j9vbEzkTSnea+AwMY/MUCn0z0c=\r\n=oXO3\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-nested-middleware_3.0.1_1681925811394_0.7930228723926225"},"_hasShrinkwrap":false},"3.0.2":{"name":"prisma-nested-middleware","version":"3.0.2","description":"Util for calling Prisma middleware for nested write operations","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.11.0","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","npm-run-all":"^4.1.5","prisma":"^4.11.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"2e2c3ceabdbea6671ee1d2a53155437eb9375c9d","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@3.0.2","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-7Q0MlXuu+tQ1vtgWFjixCtAC1Sk5R7MFEAWajIxAIVQbxPE6tlktdPgH2esYsiS2a6yDbdsujD3JYhw52Pb2hg==","shasum":"24680920ca33828d88f033af8a28b7ac670a9116","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-3.0.2.tgz","fileCount":47,"unpackedSize":143575,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKUkuK7yVptYLlPDePXWFuZSosYukXwAYQaa4x9uZIwQIhALv1m1r9M901Dq2qpjqcsJQhkf5Y/fGF/rrQMvnKO25e"}]},"_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-nested-middleware_3.0.2_1684601268078_0.28508139761878604"},"_hasShrinkwrap":false},"3.0.3":{"name":"prisma-nested-middleware","version":"3.0.3","description":"Util for calling Prisma middleware for nested write operations","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.11.0","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","npm-run-all":"^4.1.5","prisma":"^4.11.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"7b353626e16dee9a6219ca103d686838ee00b734","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@3.0.3","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-8kan2xi+fYj2gtOD/6XsGkvrbpN8F7pYhuknF4/GSL+E7eZrq57594x0diYl3f/4FpVseSWRc+nhP1XbvFKVSg==","shasum":"8406a8609e7855fdffbc3ec16c3ffd7c1b7c737d","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-3.0.3.tgz","fileCount":47,"unpackedSize":143709,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDq7TjSZ9z1n/As9MDjQN3YEXsvBCjvgZh6Sv/Rj1rBPgIhAKPFtYluBRX7UCE7EscrZCRP8eKNwWAkBOmtAoyzdQQx"}]},"_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-nested-middleware_3.0.3_1685114099921_0.6687468831542112"},"_hasShrinkwrap":false},"4.0.0":{"name":"prisma-nested-middleware","version":"4.0.0","description":"Util for calling Prisma middleware for nested write operations","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":{"@open-draft/deferred-promise":"^2.1.0","lodash":"^4.17.21"},"peerDependencies":{"@prisma/client":"*"},"devDependencies":{"@prisma/client":"^4.11.0","@types/faker":"^5.5.9","@types/jest":"^29.2.5","@types/lodash":"^4.14.185","@typescript-eslint/eslint-plugin":"^4.14.0","@typescript-eslint/parser":"^4.14.0","doctoc":"^2.2.0","dotenv":"^16.0.3","eslint":"^7.6.0","faker":"^5.0.0","jest":"^29.3.1","kcd-scripts":"^5.0.0","npm-run-all":"^4.1.5","prisma":"^4.11.0","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-nested-middleware.git"},"release":{"branches":["main","next"]},"publishConfig":{"access":"public"},"gitHead":"36c5410fcadb7ea8f7a4452e1406550daf58dfdc","bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","_id":"prisma-nested-middleware@4.0.0","_nodeVersion":"14.21.3","_npmVersion":"7.24.2","dist":{"integrity":"sha512-WSx0nl7KNXEzGaNC87fuDBOdAjj3V6um/JoQUo24PaMzMy8tvOYfb2Mw25OZhnrMXNTBhqgk4rJTUW3CVcDsHQ==","shasum":"e4743f7c943c32dae21f7597be7d2d700722bffb","tarball":"https://registry.npmjs.org/prisma-nested-middleware/-/prisma-nested-middleware-4.0.0.tgz","fileCount":47,"unpackedSize":141984,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCb1ESKYVMElNYsNOZwY/4SjHCbL0bJYTJAhul6S5tcsgIgFCODt0fRD38U3E/3OjLFIyUvolGM91iJUqijpZEfa04="}]},"_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-nested-middleware_4.0.0_1705156813580_0.7578027379758343"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-21T09:56:28.713Z","1.0.0":"2022-09-21T09:56:29.019Z","modified":"2024-01-13T14:40:13.912Z","1.0.1":"2023-01-09T18:31:42.006Z","1.1.0":"2023-01-10T19:43:02.914Z","1.1.1":"2023-01-12T18:17:59.934Z","1.1.2":"2023-01-13T15:35:09.859Z","1.2.0":"2023-02-07T22:48:04.827Z","2.0.0":"2023-02-07T23:02:55.762Z","2.1.0":"2023-03-02T20:38:09.235Z","2.2.0":"2023-03-27T08:11:57.360Z","2.3.0":"2023-03-27T08:18:46.009Z","3.0.0":"2023-03-28T23:38:24.309Z","3.0.1":"2023-04-19T17:36:51.631Z","3.0.2":"2023-05-20T16:47:48.271Z","3.0.3":"2023-05-26T15:15:00.078Z","4.0.0":"2024-01-13T14:40:13.740Z"},"maintainers":[{"name":"olivierwilkinson","email":"olivier.wilkinson@gmail.com"}],"description":"Util for calling Prisma middleware for nested write operations","homepage":"https://github.com/olivierwilkinson/prisma-nested-middleware#readme","keywords":["prisma","client","middleware"],"repository":{"type":"git","url":"git+https://github.com/olivierwilkinson/prisma-nested-middleware.git"},"author":{"name":"Olivier Wilkinson"},"bugs":{"url":"https://github.com/olivierwilkinson/prisma-nested-middleware/issues"},"license":"Apache-2.0","readme":"<div align=\"center\">\n<h1>Prisma Nested Middleware</h1>\n\n<p>Middleware that is called for every nested relation in a Prisma query.</p>\n\n<p>\n  Vanilla Prisma middleware is great for modifying top-level queries but\n  becomes difficult to use when middleware must handle\n  <a href=\"https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-writes\">nested writes</a>\n  or modify where objects that reference relations.\n  See the <a href=\"https://github.com/prisma/prisma/issues/4211\">existing issue regarding nested middleware</a>\n  for more information.\n</p>\n\n<p>\n  This library creates middleware that is called for relations nested in the\n  params object, allowing you to modify params and results without having to\n  recurse through params objects yourself.\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- [Installation](#installation)\n- [Usage](#usage)\n  - [Params](#params)\n  - [Nested Writes](#nested-writes)\n    - [Changing Nested Write Actions](#changing-nested-write-actions)\n    - [Splitting Nested Write Actions](#splitting-nested-write-actions)\n    - [Write Results](#write-results)\n  - [Where](#where)\n    - [Where Results](#where-results)\n  - [Include](#include)\n    - [Include Results](#include-results)\n  - [Select](#select)\n    - [Select Results](#select-results)\n  - [Relations](#relations)\n  - [Modifying Nested Write Params](#modifying-nested-write-params)\n  - [Modifying Where Params](#modifying-where-params)\n  - [Modifying Results](#modifying-results)\n  - [Errors](#errors)\n- [LICENSE](#license)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n## Installation\n\nThis module is distributed via [npm][npm] which is bundled with [node][node] and\nshould be installed as one of your project's dependencies:\n\n```\nnpm install --save prisma-nested-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\nPass a [middleware function](https://www.prisma.io/docs/concepts/components/prisma-client/middleware) to\n`createNestedMiddleware`, the returned middleware can be passed to Prisma client's `$use` method:\n\n```javascript\nimport { createNestedMiddleware } from 'prisma-nested-middleware'\n\nclient.$use(createNestedMiddleware(async (params, next) => {\n  // update params here\n  const result = await next(params)\n  // update result here\n  return result;\n));\n```\n\n### Params\n\nThe params object passed to the middleware function is a normal Prisma.MiddlewareParams object with the following\ndifferences:\n\n- the `action` field adds the following options: 'connectOrCreate', 'connect', 'disconnect', 'include', 'select' and 'where'\n- there is an additional `scope` field that contains information specific to nested relations:\n\n  - the `parentParams` field contains the params object of the parent relation\n  - the `modifier` field contains any modifiers the params were wrapped in, for example `some` or `every`.\n  - the `logicalOperators` field contains any logical operators between the current relation and it's parent, for example `AND` or `NOT`.\n  - the `relations` field contains an object with the relation `to` the current model and `from` the model back to it's parent.\n\nFor more information on the `modifier` and `logicalOperators` fields see the [Where](#Where) section.\n\nFor more information on the `relations` field see the [Relations](#Relations) section.\n\nThe type for the params object is:\n\n```typescript\ntype NestedParams = Omit<Prisma.MiddlewareParams, \"action\"> & {\n  action:\n    | Prisma.PrismaAction\n    | \"where\"\n    | \"include\"\n    | \"select\"\n    | \"connect\"\n    | \"connectOrCreate\"\n    | \"disconnect\";\n  scope?: {\n    parentParams: NestedParams;\n    relations: { to: Prisma.DMMF.Field; from: Prisma.DMMF.Field };\n    modifier?: \"is\" | \"isNot\" | \"some\" | \"none\" | \"every\";\n    logicalOperators?: (\"AND\" | \"OR\" | \"NOT)[];\n  };\n};\n```\n\n### Nested Writes\n\nThe middleware function is called for every [nested write](https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-writes)\noperation in the query. The `action` field is set to the operation being performed, for example \"create\" or \"update\".\nThe `model` field is set to the model being operated on, for example \"User\" or \"Post\".\n\nFor example take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      update: {\n        where: { id: 1 },\n        data: { title: \"Hello World\" },\n      },\n    },\n  },\n});\n```\n\nThe middleware function will be called with:\n\n```javascript\n{\n  action: 'update',\n  model: 'Post',\n  args: {\n    where: { id: 1 },\n    data: { title: 'Hello World' }\n  },\n  relations: {\n    to: { kind: 'object', name: 'posts', isList: true, ... },\n    from: { kind: 'object', name: 'author', isList: false, ... },\n  },\n  scope: [root params],\n}\n```\n\nSome nested writes can be passed as an array of operations. In this case the middleware function is called for each\noperation in the array. For example take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      update: [\n        { where: { id: 1 }, data: { title: \"Hello World\" } },\n        { where: { id: 2 }, data: { title: \"Hello World 2\" } },\n      ],\n    },\n  },\n});\n```\n\nThe middleware function will be called with:\n\n```javascript\n {\n  action: 'update',\n  model: 'Post',\n  args: {\n    where: { id: 1 },\n    data: { title: 'Hello World' }\n  },\n  relations: {\n    to: { kind: 'object', name: 'posts', isList: true, ... },\n    from: { kind: 'object', name: 'author', isList: false, ... },\n  },\n  scope: [root params],\n}\n```\n\nand\n\n```javascript\n {\n  action: 'update',\n  model: 'Post',\n  args: {\n    where: { id: 2 },\n    data: { title: 'Hello World 2' }\n  },\n  relations: {\n    to: { kind: 'object', name: 'posts', isList: true, ... },\n    from: { kind: 'object', name: 'author', isList: false, ... },\n  },\n  scope: [root params],\n}\n```\n\n#### Changing Nested Write Actions\n\nThe middleware function can change the action that is performed on the model. For example take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      update: {\n        where: { id: 1 }\n        data: { title: 'Hello World' }\n      },\n    },\n  },\n});\n```\n\nThe middleware function could be used to change the action to `upsert`:\n\n```javascript\nconst middleware = createNestedMiddleware((params, next) => {\n  if (params.model === \"Post\" && params.action === \"update\") {\n    return next({\n      ...params,\n      action: \"upsert\",\n      args: {\n        where: params.args.where,\n        create: params.args.data,\n        update: params.args.data,\n      },\n    });\n  }\n  return next(params);\n});\n```\n\nThe final query would be modified by the above middleware to:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      upsert: {\n        where: { id: 1 },\n        create: { title: \"Hello World\" },\n        update: { title: \"Hello World\" },\n      },\n    },\n  },\n});\n```\n\nWhen changing the action it is possible for the action to already exist. In this case the resulting actions are merged.\nFor example take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      update: {\n        where: { id: 1 },\n        data: { title: \"Hello World\" },\n      },\n      upsert: {\n        where: { id: 2 },\n        create: { title: \"Hello World 2\" },\n        update: { title: \"Hello World 2\" },\n      },\n    },\n  },\n});\n```\n\nUsing the same middleware defined before the update action would be changed to an upsert action, however there is\nalready an upsert action so the two actions are merged into a upsert operation array with the new operation added to\nthe end of the array. When the existing action is already a list of operations the new operation is added to the end of\nthe list. The final query in this case would be:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      upsert: [\n        {\n          where: { id: 2 },\n          create: { title: \"Hello World 2\" },\n          update: { title: \"Hello World 2\" },\n        },\n        {\n          where: { id: 1 },\n          create: { title: \"Hello World\" },\n          update: { title: \"Hello World\" },\n        },\n      ],\n    },\n  },\n});\n```\n\nSometimes it is not possible to merge the actions together in this way. The `createMany` action does not support\noperation arrays so the `data` field of the `createMany` action is merged instead. For example take the following query:\n\n```javascript\nconst result = await client.user.create({\n  data: {\n    posts: {\n      createMany: {\n        data: [{ title: \"Hello World\" }, { title: \"Hello World 2\" }],\n      },\n      create: {\n        title: \"Hello World 3\",\n      },\n    },\n  },\n});\n```\n\nIf the `create` action was changed to be a `createMany` action the `data` field would be added to the end of the existing\n`createMany` action. The final query would be:\n\n```javascript\nconst result = await client.user.create({\n  data: {\n    posts: {\n      createMany: {\n        data: [\n          { title: \"Hello World\" },\n          { title: \"Hello World 2\" },\n          { title: \"Hello World 3\" },\n        ],\n      },\n    },\n  },\n});\n```\n\nIt is also not possible to merge the actions together by creating an array of operations for non-list relations. For\nexample take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    profile: {\n      create: {\n        bio: \"My personal bio\",\n        age: 30,\n      },\n      update: {\n        where: { id: 1 },\n        data: { bio: \"Updated bio\" },\n      },\n    },\n  },\n});\n```\n\nIf the `update` action was changed to be a `create` action using the following middleware:\n\n```javascript\nconst middleware = createNestedMiddleware((params, next) => {\n  if (params.model === \"Profile\" && params.action === \"update\") {\n    return next({\n      ...params,\n      action: \"create\",\n      args: params.args.data,\n    });\n  }\n  return next(params);\n});\n```\n\nThe `create` action from the `update` action would need be merged with the existing `create` action, however since\n`profile` is not a list relation we must merge together the resulting objects instead, resulting in the final query:\n\n```javascript\nconst result = await client.user.create({\n  data: {\n    profile: {\n      create: {\n        bio: \"Updated bio\",\n        age: 30,\n      },\n    },\n  },\n});\n```\n\n#### Splitting Nested Write Actions\n\nThe middleware function can also split the action into multiple actions by passing an array of params to the `next`\nfunction. For example take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      delete: { id: 1 },\n    },\n  },\n});\n```\n\nA middleware function that changes the `delete` into an `update` and `disconnect` could be defined as:\n\n```javascript\nconst middleware = createNestedMiddleware((params, next) => {\n  if (params.model === \"Post\" && params.action === \"delete\") {\n    return next([\n      {\n        ...params,\n        action: \"update\",\n        args: {\n          where: params.args,\n          data: { deleted: true },\n        },\n      },\n      {\n        ...params,\n        action: \"disconnect\",\n        args: params.args.where,\n      },\n    ]);\n  }\n  return next(params);\n});\n```\n\nThe final query would be:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    posts: {\n      update: {\n        where: { id: 1 },\n        data: { deleted: true },\n      },\n      disconnect: { id: 1 },\n    },\n  },\n});\n```\n\n#### Write Results\n\nThe `next` function of middleware calls for nested write actions always return `undefined` as their result. This is\nbecause it the results returned from the root query may not include the data for a particular nested write.\nFor example take the following query:\n\n```javascript\nconst result = await client.user.update({\n  data: {\n    profile: {\n      create: {\n        bio: \"My personal bio\",\n        age: 30,\n      },\n    }\n    posts: {\n      updateMany: {\n        where: {\n          published: false,\n        },\n        data: {\n          published: true,\n        },\n      },\n    },\n  },\n  select: {\n    id: true,\n    posts: {\n      where: {\n        title: {\n          contains: \"Hello\",\n        },\n      },\n      select: {\n        id: true,\n      },\n    },\n  }\n});\n```\n\nThe `profile` field is not included in the `select` object so the result of the `create` action will not be included in\nthe root result. The `posts` field is included in the `select` object but the `where` object only includes posts with\ntitles that contain \"Hello\" and returns only the \"id\" field, in this case it is not possible to match the result of the\n`updateMany` action to the returned Posts.\n\nSee [Modifying Results](#modifying-results) for more information on how to update the results of queries.\n\n### Where\n\nThe `where` action is called for any relations found inside where objects in params.\n\nNote that the `where` action is not called for the root where object, this is because you need the root action to know\nwhat properties the root where object accepts. For nested where objects this is not a problem as they always follow the\nsame pattern.\n\nTo see where the `where` action is called take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  where: {\n    posts: {\n      some: {\n        published: true,\n      },\n    },\n  },\n});\n```\n\nThe where object above produces a call for \"posts\" relation found in the where object. The `modifier` field is set to\n\"some\" since the where object is within the \"some\" field.\n\n```javascript\n{\n  action: 'where',\n  model: 'Post',\n  args: {\n    published: true,\n  },\n  scope: {\n    parentParams: {...}\n    modifier: 'some',\n    relations: {...}\n  },\n}\n```\n\nRelations found inside where AND, OR and NOT logical operators are also found and called with the middleware function,\nhowever the `where` action is not called for the logical operators themselves. For example take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  where: {\n    posts: {\n      some: {\n        published: true,\n        AND: [\n          {\n            title: \"Hello World\",\n          },\n          {\n            comments: {\n              every: {\n                text: \"Great post!\",\n              },\n            },\n          },\n        ],\n      },\n    },\n  },\n});\n```\n\nThe middleware function will be called with the params for \"posts\" similarly to before, however it will also be called\nwith the following params:\n\n```javascript\n{\n  action: 'where',\n  model: 'Comment',\n  args: {\n    text: \"Great post!\",\n  },\n  scope: {\n    parentParams: {...}\n    modifier: 'every',\n    logicalOperators: ['AND'],\n    relations: {...}\n  },\n}\n```\n\nSince the \"comments\" relation is found inside the \"AND\" logical operator the\nmiddleware is called for it. The `modifier` field is set to \"every\" since the where object is in the \"every\" field and\nthe `logicalOperators` field is set to `['AND']` since the where object is inside the \"AND\" logical operator.\n\nNotice that the middleware function is not called for the first item in the \"AND\" array, this is because the first item\ndoes not contain any relations.\n\nThe `logicalOperators` field tracks all the logical operators between the `parentParams` and the current params. For\nexample take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  where: {\n    AND: [\n      {\n        NOT: {\n          OR: [\n            {\n              posts: {\n                some: {\n                  published: true,\n                },\n              },\n            },\n          ],\n        },\n      },\n    ],\n  },\n});\n```\n\nThe middleware function will be called with the following params:\n\n```javascript\n{\n  action: 'where',\n  model: 'Post',\n  args: {\n    published: true,\n  },\n  scope: {\n    parentParams: {...}\n    modifier: 'some',\n    logicalOperators: ['AND', 'NOT', 'OR'],\n    relations: {...},\n  },\n}\n```\n\nThe `where` action is also called for relations found in the `where` field of includes and selects. For example:\n\n```javascript\nconst result = await client.user.findMany({\n  select: {\n    posts: {\n      where: {\n        published: true,\n      },\n    },\n  },\n});\n```\n\nThe middleware function will be called with the following params:\n\n```javascript\n{\n  action: 'where',\n  model: 'Post',\n  args: {\n    published: true,\n  },\n  scope: {...}\n}\n```\n\n#### Where Results\n\nThe `next` function for a `where` action always resolves with `undefined`.\n\n### Include\n\nThe `include` action will be called for any included relation. The `args` field will contain the object or boolean\npassed as the relation include. For example take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  include: {\n    profile: true,\n    posts: {\n      where: {\n        published: true,\n      },\n    },\n  },\n});\n```\n\nFor the \"profile\" relation the middleware function will be called with:\n\n```javascript\n{\n  action: 'include',\n  model: 'Profile',\n  args: true,\n  scope: {...}\n}\n```\n\nand for the \"posts\" relation the middleware function will be called with:\n\n```javascript\n{\n  action: 'include',\n  model: 'Post',\n  args: {\n    where: {\n      published: true,\n    },\n  },\n  scope: {...}\n}\n```\n\n#### Include Results\n\nThe `next` function for an `include` action resolves with the result of the `include` action. For example take the\nfollowing query:\n\n```javascript\nconst result = await client.user.findMany({\n  include: {\n    profile: true,\n  },\n});\n```\n\nThe middleware function for the \"profile\" relation will be called with:\n\n```javascript\n{\n  action: 'include',\n  model: 'Profile',\n  args: true,\n  scope: {...}\n}\n```\n\nAnd the `next` function will resolve with the result of the `include` action, in this case something like:\n\n```javascript\n{\n  id: 2,\n  bio: 'My personal bio',\n  age: 30,\n  userId: 1,\n}\n```\n\nFor relations that are included within a list of parent results the `next` function will resolve with a flattened array\nof all the models from each parent result. For example take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  include: {\n    posts: true,\n  },\n});\n```\n\nIf the root result looks like the following:\n\n```javascript\n[\n  {\n    id: 1,\n    name: \"Alice\",\n    posts: [\n      {\n        id: 1,\n        title: \"Hello World\",\n        published: false,\n        userId: 1,\n      },\n      {\n        id: 2,\n        title: \"My first published post\",\n        published: true,\n        userId: 1,\n      },\n    ],\n  },\n  {\n    id: 2,\n    name: \"Bob\",\n    posts: [\n      {\n        id: 3,\n        title: \"Clean Code\",\n        published: true,\n        userId: 2,\n      },\n    ],\n  },\n];\n```\n\nThe `next` function for the \"posts\" relation will resolve with the following:\n\n```javascript\n[\n  {\n    id: 1,\n    title: \"Hello World\",\n    published: false,\n    userId: 1,\n  },\n  {\n    id: 2,\n    title: \"My first published post\",\n    published: true,\n    userId: 1,\n  },\n  {\n    id: 3,\n    title: \"Clean Code\",\n    published: true,\n    userId: 2,\n  },\n];\n```\n\nFor more information on how to modify the results of an `include` action see the [Modifying Results](#modifying-results)\n\n### Select\n\nSimilarly to the `include` action, the `select` action will be called for any selected relation with the `args` field\ncontaining the object or boolean passed as the relation select. For example take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  select: {\n    posts: true,\n    profile: {\n      select: {\n        bio: true,\n      },\n    },\n  },\n});\n```\n\nand for the \"posts\" relation the middleware function will be called with:\n\n```javascript\n{\n  action: 'select',\n  model: 'Post',\n  args: true,\n  scope: {...}\n}\n```\n\nFor the \"profile\" relation the middleware function will be called with:\n\n```javascript\n{\n  action: 'select',\n  model: 'Profile',\n  args: {\n    bio: true,\n  },\n  scope: {...}\n}\n```\n\nThere is another case possible for selecting fields in Prisma. When including a model it is supported to use a select\nobject to select fields from the included model. For example take the following query:\n\n```javascript\nconst result = await client.user.findMany({\n  include: {\n    profile: {\n      select: {\n        bio: true,\n      },\n    },\n  },\n});\n```\n\nFrom v4 the \"select\" action is _not_ called for the \"profile\" relation. This is because it caused two different kinds\nof \"select\" action args, and it was not always possible to distinguish between them.\nSee [Modifying Selected Fields](#modifying-selected-fields) for more information on how to handle selects.\n\n#### Select Results\n\nThe `next` function for a `select` action resolves with the result of the `select` action. This is the same as the\n`include` action. See the [Include Results](#include-results) section for more information.\n\n### Relations\n\nThe `relations` field of the `scope` object contains the relations relevant to the current model. For example take the\nfollowing query:\n\n```javascript\nconst result = await client.user.create({\n  data: {\n    email: \"test@test.com\",\n    profile: {\n      create: {\n        bio: \"Hello World\",\n      },\n    },\n    posts: {\n      create: {\n        title: \"Hello World\",\n      },\n    },\n  },\n});\n```\n\nThe middleware function will be called with the following params for the \"profile\" relation:\n\n```javascript\n{\n  action: 'create',\n  model: 'Profile',\n  args: {\n    bio: \"Hello World\",\n  },\n  scope: {\n    parentParams: {...}\n    relations: {\n      to: { name: 'profile', kind: 'object', isList: false, ... },\n      from: { name: 'user', kind: 'object', isList: false, ... },\n    },\n  },\n}\n```\n\nand the following params for the \"posts\" relation:\n\n```javascript\n{\n  action: 'create',\n  model: 'Post',\n  args: {\n    title: \"Hello World\",\n  },\n  scope: {\n    parentParams: {...}\n    relations: {\n      to: { name: 'posts', kind: 'object', isList: true, ... },\n      from: { name: 'author', kind: 'object', isList: false, ... },\n    },\n  },\n}\n```\n\n### Modifying Nested Write Params\n\nWhen writing middleware that modifies the params of a query you should first write the middleware as if it were vanilla\nmiddleware and then add conditions for nested writes.\n\nSay you are writing middleware that sets a default value when creating a model for a particular model:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    // ignore any non-root actions\n    if (params.scope) {\n      return next(params);\n    }\n\n    // we only want to add default values for the \"Invite\" model\n    if (params.model !== \"Invite\") {\n      return next(params);\n    }\n\n    // handle root actions\n    if (params.action === \"create\") {\n      // set default value for the \"code\" field\n      if (!params.args.data.code) {\n        params.args.data.code = createCode();\n      }\n    }\n\n    if (params.action === \"createMany\") {\n      // set default value for the \"code\" field\n      params.args.data.forEach((data) => {\n        if (!data.code) {\n          data.code = createCode();\n        }\n      });\n    }\n\n    if (params.action === \"upsert\") {\n      // set default value for the \"code\" field\n      if (!params.args.create.code) {\n        params.args.create.code = createCode();\n      }\n    }\n\n    // pass params to next middleware\n    return next(params);\n  })\n);\n```\n\nThen add conditions for the different args and actions that can be found in nested writes:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    // we only want to add default values for the \"Invite\" model\n    if (params.model !== \"Invite\") {\n      return next(params);\n    }\n\n    // handle root actions\n    if (params.action === \"create\") {\n      // when the \"create\" action is from a nested write the data is not in the \"data\" field\n      if (params.scope) {\n        if (!params.args.code) {\n          params.args.code = createCode();\n        }\n      } else {\n        if (!params.args.data.code) {\n          params.args.data.code = createCode();\n        }\n      }\n    }\n\n    // createMany and upsert do not change\n    [...]\n\n    // handle the \"connectOrCreate\" action\n    if (params.action === \"connectOrCreate\") {\n      if (!params.args.create.code) {\n        params.args.create.code = createCode();\n      }\n    }\n\n    // pass params to next middleware\n    return next(params);\n  })\n);\n```\n\n### Modifying Selected Fields\n\nWhen writing middleware that modifies the selected fields of a model you must handle all actions that can contain a\nselect object, this includes:\n\n- `select`\n- `include`\n- `findMany`\n- `findFirst`\n- `findUnique`\n- `findFirstOrThrow`\n- `findUniqueOrThrow`\n- `create`\n- `update`\n- `upsert`\n- `delete`\n \nThis is because the `select` action is only called for relations found _within_ a select object. For example take the\nfollowing query:\n\n```javascript\nconst result = await client.user.findMany({\n  include: {\n    comments: {\n      select: {\n        title: true,\n        replies: {\n          select: {\n            title: true,\n          },\n        },\n      },\n    },\n  },\n});\n```\n\nFor the above query the middleware function will be called with the following for the replies relation:\n\n```javascript\n{\n  action: 'select',\n  model: 'Comment',\n  args: {\n    select: {\n      title: true,\n    },\n  },\n  scope: {...}\n}\n```\n\nand the following for the comments relation:\n\n```javascript\n{\n  action: 'include',\n  model: 'Comment',\n  args: {\n    select: {\n      title: true,\n      replies: {\n        select: {\n          title: true,\n        }\n      },\n    },\n  },\n  scope: {...}\n}\n```\n\nSo if you wanted to ensure that the \"id\" field is always selected you could write the following middleware:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    if ([\n    'select',\n    'include',\n    'findMany',\n    'findFirst',\n    'findUnique',\n    'findFirstOrThrow',\n    'findUniqueOrThrow',\n    'create',\n    'update',\n    'upsert',\n    'delete',\n    ].includes(params.action)) {\n      if (typeof params.args === 'object' && params.args !== null && params.args.select) {\n        return next({\n          ...params,\n          args: {\n            ...params.args,\n            select: {\n              ...params.args.select,\n              id: true,\n            },\n          },\n        });\n      }\n    }\n\n    return next(params)\n  })\n);\n```\n\n### Modifying Where Params\n\nWhen writing middleware that modifies the where params of a query it is very important to first write the middleware as\nif it were vanilla middleware and then handle the `where` action. This is because the `where` action is not called for\nthe root where object and so you will need to handle it manually.\n\nSay you are writing middleware that excludes models with a particular field, let's call it \"invisible\" rather than\n\"deleted\" to make this less familiar:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    // ignore any non-root actions\n    if (params.scope) {\n      return next(params);\n    }\n\n    // handle root actions\n    // don't handle actions that only accept unique fields such as findUnique or upsert\n    if (\n      params.action === \"findFirst\" ||\n      params.action === \"findMany\" ||\n      params.action === \"updateMany\" ||\n      params.action === \"deleteMany\" ||\n      params.action === \"count\" ||\n      params.action === \"aggregate\"\n    ) {\n      return next({\n        ...params,\n        where: {\n          ...params.where,\n          invisible: false,\n        },\n      });\n    }\n\n    // pass params to next middleware\n    return next(params);\n  })\n);\n```\n\nThen add conditions for the `where` action:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    // handle the \"where\" action\n    if (params.action === \"where\") {\n      return next({\n        ...params,\n        args: {\n          ...params.args,\n          invisible: false,\n        },\n      });\n    }\n\n    // handle root actions\n    // don't handle actions that only accept unique fields such as findUnique or upsert\n    if (\n      params.action === \"findFirst\" ||\n      params.action === \"findMany\" ||\n      params.action === \"updateMany\" ||\n      params.action === \"deleteMany\" ||\n      params.action === \"count\" ||\n      params.action === \"aggregate\"\n    ) {\n      return next({\n        ...params,\n        where: {\n          ...params.where,\n          invisible: false,\n        },\n      });\n    }\n\n    // pass params to next middleware\n    return next(params);\n  })\n);\n```\n\n### Modifying Results\n\nWhen writing middleware that modifies the results of a query you should take the following process:\n\n- handle all the root cases in the same way as you would with vanilla Prisma middleware.\n- handle nested results using the `include` and `select` actions.\n\nSay you are writing middleware that adds a timestamp to the results of a query. You would first handle the root cases:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    // ignore any non-root actions\n    if (params.scope) {\n      return next(params);\n    }\n\n    // get result from next middleware\n    const result = await next(params);\n\n    // ensure result is defined\n    if (!result) return result;\n\n    // handle root actions\n    if (\n      params.action === 'findFirst' ||\n      params.action === 'findUnique' ||\n      params.action === 'create' ||\n      params.action === 'update' ||\n      params.action === 'upsert' ||\n      params.action === 'delete'\n    ) {\n      result.timestamp = Date.now();\n      return result;\n    }\n\n    if (params.action === 'findMany') {\n      const result = await next(params);\n      result.forEach(model => {\n        model.timestamp = Date.now();\n      })\n      return result;\n    }\n\n    return result;\n  })\n)\n```\n\nThen you would handle the nested results using the `include` and `select` actions:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    // get result from next middleware\n    const result = await next(params);\n\n    // ensure result is defined\n    if (!result) return result;\n\n    // handle root actions\n    [...]\n\n    // handle nested actions\n    if (\n      params.action === 'include' ||\n      params.action === 'select'\n    ) {\n      if (Array.isArray(result)) {\n        result.forEach(model => {\n          model.timestamp = Date.now();\n        })\n      } else {\n        result.timestamp = Date.now();\n      }\n      return result\n    }\n\n    return result;\n  })\n)\n```\n\nYou could also write the above middleware by creating new objects for each result rather than mutating the existing\nobjects:\n\n```javascript\nclient.$use(\n  createNestedMiddleware((params, next) => {\n    [...]\n\n    if (\n      params.action === 'include' ||\n      params.action === 'select'\n    ) {\n      if (Array.isArray(result)) {\n        return result.map(model => ({\n          ...model,\n          timestamp: Date.now(),\n        }))\n      } else {\n        return {\n          ...result,\n          timestamp: Date.now(),\n        }\n      }\n    }\n\n    return result;\n  })\n)\n```\n\nNOTE: When modifying results from `include` or `select` actions it is important to either mutate the existing objects or\nspread the existing objects into the new objects. This is because `createNestedMiddleware` needs some fields from the\noriginal objects in order to correct update the root results.\n\n### Errors\n\nIf any middleware throws an error at any point then the root query will throw with that error. Any middleware that is\npending will have it's promises rejects at that point.\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-nested-middleware/workflows/prisma-nested-middleware/badge.svg\n[build]: https://github.com/olivierwilkinson/prisma-nested-middleware/actions?query=branch%3Amaster+workflow%3Aprisma-nested-middleware\n[version-badge]: https://img.shields.io/npm/v/prisma-nested-middleware.svg?style=flat-square\n[package]: https://www.npmjs.com/package/prisma-nested-middleware\n[downloads-badge]: https://img.shields.io/npm/dm/prisma-nested-middleware.svg?style=flat-square\n[npmtrends]: http://www.npmtrends.com/prisma-nested-middleware\n[license-badge]: https://img.shields.io/npm/l/prisma-nested-middleware.svg?style=flat-square\n[license]: https://github.com/olivierwilkinson/prisma-nested-middleware/blob/master/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-nested-middleware/blob/master/other/CODE_OF_CONDUCT.md\n","readmeFilename":"README.md"}