@pluv/persistence-redis 2.2.4 → 2.2.6

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@2.2.4 build /home/runner/work/pluv/pluv/packages/persistence-redis
2
+ > @pluv/persistence-redis@2.2.6 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 5.83 KB
12
- CJS ⚡️ Build success in 93ms
13
- ESM dist/index.mjs 4.81 KB
14
- ESM ⚡️ Build success in 97ms
11
+ ESM dist/index.mjs 5.61 KB
12
+ ESM ⚡️ Build success in 86ms
13
+ CJS dist/index.js 6.53 KB
14
+ CJS ⚡️ Build success in 90ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 5244ms
17
- DTS dist/index.d.mts 1.17 KB
18
- DTS dist/index.d.ts 1.17 KB
16
+ DTS ⚡️ Build success in 5037ms
17
+ DTS dist/index.d.mts 1.18 KB
18
+ DTS dist/index.d.ts 1.18 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @pluv/persistence-redis
2
2
 
3
+ ## 2.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/io@2.2.6
8
+ - @pluv/types@2.2.6
9
+
10
+ ## 2.2.5
11
+
12
+ ### Patch Changes
13
+
14
+ - @pluv/io@2.2.5
15
+ - @pluv/types@2.2.5
16
+
3
17
  ## 2.2.4
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -19,7 +19,7 @@ declare class PersistenceRedis extends AbstractPersistence {
19
19
  getUser(room: string, connectionId: string): Promise<JsonObject | null>;
20
20
  getUsers(room: string): Promise<Map<[connectionId: string][0], JsonObject | null>>;
21
21
  getUsersSize(room: string): Promise<number>;
22
- initialize(roomContext: {}): this;
22
+ initialize(roomContext: {}): typeof this;
23
23
  private _getClusterKey;
24
24
  private _getRoomStorageKey;
25
25
  private _getRoomUsersKey;
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ declare class PersistenceRedis extends AbstractPersistence {
19
19
  getUser(room: string, connectionId: string): Promise<JsonObject | null>;
20
20
  getUsers(room: string): Promise<Map<[connectionId: string][0], JsonObject | null>>;
21
21
  getUsersSize(room: string): Promise<number>;
22
- initialize(roomContext: {}): this;
22
+ initialize(roomContext: {}): typeof this;
23
23
  private _getClusterKey;
24
24
  private _getRoomStorageKey;
25
25
  private _getRoomUsersKey;
package/dist/index.js CHANGED
@@ -2,7 +2,21 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
6
20
  var __export = (target, all) => {
7
21
  for (var name in all)
8
22
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -59,12 +73,13 @@ var partitionByLength = (arr, length) => {
59
73
  var DELIMITER = ":::";
60
74
  var HASH_TAG = "{PluvPersistenceRedis}";
61
75
  var GET_USERS_CONCURRENCY = 4;
62
- var PersistenceRedis = class extends import_io.AbstractPersistence {
76
+ var PersistenceRedis = class _PersistenceRedis extends import_io.AbstractPersistence {
63
77
  constructor(options) {
64
78
  super();
65
79
  this._initialized = null;
66
80
  const { client } = options;
67
81
  this._client = client;
82
+ this._initialized = options._initialized;
68
83
  }
69
84
  addUser(room, connectionId, user) {
70
85
  return __async(this, null, function* () {
@@ -151,8 +166,9 @@ var PersistenceRedis = class extends import_io.AbstractPersistence {
151
166
  });
152
167
  }
153
168
  initialize(roomContext) {
154
- this._initialized = Promise.resolve(true);
155
- return this;
169
+ return new _PersistenceRedis(__spreadValues({
170
+ client: this._client
171
+ }, { _initialized: Promise.resolve(true) }));
156
172
  }
157
173
  _getClusterKey(key) {
158
174
  return `${HASH_TAG}${key}`;
package/dist/index.mjs CHANGED
@@ -1,3 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
1
17
  var __async = (__this, __arguments, generator) => {
2
18
  return new Promise((resolve, reject) => {
3
19
  var fulfilled = (value) => {
@@ -34,12 +50,13 @@ var partitionByLength = (arr, length) => {
34
50
  var DELIMITER = ":::";
35
51
  var HASH_TAG = "{PluvPersistenceRedis}";
36
52
  var GET_USERS_CONCURRENCY = 4;
37
- var PersistenceRedis = class extends AbstractPersistence {
53
+ var PersistenceRedis = class _PersistenceRedis extends AbstractPersistence {
38
54
  constructor(options) {
39
55
  super();
40
56
  this._initialized = null;
41
57
  const { client } = options;
42
58
  this._client = client;
59
+ this._initialized = options._initialized;
43
60
  }
44
61
  addUser(room, connectionId, user) {
45
62
  return __async(this, null, function* () {
@@ -126,8 +143,9 @@ var PersistenceRedis = class extends AbstractPersistence {
126
143
  });
127
144
  }
128
145
  initialize(roomContext) {
129
- this._initialized = Promise.resolve(true);
130
- return this;
146
+ return new _PersistenceRedis(__spreadValues({
147
+ client: this._client
148
+ }, { _initialized: Promise.resolve(true) }));
131
149
  }
132
150
  _getClusterKey(key) {
133
151
  return `${HASH_TAG}${key}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/persistence-redis",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "@pluv/io crdt storage persistence for node.js",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@types/node": "^22.15.21",
21
- "@pluv/io": "^2.2.4",
22
- "@pluv/types": "^2.2.4"
21
+ "@pluv/io": "^2.2.6",
22
+ "@pluv/types": "^2.2.6"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "ioredis": "^5.0.0"
@@ -29,8 +29,8 @@
29
29
  "ioredis": "^5.6.1",
30
30
  "tsup": "^8.5.0",
31
31
  "typescript": "^5.8.3",
32
- "@pluv/tsconfig": "^2.2.4",
33
- "eslint-config-pluv": "^2.2.4"
32
+ "@pluv/tsconfig": "^2.2.6",
33
+ "eslint-config-pluv": "^2.2.6"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -24,6 +24,7 @@ export class PersistenceRedis extends AbstractPersistence {
24
24
  const { client } = options;
25
25
 
26
26
  this._client = client;
27
+ this._initialized = (options as any)._initialized;
27
28
  }
28
29
 
29
30
  public async addUser(
@@ -143,10 +144,11 @@ export class PersistenceRedis extends AbstractPersistence {
143
144
  return await this._client.scard(this._getRoomUsersKey(room));
144
145
  }
145
146
 
146
- public initialize(roomContext: {}): this {
147
- this._initialized = Promise.resolve(true as const);
148
-
149
- return this;
147
+ public initialize(roomContext: {}): typeof this {
148
+ return new PersistenceRedis({
149
+ client: this._client,
150
+ ...{ _initialized: Promise.resolve(true as const) },
151
+ }) as typeof this;
150
152
  }
151
153
 
152
154
  private _getClusterKey(key: string): string {