@pluv/io 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,9 +1,9 @@
1
1
 
2
- > @pluv/io@3.1.2 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@3.1.4 build /home/runner/work/pluv/pluv/packages/io
3
3
  > pnpm run version && tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
 
6
- > @pluv/io@3.1.2 version /home/runner/work/pluv/pluv/packages/io
6
+ > @pluv/io@3.1.4 version /home/runner/work/pluv/pluv/packages/io
7
7
  > genversion ./src/version.generated.ts --esm
8
8
 
9
9
  CLI Building entry: src/index.ts
@@ -12,11 +12,11 @@
12
12
  CLI Target: es6
13
13
  ESM Build start
14
14
  CJS Build start
15
- ESM dist/index.mjs 52.78 KB
16
- ESM ⚡️ Build success in 109ms
17
- CJS dist/index.js 54.96 KB
18
- CJS ⚡️ Build success in 109ms
15
+ CJS dist/index.js 55.16 KB
16
+ CJS ⚡️ Build success in 121ms
17
+ ESM dist/index.mjs 52.98 KB
18
+ ESM ⚡️ Build success in 149ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 4267ms
20
+ DTS ⚡️ Build success in 4534ms
21
21
  DTS dist/index.d.mts 33.98 KB
22
22
  DTS dist/index.d.ts 33.98 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 3.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/crdt@3.1.4
8
+ - @pluv/types@3.1.4
9
+
10
+ ## 3.1.3
11
+
12
+ ### Patch Changes
13
+
14
+ - 651a9f8: Fixed applying `getInitialStorage` if the initial storage state is empty.
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
@@ -1170,7 +1170,7 @@ var IORoom = class {
1170
1170
  };
1171
1171
 
1172
1172
  // src/version.generated.ts
1173
- var version = "3.1.2";
1173
+ var version = "3.1.4";
1174
1174
 
1175
1175
  // src/PluvServer.ts
1176
1176
  var PluvServer = class {
@@ -1267,7 +1267,10 @@ var PluvServer = class {
1267
1267
  const update = data == null ? void 0 : data.update;
1268
1268
  if (!oldState) {
1269
1269
  const loadedState = yield this._getInitialStorage({ context, room });
1270
- if (!!loadedState) {
1270
+ const checkDoc = this._config.crdt.doc(() => ({})).getEmpty().applyEncodedState({ update: loadedState });
1271
+ const isEmpty = checkDoc.isEmpty();
1272
+ checkDoc.destroy();
1273
+ if (!!loadedState && !isEmpty) {
1271
1274
  doc.applyEncodedState({ update: loadedState }).getEncodedState();
1272
1275
  }
1273
1276
  }
package/dist/index.mjs CHANGED
@@ -1128,7 +1128,7 @@ var IORoom = class {
1128
1128
  };
1129
1129
 
1130
1130
  // src/version.generated.ts
1131
- var version = "3.1.2";
1131
+ var version = "3.1.4";
1132
1132
 
1133
1133
  // src/PluvServer.ts
1134
1134
  var PluvServer = class {
@@ -1225,7 +1225,10 @@ var PluvServer = class {
1225
1225
  const update = data == null ? void 0 : data.update;
1226
1226
  if (!oldState) {
1227
1227
  const loadedState = yield this._getInitialStorage({ context, room });
1228
- if (!!loadedState) {
1228
+ const checkDoc = this._config.crdt.doc(() => ({})).getEmpty().applyEncodedState({ update: loadedState });
1229
+ const isEmpty = checkDoc.isEmpty();
1230
+ checkDoc.destroy();
1231
+ if (!!loadedState && !isEmpty) {
1229
1232
  doc.applyEncodedState({ update: loadedState }).getEncodedState();
1230
1233
  }
1231
1234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/io",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "@pluv/io server-side websocket manager",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -21,16 +21,16 @@
21
21
  "jose": "^5.10.0",
22
22
  "kleur": "^4.1.5",
23
23
  "wonka": "^6.3.5",
24
- "@pluv/crdt": "^3.1.2",
25
- "@pluv/types": "^3.1.2"
24
+ "@pluv/crdt": "^3.1.4",
25
+ "@pluv/types": "^3.1.4"
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^9.27.0",
29
29
  "genversion": "^3.2.0",
30
30
  "tsup": "^8.5.0",
31
31
  "typescript": "^5.8.3",
32
- "@pluv/tsconfig": "^3.1.2",
33
- "eslint-config-pluv": "^3.1.2"
32
+ "@pluv/tsconfig": "^3.1.4",
33
+ "eslint-config-pluv": "^3.1.4"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
package/src/PluvServer.ts CHANGED
@@ -211,7 +211,14 @@ export class PluvServer<
211
211
  if (!oldState) {
212
212
  const loadedState = await this._getInitialStorage({ context, room });
213
213
 
214
- if (!!loadedState) {
214
+ const checkDoc = this._config.crdt
215
+ .doc(() => ({}))
216
+ .getEmpty()
217
+ .applyEncodedState({ update: loadedState });
218
+ const isEmpty = checkDoc.isEmpty();
219
+ checkDoc.destroy();
220
+
221
+ if (!!loadedState && !isEmpty) {
215
222
  doc.applyEncodedState({ update: loadedState }).getEncodedState();
216
223
  }
217
224
  }
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '3.1.2'
2
+ export const version = '3.1.4'