@pluv/client 0.41.7 → 0.42.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 +8 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +19 -0
- package/dist/index.mjs +19 -0
- package/package.json +6 -6
- package/src/PluvRoom.ts +26 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/client@0.
|
|
2
|
+
> @pluv/client@0.42.0 build /home/runner/work/pluv/pluv/packages/client
|
|
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
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m55.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m55.91 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 112ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m57.22 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 118ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m24.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m24.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3444ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m24.61 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m24.61 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -206,6 +206,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
|
|
|
206
206
|
private _handleRegisteredMessage;
|
|
207
207
|
private _handleStorageReceivedMessage;
|
|
208
208
|
private _handleStorageUpdatedMessage;
|
|
209
|
+
private _handleSyncStateReceived;
|
|
209
210
|
private _handleUserJoinedMessage;
|
|
210
211
|
private _heartbeat;
|
|
211
212
|
private _logDebug;
|
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
|
|
|
206
206
|
private _handleRegisteredMessage;
|
|
207
207
|
private _handleStorageReceivedMessage;
|
|
208
208
|
private _handleStorageUpdatedMessage;
|
|
209
|
+
private _handleSyncStateReceived;
|
|
209
210
|
private _handleUserJoinedMessage;
|
|
210
211
|
private _heartbeat;
|
|
211
212
|
private _logDebug;
|
package/dist/index.js
CHANGED
|
@@ -1113,6 +1113,21 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1113
1113
|
);
|
|
1114
1114
|
this._crdtNotifier.rootSubject.next(storageRoot);
|
|
1115
1115
|
}
|
|
1116
|
+
_handleSyncStateReceived(message) {
|
|
1117
|
+
var _a;
|
|
1118
|
+
const { connectionId } = message;
|
|
1119
|
+
if (!connectionId) return;
|
|
1120
|
+
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
1121
|
+
if (!this._usersManager.myself) return;
|
|
1122
|
+
const data = message.data;
|
|
1123
|
+
const active = new Set((_a = data == null ? void 0 : data.connectionIds) != null ? _a : []);
|
|
1124
|
+
const quitters = this._usersManager.getOthers().filter((other) => !active.has(other.connectionId));
|
|
1125
|
+
quitters.forEach((quitter) => {
|
|
1126
|
+
this._usersManager.deleteConnection(quitter.connectionId);
|
|
1127
|
+
});
|
|
1128
|
+
const remaining = this._usersManager.getOthers();
|
|
1129
|
+
this._stateNotifier.subjects.others.next(remaining);
|
|
1130
|
+
}
|
|
1116
1131
|
_handleUserJoinedMessage(message) {
|
|
1117
1132
|
const { connectionId } = message;
|
|
1118
1133
|
if (!connectionId) return;
|
|
@@ -1250,6 +1265,10 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1250
1265
|
this._handleStorageUpdatedMessage(message);
|
|
1251
1266
|
return;
|
|
1252
1267
|
}
|
|
1268
|
+
case "$syncStateReceived": {
|
|
1269
|
+
this._handleSyncStateReceived(message);
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1253
1272
|
case "$userJoined": {
|
|
1254
1273
|
this._handleUserJoinedMessage(message);
|
|
1255
1274
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -1082,6 +1082,21 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1082
1082
|
);
|
|
1083
1083
|
this._crdtNotifier.rootSubject.next(storageRoot);
|
|
1084
1084
|
}
|
|
1085
|
+
_handleSyncStateReceived(message) {
|
|
1086
|
+
var _a;
|
|
1087
|
+
const { connectionId } = message;
|
|
1088
|
+
if (!connectionId) return;
|
|
1089
|
+
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
1090
|
+
if (!this._usersManager.myself) return;
|
|
1091
|
+
const data = message.data;
|
|
1092
|
+
const active = new Set((_a = data == null ? void 0 : data.connectionIds) != null ? _a : []);
|
|
1093
|
+
const quitters = this._usersManager.getOthers().filter((other) => !active.has(other.connectionId));
|
|
1094
|
+
quitters.forEach((quitter) => {
|
|
1095
|
+
this._usersManager.deleteConnection(quitter.connectionId);
|
|
1096
|
+
});
|
|
1097
|
+
const remaining = this._usersManager.getOthers();
|
|
1098
|
+
this._stateNotifier.subjects.others.next(remaining);
|
|
1099
|
+
}
|
|
1085
1100
|
_handleUserJoinedMessage(message) {
|
|
1086
1101
|
const { connectionId } = message;
|
|
1087
1102
|
if (!connectionId) return;
|
|
@@ -1219,6 +1234,10 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
1219
1234
|
this._handleStorageUpdatedMessage(message);
|
|
1220
1235
|
return;
|
|
1221
1236
|
}
|
|
1237
|
+
case "$syncStateReceived": {
|
|
1238
|
+
this._handleSyncStateReceived(message);
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1222
1241
|
case "$userJoined": {
|
|
1223
1242
|
this._handleUserJoinedMessage(message);
|
|
1224
1243
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
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": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
21
|
+
"@pluv/crdt": "^0.42.0",
|
|
22
|
+
"@pluv/types": "^0.42.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"eslint": "^9.25.
|
|
25
|
+
"eslint": "^9.25.1",
|
|
26
26
|
"tsup": "^8.4.0",
|
|
27
27
|
"typescript": "^5.8.3",
|
|
28
|
-
"@pluv/tsconfig": "^0.
|
|
29
|
-
"eslint-config-pluv": "^0.
|
|
28
|
+
"@pluv/tsconfig": "^0.42.0",
|
|
29
|
+
"eslint-config-pluv": "^0.42.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvRoom.ts
CHANGED
|
@@ -1017,6 +1017,28 @@ export class PluvRoom<
|
|
|
1017
1017
|
this._crdtNotifier.rootSubject.next(storageRoot);
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
|
+
private _handleSyncStateReceived(message: IOEventMessage<TIO>): void {
|
|
1021
|
+
const { connectionId } = message;
|
|
1022
|
+
|
|
1023
|
+
if (!connectionId) return;
|
|
1024
|
+
// Should not reach here
|
|
1025
|
+
if (!this._state.webSocket) throw new Error("Could not find WebSocket");
|
|
1026
|
+
if (!this._usersManager.myself) return;
|
|
1027
|
+
|
|
1028
|
+
const data = message.data as BaseIOEventRecord<InferIOAuthorize<TIO>>["$syncStateReceived"];
|
|
1029
|
+
const active = new Set(data?.connectionIds ?? []);
|
|
1030
|
+
|
|
1031
|
+
const quitters = this._usersManager.getOthers().filter((other) => !active.has(other.connectionId));
|
|
1032
|
+
|
|
1033
|
+
quitters.forEach((quitter) => {
|
|
1034
|
+
this._usersManager.deleteConnection(quitter.connectionId);
|
|
1035
|
+
});
|
|
1036
|
+
|
|
1037
|
+
const remaining = this._usersManager.getOthers();
|
|
1038
|
+
|
|
1039
|
+
this._stateNotifier.subjects.others.next(remaining);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1020
1042
|
private _handleUserJoinedMessage(message: IOEventMessage<TIO>): void {
|
|
1021
1043
|
const { connectionId } = message;
|
|
1022
1044
|
|
|
@@ -1190,6 +1212,10 @@ export class PluvRoom<
|
|
|
1190
1212
|
this._handleStorageUpdatedMessage(message);
|
|
1191
1213
|
return;
|
|
1192
1214
|
}
|
|
1215
|
+
case "$syncStateReceived": {
|
|
1216
|
+
this._handleSyncStateReceived(message);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1193
1219
|
case "$userJoined": {
|
|
1194
1220
|
this._handleUserJoinedMessage(message);
|
|
1195
1221
|
return;
|