@pluv/io 0.2.3 → 0.2.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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +17 -0
- package/README.md +2 -2
- package/dist/index.js +15 -4
- package/dist/index.mjs +11 -4
- package/package.json +11 -11
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.2.
|
|
2
|
+
> @pluv/io@0.2.4 build /home/runner/work/pluv/pluv/packages/io
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v6.
|
|
7
|
+
[34mCLI[39m tsup v6.6.3
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m29.22 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 97ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m27.14 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 99ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 2738ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m12.86 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 0.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8bf62cb: bumped dependencies
|
|
8
|
+
- 7e52685: Bumped dependencies
|
|
9
|
+
- 3b7b17a: docs: corrected readme typos
|
|
10
|
+
- b1cb325: Updated dependencies
|
|
11
|
+
- 8e97fb2: Updated dependencies
|
|
12
|
+
- Updated dependencies [8bf62cb]
|
|
13
|
+
- Updated dependencies [7e52685]
|
|
14
|
+
- Updated dependencies [b1cb325]
|
|
15
|
+
- Updated dependencies [327a6ef]
|
|
16
|
+
- Updated dependencies [8e97fb2]
|
|
17
|
+
- @pluv/crdt-yjs@0.3.0
|
|
18
|
+
- @pluv/types@0.1.3
|
|
19
|
+
|
|
3
20
|
## 0.2.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
## Intro
|
|
48
48
|
|
|
49
|
-
Pluv.IO allows you to build real-time
|
|
49
|
+
Pluv.IO allows you to build real-time collaborative features with a fully end-to-end type-safe api.
|
|
50
50
|
|
|
51
51
|
### Why?
|
|
52
52
|
|
|
@@ -65,7 +65,7 @@ broadcast("SEND_MESSAGE", { message: "Hello world!" });
|
|
|
65
65
|
And this:
|
|
66
66
|
|
|
67
67
|
```tsx
|
|
68
|
-
const [myCursor, updatePresence] = usePluvMyPresence((me) => me.
|
|
68
|
+
const [myCursor, updatePresence] = usePluvMyPresence((me) => me.cursor);
|
|
69
69
|
const cursors = usePluvOthers((others) => {
|
|
70
70
|
return others.map((other) => other.presence.cursor);
|
|
71
71
|
});
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
47
47
|
return to;
|
|
48
48
|
};
|
|
49
49
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
50
54
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
51
55
|
mod
|
|
52
56
|
));
|
|
@@ -160,8 +164,11 @@ var PubSub = class extends AbstractPubSub {
|
|
|
160
164
|
constructor() {
|
|
161
165
|
super(...arguments);
|
|
162
166
|
this._currentSubscriptionId = 0;
|
|
167
|
+
// Map of roomName to subjects
|
|
163
168
|
this._subjects = /* @__PURE__ */ new Map();
|
|
169
|
+
// Map of roomName to subscription ids
|
|
164
170
|
this._subscriptionsRefs = /* @__PURE__ */ new Map();
|
|
171
|
+
// Map of
|
|
165
172
|
this._unsubscriptions = /* @__PURE__ */ new Map();
|
|
166
173
|
}
|
|
167
174
|
publish(roomName, payload) {
|
|
@@ -219,9 +226,13 @@ var AbstractPlatform = class {
|
|
|
219
226
|
// src/AbstractWebSocket.ts
|
|
220
227
|
var AbstractWebSocket = class {
|
|
221
228
|
constructor(config) {
|
|
229
|
+
/** The connection is not yet open. */
|
|
222
230
|
this.CONNECTING = 0;
|
|
231
|
+
/** The connection is open and ready to communicate. */
|
|
223
232
|
this.OPEN = 1;
|
|
233
|
+
/** The connection is in the process of closing. */
|
|
224
234
|
this.CLOSING = 2;
|
|
235
|
+
/** The connection is closed. */
|
|
225
236
|
this.CLOSED = 3;
|
|
226
237
|
const { room } = config;
|
|
227
238
|
this.room = room;
|
|
@@ -356,7 +367,7 @@ var IORoom = class {
|
|
|
356
367
|
pluvWs.close(3e3, "WebSocket unauthorized.");
|
|
357
368
|
return;
|
|
358
369
|
}
|
|
359
|
-
const currentTime = new Date().getTime();
|
|
370
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
360
371
|
const session = {
|
|
361
372
|
id: sessionId,
|
|
362
373
|
presence: null,
|
|
@@ -481,7 +492,7 @@ var IORoom = class {
|
|
|
481
492
|
_broadcast(params) {
|
|
482
493
|
var _a;
|
|
483
494
|
const { message, senderId } = params;
|
|
484
|
-
const currentTime = new Date().getTime();
|
|
495
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
485
496
|
const sender = senderId ? this._sessions.get(senderId) : null;
|
|
486
497
|
const quitters = Array.from(this._sessions.values()).filter(
|
|
487
498
|
(session) => session.quit || currentTime - session.timers.ping > PING_TIMEOUT_MS
|
|
@@ -577,7 +588,7 @@ var IORoom = class {
|
|
|
577
588
|
});
|
|
578
589
|
}
|
|
579
590
|
_getSessionsSize() {
|
|
580
|
-
const currentTime = new Date().getTime();
|
|
591
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
581
592
|
return Array.from(this._sessions.values()).reduce((count, session) => {
|
|
582
593
|
if (session.quit)
|
|
583
594
|
return count;
|
|
@@ -741,7 +752,7 @@ var PluvIO = class {
|
|
|
741
752
|
resolver: (data, { session }) => {
|
|
742
753
|
if (!session)
|
|
743
754
|
return {};
|
|
744
|
-
const currentTime = new Date().getTime();
|
|
755
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
745
756
|
session.timers.ping = currentTime;
|
|
746
757
|
return { $PONG: {} };
|
|
747
758
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -127,8 +127,11 @@ var PubSub = class extends AbstractPubSub {
|
|
|
127
127
|
constructor() {
|
|
128
128
|
super(...arguments);
|
|
129
129
|
this._currentSubscriptionId = 0;
|
|
130
|
+
// Map of roomName to subjects
|
|
130
131
|
this._subjects = /* @__PURE__ */ new Map();
|
|
132
|
+
// Map of roomName to subscription ids
|
|
131
133
|
this._subscriptionsRefs = /* @__PURE__ */ new Map();
|
|
134
|
+
// Map of
|
|
132
135
|
this._unsubscriptions = /* @__PURE__ */ new Map();
|
|
133
136
|
}
|
|
134
137
|
publish(roomName, payload) {
|
|
@@ -186,9 +189,13 @@ var AbstractPlatform = class {
|
|
|
186
189
|
// src/AbstractWebSocket.ts
|
|
187
190
|
var AbstractWebSocket = class {
|
|
188
191
|
constructor(config) {
|
|
192
|
+
/** The connection is not yet open. */
|
|
189
193
|
this.CONNECTING = 0;
|
|
194
|
+
/** The connection is open and ready to communicate. */
|
|
190
195
|
this.OPEN = 1;
|
|
196
|
+
/** The connection is in the process of closing. */
|
|
191
197
|
this.CLOSING = 2;
|
|
198
|
+
/** The connection is closed. */
|
|
192
199
|
this.CLOSED = 3;
|
|
193
200
|
const { room } = config;
|
|
194
201
|
this.room = room;
|
|
@@ -323,7 +330,7 @@ var IORoom = class {
|
|
|
323
330
|
pluvWs.close(3e3, "WebSocket unauthorized.");
|
|
324
331
|
return;
|
|
325
332
|
}
|
|
326
|
-
const currentTime = new Date().getTime();
|
|
333
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
327
334
|
const session = {
|
|
328
335
|
id: sessionId,
|
|
329
336
|
presence: null,
|
|
@@ -448,7 +455,7 @@ var IORoom = class {
|
|
|
448
455
|
_broadcast(params) {
|
|
449
456
|
var _a;
|
|
450
457
|
const { message, senderId } = params;
|
|
451
|
-
const currentTime = new Date().getTime();
|
|
458
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
452
459
|
const sender = senderId ? this._sessions.get(senderId) : null;
|
|
453
460
|
const quitters = Array.from(this._sessions.values()).filter(
|
|
454
461
|
(session) => session.quit || currentTime - session.timers.ping > PING_TIMEOUT_MS
|
|
@@ -544,7 +551,7 @@ var IORoom = class {
|
|
|
544
551
|
});
|
|
545
552
|
}
|
|
546
553
|
_getSessionsSize() {
|
|
547
|
-
const currentTime = new Date().getTime();
|
|
554
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
548
555
|
return Array.from(this._sessions.values()).reduce((count, session) => {
|
|
549
556
|
if (session.quit)
|
|
550
557
|
return count;
|
|
@@ -708,7 +715,7 @@ var PluvIO = class {
|
|
|
708
715
|
resolver: (data, { session }) => {
|
|
709
716
|
if (!session)
|
|
710
717
|
return {};
|
|
711
|
-
const currentTime = new Date().getTime();
|
|
718
|
+
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
712
719
|
session.timers.ping = currentTime;
|
|
713
720
|
return { $PONG: {} };
|
|
714
721
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "@pluv/io server-side websocket manager",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,22 +17,22 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@panva/hkdf": "^1.0.
|
|
20
|
+
"@panva/hkdf": "^1.0.4",
|
|
21
21
|
"chalk": "^4.1.2",
|
|
22
|
-
"jose": "^4.
|
|
23
|
-
"wonka": "^6.
|
|
24
|
-
"@pluv/crdt-yjs": "^0.
|
|
25
|
-
"@pluv/types": "^0.1.
|
|
22
|
+
"jose": "^4.13.1",
|
|
23
|
+
"wonka": "^6.2.3",
|
|
24
|
+
"@pluv/crdt-yjs": "^0.3.0",
|
|
25
|
+
"@pluv/types": "^0.1.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"yjs": "^13.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"tsup": "^6.
|
|
32
|
-
"typescript": "^4.9.
|
|
33
|
-
"yjs": "^13.5.
|
|
34
|
-
"@pluv/tsconfig": "^0.1.
|
|
35
|
-
"eslint-config-pluv": "^0.1.
|
|
31
|
+
"tsup": "^6.6.3",
|
|
32
|
+
"typescript": "^4.9.5",
|
|
33
|
+
"yjs": "^13.5.49",
|
|
34
|
+
"@pluv/tsconfig": "^0.1.3",
|
|
35
|
+
"eslint-config-pluv": "^0.1.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|