{"_id":"@apiratorjs/locking","_rev":"20-f88d787d8a7e78158bf554a968e49757","name":"@apiratorjs/locking","dist-tags":{"latest":"5.0.0"},"versions":{"1.0.0":{"name":"@apiratorjs/locking","version":"1.0.0","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.0.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"8ec2f4a4dd559a0e152bab911e7a3d64da427c12","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.0.0.tgz","fileCount":35,"integrity":"sha512-IoXhy34xY0+SvXVWSzKpyeKTeCqWs2AL0ZyXiRTZvidBaV/VDB/pUo1ZbKOBMC7L/MS1P+lm8J9ax60Yo+Rbuw==","signatures":[{"sig":"MEUCIC8/Yt/n7k+hYdULQN7aAgtsNaq6TxzrIIkbqoqPT7oLAiEAymNv2ShGSYeoffblqNhjjkVGvy1Gk1Y89s5K5bQR9TI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40477},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"8bf0bfd4f498c8496ba9d909cc740e45d0c02e19","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.0.0_1740926234568_0.74224342639415","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@apiratorjs/locking","version":"1.1.0","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.1.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"ad9580c6c3ce3dce40ab8e75b9d4fda0e8c10585","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.1.0.tgz","fileCount":35,"integrity":"sha512-WC1nnJtyS97AtRxiyZcVZyaR20wd9ZfTWItsUtU49fe4dMhsmLJbr4OzF80pTfTUgNfpaZ7huzWd0BlwQiqIig==","signatures":[{"sig":"MEUCIAPvP6M8LEsHxgvuc9kqm19bciKODb5QTuHNbBY+639PAiEA5ZnnF+jCIPY5CGnfTwPArk5m95HwczqUJvHXGtkl6S4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44853},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"8ecd102f90cddfb4535bca30686f7a0eb0585ed9","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.1.0_1740927244082_0.41696801821367746","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@apiratorjs/locking","version":"1.1.1","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.1.1","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"6fedda03142858011cb958abf8c1dd7958c2dd03","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.1.1.tgz","fileCount":35,"integrity":"sha512-5f0vYeQd1JP3N3wkjEnaD+lQftPyKehw5EkwDW+VYxYodyQ4/uZa+00jTl1Axj1qgpa/2DmJew7+btOH7ilVvA==","signatures":[{"sig":"MEUCIQDqqLA0tGonZ5ExSOXMiBKkVzdmSKGxBdd/1vV9UMf7oAIgRq/mCegsgAQxdgTd+8y3VzY/aNugSad2Xu9utIXxcAE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46165},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"505a8241777a153fd2f6fe24ca4957bc3a1fb98f","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.1.1_1740927954790_0.1608045338035342","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@apiratorjs/locking","version":"1.1.2","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.1.2","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"7026801fe5829f5937e623ec7466e15409f36aae","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.1.2.tgz","fileCount":35,"integrity":"sha512-0PHlUvcIRt6TsgmshRo5R17W6YGAAYr6ERP3sCIndn+wKWhj5V+EPlgHSf5Lud8OUMHWwUbdj4cz0MDhSph09w==","signatures":[{"sig":"MEQCIGSxfaW4j22WMREXgd+eSNWplcouDUnf5vq/H9K6bTsAAiA6HaoDcbk9XxKFcp6nT7J0MZvga+IhvEU4a7CD89S1vQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":49811},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"62ed125c2bf770ddeda0255de3f49e3eb68cfd2d","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.1.2_1740929231858_0.06807555508307761","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@apiratorjs/locking","version":"1.1.3","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.1.3","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"dd98caeac60d252dc0a37c1080ac8a4dc74c245c","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.1.3.tgz","fileCount":35,"integrity":"sha512-T4b5HU/Q0sqGG/3pF1F4NAVRK100+Vll8t1sstrBiqZdSMZvhMGInwzdS5KJKkWAlkPFO/+OLxHBycXcq6GBnw==","signatures":[{"sig":"MEYCIQDS+gVp4YVqALonBDXcc0Gm0/2VIA92tFdgiklAJ0HYMgIhAKYagkx8hUDXk4UmM4M10ZrpGazY45HT+wW4W4iyF84G","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":49945},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"d0d677c3ac57c3cdcd4e70fc84799c1e6f044606","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.1.3_1740937491794_0.7084874121618576","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@apiratorjs/locking","version":"1.2.0","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.2.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"5122149a365cdb15055373e86a1b4b4b0377876b","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.2.0.tgz","fileCount":39,"integrity":"sha512-NHW8ZAumUGVSouKCe/X6jzAN94qxxpGsnmoRWQQQe1Tt1wHOkbqqhScTjc7fHz5zHCaW8IaEqhr8aBEXkklGgA==","signatures":[{"sig":"MEQCIHBb0w0ppmjHjNT20jt/W18cprVkZoAkTC9HJUtkLQn2AiAClXqwYyLHPqiwlE5a32j1755yQzbOvTY2H/FIqDyEAA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56567},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"f56b3db223028a9139ca93b3f743c210937bc83a","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.2.0_1741015255002_0.04943674711422741","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@apiratorjs/locking","version":"1.2.1","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.2.1","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"6c1ad28bb948f789db92eb69c5d9f3374f89d1a9","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.2.1.tgz","fileCount":39,"integrity":"sha512-Ibwe36uo+aoCYRKKtzxKyGPIeQGx3Gq7JrSu/5WaTUy/wXC6ZVU7+WaBay5H5jGxfC4ysgoCeEwneZ3efN59vQ==","signatures":[{"sig":"MEQCIBAmbEpONBZmdKMWl9w5v2Sm16l4vftF0N5lStnA1dWPAiByaHLrXfEZl0XPBg9NDINbMCG2jRn1Ix921fSMVVhctw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56651},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"aa1be7ffa200f79d86c9fbcd7f835ffc54c0acee","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.2.1_1741070919314_0.4243905378900463","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@apiratorjs/locking","version":"1.3.0","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.3.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"e7ea52147f104736a1cfcb5ee17d247a5e7e647f","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.3.0.tgz","fileCount":39,"integrity":"sha512-mOHn1CbCKsn95mXrA5bst/Bu74uM9Y9E2tT6fN9aMo68U/A7CrxEjImmqkOQAoBj3OqbbJD9otviEJ1rEog30w==","signatures":[{"sig":"MEYCIQCEAzFLsrQZL7m/pcueyvxWOXnGxspN29b6+5DVI4lWoAIhAJt+KpnPRbL+TXfgjeS1daysXi6JsyjUmYH4m25QzIG/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58639},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"4ac7da46cea40b0efcc36db11357bb2d2d17cf3f","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.3.0_1741119603817_0.9514980470082701","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"@apiratorjs/locking","version":"1.3.1","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@1.3.1","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"9d3da4ba00250ad3181eb6f4e6bdf731eae4f5ef","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-1.3.1.tgz","fileCount":39,"integrity":"sha512-YzF5baJowhpVjp9rijgCtciy7Tf4NJKTrVyfgOX+YFpEUVcQhzBpZILHNBHAHnkwItpTZcobX/J1QerpGVeb1Q==","signatures":[{"sig":"MEYCIQCA6mYgzfz/sK9r3IbtdvVnI8JBVYDUGIyQCO64foNnYAIhAJ4qiaf2IRJvynSNqY6nlrs6jl5Cs8r+AoDG1zwMatSL","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58683},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"f2eac33d49b08074866a8076346abbcffb64d3f1","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_1.3.1_1741120999747_0.7076845866138914","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@apiratorjs/locking","version":"2.0.0","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@2.0.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"23b52b29b551a2cb503cc02219f9f3ca482394a4","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-2.0.0.tgz","fileCount":43,"integrity":"sha512-VtQse+VDAOFA4tHYsuenDRkieVmePUdeuVaqPvwsNeAmn7/Md4242jJ/jgpSZo7uEY7Olkh/WTuYApIyHUnWrA==","signatures":[{"sig":"MEUCIFtbdaCAieWsCRF8GB9rpW7H1LPeAB5yQfXP1B7CtR4pAiEAhbQkYyijOe9mx5t+/431wXs1k+s316PiWaTaGLybQK0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59448},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"0475ebf12276a7e8b85b3923564d5040f43414ba","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_2.0.0_1741157289085_0.35430579167289555","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@apiratorjs/locking","version":"2.0.1","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@2.0.1","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"836ca60ee351dd1bb7040cb111ad73366304216c","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-2.0.1.tgz","fileCount":43,"integrity":"sha512-2fT1qtYfkYR5FgjIA/26P4ng55PW/TGvhcNo0Xvur1GhX2TUrW7liJHNTNj6eq6kPALST6ljwAMPwwiJ40N4wA==","signatures":[{"sig":"MEUCIQDcGIxMJ3NA6N4tUr/m82u3iZpKHwkU0BbqRHZDHJ1qEgIger3vjCUBbSNL0rK0UegnKSChD5v1M9nTM3YrVhnG3g4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60432},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"cb119c915d8bc598d9ed11abcbc46814e8bee6ff","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_2.0.1_1741266787252_0.22881947253133728","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@apiratorjs/locking","version":"2.0.2","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@2.0.2","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"1e6c5c643ab042b3bbb8ea0944a1c19cb51ca40d","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-2.0.2.tgz","fileCount":43,"integrity":"sha512-vbW+ux6nAvnFSPJhmg8l9OANdf4YdQKGDLjDDPxSFVuOiq8K7XpqbqReb59AIU7cdw2N8fOLVxort/7fw0+MZw==","signatures":[{"sig":"MEYCIQDN+ehlXEo7uUzRogW67NK10z02C1zdXR48r/GWZ3AH9wIhANzK6bNjcbrjX0zDDdciF4rhchgOd3fDKt3a4R0yR4jh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60549},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"3aa167afa26a1c33d12c8e316fc743f89252d0e1","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_2.0.2_1741267221958_0.42459141475816997","host":"s3://npm-registry-packages-npm-production"}},"2.0.3":{"name":"@apiratorjs/locking","version":"2.0.3","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@2.0.3","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"d713434bfb32c52bbe3af528b44bc169d923289a","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-2.0.3.tgz","fileCount":43,"integrity":"sha512-gkTKGS7VnThFe4SSliE4htS81I+om/u8HMhqURkqLGigg7KmdnvhsgJft8MrbaFUQDbA1VXbVkHM8382XkLFdg==","signatures":[{"sig":"MEQCIGlbvbPDCVPaK00iQQIjfjSucv8/4Rndyl+XdemMTSWMAiAyr5iynFmD9sseGqO6hEVLtrfMD0Db6czyUZ/qZNwGEg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60600},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"96adc9aff661625d694a6e19c88025d615807090","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_2.0.3_1741267469789_0.417533939210994","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@apiratorjs/locking","version":"3.0.0","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@3.0.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"72c0ab50b190d6dfad9556586c646d08ecdf1a0f","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-3.0.0.tgz","fileCount":43,"integrity":"sha512-rtXIoylEtMIXcoIZq6EamSZWhB9IrXIXLjw7cNV842yJ5yZyMJvTbEyiCzE9Ffj75GCyyG1Oy54bQesJ7y/+gw==","signatures":[{"sig":"MEQCIFQCnh9jvAnp0zE5rKnValHYESIY9tDxrVV/OobBoGAPAiBpahFCEV+F/UcbeE/wv+0b89mXpSaobj73rsTCY+oD4g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60061},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"511e5804733dc7b3e2b1255049e4bca43bc1d9b1","scripts":{"test":"node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_3.0.0_1742048735392_0.400299763632477","host":"s3://npm-registry-packages-npm-production"}},"3.0.2":{"name":"@apiratorjs/locking","version":"3.0.2","keywords":["locking","mutex","semaphore","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@3.0.2","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"2e0e9f8798605782a734ed93d5e48aaeec365d3a","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-3.0.2.tgz","fileCount":43,"integrity":"sha512-MAVKlJv3SMrdL0s910Us4BJcPNdXjTZa6YVz2PniNmqlo6uT/40HCdyUHLBUnQSTdUAVS0zH/srs8tXG48ns9w==","signatures":[{"sig":"MEUCIHysJBzh7y+NmikpRbg3W1/YZ/HKCNqEZjoiI3eKdUQ/AiEA4SEK0zYc91/cCF0BK0ucZCjEJKXT2IsFT/VQXYWV+gY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":60293},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"eda781821b03c308dc6266f5bb319badf9303d36","scripts":{"test":"npm run build && node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes and semaphores) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"23.7.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_3.0.2_1742662237418_0.9172884024517429","host":"s3://npm-registry-packages-npm-production"}},"4.0.0":{"name":"@apiratorjs/locking","version":"4.0.0","keywords":["locking","mutex","semaphore","read-write-lock","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","distributed-read-write-lock","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@4.0.0","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"34fecd809f68f90ceaf6466a3ab1d995adfb830b","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-4.0.0.tgz","fileCount":55,"integrity":"sha512-NulXyLUSTtpkO8gegJqoil3IEgKzwNw5R0RkAfFfZQecuar/35Xb91wIJryBp1eLWbnkkfg+pvgZqdLro3wHFQ==","signatures":[{"sig":"MEYCIQDNeiK2gEMOSvInBVj9j5XCYcTB5mPN42PTbGw+uo203wIhAI36FfPsdMApcVGCT0yOhbvL+yLSAlLoAn1xcqluztM5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":104013},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"59034485a7e99f1a4659943273e66b7e6e42fa88","scripts":{"test":"npm run build && node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.8.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes, semaphores, and read-write locks) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"20.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_4.0.0_1744890047444_0.6128200689035093","host":"s3://npm-registry-packages-npm-production"}},"4.0.1":{"name":"@apiratorjs/locking","version":"4.0.1","keywords":["locking","mutex","semaphore","read-write-lock","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","distributed-read-write-lock","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@4.0.1","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"ca8192c4d074d8938fb55b7a9e7b08021a6106d4","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-4.0.1.tgz","fileCount":55,"integrity":"sha512-vwlrvKciWhm39iblSszaxoSBYM/CUKgFTnn0ioHmb+ESCRKe+bKGUrkDjD4agGDeYZyfzCsZfCwUeNlX8X73ug==","signatures":[{"sig":"MEUCIHpT+L+H6UC4P++WHfQTxJ5PGyjariugiEr78bZ3qjoeAiEAhDA420uM8zYi4uWidLcIKsaM8eIqEs/iNK578J0ZG4c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":103942},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"59034485a7e99f1a4659943273e66b7e6e42fa88","scripts":{"test":"npm run build && node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.8.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes, semaphores, and read-write locks) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"20.19.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_4.0.1_1744890306375_0.7963923449242922","host":"s3://npm-registry-packages-npm-production"}},"4.0.2":{"name":"@apiratorjs/locking","version":"4.0.2","keywords":["locking","mutex","semaphore","read-write-lock","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","distributed-read-write-lock","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@4.0.2","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"493ef074098c9adb770fc0bfef5095e12a8d8e43","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-4.0.2.tgz","fileCount":55,"integrity":"sha512-+aDM2zUwFBoaImeyziEXMgnSvNSPiicBaxG63JmHUckFQPUo4vWpoUvp2lJ1RTEE/ins5vXk+38+FzPuMTF3DQ==","signatures":[{"sig":"MEUCIQCUGmHoi6xdHK/dhfmXOD60C/h/CnJ2ePZBvys8tbjA5AIgfGdHiUv03Pr/TqW5upLfiD9sg6oQON33lTx33Im9dGs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":104836},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"4fd77daccdb7ececf3b0397d3ef531e74df0e0ea","scripts":{"test":"npm run build && node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.8.2","description":"A lightweight library providing both local and distributed locking primitives (mutexes, semaphores, and read-write locks) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"20.19.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_4.0.2_1748860546975_0.9980336758215134","host":"s3://npm-registry-packages-npm-production"}},"4.0.3":{"name":"@apiratorjs/locking","version":"4.0.3","keywords":["locking","mutex","semaphore","read-write-lock","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","distributed-read-write-lock","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"author":{"url":"https://oleksiizaitsev.com","name":"Oleksii Zaitsev"},"license":"MIT","_id":"@apiratorjs/locking@4.0.3","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"homepage":"https://github.com/apiratorjs/locking#readme","bugs":{"url":"https://github.com/apiratorjs/locking/issues"},"dist":{"shasum":"37c115e61c16b850dcdf902c661e17192302938c","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-4.0.3.tgz","fileCount":59,"integrity":"sha512-c/7+P0fn8FnTuLLpdn0qxJghjm+RaGV6nGCuQ+yIVrZ3Ssox244yyBR6rKHZlRCLTAQFs4JkRAgLPizyUSLOxA==","signatures":[{"sig":"MEYCIQDSUkcyMDNS+x67goomazyYMyp/kZShsffSibh38RWGXgIhAIgnI9fKXKadwJ7vcxo42Glp5fg/bb/JtgZLNltC1dBf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":110471},"main":"dist/src/index.js","type":"commonjs","types":"dist/src/index.d.ts","engines":{"node":">=16.4.0"},"gitHead":"8eeffd5ef37a8b8aa0580906dff679b571c26350","scripts":{"test":"npm run build && node --test dist/test","build":"rm -rf dist && tsc","watch":"tsc --watch","prepublishOnly":"npm run build && npm test"},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"repository":{"url":"git+https://github.com/apiratorjs/locking.git","type":"git"},"_npmVersion":"10.9.4","description":"A lightweight library providing both local and distributed locking primitives (mutexes, semaphores, and read-write locks) for managing concurrency in Node.js.","directories":{},"_nodeVersion":"22.21.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.2","typescript":"^5.7.3","@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/locking_4.0.3_1768904296315_0.4265140143533732","host":"s3://npm-registry-packages-npm-production"}},"5.0.0":{"name":"@apiratorjs/locking","version":"5.0.0","description":"A lightweight library providing both local and distributed locking primitives (mutexes, semaphores, and read-write locks) for managing concurrency in Node.js.","author":{"name":"Oleksii Zaitsev","url":"https://oleksiizaitsev.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/apiratorjs/locking.git"},"main":"dist/src/index.js","types":"dist/src/index.d.ts","publishConfig":{"access":"public"},"keywords":["locking","mutex","semaphore","read-write-lock","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","distributed-read-write-lock","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"type":"commonjs","engines":{"node":">=16.4.0"},"devDependencies":{"@types/node":"^22.13.1","tsx":"^4.19.2","typescript":"^5.7.3"},"scripts":{"build":"rm -rf dist && tsc","watch":"tsc --watch","test":"npm run build && node --test dist/test"},"_nodeVersion":"26.0.0","_id":"@apiratorjs/locking@5.0.0","dist":{"integrity":"sha512-zmaqMvm4JBH6Pz/g8IFkJ+lByvLm/i3Ww93HYUN/jQvbhq3ugUBUZsqhL4LrGlCKSXVKYw/14lz+DCuUX3wvmg==","shasum":"b869e9820aa7c83bd74d4a0ede47288681bdce0a","tarball":"https://registry.npmjs.org/@apiratorjs/locking/-/locking-5.0.0.tgz","fileCount":52,"unpackedSize":139312,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDqtahk5chMXb1+wdRI3DardpC3Lg96bSw4yR+GgSNJuAIgAWnEb2B6NccZMsr7n2+AWDNR3jATdsXoRqxifNnz1rw="}]},"_npmUser":{"name":"apiratorjs","email":"apirator.framework@gmail.com"},"directories":{},"maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/locking_5.0.0_1785072676525_0.7735625244557502"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-02T14:37:14.455Z","modified":"2026-07-26T13:31:16.808Z","1.0.0":"2025-03-02T14:37:14.773Z","1.1.0":"2025-03-02T14:54:04.244Z","1.1.1":"2025-03-02T15:05:54.958Z","1.1.2":"2025-03-02T15:27:12.082Z","1.1.3":"2025-03-02T17:44:51.975Z","1.2.0":"2025-03-03T15:20:55.210Z","1.2.1":"2025-03-04T06:48:39.488Z","1.3.0":"2025-03-04T20:20:04.008Z","1.3.1":"2025-03-04T20:43:19.962Z","2.0.0":"2025-03-05T06:48:09.285Z","2.0.1":"2025-03-06T13:13:07.480Z","2.0.2":"2025-03-06T13:20:22.156Z","2.0.3":"2025-03-06T13:24:29.961Z","3.0.0":"2025-03-15T14:25:35.582Z","3.0.2":"2025-03-22T16:50:37.580Z","4.0.0":"2025-04-17T11:40:47.654Z","4.0.1":"2025-04-17T11:45:06.561Z","4.0.2":"2025-06-02T10:35:47.153Z","4.0.3":"2026-01-20T10:18:16.450Z","5.0.0":"2026-07-26T13:31:16.671Z"},"author":{"name":"Oleksii Zaitsev","url":"https://oleksiizaitsev.com"},"license":"MIT","keywords":["locking","mutex","semaphore","read-write-lock","concurrency","synchronization","distributed-locking","distributed-mutex","distributed-semaphore","distributed-read-write-lock","critical-section","race-condition","resource-sharing","thread-safety","concurrent-access"],"repository":{"type":"git","url":"git+https://github.com/apiratorjs/locking.git"},"description":"A lightweight library providing both local and distributed locking primitives (mutexes, semaphores, and read-write locks) for managing concurrency in Node.js.","maintainers":[{"name":"apiratorjs","email":"apirator.framework@gmail.com"}],"readme":"# @apiratorjs/locking\n\n[![NPM version](https://img.shields.io/npm/v/@apiratorjs/locking.svg)](https://www.npmjs.com/package/@apiratorjs/locking)\n[![License: MIT](https://img.shields.io/npm/l/@apiratorjs/locking.svg)](https://github.com/apiratorjs/locking/blob/main/LICENSE)\n\nA lightweight Node.js library for concurrency management with three types of locking primitives: mutexes, semaphores, and read-write locks. Supports both local (in-process) and distributed (multi-process) synchronization, with Redis backend support via additional packages.\n\n> **Note:** Requires Node.js version **>=16.4.0**\n>\n> Upgrading from 4.x? See [CHANGELOG](./CHANGELOG.md) and [5.0.0 release notes](./RELEASE_NOTES.md).\n\n---\n\n## What Are Mutexes, Semaphores, ReadWriteLock?\n\n- **Mutex**\n    - A mutex (short for \"mutual exclusion\") ensures only one operation or task can access a resource at any time.\n    - Once acquired by a task, other tasks must wait until it is released.\n    - Real-life analogy: A bathroom key in a small office. If one person is using the bathroom (has the key), no one\n      else can enter until the key is returned.\n\n- **When to use a Mutex**\n    - Whenever you need exclusive access to a shared resource.\n    - For example, updating a single record in a file or database so that no two processes modify it at the same time.\n\n\n- **Semaphore**\n    - A semaphore manages access to a resource by keeping track of a certain number of \"permits.\" A task must acquire a\n      permit before it can proceed, and releases a permit when finished.\n    - Semaphores allow multiple concurrent holders (up to a limit), rather than just one.\n    - Real-life analogy: A parking garage with a limited number of parking spots. Each car must find an available spot (\n      permit) to park, and if the garage is full, incoming cars must wait for someone to leave.\n- **When to use a Semaphore**\n    - Whenever you need to limit concurrency to a fixed number.\n    - For example, limiting the number of simultaneous API requests or controlling concurrency in a task queue.\n\n\n- **ReadWriteLock**\n    - A read-write lock allows multiple readers to access a resource simultaneously, but only one writer at a time.\n    - When a writer holds the lock, no readers can access the resource.\n    - Real-life analogy: A library where multiple people can read books at the same time, but when someone is updating the catalog (writing), no one else can read or update until they finish.\n- **When to use a ReadWriteLock**\n    - When you have a resource that is read frequently but written to infrequently.\n    - For example, a cache, configuration store, or any data structure that needs to be thread-safe with high read throughput.\n\n---\n\n## Features\n\n### Local Locking Primitives\n\n- **Mutex**\n    - Immediate lock acquisition and release.\n    - Waits for lock availability with configurable timeouts.\n    - Supports cancellation of pending acquisitions.\n\n- **Semaphore**\n    - Configurable concurrent access limits.\n    - Waits for an available slot with timeouts and cancellation support.\n    - Ideal for limiting concurrency to a specific maximum number.\n\n- **ReadWriteLock**\n    - Allows multiple readers to access data simultaneously.\n    - Ensures exclusive access when writing data.\n    - Configurable maximum number of concurrent readers.\n    - Supports timeouts for both read and write lock acquisition.\n    - Provides convenience methods for automatic lock release.\n\n### Distributed Locking Primitives\n\nDistributed locks are created by name through an `InMemoryDistributedLockManager`.\n\n- **Distributed Mutex** — same API as the local Mutex, shared by name.\n- **Distributed Semaphore** — same API as the local Semaphore, shared by name.\n- **Distributed ReadWriteLock** — same API as the local ReadWriteLock, shared by name.\n\nBy default a manager keeps everything in memory, which only synchronizes code inside one process. For\ncross-process or multi-instance locking, use a backend that implements `IDistributedLockManager` — for\nexample [@apiratorjs/locking-redis](https://github.com/apiratorjs/locking-redis) (currently without\nread-write lock support).\n\n- **InMemoryDistributedLockManager**\n    - Process-local implementation of `IDistributedLockManager`.\n    - A single place that owns your named locks: the same name gives you the same instance while it is alive.\n    - Answers `hasMutex` / `hasSemaphore` / `hasRWLock`, lists what exists and reports live state.\n    - `cancelAll()` to drain waiters, `destroyAll()` for graceful shutdown.\n    - Backend packages implement `IDistributedLockManager` themselves; several managers can run side by side.\n\n### General\n\n- **Asynchronous & Framework-Agnostic:** Fully compatible with async/await and works with any Node.js framework.\n- **Lightweight & Reliable:** Minimal overhead with comprehensive test coverage to ensure robust locking behavior.\n\n---\n\n## Installation\n\nInstall via npm:\n\n```bash\nnpm install @apiratorjs/locking\n```\n\nOr using yarn:\n\n```bash\nyarn add @apiratorjs/locking\n```\n\n---\n\n## Usage\n\n> All locking primitives have a default acquire timeout of 1 minute. Pass `timeoutMs: 0` to fail fast with a\n> `TimeoutLockingError` when the lock is not immediately available.\n>\n> `cancel()` (mutex) / `cancelAll()` (semaphore, read-write lock, manager) reject the pending acquisitions only:\n> locks that are already held stay held, and `waitForUnlock()` / `waitForAnyUnlock()` / `waitForFullyUnlock()` keep\n> waiting until the holders actually release. On distributed locks, `destroy()` additionally resolves those waiters,\n> since a lock that no longer exists cannot be held.\n\n### Local Primitives\n\n#### Mutex\n\n```typescript\nimport { Mutex } from \"@apiratorjs/locking\";\n\nasync function example() {\n  const mutex = new Mutex();\n  \n  // Method 1: Manual acquisition and release\n  const releaser = await mutex.acquire({ timeoutMs: 5000 });\n  try {\n    // Critical section - exclusive access\n    console.log(\"Mutex acquired\");\n  } finally {\n    await releaser.release();\n  }\n  \n  // Method 2: Automatic acquisition and release\n  const result = await mutex.runExclusive(async () => {\n    console.log(\"Mutex locked automatically\");\n    return \"operation result\";\n  });\n  \n  // Cancel all pending acquisitions\n  await mutex.cancel(\"Operation cancelled\");\n}\n```\n\n#### Semaphore\n\n```typescript\nimport { Semaphore } from \"@apiratorjs/locking\";\n\nasync function example() {\n  // Create semaphore with max 3 concurrent holders\n  const semaphore = new Semaphore(3);\n  \n  // Method 1: Manual acquisition and release\n  const releaser = await semaphore.acquire({ timeoutMs: 5000 });\n  try {\n    // Protected section - limited concurrency\n    console.log(\"Semaphore slot acquired\");\n  } finally {\n    await releaser.release();\n  }\n  \n  // Method 2: Automatic acquisition and release\n  const result = await semaphore.runExclusive(async () => {\n    console.log(\"Semaphore slot acquired automatically\");\n    return \"operation result\";\n  });\n  \n  // Cancel all pending acquisitions\n  await semaphore.cancelAll(\"Operation cancelled\");\n}\n```\n\n#### ReadWriteLock\n\n```typescript\nimport { ReadWriteLock } from \"@apiratorjs/locking\";\n\nasync function example() {\n  const rwLock = new ReadWriteLock({ maxReaders: 100 });\n  \n  // For read operations (multiple readers allowed)\n  const readReleaser = await rwLock.acquireRead({ timeoutMs: 3000 });\n  try {\n    // Read operations - multiple readers can access simultaneously\n    console.log(\"Read lock acquired\");\n  } finally {\n    await readReleaser.release();\n  }\n  \n  // For write operations (exclusive access)\n  const writeReleaser = await rwLock.acquireWrite({ timeoutMs: 5000 });\n  try {\n    // Write operations - no readers or other writers allowed\n    console.log(\"Write lock acquired\");\n  } finally {\n    await writeReleaser.release();\n  }\n  \n  // Automatic acquisition and release\n  await rwLock.withReadLock(async () => {\n    console.log(\"Read lock acquired and released automatically\");\n  });\n  \n  await rwLock.withWriteLock(async () => {\n    console.log(\"Write lock acquired and released automatically\");\n  });\n  \n  // Cancel all pending acquisitions\n  await rwLock.cancelAll(\"Operation cancelled\");\n}\n```\n\n### Distributed Primitives\n\nDistributed locks are created through an `InMemoryDistributedLockManager`: it owns them by name and hands out the same\ninstance for the same name. See [Managing Locks](#managing-locks-inmemorydistributedlockmanager) for the manager itself.\n\n> By default, a manager is in-memory and therefore suitable only for single-process usage. For multi-process or\n> multi-instance environments, use a backend that implements `IDistributedLockManager` - see\n> [Switching to a Real Distributed Backend](#switching-to-a-real-distributed-backend).\n\n#### Distributed Mutex\n\n```typescript\nimport { InMemoryDistributedLockManager } from \"@apiratorjs/locking\";\n\nconst locks = new InMemoryDistributedLockManager();\n\nasync function example() {\n  const mutex = locks.mutex(\"shared-resource\");\n  \n  // Method 1: Manual acquisition and release\n  const releaser = await mutex.acquire({ timeoutMs: 5000 });\n  try {\n    // Critical section - exclusive access (shared by name within this manager)\n    console.log(\"Distributed mutex acquired\");\n  } finally {\n    await releaser.release();\n  }\n  \n  // Method 2: Automatic acquisition and release\n  const result = await mutex.runExclusive(async () => {\n    console.log(\"Distributed mutex locked automatically\");\n    return \"operation result\";\n  });\n  \n  // Cancel all pending acquisitions\n  await mutex.cancel(\"Operation cancelled\");\n}\n```\n\n#### Distributed Semaphore\n\n```typescript\nimport { InMemoryDistributedLockManager } from \"@apiratorjs/locking\";\n\nconst locks = new InMemoryDistributedLockManager();\n\nasync function example() {\n  const semaphore = locks.semaphore(\"api-rate-limiter\", 5);\n  \n  // Method 1: Manual acquisition and release\n  const releaser = await semaphore.acquire({ timeoutMs: 5000 });\n  try {\n    // Protected section - limited concurrency (shared by name within this manager)\n    console.log(\"Distributed semaphore slot acquired\");\n  } finally {\n    await releaser.release();\n  }\n  \n  // Method 2: Automatic acquisition and release\n  const result = await semaphore.runExclusive(async () => {\n    console.log(\"Distributed semaphore slot acquired automatically\");\n    return \"operation result\";\n  });\n  \n  // Cancel all pending acquisitions\n  await semaphore.cancelAll(\"Operation cancelled\");\n}\n```\n\n#### Distributed ReadWriteLock\n\n```typescript\nimport { InMemoryDistributedLockManager } from \"@apiratorjs/locking\";\n\nconst locks = new InMemoryDistributedLockManager();\n\nasync function example() {\n  const rwLock = locks.readWriteLock(\"shared-config\", 50);\n  \n  // For read operations (multiple readers allowed)\n  const readReleaser = await rwLock.acquireRead({ timeoutMs: 3000 });\n  try {\n    // Read operations - multiple readers can access simultaneously\n    console.log(\"Distributed read lock acquired\");\n  } finally {\n    await readReleaser.release();\n  }\n  \n  // For write operations (exclusive access)\n  const writeReleaser = await rwLock.acquireWrite({ timeoutMs: 5000 });\n  try {\n    // Write operations - no readers or other writers allowed\n    console.log(\"Distributed write lock acquired\");\n  } finally {\n    await writeReleaser.release();\n  }\n  \n  // Automatic acquisition and release\n  await rwLock.withReadLock(async () => {\n    console.log(\"Distributed read lock acquired and released automatically\");\n  });\n  \n  await rwLock.withWriteLock(async () => {\n    console.log(\"Distributed write lock acquired and released automatically\");\n  });\n  \n  // Cancel all pending acquisitions\n  await rwLock.cancelAll(\"Operation cancelled\");\n}\n```\n\n### Cancellation\n\nAll primitives support cancelling pending acquisitions:\n\n```typescript\n// Cancel all pending acquisitions with custom error message\nawait mutex.cancel(\"Operation cancelled\");\nawait semaphore.cancelAll(\"Operation cancelled\");\nawait rwLock.cancelAll(\"Operation cancelled\");\n\n// ...or everything a manager holds at once\nawait locks.cancelAll(\"Operation cancelled\");\n```\n\nCancelling never takes a lock away from whoever is holding it — it rejects the waiters, and the owners release as\nusual.\n\n### Error Handling\n\nThe library provides specific error classes to help you handle different failure scenarios:\n\n```typescript\nimport {\n  LockingError,\n  TimeoutLockingError,\n  CancelledLockingError,\n  LockNotFoundError,\n  LockConfigMismatchError\n} from \"@apiratorjs/locking\";\n```\n\n#### Error Classes\n\n| Error Class | Description | When Thrown |\n|-------------|-------------|-------------|\n| `LockingError` | Base class for all locking errors | Parent class, not thrown directly |\n| `TimeoutLockingError` | Lock acquisition timed out | When `acquire()` exceeds `timeoutMs` |\n| `CancelledLockingError` | Lock acquisition was cancelled | When `cancel()` / `cancelAll()` or `destroy()` is called |\n| `LockNotFoundError` | Lock no longer exists | When accessing a destroyed distributed lock |\n| `LockConfigMismatchError` | A lock with this name already exists with different settings | When a distributed lock is constructed with a `maxCount` / `maxReaders` that conflicts with the existing lock of the same name |\n\n#### Example Usage\n\n```typescript\nimport { Mutex, TimeoutLockingError, CancelledLockingError } from \"@apiratorjs/locking\";\n\nconst mutex = new Mutex();\n\ntry {\n  const releaser = await mutex.acquire({ timeoutMs: 1000 });\n  // ... critical section ...\n  await releaser.release();\n} catch (error) {\n  if (error instanceof TimeoutLockingError) {\n    console.log(\"Failed to acquire lock within timeout\");\n  } else if (error instanceof CancelledLockingError) {\n    console.log(\"Lock acquisition was cancelled\");\n  } else {\n    throw error;\n  }\n}\n```\n\n#### Distributed Lock Error Handling\n\n```typescript\nimport { InMemoryDistributedLockManager, LockNotFoundError, CancelledLockingError } from \"@apiratorjs/locking\";\n\nconst locks = new InMemoryDistributedLockManager();\nconst mutex = locks.mutex(\"my-resource\");\n\ntry {\n  const releaser = await mutex.acquire();\n  // ... critical section ...\n  await releaser.release();\n} catch (error) {\n  if (error instanceof LockNotFoundError) {\n    console.log(\"Lock was destroyed by another process\");\n  } else if (error instanceof CancelledLockingError) {\n    console.log(\"Lock acquisition was cancelled\");\n  } else {\n    throw error;\n  }\n}\n```\n\n### Waiting for Lock State Changes\n\nAll locking primitives provide methods to wait for lock state changes without attempting to acquire the lock:\n\n#### Mutex: `waitForUnlock()`\n\nWaits until the mutex is released by its current holder:\n\n> **Important:** The `waitForUnlock()` method allows you to monitor mutex availability without actually acquiring the lock. It returns a promise that resolves when the mutex becomes free for acquisition. Note that this is purely observational - the mutex remains unlocked, and due to the asynchronous nature of JavaScript, the mutex may be acquired by another operation before you have a chance to acquire it yourself.\n\n```typescript\nimport { Mutex } from \"@apiratorjs/locking\";\n\nasync function example() {\n  const mutex = new Mutex();\n  \n  // In one part of your code\n  const releaser = await mutex.acquire();\n  \n  // In another part (e.g., different function or service)\n  try {\n    // Wait for the mutex to be unlocked without trying to acquire it\n    await mutex.waitForUnlock();\n    console.log(\"Mutex is now unlocked!\");\n    \n    // Now you can try to acquire it if needed\n    const myReleaser = await mutex.acquire();\n    // ...\n  } catch (error) {\n    console.error(\"Waiting was interrupted:\", error.message);\n  }\n}\n```\n\n#### Semaphore: `waitForAnyUnlock()` and `waitForFullyUnlock()`\n\nSemaphores provide two waiting methods:\n- `waitForAnyUnlock()`: Resolves when at least one permit becomes available\n- `waitForFullyUnlock()`: Resolves when all permits are available (semaphore is fully unlocked)\n\n> **Important:** These waiting methods allow you to monitor semaphore permit availability without actually acquiring any permits. They return promises that resolve when the specified conditions are met (at least one permit available or all permits available). Note that these are purely observational - no permits are acquired, and due to the asynchronous nature of JavaScript, permits may be acquired by other operations before you have a chance to acquire them yourself.\n\n```typescript\nimport { Semaphore } from \"@apiratorjs/locking\";\n\nasync function example() {\n  const semaphore = new Semaphore(3);\n  \n  // Acquire all permits\n  const releasers = await Promise.all([\n    semaphore.acquire(),\n    semaphore.acquire(),\n    semaphore.acquire()\n  ]);\n  \n  // In another part of your code\n  setTimeout(() => {\n    // Release one permit\n    releasers[0].release();\n  }, 1000);\n  \n  // This will resolve after one permit is released\n  await semaphore.waitForAnyUnlock();\n  console.log(\"At least one permit is now available!\");\n  \n  setTimeout(() => {\n    // Release all remaining permits\n    releasers[1].release();\n    releasers[2].release();\n  }, 1000);\n  \n  // This will resolve only when all permits are available\n  await semaphore.waitForFullyUnlock();\n  console.log(\"Semaphore is fully unlocked!\");\n}\n```\n\n### Managing Locks: `InMemoryDistributedLockManager`\n\n`InMemoryDistributedLockManager` owns a set of named locks. It hands out the same instance for the same name while that\nlock is alive, so you no longer have to pass lock objects around, and it knows what it handed out — which makes\nlisting, draining and shutdown possible.\n\n```typescript\nimport { InMemoryDistributedLockManager, ELockDisplayType } from \"@apiratorjs/locking\";\n\n// One per backend; inject it instead of reaching for a global\nexport const locks = new InMemoryDistributedLockManager();\n\n// Same name -> same instance, created on first use\nlocks.mutex(\"orders\") === locks.mutex(\"orders\"); // true\n\nawait locks.mutex(\"orders\").runExclusive(() => shipOrder());\nawait locks.semaphore(\"uploads\", 5).runExclusive(() => upload());\nawait locks.readWriteLock(\"catalog\").withReadLock(() => readCatalog());\n```\n\n#### Inspecting what exists\n\n```typescript\nlocks.hasMutex(\"orders\");           // true\nlocks.hasSemaphore(\"uploads\");      // true\nlocks.hasRWLock(\"catalog\");         // true\n\nlocks.count();                      // 3\nlocks.count(ELockDisplayType.Semaphore);   // 1\n\nlocks.list();\n// [ { kind: \"mutex\", name: \"orders\", implementation: \"in-memory\", isDestroyed: false },\n//   { kind: \"semaphore\", name: \"uploads\", implementation: \"in-memory\", isDestroyed: false, maxCount: 5 }, ... ]\n\nawait locks.snapshot();\n// same, plus current state: isLocked / freeCount / isWriteLocked / isReadLocked / activeReaders\n```\n\n`has*`, `list()` and `count()` are synchronous and cheap; `snapshot()` reads live state through the lock implementation,\nso it is asynchronous. Locks destroyed in the meantime are dropped rather than reported.\n\n#### Draining and shutdown\n\n```typescript\n// Reject everything that is waiting; held locks stay held and the locks stay usable\nawait locks.cancelAll(\"Draining before deploy\");\n\n// Tear everything down: waiters are rejected, handles report isDestroyed, the manager empties itself\nprocess.on(\"SIGTERM\", async () => {\n  await locks.destroyAll(\"Shutting down\");\n});\n```\n\n> `cancelAll()` never force-releases a lock somebody is holding — that would put two owners inside the same\n> critical section. It cancels the queue; the owners release as usual.\n\nIf a lock fails to cancel or destroy, the bulk operation still processes the rest and then throws an\n`AggregateError` with the collected failures.\n\n#### Requesting a different configuration\n\nA name is registered together with its configuration, so asking for the same name with a different capacity is a\nmistake rather than a silent reconfiguration:\n\n```typescript\nlocks.semaphore(\"uploads\", 5);\nlocks.semaphore(\"uploads\", 10); // throws LockConfigMismatchError\n\nlocks.readWriteLock(\"catalog\", 3);\nlocks.readWriteLock(\"catalog\");  // fine - no maxReaders means \"whatever is registered\"\n```\n\n---\n\n### Switching to a Real Distributed Backend\n\n`InMemoryDistributedLockManager` synchronizes code inside one Node.js process, and nothing more. For\nseveral processes or servers you need a backend that all of them talk to — a package that implements\n`IDistributedLockManager`, such as [@apiratorjs/locking-redis](https://github.com/apiratorjs/locking-redis).\n\n> **Note:** The current version of `@apiratorjs/locking-redis` does not yet support distributed read-write locks.\n\n```typescript\nimport { types } from \"@apiratorjs/locking\";\nimport { RedisDistributedLockManager } from \"@apiratorjs/locking-redis\";\n\n// Same IDistributedLockManager contract, Redis-backed\nexport const locks: types.IDistributedLockManager = new RedisDistributedLockManager({\n  url: \"redis://localhost:6379\",\n});\n\nawait locks.mutex(\"shared-resource\").runExclusive(() => chargeCard());\nawait locks.semaphore(\"api-rate-limiter\", 5).runExclusive(() => callUpstream());\n```\n\nNothing is global here, so a Redis-backed manager and an in-memory one can coexist — useful when only part of the\nsystem needs cross-process coordination, and in tests.\n\n---\n\n### Own implementation of a distributed backend\n\nImplement `IDistributedLockManager` (and, behind it, `IDistributedMutex` / `IDistributedSemaphore` /\n`IDistributedRWLock`):\n\n```typescript\nimport { types } from \"@apiratorjs/locking\";\n\nexport class MyDistributedLockManager implements types.IDistributedLockManager {\n  public mutex(name: string): types.IDistributedMutex {\n    // create or return the named mutex\n  }\n\n  public semaphore(name: string, maxCount: number): types.IDistributedSemaphore {\n    // ...\n  }\n\n  public readWriteLock(name: string, maxReaders?: number): types.IDistributedRWLock {\n    // ...\n  }\n\n  public hasMutex(name: string): boolean { /* ... */ }\n  public hasSemaphore(name: string): boolean { /* ... */ }\n  public hasRWLock(name: string): boolean { /* ... */ }\n\n  public list(): types.TDistributedLockInfo[] { /* ... */ }\n  public count(kind?: types.ELockDisplayType): number { /* ... */ }\n  public snapshot(): Promise<types.TDistributedLockSnapshot[]> { /* ... */ }\n  public cancelAll(errMessage?: string): Promise<void> { /* ... */ }\n  public destroyAll(errMessage?: string): Promise<void> { /* ... */ }\n}\n```\n\nWhat an implementation is responsible for:\n\n- **Owning locks by name.** The same name should return the same live instance; destroyed locks are forgotten.\n- **Rejecting a conflicting configuration.** If `\"uploads\"` already exists with `maxCount: 2`, a request for\n  `maxCount: 5` should throw `LockConfigMismatchError` rather than silently return a different capacity.\n- **Never force-releasing a held lock.** `cancelAll()` cancels waiters; owners release their own locks.\n- **`destroy()` being idempotent**, and `isDestroyed` becoming `true` once a lock is torn down.\n\n`InMemoryDistributedLockManager` and the in-memory locks under `src/in-memory-distributed` can be read as a\nreference.\n\n---\n\n## Contributing\n\nContributions, issues, and feature requests are welcome!\nPlease open an issue or submit a pull request on [GitHub](https://github.com/apiratorjs/locking).\n","readmeFilename":""}