{"_id":"@technance/nestjs-redis-warlock","_rev":"34-861f62e97e23539c4440ffa471ed7915","name":"@technance/nestjs-redis-warlock","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.3":{"name":"@technance/nestjs-redis-warlock","version":"0.0.3","author":"","license":"ISC","_id":"@technance/nestjs-redis-warlock@0.0.3","maintainers":[{"name":"mehrabmp","email":"mehrabmpdev@gmail.com"},{"name":"mohammadxali","email":"mohammadali.shahbazi@gmail.com"},{"name":"mhaghshenas","email":"mhaghshenas74@gmail.com"},{"name":"mohammadrezam9696","email":"mardani93.itsu@gmail.com"},{"name":"sepanta_97","email":"Sepanta_97@Yahoo.com"}],"homepage":"https://github.com/technance-foundation/redis-warlock.github#readme","bugs":{"url":"https://github.com/technance-foundation/redis-warlock.github/issues"},"dist":{"shasum":"f70cc3cf9046c9bf80e5df83f35149dad725b1bc","tarball":"https://registry.npmjs.org/@technance/nestjs-redis-warlock/-/nestjs-redis-warlock-0.0.3.tgz","fileCount":15,"integrity":"sha512-zTfpXHjXCkj/12UNo8qXNKgxExOFnbXv0v5Tn0Dbc/uTrQEqTbLAd05PiiroijloZ0XeT4GaVRXGcQlfIgDHvA==","signatures":[{"sig":"MEUCIQCldnO2gFIjACxIaYY3o6s3pRS8/VR9FQg9tWrJ4qWmLwIgLumwsiApOJoXmxv3EpGExnQW1LvZBVn38Q/ADPai8DE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":144602},"jest":{"rootDir":"src","testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","coverageDirectory":"../coverage","collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"_from":"file:technance-nestjs-redis-warlock-0.0.3.tgz","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"lint":"eslint \"{src,test}/**/*.ts\" --fix","test":"jest","build":"tsc -p .","clean":"rimraf dist node_modules","watch":"tsc --watch -p .","format":"prettier --write \"src/**/*.ts\"","release":"np","prerelease":"pnpm build"},"_npmUser":{"name":"mohammadxali","email":"mohammadali.shahbazi@gmail.com"},"_resolved":"/tmp/3322b6103e662f5940e8b8db6e715d27/technance-nestjs-redis-warlock-0.0.3.tgz","_integrity":"sha512-zTfpXHjXCkj/12UNo8qXNKgxExOFnbXv0v5Tn0Dbc/uTrQEqTbLAd05PiiroijloZ0XeT4GaVRXGcQlfIgDHvA==","repository":{"url":"git+https://github.com/technance-foundation/redis-warlock.github.git","type":"git"},"_npmVersion":"10.8.1","description":"`@technance/nestjs-redis-warlock` is a Redis-based locking utility for managing distributed locks in Node.js applications.","directories":{},"_nodeVersion":"20.16.0","dependencies":{"ioredis":"^5.4.2","@nestjs/common":"^10.0.0"},"_hasShrinkwrap":false,"devDependencies":{"np":"^10.1.0","jest":"^29.5.0","eslint":"^8.42.0","rimraf":"^6.0.1","ts-jest":"^29.1.0","ts-node":"^10.9.1","prettier":"^3.0.0","supertest":"^6.3.3","ts-loader":"^9.4.3","typescript":"^5.1.3","@nestjs/cli":"^10.0.0","@types/jest":"^29.5.2","@types/node":"^20.3.1","@types/express":"^4.17.17","tsconfig-paths":"^4.2.0","@nestjs/testing":"^10.0.0","@types/supertest":"^2.0.12","@nestjs/schematics":"^10.0.0","source-map-support":"^0.5.21","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.0","@typescript-eslint/parser":"^6.0.0","@typescript-eslint/eslint-plugin":"^6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-redis-warlock_0.0.3_1746798307185_0.5698595613313819","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-05-09T13:45:07.048Z","modified":"2026-08-15T12:59:29.717Z","0.0.3":"2025-05-09T13:45:07.358Z"},"bugs":{"url":"https://github.com/technance-foundation/redis-warlock.github/issues"},"license":"ISC","homepage":"https://github.com/technance-foundation/redis-warlock.github#readme","repository":{"url":"git+https://github.com/technance-foundation/redis-warlock.github.git","type":"git"},"description":"`@technance/nestjs-redis-warlock` is a Redis-based locking utility for managing distributed locks in Node.js applications.","maintainers":[{"email":"amirrezakheram1376@gmail.com","name":"am28z"},{"email":"vahid@invexa.io","name":"vahidj"},{"email":"sepehrxsohrabpour@gmail.com","name":"sepehrsoh"},{"email":"mehrabmpdev@gmail.com","name":"mehrabmp"},{"email":"mohammadali.shahbazi@gmail.com","name":"mohammadxali"},{"email":"mowhcen@invexa.io","name":"mowhcen"},{"email":"mhaghshenas74@gmail.com","name":"mhaghshenas"},{"email":"mardani93.itsu@gmail.com","name":"mohammadrezam9696"},{"email":"Sepanta_97@Yahoo.com","name":"sepanta_97"},{"email":"khoshkam93.itsu@gmail.com","name":"khoshkam"},{"email":"rzvxa@protonmail.com","name":"rzvxa"},{"email":"mehran@technance.com","name":"mehran_amanollah"},{"email":"ho.sajadi@gmail.com","name":"hosnia"},{"email":"aslrousta@gmail.com","name":"alirus"}],"readme":"# @technance/nestjs-redis-warlock\n\n`@technance/nestjs-redis-warlock` is a Redis-based locking utility for managing distributed locks in Node.js applications.\n\n## Installation\n\nYou can install the package using npm or pnpm.\n\n### npm\n\n```sh\nnpm i @technance/nestjs-redis-warlock\n``` \n\n### pnpm\n```sh\npnpm i @technance/nestjs-redis-warlock\n```\n\n\n### Usage\n\nTo use `@technance/nestjs-redis-warlock` in your project, follow these steps:\n\n## Initialization\n\nYou can initialize the WarlockModule in two ways: asynchronously or synchronously.\n\n\n#### Asynchronous Initialization\nIf you need to fetch the Redis URL from a configuration service, you can use the forRootAsync method:\n\n```typescript\nimport { WarlockModule } from '@technance/nestjs-redis-warlock';\nimport { ConfigService } from '@nestjs/config';\n\nWarlockModule.forRootAsync({\n    useFactory: (configService: ConfigService) => {\n        return configService.get<string>(\"app.redis.url\") || \"redis://127.0.0.1:6379\";\n    },\n    inject: [ConfigService],\n});\n```\n\n#### Synchronous Initialization\nIf you have the Redis URL available, you can use the forRoot method:\n\n```typescript\nimport { WarlockModule } from '@technance/nestjs-redis-warlock';\n\nWarlockModule.forRoot(\"redis://127.0.0.1:6379\");\n```\n\n### Using the Warlock Decorator\nYou can use the @Warlock decorator to lock a function. The decorator accepts a key and an optional TTL (time to live) value in seconds.\n```typescript\nimport { Warlock } from '@technance/nestjs-redis-warlock';\n\nclass SomeService {\n    @Warlock(\"key_example\", 60) // TTL is 60 seconds\n    async someFunction() {\n        // function implementation\n    }\n}\n```\n\nThe @Warlock decorator ensures that the function is locked based on the provided key, preventing concurrent executions.","readmeFilename":"README.md"}