@pluv/persistence-redis 0.38.14 → 0.39.1

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/persistence-redis@0.38.14 build /home/runner/work/pluv/pluv/packages/persistence-redis
2
+ > @pluv/persistence-redis@0.39.1 build /home/runner/work/pluv/pluv/packages/persistence-redis
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 4.37 KB
12
- CJS ⚡️ Build success in 63ms
13
- ESM dist/index.mjs 3.36 KB
14
- ESM ⚡️ Build success in 64ms
11
+ ESM dist/index.mjs 3.37 KB
12
+ ESM ⚡️ Build success in 57ms
13
+ CJS dist/index.js 4.38 KB
14
+ CJS ⚡️ Build success in 57ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4617ms
17
- DTS dist/index.d.mts 1.08 KB
18
- DTS dist/index.d.ts 1.08 KB
16
+ DTS ⚡️ Build success in 4662ms
17
+ DTS dist/index.d.mts 1.09 KB
18
+ DTS dist/index.d.ts 1.09 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pluv/persistence-redis
2
2
 
3
+ ## 0.39.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/io@0.39.1
8
+ - @pluv/types@0.39.1
9
+
10
+ ## 0.39.0
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [fe6e239]
15
+ - Updated dependencies [737d508]
16
+ - @pluv/io@0.39.0
17
+ - @pluv/types@0.39.0
18
+
3
19
  ## 0.38.14
4
20
 
5
21
  ### Patch Changes
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.getSize(room);
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.getSize(room);
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
  }
@@ -0,0 +1,4 @@
1
+ import { config } from "eslint-config-pluv/base";
2
+
3
+ /** @type {import("eslint").Linter.Config} */
4
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/persistence-redis",
3
- "version": "0.38.14",
3
+ "version": "0.39.1",
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.0",
21
- "@pluv/io": "^0.38.14",
22
- "@pluv/types": "^0.38.14"
20
+ "@types/node": "^22.14.1",
21
+ "@pluv/io": "^0.39.1",
22
+ "@pluv/types": "^0.39.1"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "ioredis": "^5.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "eslint": "^8.57.1",
29
- "ioredis": "^5.6.0",
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.38.14",
33
- "eslint-config-pluv": "^0.38.14"
32
+ "@pluv/tsconfig": "^0.39.1",
33
+ "eslint-config-pluv": "^0.39.1"
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
  }
@@ -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.getSize(room);
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
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- extends: ["pluv"],
4
- };