@pluv/io 0.2.3 → 0.2.5

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,17 +1,17 @@
1
1
 
2
- > @pluv/io@0.2.3 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@0.2.5 build /home/runner/work/pluv/pluv/packages/io
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v6.5.0
7
+ CLI tsup v6.6.3
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 26.79 KB
12
- ESM ⚡️ Build success in 115ms
13
- CJS dist/index.js 28.59 KB
14
- CJS ⚡️ Build success in 116ms
11
+ CJS dist/index.js 29.22 KB
12
+ CJS ⚡️ Build success in 119ms
13
+ ESM dist/index.mjs 27.14 KB
14
+ ESM ⚡️ Build success in 120ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 2500ms
16
+ DTS ⚡️ Build success in 2926ms
17
17
  DTS dist/index.d.ts 12.86 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 161e00e: fixed links to other pluv packages in readmes
8
+ - f6c0e65: bumped dependencies
9
+ - Updated dependencies [161e00e]
10
+ - Updated dependencies [f6c0e65]
11
+ - @pluv/crdt-yjs@0.3.1
12
+ - @pluv/types@0.1.3
13
+
14
+ ## 0.2.4
15
+
16
+ ### Patch Changes
17
+
18
+ - 8bf62cb: bumped dependencies
19
+ - 7e52685: Bumped dependencies
20
+ - 3b7b17a: docs: corrected readme typos
21
+ - b1cb325: Updated dependencies
22
+ - 8e97fb2: Updated dependencies
23
+ - Updated dependencies [8bf62cb]
24
+ - Updated dependencies [7e52685]
25
+ - Updated dependencies [b1cb325]
26
+ - Updated dependencies [327a6ef]
27
+ - Updated dependencies [8e97fb2]
28
+ - @pluv/crdt-yjs@0.3.0
29
+ - @pluv/types@0.1.3
30
+
3
31
  ## 0.2.3
4
32
 
5
33
  ### Patch Changes
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
  > This package is currently in preview and may have breaking changes between versions. Please wait for a `v1.0.0` stable release before using this in production.
3
3
 
4
4
  <h1 align="center">
5
- <br>
6
- <img src="https://github.com/pluv-io/pluv/blob/master/assets/pluv-icon-192x192.png?raw=true" alt="Pluv.IO" width="180" style="border-radius:16px">
7
- <br>
5
+ <br />
6
+ <img src="https://github.com/pluv-io/pluv/blob/master/assets/pluv-icon-192x192.png?raw=true" alt="Pluv.IO" width="180" style="border-radius:16px" />
7
+ <br />
8
8
  Pluv.IO (preview)
9
- <br>
9
+ <br />
10
10
  </h1>
11
11
 
12
12
  <h3 align="center">Multi-platform, E2E type-safe realtime packages</h3>
@@ -26,7 +26,7 @@
26
26
  </p>
27
27
 
28
28
  <p align="center">
29
- <img src="https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555" alt="TypeScript">
29
+ <img src="https://badgen.net/badge/-/TypeScript?icon=typescript&label&labelColor=blue&color=555555" alt="TypeScript" />
30
30
  <a href="https://openbase.com/js/@pluv/io?utm_source=embedded&amp;utm_medium=badge&amp;utm_campaign=rate-badge">
31
31
  <img src="https://badges.openbase.com/js/featured/@pluv/io.svg?token=FdWfpo90mCUb7InAjDG0KeXM/uH+KdHK3us2pNRgWf0=" alt="Featured on Openbase" />
32
32
  </a>
@@ -46,7 +46,7 @@
46
46
 
47
47
  ## Intro
48
48
 
49
- Pluv.IO allows you to build real-time collaborate features with a fully end-to-end type-safe api.
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.presence.cursor);
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",
3
+ "version": "0.2.5",
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.2",
20
+ "@panva/hkdf": "^1.0.4",
21
21
  "chalk": "^4.1.2",
22
- "jose": "^4.11.2",
23
- "wonka": "^6.1.2",
24
- "@pluv/crdt-yjs": "^0.2.0",
25
- "@pluv/types": "^0.1.2"
22
+ "jose": "^4.13.1",
23
+ "wonka": "^6.2.4",
24
+ "@pluv/crdt-yjs": "^0.3.1",
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.5.0",
32
- "typescript": "^4.9.4",
33
- "yjs": "^13.5.44",
34
- "@pluv/tsconfig": "^0.1.2",
35
- "eslint-config-pluv": "^0.1.3"
31
+ "tsup": "^6.6.3",
32
+ "typescript": "^4.9.5",
33
+ "yjs": "^13.5.50",
34
+ "@pluv/tsconfig": "^0.1.3",
35
+ "eslint-config-pluv": "^0.1.5"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsup src/index.ts --format esm,cjs --dts",