{"_id":"@anishghosh103/mongoose-transactions","_rev":"7-8af8cd202bb9a94cb61e757f37b55cb0","name":"@anishghosh103/mongoose-transactions","dist-tags":{"latest":"2.0.0"},"versions":{"1.1.3":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.3","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.3","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"47a3754fc4a7481519d047bc5efd4da73b925fb0","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.3.tgz","fileCount":23,"integrity":"sha512-rxZ4u6SyisQWMNDFVxTm4+zTVQmw3W8UStz8iXVDP3eb+EeJNUu6ZfooivJ2p524DHf7/WstlCX8oIauCK/xuQ==","signatures":[{"sig":"MEUCIEFiGBas6yAesFObvwhL+VwHCq5zxNU+sBVNgG9UayqeAiEAp8iF55suVg0pb7shvy2lJ0H89Fmyof0Bma10umlT69A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":228610},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"0d8a7772afd90cc2848cf1889c5c77bfca83cd84","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"9.9.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"18.18.2","_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.3_1713695525983_0.7061062737483663","host":"s3://npm-registry-packages"}},"1.1.4":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.4","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.4","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"0bac380e183a160f285f7ee37d3eca712542795c","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.4.tgz","fileCount":23,"integrity":"sha512-BcsRaqNvlLLhCfIobQGWdYEqeiDPPzqy+g9zJZKCT7cnkEfOr8CAbNJvMqWUzEYScVA/4wRFHdUSJs9eBQaNbw==","signatures":[{"sig":"MEQCIHHQ82iIpwZuRkStPIoomQf3SCbzS8ySB5V5tAPA0ZFJAiAvSq10CX1039dEfo61e3ieXQS+2FrV+ClJQgv2spMTRw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":242374},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"0d8a7772afd90cc2848cf1889c5c77bfca83cd84","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"9.9.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"18.18.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7","mongoose-delete":"^0.5.4"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.4_1713761495982_0.2962735429115335","host":"s3://npm-registry-packages"}},"1.1.5":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.5","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.5","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"30b16b435394f7c7197726cc2a5182d25c0d3a78","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.5.tgz","fileCount":23,"integrity":"sha512-XW/hgrQkfayxHSKnEVu0k+TzvtFiIjAfeoO+TcreRleIcsZJWXjiqD8467ZswEMkNgGsZLDBXyFV6ui9088pbw==","signatures":[{"sig":"MEQCICwMLeRYSqCeaxJk4/xykOcOLwaQi4KJ1Sz4eCZOlCLNAiBDfgLfCKRr10GcQxQAhq8zeXjJFlzwwxYZLQE6/YGKtg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":243626},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"0d8a7772afd90cc2848cf1889c5c77bfca83cd84","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"9.9.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"16.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7","mongoose-delete":"^0.5.4"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.5_1713977332296_0.5920932014583125","host":"s3://npm-registry-packages"}},"1.1.6":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.6","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.6","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"91f3be1657b3f23b5266edc54291d1f6f2466377","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.6.tgz","fileCount":23,"integrity":"sha512-fkUvvxzC5xmE4mtEXlUg+Cz/Aqp7iMQ62Nez4d+wBc0taaRydOfI29765KIJcEQV3MpZSI3N6K7oglZXt5JlnQ==","signatures":[{"sig":"MEQCIA9tEZIob6Ji6Zih2ddKmqj3wfawIqtuXW6AQRfnYDIuAiBxC9Umvm5sE27bLECiTqawXNb4y36IPQQ9EP84o6+iVA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":248083},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"56a318dd531040d5378f54c3848b4ca2c863cd86","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test:local"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"10.8.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"20.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7","mongoose-delete":"^0.5.4"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.6_1734056908936_0.0658810247243522","host":"s3://npm-registry-packages-npm-production"}},"1.1.7":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.7","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.7","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"62fe197212724dfae5183fa14c3758b48b8b5b63","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.7.tgz","fileCount":23,"integrity":"sha512-HHOETuv3m52fEFxDNJJB7PP4Ozw17OvtgLKkHa+iIBAKhNwNBgmupslh2SwzAb1y8L/PWRFNoPQcJoLr1jtFNw==","signatures":[{"sig":"MEUCIQD7FhGXHZvG5aVjiAFZRoCKM6eNmK2Tnnoji+9MZLvlhgIgeGf4ZbYWp9xrxTntMqUNhlwG/NEPKHY7k/G8mlMonZo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":248625},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"3e2bf6bb1a57e585d5656017a5934c5241ae1cc5","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test:local"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"10.8.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"20.18.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7","mongoose-delete":"^0.5.4"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.7_1734086241198_0.8666640327849049","host":"s3://npm-registry-packages-npm-production"}},"1.1.8":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.8","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.8","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"159a93314e889b79bc34e5659597fb8ddd9b382e","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.8.tgz","fileCount":23,"integrity":"sha512-DE5MSCsaPaqYK/5kRLG97Dc9GenGQeduMCgv8GZIWwXJnZX6nd0NxLWFQ41jJM1AfzSCcSahTra5sQYdUvAl9A==","signatures":[{"sig":"MEQCICleM2DAorsXJ0swbYzvdJjAgJKrT8oCIYGVBcnV3sdfAiBejY/Bn91T7AacyhvbNtsMiEgqKAtD6e30GE0tGHY7zw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":254533},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"3e2bf6bb1a57e585d5656017a5934c5241ae1cc5","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test:local"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"9.9.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"18.18.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7","mongoose-delete":"^0.5.4"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.8_1734350223678_0.3500310424363149","host":"s3://npm-registry-packages-npm-production"}},"1.1.9":{"name":"@anishghosh103/mongoose-transactions","version":"1.1.9","keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","_id":"@anishghosh103/mongoose-transactions@1.1.9","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"dist":{"shasum":"e46889537b84bf333fb67f3021b4f63ffa391226","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-1.1.9.tgz","fileCount":23,"integrity":"sha512-FRu6F9xtQHblH3Z2Rzg9mKA7Zeb8KtfWPt1VJwun0jboV/Ws0UVKzwxUJECcQMoLXu3gmwbfZGleYi8rihBGbQ==","signatures":[{"sig":"MEUCIQD1cyTvkDz+ehM4exgC/4C0rOsHoxmmk4Np28dngmgapgIgQwiN37RDOJDVcnOQBstGN7UGKh3VScBtn74Jmk/Vz34=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":255853},"jest":{"bail":false,"notify":false,"verbose":true,"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","transform":{"\\.(ts|tsx)$":"ts-jest"},"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"]},"main":"index.js","gitHead":"3e2bf6bb1a57e585d5656017a5934c5241ae1cc5","scripts":{"lint":"tslint -c tslint.json 'src/**/*.ts' '__tests__/**/*.ts'","test":"jest --forceExit --runInBand","build":"tsc -w false","pretest":"npm run lint","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__"},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"prettier":{"semi":false,"tabWidth":4,"singleQuote":true},"pre-commit":["test:local"],"repository":{"url":"git+https://github.com/anishghosh103/mongoose-transactions.git","type":"git"},"_npmVersion":"9.9.2","description":"Atomicity and Transactions for mongoose","directories":{},"_nodeVersion":"18.18.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^25.1.0","tslint":"^6.1.0","core-js":"^3.6.4","ts-jest":"^25.2.1","mongoose":"^5.9.2","prettier":"^2.0.2","pre-commit":"^1.2.2","typescript":"^3.8.3","@types/jest":"^25.1.4","@types/node":"^13.9.3","@types/core-js":"^2.5.3","@types/mongoose":"^5.7.7","mongoose-delete":"^0.5.4"},"peerDependencies":{"mongoose":">=4.11.1"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-transactions_1.1.9_1734350904040_0.5101599257873353","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@anishghosh103/mongoose-transactions","version":"2.0.0","description":"Atomicity and Transactions for mongoose","main":"index.js","scripts":{"lint":"eslint","lint:fix":"eslint --fix","pretest":"npm run lint","test":"jest --forceExit --runInBand","test:local":"jest --forceExit --runInBand --detectOpenHandles --rootDir=./__tests__","build":"tsc -w false"},"pre-commit":["test:local"],"repository":{"type":"git","url":"git+https://github.com/anishghosh103/mongoose-transactions.git"},"keywords":["mongoose","transactions"],"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","peerDependencies":{"mongoose":">=8.0.0"},"devDependencies":{"@eslint/js":"^8.57.0","@types/core-js":"^2.5.3","@types/jest":"^25.1.4","@types/node":"^22.12.0","core-js":"^3.6.4","eslint":"^8.57.0","globals":"^15.8.0","jest":"^29.7.0","mongoose":"^8.5.0","mongoose-delete":"^1.0.2","pre-commit":"^1.2.2","prettier":"^2.0.2","ts-jest":"^29.2.2","typescript":"^5.5.2","typescript-eslint":"^7.16.0"},"jest":{"testEnvironment":"node","moduleFileExtensions":["ts","tsx","js"],"transform":{"\\.(ts|tsx)$":"ts-jest"},"testRegex":"/__tests__/.*\\.(ts|tsx|js)$","verbose":true,"notify":false,"bail":false},"prettier":{"semi":false,"singleQuote":true,"tabWidth":4},"publishConfig":{"access":"public"},"_id":"@anishghosh103/mongoose-transactions@2.0.0","gitHead":"5b946a516413a12b46dca8e4cef2c908302d4c96","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-oLAElpGyaR2tSNJaxx+PTW/DJb3eCQMzZzCpMOTdQ/5couCwUWV/MvO5/qVFG6SfEGmVpitpL1O/NjezspYIzA==","shasum":"142e6e03004ad4d7a1ec8a50f1864bdef0f7832f","tarball":"https://registry.npmjs.org/@anishghosh103/mongoose-transactions/-/mongoose-transactions-2.0.0.tgz","fileCount":22,"unpackedSize":206165,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICvOW9QZMYvX9YguSGcb0grEYu++8bXpWWQMspdmDa7SAiEA8BFu3lXOxDYG+HQMgR5dmnY8YCJ83027WVsSBsx0EXA="}]},"_npmUser":{"name":"anishghosh103","email":"anishghosh103@gmail.com"},"directories":{},"maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mongoose-transactions_2.0.0_1738245398604_0.6014230210591291"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-21T10:32:05.852Z","modified":"2025-01-30T13:56:39.772Z","1.1.3":"2024-04-21T10:32:06.217Z","1.1.4":"2024-04-22T04:51:36.205Z","1.1.5":"2024-04-24T16:48:52.458Z","1.1.6":"2024-12-13T02:28:29.243Z","1.1.7":"2024-12-13T10:37:21.471Z","1.1.8":"2024-12-16T11:57:03.919Z","1.1.9":"2024-12-16T12:08:24.236Z","2.0.0":"2025-01-30T13:56:39.002Z"},"bugs":{"url":"https://github.com/daton89-topperblues/mongoose-transactions/issues"},"author":{"name":"Nicola Bonavita @topperblues, Antonio D'Angelo @daton89"},"license":"Apache-2.0","homepage":"https://github.com/daton89-topperblues/mongoose-transactions#readme","keywords":["mongoose","transactions"],"repository":{"type":"git","url":"git+https://github.com/anishghosh103/mongoose-transactions.git"},"description":"Atomicity and Transactions for mongoose","maintainers":[{"name":"anishghosh103","email":"anishghosh103@gmail.com"}],"readme":"[![dm](https://img.shields.io/npm/dm/mongoose-transactions.svg)](https://www.npmjs.com/package/mongoose-transactions)\n[![version](https://img.shields.io/npm/v/mongoose-transactions.svg)](https://www.npmjs.com/package/mongoose-transactions)\n[![GitHub stars](https://img.shields.io/github/stars/daton89-topperblues/mongoose-transactions.svg?style=social&label=Star)](https://www.github.com/daton89-topperblues/mongoose-transactions)\n[![GitHub forks](https://img.shields.io/github/forks/daton89-topperblues/mongoose-transactions.svg?style=social&label=Fork)](https://github.com/daton89-topperblues/mongoose-transactions)\n[![mongoose-transactions](https://raw.githubusercontent.com/daton89-topperblues/mongoose-transactions/master/docs/img/mongoose-transactions.png)](https://www.npmjs.com/package/mongoose-transactions)\n\n# Introduction\n\n###### Atomicity and Transactions for mongoose\n\nA transaction is a sequential group of database manipulation operations, which is performed as if it were one single work unit. In other words, a transaction will never be complete unless each individual operation within the group is successful. If any operation within the transaction fails, the entire transaction will fail.\n\nWith this module, you can :\n\nPractically, you will club many MongoDB queries into a group and you will execute all of them together as a part of a transaction.\n\n### Getting started\n\nInstall module:\n\n```sh\n$ npm i mongoose-transactions\n```\n\nInstall and save module in your project:\n\n```sh\n$ npm i -S mongoose-transactions\n```\n\n#### API\n\nCreate new instance:\n\n```js\nconst Transaction = require('mongoose-transactions')\n\nconst transaction = new Transaction()\n```\n\nAdd an operation:\n\n```js\n/**\n * Create the insert transaction and rollback states.\n * @param modelName - The string containing the mongoose model name.\n * @param data - The object containing data to insert into mongoose model.\n * @returns id - The id of the object to insert.\n */\nconst id = transaction.insert('modelName', object)\n/**\n * Create the findOneAndUpdate transaction and rollback states.\n * @param modelName - The string containing the mongoose model name.\n * @param findId - The id of the object to update.\n * @param dataObj - The object containing data to update into mongoose model.\n * @param options - The update operation options object as { new: true }\n */\ntransaction.update('modelName', id, object, options)\n/**\n * Create the findOneAndUpdate transaction and rollback states.\n * @param modelName - The string containing the mongoose model name.\n * @param findObj - The filter to get the the object to update.\n * @param dataObj - The object containing data to update into mongoose model.\n * @param options - The update operation options object as { new: true }\n */\ntransaction.updateOne('modelName', findObj, object, options)\n/**\n * Create the remove transaction and rollback states.\n * @param modelName - The string containing the mongoose model name.\n * @param findId - The id of the object to delete.\n */\ntransaction.remove('modelName', id)\n/**\n * Create the remove transaction and rollback states.\n * @param modelName - The string containing the mongoose model name.\n * @param findObj - The filter to get the the object to delete.\n */\ntransaction.removeOne('modelName', findObj)\n```\n\nRun operations:\n\n```js\n/**\n * Run the operations and check errors.\n * @returns Array of objects - The objects returned by operations\n *          Error - The error object containing:\n *                  data - the input data of operation\n *                  error - the error returned by the operation\n *                  executedTransactions - the number of executed operations\n *                  remainingTransactions - the number of the not executed operations\n */\ntransaction.run() // return Promise\n```\n\nRollback operations:\n\n```js\n/**\n * Rollback the executed operations if any error occurred.\n * @param   stepNumber - (optional) the number of the operation to rollback - default to length of\n *                            operation successfully runned\n * @returns Array of objects - The objects returned by rollback operations\n *          Error - The error object containing:\n *                  data - the input data of operation\n *                  error - the error returned by the operation\n *                  executedTransactions - the number of rollbacked operations\n *                  remainingTransactions - the number of the not rollbacked operations\n */\ntransaction.rollback() // return Promise\n```\n\nClean operations:\n\n```js\n/**\n * Clean the transactions object to begin a new transaction on the same instance.\n */\ntransaction.clean() // clean the previous operation\n```\n\nFull example:\n\n```js\nconst Transaction = require('mongoose-transactions')\nconst transaction = new Transaction()\n\nconst person = 'Person' // the name of the registered schema\n\nconst jonathanObject = {\n    age: 18,\n    name: 'Jonathan',\n}\nconst aliceObject = {\n    age: 23,\n    name: 'Alice',\n}\n\nasync function start() {\n    try {\n        const jonathanId = transaction.insert(person, jonathanObject)\n        transaction.update(person, jonathanId, aliceObject)\n        transaction.remove(person, 'fakeId') // this operation fail\n        const final = await transaction.run()\n        // expect(final[0].name).toBe('Jonathan')\n    } catch (error) {\n        console.error(error)\n        const rollbackObj = await transaction.rollback().catch(console.error)\n        transaction.clean()\n        //  expect(rollbacks[0].name).toBe('Alice')\n        //  expect(rollbacks[0].age).toBe(aliceObject.age)\n        //  expect(rollbacks[1].name).toBe('Jonathan')\n        //  expect(rollbacks[1].age).toBe(bobObject.age)\n    }\n}\n\nstart()\n```\n\n### Operation Object\n\nYou can get the operations object by calling getOperations method.\n\n```js\n/**\n * Get transaction operations array from transaction object or collection on db.\n * @param transactionId - Optional. If the transaction id is passed return the elements of the transaction id\n *                                  else return the elements of current transaction (default null).\n */\nconst operations = transaction.getOperations()\n```\n\nFor debug purposes you can inspect the array of transaction operation object that is designed like this:\n\n```js\n// console.log(operations)\n;[\n    {\n        /** The transaction type to run */\n        type: string, // 'insert', 'update', 'remove'\n        /** The transaction type to execute for rollback */\n        rollbackType: string, // 'remove', 'update', 'insert'\n        /** The mongoose model instance */\n        model: any, // compiled mongoose model\n        /** The mongoose model name */\n        modelName: string, // 'Person'\n        /** The mongoose model instance before transaction if exists */\n        oldModel: any, // model used for rollback\n        /** The id of the object */\n        findId: any,\n        /** The data */\n        data: any,\n        /** options configuration query */\n        options: any,\n        /** The current status of the operation */\n        status: Status,\n    },\n]\n\n/** The operations possible states are: */\nStatus = ['Pending', 'Success', 'Error', 'Rollback', 'ErrorRollback']\n```\n\nThe status is automatically updated, so you can check the current status of your transaction operations every time you need\n\n### Using database to save transactions\n\nCreate new transaction instance with the ability to store and load transaction object to/form database.\n\n```js\nconst useDB = true\nconst transaction = new Transaction(useDB)\n```\n\nFirst of all you need to get the actual transaction id, you can use the id to load the transaction object from database.\n\n```js\n/**\n * If the instance is db true, return the actual or new transaction id.\n * @throws Error - Throws error if the instance is not a db instance.\n */\nconst transId = await transaction.getTransactionId()\n```\n\nYou can load a transaction object from database with the loadDbTransaction fuction.\n\n```js\n/**\n * Load transaction from transaction collection on db.\n * @param transactionId - The id of the transaction to load.\n * @trows Error - Throws error if the transaction is not found\n */\nawait transaction.loadDbTransaction(transId)\n```\n\nYou can save the operations object on database by calling saveOperations method.\n\n```js\n/**\n * Save transaction operations array on db.\n * @throws Error - Throws error if the instance is not a db instance.\n * @return transactionId - The transaction id on database\n */\nconst transId = await transaction.saveOperations()\n```\n\nFull example:\n\n```js\nconst Transaction = require('mongoose-transactions')\nconst useDB = true\nconst transaction = new Transaction(useDB)\n\nconst person: string = 'Person'\n\nconst tonyObject: any = {\n    age: 28,\n    name: 'Tony',\n}\n\nconst nicolaObject: any = {\n    age: 32,\n    name: 'Nicola',\n}\n\nasync function start() {\n    // create operation on transaction instance\n    const id = transaction.insert(person, tonyObject)\n    transaction.update(person, id, nicolaObject, { new: true })\n\n    // get and save created operation, saveOperations method  return the transaction id saved on database\n    const operations = transaction.getOperations()\n    const transId = await transaction.saveOperations()\n\n    // create a new transaction instance\n    const newTransaction = new Transaction(true)\n\n    // load the saved operations in the new transaction instance using the transId\n    await newTransaction.loadDbTransaction(transId)\n\n    // if you need you can get the operations object\n    const newOperations = newTransaction.getOperations()\n\n    // finally run and rollback\n    try {\n        const final = await newTransaction.run()\n    } catch (err) {\n        const rolled = await newTransaction.rollback()\n    }\n}\n\nstart()\n```\n\n## More examples\n\nSee tests folder for more examples\n\nFeel free to open issues, fork project, and collaborate with us!\n\n## Contribute\n\nClone repository locally and install dependencies:\n\n```sh\n$ git clone https://github.com/daton89-topperblues/mongoose-transactions.git\n$ cd mongoose-transactions\n$ npm i\n```\n\nFork project and open pull request\n\nCurrently development runs with:\n\nNode.js v12.13.0\n\nMongoose v5.9.2\n\nTypescript v2.9.2\n\nJest v25.1.0\n\n## Changelog\n\n1.1.0 add transaction persistence\n\n1.0.4 fix exports default error\n\n### Contributors\n\n[@topperblues](https://github.com/topperblues) Nicola Bonavita\n\n[@daton89](https://github.com/daton89) Toni D'Angelo\n","readmeFilename":"README.md"}