@pluv/client 3.1.2 → 3.1.4

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/client@3.1.2 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@3.1.4 build /home/runner/work/pluv/pluv/packages/client
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
- ESM dist/index.mjs 63.03 KB
12
- ESM ⚡️ Build success in 119ms
13
- CJS dist/index.js 64.77 KB
14
- CJS ⚡️ Build success in 118ms
11
+ ESM dist/index.mjs 63.39 KB
12
+ ESM ⚡️ Build success in 125ms
13
+ CJS dist/index.js 65.12 KB
14
+ CJS ⚡️ Build success in 128ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4812ms
16
+ DTS ⚡️ Build success in 4570ms
17
17
  DTS dist/index.d.mts 19.16 KB
18
18
  DTS dist/index.d.ts 19.16 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 3.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - e443b66: Fixed a case where an empty storage store (e.g. @pluv/addon-indexeddb) would result in an empty initial storage, even when an initial storage was defined.
8
+ - @pluv/crdt@3.1.4
9
+ - @pluv/types@3.1.4
10
+
11
+ ## 3.1.3
12
+
13
+ ### Patch Changes
14
+
15
+ - @pluv/crdt@3.1.3
16
+ - @pluv/types@3.1.3
17
+
3
18
  ## 3.1.2
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1141,7 +1141,7 @@ var PluvRoom = class {
1141
1141
  }
1142
1142
  _handleRegisteredMessage(message) {
1143
1143
  return __async(this, null, function* () {
1144
- var _a, _b, _c;
1144
+ var _a, _b;
1145
1145
  const { connectionId } = message;
1146
1146
  const user = message.user;
1147
1147
  if (!connectionId) return;
@@ -1163,7 +1163,21 @@ var PluvRoom = class {
1163
1163
  const myself = (_b = this._usersManager.myself) != null ? _b : null;
1164
1164
  this._stateNotifier.subjects["my-presence"].next(presence);
1165
1165
  this._stateNotifier.subjects.myself.next(myself);
1166
- const update = !state ? (_c = this._crdtManager.resolveEncodedState(yield this._storageStore.getUpdates())) != null ? _c : this._crdtManager.getInitialState() : this._crdtManager.getInitialState();
1166
+ const update = yield (() => __async(this, null, function* () {
1167
+ if (!!state) {
1168
+ this._logDebug("Retrieving initial state");
1169
+ return this._crdtManager.getInitialState();
1170
+ }
1171
+ const resolved = this._crdtManager.resolveEncodedState(
1172
+ yield this._storageStore.getUpdates()
1173
+ );
1174
+ if (!!resolved) {
1175
+ this._logDebug("Retrieving storage store state");
1176
+ return resolved;
1177
+ }
1178
+ this._logDebug("Retrieving initial state");
1179
+ return this._crdtManager.getInitialState();
1180
+ }))();
1167
1181
  this._sendMessage({
1168
1182
  type: "$initializeSession",
1169
1183
  data: { presence, update }
package/dist/index.mjs CHANGED
@@ -1113,7 +1113,7 @@ var PluvRoom = class {
1113
1113
  }
1114
1114
  _handleRegisteredMessage(message) {
1115
1115
  return __async(this, null, function* () {
1116
- var _a, _b, _c;
1116
+ var _a, _b;
1117
1117
  const { connectionId } = message;
1118
1118
  const user = message.user;
1119
1119
  if (!connectionId) return;
@@ -1135,7 +1135,21 @@ var PluvRoom = class {
1135
1135
  const myself = (_b = this._usersManager.myself) != null ? _b : null;
1136
1136
  this._stateNotifier.subjects["my-presence"].next(presence);
1137
1137
  this._stateNotifier.subjects.myself.next(myself);
1138
- const update = !state ? (_c = this._crdtManager.resolveEncodedState(yield this._storageStore.getUpdates())) != null ? _c : this._crdtManager.getInitialState() : this._crdtManager.getInitialState();
1138
+ const update = yield (() => __async(this, null, function* () {
1139
+ if (!!state) {
1140
+ this._logDebug("Retrieving initial state");
1141
+ return this._crdtManager.getInitialState();
1142
+ }
1143
+ const resolved = this._crdtManager.resolveEncodedState(
1144
+ yield this._storageStore.getUpdates()
1145
+ );
1146
+ if (!!resolved) {
1147
+ this._logDebug("Retrieving storage store state");
1148
+ return resolved;
1149
+ }
1150
+ this._logDebug("Retrieving initial state");
1151
+ return this._crdtManager.getInitialState();
1152
+ }))();
1139
1153
  this._sendMessage({
1140
1154
  type: "$initializeSession",
1141
1155
  data: { presence, update }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "@pluv/io frontend client",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "wonka": "^6.3.5",
21
- "@pluv/crdt": "^3.1.2",
22
- "@pluv/types": "^3.1.2"
21
+ "@pluv/crdt": "^3.1.4",
22
+ "@pluv/types": "^3.1.4"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^9.27.0",
26
26
  "tsup": "^8.5.0",
27
27
  "typescript": "^5.8.3",
28
- "@pluv/tsconfig": "^3.1.2",
29
- "eslint-config-pluv": "^3.1.2"
28
+ "@pluv/tsconfig": "^3.1.4",
29
+ "eslint-config-pluv": "^3.1.4"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvRoom.ts CHANGED
@@ -1028,10 +1028,24 @@ export class PluvRoom<
1028
1028
  this._stateNotifier.subjects["my-presence"].next(presence);
1029
1029
  this._stateNotifier.subjects.myself.next(myself);
1030
1030
 
1031
- const update = !state
1032
- ? (this._crdtManager.resolveEncodedState(await this._storageStore.getUpdates()) ??
1033
- this._crdtManager.getInitialState())
1034
- : this._crdtManager.getInitialState();
1031
+ const update = await (async () => {
1032
+ if (!!state) {
1033
+ this._logDebug("Retrieving initial state");
1034
+ return this._crdtManager.getInitialState();
1035
+ }
1036
+
1037
+ const resolved = this._crdtManager.resolveEncodedState(
1038
+ await this._storageStore.getUpdates(),
1039
+ );
1040
+
1041
+ if (!!resolved) {
1042
+ this._logDebug("Retrieving storage store state");
1043
+ return resolved;
1044
+ }
1045
+
1046
+ this._logDebug("Retrieving initial state");
1047
+ return this._crdtManager.getInitialState();
1048
+ })();
1035
1049
 
1036
1050
  this._sendMessage({
1037
1051
  type: "$initializeSession",