murlock 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ local key = KEYS[1]
2
+ local clientId = ARGV[1]
3
+ local releaseTime = ARGV[2]
4
+
5
+ if redis.call("get",key) == clientId or redis.call("set", key, clientId, "NX", "PX", releaseTime) then
6
+ return 1
7
+ else
8
+ return 0
9
+ end
@@ -0,0 +1,8 @@
1
+ local key = KEYS[1]
2
+ local clientId = ARGV[1]
3
+
4
+ if redis.call("get", key) == clientId then
5
+ return redis.call("del", key)
6
+ else
7
+ return 0
8
+ end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "murlock",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A distributed locking solution for NestJS, providing a decorator for critical sections with Redis-based synchronization.",
5
5
  "author": "https://github.com/felanios",
6
6
  "homepage": "https://github.com/felanios/murlock#readme",
@@ -8,7 +8,8 @@
8
8
  "private": false,
9
9
  "main": "dist/index.js",
10
10
  "scripts": {
11
- "build": "tsc"
11
+ "copy-lua": "ncp lib/lua dist/lua/",
12
+ "build": "tsc && npm run copy-lua"
12
13
  },
13
14
  "dependencies": {
14
15
  "@nestjs/common": "^10.0.0",
@@ -19,6 +20,7 @@
19
20
  "devDependencies": {
20
21
  "@types/node": "^20.3.1",
21
22
  "@types/redis": "^2.8.32",
23
+ "ncp": "^2.0.0",
22
24
  "typescript": "^5.1.3"
23
25
  },
24
26
  "peerDependencies": {
package/tsconfig.json CHANGED
@@ -14,5 +14,5 @@
14
14
  "include": [
15
15
  "lib/**/*"
16
16
  ],
17
- "exclude": ["node_modules"]
17
+ "exclude": ["node_modules","dist"]
18
18
  }