@pluv/client 0.1.2 → 0.2.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 +7 -7
- package/CHANGELOG.md +21 -0
- package/README.md +6 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +7 -7
- package/src/PluvRoom.ts +9 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/client@0.
|
|
2
|
+
> @pluv/client@0.2.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,10 +8,10 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m29.38 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 86ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m30.46 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 98ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m8.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 2621ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m8.26 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @pluv/client
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 95b5ef8: breaking: update PluvRoom.broadcast api
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [6858682]
|
|
12
|
+
- @pluv/crdt-yjs@0.2.0
|
|
13
|
+
- @pluv/types@0.1.2
|
|
14
|
+
|
|
15
|
+
## 0.1.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- fe80d7b: added preview disclaimer about breaking changes in the readme
|
|
20
|
+
- Updated dependencies [fe80d7b]
|
|
21
|
+
- @pluv/crdt-yjs@0.1.3
|
|
22
|
+
- @pluv/types@0.1.2
|
|
23
|
+
|
|
3
24
|
## 0.1.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
> **Disclaimer:**
|
|
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
|
+
|
|
1
4
|
<h1 align="center">
|
|
2
5
|
<br>
|
|
3
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">
|
|
@@ -23,7 +26,9 @@
|
|
|
23
26
|
<img src="https://img.shields.io/badge/docs-coming%20soon!-blue" alt="Docs coming soon!" />
|
|
24
27
|
</p>
|
|
25
28
|
|
|
26
|
-
<
|
|
29
|
+
<p align="center">
|
|
30
|
+
<img src="https://github.com/pluv-io/pluv/blob/master/assets/demo-events.gif?raw=true" alt="Demo" />
|
|
31
|
+
</p>
|
|
27
32
|
|
|
28
33
|
## `@pluv/client`
|
|
29
34
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InferYjsSharedTypeJson, array, map, text, unstable__object } from '@pluv/crdt-yjs';
|
|
2
2
|
export { InferYjsSharedTypeJson } from '@pluv/crdt-yjs';
|
|
3
3
|
import * as _pluv_types from '@pluv/types';
|
|
4
|
-
import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, InputZodLike, InferIOInput,
|
|
4
|
+
import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, InputZodLike, InferIOInput, InferIOAuthorizeRequired } from '@pluv/types';
|
|
5
5
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
6
6
|
import { AbstractType } from 'yjs';
|
|
7
7
|
export { AbstractType } from 'yjs';
|
|
@@ -105,10 +105,10 @@ declare class PluvRoom<TIO extends IOLike, TPresence extends JsonObject = {}, TS
|
|
|
105
105
|
private _usersManager;
|
|
106
106
|
constructor(room: string, options: RoomConfig<TIO, TPresence, TStorage>);
|
|
107
107
|
get webSocket(): WebSocket | null;
|
|
108
|
-
broadcast(
|
|
108
|
+
broadcast<TEvent extends keyof InferIOInput<TIO>>(event: TEvent, data: Id<InferIOInput<TIO>[TEvent]>): void;
|
|
109
109
|
connect(): Promise<void>;
|
|
110
110
|
disconnect(): void;
|
|
111
|
-
event: <TEvent extends keyof InferIOOutput<TIO>>(
|
|
111
|
+
event: <TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>) => (() => void);
|
|
112
112
|
getConnection(): WebSocketConnection;
|
|
113
113
|
getMyPresence: () => TPresence | null;
|
|
114
114
|
getMyself: () => Id<UserInfo<TIO, TPresence>> | null;
|
package/dist/index.js
CHANGED
|
@@ -298,8 +298,8 @@ var PluvRoom = class {
|
|
|
298
298
|
};
|
|
299
299
|
this._windowListeners = null;
|
|
300
300
|
this._wsListeners = null;
|
|
301
|
-
this.event = (
|
|
302
|
-
return this._eventNotifier.subscribe(
|
|
301
|
+
this.event = (event, callback) => {
|
|
302
|
+
return this._eventNotifier.subscribe(event, callback);
|
|
303
303
|
};
|
|
304
304
|
this.getMyPresence = () => {
|
|
305
305
|
var _a, _b;
|
|
@@ -362,12 +362,13 @@ var PluvRoom = class {
|
|
|
362
362
|
get webSocket() {
|
|
363
363
|
return this._state.webSocket;
|
|
364
364
|
}
|
|
365
|
-
broadcast(
|
|
365
|
+
broadcast(event, data) {
|
|
366
366
|
if (!this._state.webSocket)
|
|
367
367
|
return;
|
|
368
368
|
if (this._state.connection.state !== "Open" /* Open */)
|
|
369
369
|
return;
|
|
370
|
-
|
|
370
|
+
const type = event.toString();
|
|
371
|
+
this._sendMessage({ data, type });
|
|
371
372
|
}
|
|
372
373
|
connect() {
|
|
373
374
|
return __async(this, null, function* () {
|
package/dist/index.mjs
CHANGED
|
@@ -275,8 +275,8 @@ var PluvRoom = class {
|
|
|
275
275
|
};
|
|
276
276
|
this._windowListeners = null;
|
|
277
277
|
this._wsListeners = null;
|
|
278
|
-
this.event = (
|
|
279
|
-
return this._eventNotifier.subscribe(
|
|
278
|
+
this.event = (event, callback) => {
|
|
279
|
+
return this._eventNotifier.subscribe(event, callback);
|
|
280
280
|
};
|
|
281
281
|
this.getMyPresence = () => {
|
|
282
282
|
var _a, _b;
|
|
@@ -339,12 +339,13 @@ var PluvRoom = class {
|
|
|
339
339
|
get webSocket() {
|
|
340
340
|
return this._state.webSocket;
|
|
341
341
|
}
|
|
342
|
-
broadcast(
|
|
342
|
+
broadcast(event, data) {
|
|
343
343
|
if (!this._state.webSocket)
|
|
344
344
|
return;
|
|
345
345
|
if (this._state.connection.state !== "Open" /* Open */)
|
|
346
346
|
return;
|
|
347
|
-
|
|
347
|
+
const type = event.toString();
|
|
348
|
+
this._sendMessage({ data, type });
|
|
348
349
|
}
|
|
349
350
|
connect() {
|
|
350
351
|
return __async(this, null, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "@pluv/io frontend client",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"
|
|
21
|
-
"@pluv/
|
|
22
|
-
"
|
|
20
|
+
"wonka": "^6.1.2",
|
|
21
|
+
"@pluv/crdt-yjs": "^0.2.0",
|
|
22
|
+
"@pluv/types": "^0.1.2"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"yjs": "^13.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@pluv/tsconfig": "^0.1.1",
|
|
29
|
-
"eslint-config-pluv": "^0.1.1",
|
|
30
28
|
"tsup": "^6.5.0",
|
|
31
29
|
"typescript": "^4.9.4",
|
|
32
|
-
"yjs": "^13.5.44"
|
|
30
|
+
"yjs": "^13.5.44",
|
|
31
|
+
"@pluv/tsconfig": "^0.1.2",
|
|
32
|
+
"eslint-config-pluv": "^0.1.3"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvRoom.ts
CHANGED
|
@@ -201,11 +201,16 @@ export class PluvRoom<
|
|
|
201
201
|
return this._state.webSocket;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
public broadcast
|
|
204
|
+
public broadcast<TEvent extends keyof InferIOInput<TIO>>(
|
|
205
|
+
event: TEvent,
|
|
206
|
+
data: Id<InferIOInput<TIO>[TEvent]>
|
|
207
|
+
): void {
|
|
205
208
|
if (!this._state.webSocket) return;
|
|
206
209
|
if (this._state.connection.state !== ConnectionState.Open) return;
|
|
207
210
|
|
|
208
|
-
|
|
211
|
+
const type = event.toString();
|
|
212
|
+
|
|
213
|
+
this._sendMessage({ data, type });
|
|
209
214
|
}
|
|
210
215
|
|
|
211
216
|
public async connect(): Promise<void> {
|
|
@@ -291,10 +296,10 @@ export class PluvRoom<
|
|
|
291
296
|
}
|
|
292
297
|
|
|
293
298
|
public event = <TEvent extends keyof InferIOOutput<TIO>>(
|
|
294
|
-
|
|
299
|
+
event: TEvent,
|
|
295
300
|
callback: EventNotifierSubscriptionCallback<TIO, TEvent>
|
|
296
301
|
): (() => void) => {
|
|
297
|
-
return this._eventNotifier.subscribe(
|
|
302
|
+
return this._eventNotifier.subscribe(event, callback);
|
|
298
303
|
};
|
|
299
304
|
|
|
300
305
|
public getConnection(): WebSocketConnection {
|