@pluv/persistence-redis 0.38.14 → 0.39.0
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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/eslint.config.mjs +4 -0
- package/package.json +9 -9
- package/src/PersistenceRedis.ts +5 -5
- package/.eslintrc.js +0 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/persistence-redis@0.
|
|
2
|
+
> @pluv/persistence-redis@0.39.0 build /home/runner/work/pluv/pluv/packages/persistence-redis
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m3.37 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 79ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m4.38 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 83ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4647ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m1.09 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.09 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -13,11 +13,11 @@ declare class PersistenceRedis extends AbstractPersistence {
|
|
|
13
13
|
deleteStorageState(room: string): Promise<void>;
|
|
14
14
|
deleteUser(room: string, connectionId: string): Promise<void>;
|
|
15
15
|
deleteUsers(room: string): Promise<void>;
|
|
16
|
-
getSize(room: string): Promise<number>;
|
|
17
16
|
getStorageState(room: string): Promise<string | null>;
|
|
18
17
|
setStorageState(room: string, state: string): Promise<void>;
|
|
19
18
|
getUser(room: string, connectionId: string): Promise<JsonObject | null>;
|
|
20
19
|
getUsers(room: string): Promise<readonly (JsonObject | null)[]>;
|
|
20
|
+
getUsersSize(room: string): Promise<number>;
|
|
21
21
|
private _getClusterKey;
|
|
22
22
|
private _getRoomStorageKey;
|
|
23
23
|
private _getRoomUsersKey;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,11 +13,11 @@ declare class PersistenceRedis extends AbstractPersistence {
|
|
|
13
13
|
deleteStorageState(room: string): Promise<void>;
|
|
14
14
|
deleteUser(room: string, connectionId: string): Promise<void>;
|
|
15
15
|
deleteUsers(room: string): Promise<void>;
|
|
16
|
-
getSize(room: string): Promise<number>;
|
|
17
16
|
getStorageState(room: string): Promise<string | null>;
|
|
18
17
|
setStorageState(room: string, state: string): Promise<void>;
|
|
19
18
|
getUser(room: string, connectionId: string): Promise<JsonObject | null>;
|
|
20
19
|
getUsers(room: string): Promise<readonly (JsonObject | null)[]>;
|
|
20
|
+
getUsersSize(room: string): Promise<number>;
|
|
21
21
|
private _getClusterKey;
|
|
22
22
|
private _getRoomStorageKey;
|
|
23
23
|
private _getRoomUsersKey;
|
package/dist/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var PersistenceRedis = class extends import_io.AbstractPersistence {
|
|
|
66
66
|
}
|
|
67
67
|
deleteUser(room, connectionId) {
|
|
68
68
|
return __async(this, null, function* () {
|
|
69
|
-
const size = yield this.
|
|
69
|
+
const size = yield this.getUsersSize(room);
|
|
70
70
|
let multi = this._client.multi().srem(this._getRoomUsersKey(room), connectionId).del(this._getRoomUsersUserKey(room, connectionId));
|
|
71
71
|
if (size === 1) {
|
|
72
72
|
multi = multi.del(this._getRoomStorageKey(room)).del(this._getRoomUsersKey(room));
|
|
@@ -85,11 +85,6 @@ var PersistenceRedis = class extends import_io.AbstractPersistence {
|
|
|
85
85
|
).exec();
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
getSize(room) {
|
|
89
|
-
return __async(this, null, function* () {
|
|
90
|
-
return yield this._client.scard(this._getRoomUsersKey(room));
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
88
|
getStorageState(room) {
|
|
94
89
|
return __async(this, null, function* () {
|
|
95
90
|
return yield this._client.get(this._getRoomStorageKey(room));
|
|
@@ -112,6 +107,11 @@ var PersistenceRedis = class extends import_io.AbstractPersistence {
|
|
|
112
107
|
return yield Promise.all(members.map((connectionId) => this.getUser(room, connectionId)));
|
|
113
108
|
});
|
|
114
109
|
}
|
|
110
|
+
getUsersSize(room) {
|
|
111
|
+
return __async(this, null, function* () {
|
|
112
|
+
return yield this._client.scard(this._getRoomUsersKey(room));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
115
|
_getClusterKey(key) {
|
|
116
116
|
return `${HASH_TAG}${key}`;
|
|
117
117
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -41,7 +41,7 @@ var PersistenceRedis = class extends AbstractPersistence {
|
|
|
41
41
|
}
|
|
42
42
|
deleteUser(room, connectionId) {
|
|
43
43
|
return __async(this, null, function* () {
|
|
44
|
-
const size = yield this.
|
|
44
|
+
const size = yield this.getUsersSize(room);
|
|
45
45
|
let multi = this._client.multi().srem(this._getRoomUsersKey(room), connectionId).del(this._getRoomUsersUserKey(room, connectionId));
|
|
46
46
|
if (size === 1) {
|
|
47
47
|
multi = multi.del(this._getRoomStorageKey(room)).del(this._getRoomUsersKey(room));
|
|
@@ -60,11 +60,6 @@ var PersistenceRedis = class extends AbstractPersistence {
|
|
|
60
60
|
).exec();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
getSize(room) {
|
|
64
|
-
return __async(this, null, function* () {
|
|
65
|
-
return yield this._client.scard(this._getRoomUsersKey(room));
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
63
|
getStorageState(room) {
|
|
69
64
|
return __async(this, null, function* () {
|
|
70
65
|
return yield this._client.get(this._getRoomStorageKey(room));
|
|
@@ -87,6 +82,11 @@ var PersistenceRedis = class extends AbstractPersistence {
|
|
|
87
82
|
return yield Promise.all(members.map((connectionId) => this.getUser(room, connectionId)));
|
|
88
83
|
});
|
|
89
84
|
}
|
|
85
|
+
getUsersSize(room) {
|
|
86
|
+
return __async(this, null, function* () {
|
|
87
|
+
return yield this._client.scard(this._getRoomUsersKey(room));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
90
|
_getClusterKey(key) {
|
|
91
91
|
return `${HASH_TAG}${key}`;
|
|
92
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/persistence-redis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "@pluv/io crdt storage persistence for node.js",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,25 +17,25 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^22.14.
|
|
21
|
-
"@pluv/io": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
20
|
+
"@types/node": "^22.14.1",
|
|
21
|
+
"@pluv/io": "^0.39.0",
|
|
22
|
+
"@pluv/types": "^0.39.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"ioredis": "^5.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"eslint": "^
|
|
29
|
-
"ioredis": "^5.6.
|
|
28
|
+
"eslint": "^9.24.0",
|
|
29
|
+
"ioredis": "^5.6.1",
|
|
30
30
|
"tsup": "^8.4.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"@pluv/tsconfig": "^0.
|
|
33
|
-
"eslint-config-pluv": "^0.
|
|
32
|
+
"@pluv/tsconfig": "^0.39.0",
|
|
33
|
+
"eslint-config-pluv": "^0.39.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
37
37
|
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
38
|
-
"lint": "eslint src/**/*.ts* --fix",
|
|
38
|
+
"lint": "eslint src/**/*.ts* --fix --max-warnings 0",
|
|
39
39
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
40
40
|
}
|
|
41
41
|
}
|
package/src/PersistenceRedis.ts
CHANGED
|
@@ -35,7 +35,7 @@ export class PersistenceRedis extends AbstractPersistence {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public async deleteUser(room: string, connectionId: string): Promise<void> {
|
|
38
|
-
const size = await this.
|
|
38
|
+
const size = await this.getUsersSize(room);
|
|
39
39
|
|
|
40
40
|
let multi = this._client
|
|
41
41
|
.multi()
|
|
@@ -62,10 +62,6 @@ export class PersistenceRedis extends AbstractPersistence {
|
|
|
62
62
|
.exec();
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
public async getSize(room: string): Promise<number> {
|
|
66
|
-
return await this._client.scard(this._getRoomUsersKey(room));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
65
|
public async getStorageState(room: string): Promise<string | null> {
|
|
70
66
|
return await this._client.get(this._getRoomStorageKey(room));
|
|
71
67
|
}
|
|
@@ -86,6 +82,10 @@ export class PersistenceRedis extends AbstractPersistence {
|
|
|
86
82
|
return await Promise.all(members.map((connectionId) => this.getUser(room, connectionId)));
|
|
87
83
|
}
|
|
88
84
|
|
|
85
|
+
public async getUsersSize(room: string): Promise<number> {
|
|
86
|
+
return await this._client.scard(this._getRoomUsersKey(room));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
89
|
private _getClusterKey(key: string): string {
|
|
90
90
|
return `${HASH_TAG}${key}`;
|
|
91
91
|
}
|
package/.eslintrc.js
DELETED