@pluv/client 0.37.1 → 0.37.3
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 +16 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/package.json +6 -6
- package/src/PluvClient.ts +6 -2
- package/src/PluvRoom.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/client@0.37.
|
|
2
|
+
> @pluv/client@0.37.3 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
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m48.94 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 107ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m47.62 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 108ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m23.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m23.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3530ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m23.13 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m23.13 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pluv/client
|
|
2
2
|
|
|
3
|
+
## 0.37.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9ae837b: Add missing schema validation for room metadata.
|
|
8
|
+
- @pluv/crdt@0.37.3
|
|
9
|
+
- @pluv/types@0.37.3
|
|
10
|
+
|
|
11
|
+
## 0.37.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 11920af: Updated the default `wsEndpoint` for `PluvClient` when `publicKey` is provided to be correct.
|
|
16
|
+
- @pluv/crdt@0.37.2
|
|
17
|
+
- @pluv/types@0.37.2
|
|
18
|
+
|
|
3
19
|
## 0.37.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -323,6 +323,7 @@ declare class PluvClient<TIO extends IOLike<any, any>, TPresence extends JsonObj
|
|
|
323
323
|
private readonly _authEndpoint;
|
|
324
324
|
private readonly _debug;
|
|
325
325
|
private readonly _initialStorage?;
|
|
326
|
+
private readonly _metadata?;
|
|
326
327
|
private readonly _presence?;
|
|
327
328
|
private readonly _publicKey;
|
|
328
329
|
private readonly _rooms;
|
package/dist/index.d.ts
CHANGED
|
@@ -323,6 +323,7 @@ declare class PluvClient<TIO extends IOLike<any, any>, TPresence extends JsonObj
|
|
|
323
323
|
private readonly _authEndpoint;
|
|
324
324
|
private readonly _debug;
|
|
325
325
|
private readonly _initialStorage?;
|
|
326
|
+
private readonly _metadata?;
|
|
326
327
|
private readonly _presence?;
|
|
327
328
|
private readonly _publicKey;
|
|
328
329
|
private readonly _rooms;
|
package/dist/index.js
CHANGED
|
@@ -839,7 +839,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
839
839
|
_getWsEndpoint(room) {
|
|
840
840
|
switch (typeof this._endpoints.wsEndpoint) {
|
|
841
841
|
case "undefined":
|
|
842
|
-
return `/api/pluv/room/${room}`;
|
|
842
|
+
return !!this._getPublicKey() ? `https://rooms.pluv.io/${room}` : `/api/pluv/room/${room}`;
|
|
843
843
|
case "string":
|
|
844
844
|
return this._endpoints.wsEndpoint;
|
|
845
845
|
default:
|
|
@@ -1198,13 +1198,14 @@ var PluvClient = class {
|
|
|
1198
1198
|
var _a;
|
|
1199
1199
|
const oldRoom = this.getRoom(room);
|
|
1200
1200
|
if (oldRoom) return oldRoom;
|
|
1201
|
+
const metadata = this._metadata ? this._metadata.parse(options.metadata) : options.metadata;
|
|
1201
1202
|
const newRoom = new PluvRoom(room, {
|
|
1202
1203
|
addons: options.addons,
|
|
1203
1204
|
authEndpoint: this._authEndpoint,
|
|
1204
1205
|
debug: options.debug,
|
|
1205
1206
|
initialPresence: options.initialPresence,
|
|
1206
1207
|
initialStorage: this._initialStorage,
|
|
1207
|
-
metadata
|
|
1208
|
+
metadata,
|
|
1208
1209
|
onAuthorizationFail: options.onAuthorizationFail,
|
|
1209
1210
|
presence: this._presence,
|
|
1210
1211
|
publicKey: (_a = this._publicKey) != null ? _a : void 0,
|
|
@@ -1237,10 +1238,11 @@ var PluvClient = class {
|
|
|
1237
1238
|
this._rooms.delete(toLeave.id);
|
|
1238
1239
|
this._logDebug(`Left and deleted room: ${room}`);
|
|
1239
1240
|
});
|
|
1240
|
-
const { authEndpoint, debug = false, initialStorage, presence, publicKey, wsEndpoint } = options;
|
|
1241
|
+
const { authEndpoint, debug = false, initialStorage, metadata, presence, publicKey, wsEndpoint } = options;
|
|
1241
1242
|
this._authEndpoint = authEndpoint;
|
|
1242
1243
|
this._debug = debug;
|
|
1243
1244
|
this._initialStorage = initialStorage;
|
|
1245
|
+
this._metadata = metadata;
|
|
1244
1246
|
this._presence = presence;
|
|
1245
1247
|
this._wsEndpoint = wsEndpoint;
|
|
1246
1248
|
if (typeof publicKey === "string") this._publicKey = publicKey;
|
package/dist/index.mjs
CHANGED
|
@@ -808,7 +808,7 @@ var PluvRoom = class extends AbstractRoom {
|
|
|
808
808
|
_getWsEndpoint(room) {
|
|
809
809
|
switch (typeof this._endpoints.wsEndpoint) {
|
|
810
810
|
case "undefined":
|
|
811
|
-
return `/api/pluv/room/${room}`;
|
|
811
|
+
return !!this._getPublicKey() ? `https://rooms.pluv.io/${room}` : `/api/pluv/room/${room}`;
|
|
812
812
|
case "string":
|
|
813
813
|
return this._endpoints.wsEndpoint;
|
|
814
814
|
default:
|
|
@@ -1167,13 +1167,14 @@ var PluvClient = class {
|
|
|
1167
1167
|
var _a;
|
|
1168
1168
|
const oldRoom = this.getRoom(room);
|
|
1169
1169
|
if (oldRoom) return oldRoom;
|
|
1170
|
+
const metadata = this._metadata ? this._metadata.parse(options.metadata) : options.metadata;
|
|
1170
1171
|
const newRoom = new PluvRoom(room, {
|
|
1171
1172
|
addons: options.addons,
|
|
1172
1173
|
authEndpoint: this._authEndpoint,
|
|
1173
1174
|
debug: options.debug,
|
|
1174
1175
|
initialPresence: options.initialPresence,
|
|
1175
1176
|
initialStorage: this._initialStorage,
|
|
1176
|
-
metadata
|
|
1177
|
+
metadata,
|
|
1177
1178
|
onAuthorizationFail: options.onAuthorizationFail,
|
|
1178
1179
|
presence: this._presence,
|
|
1179
1180
|
publicKey: (_a = this._publicKey) != null ? _a : void 0,
|
|
@@ -1206,10 +1207,11 @@ var PluvClient = class {
|
|
|
1206
1207
|
this._rooms.delete(toLeave.id);
|
|
1207
1208
|
this._logDebug(`Left and deleted room: ${room}`);
|
|
1208
1209
|
});
|
|
1209
|
-
const { authEndpoint, debug = false, initialStorage, presence, publicKey, wsEndpoint } = options;
|
|
1210
|
+
const { authEndpoint, debug = false, initialStorage, metadata, presence, publicKey, wsEndpoint } = options;
|
|
1210
1211
|
this._authEndpoint = authEndpoint;
|
|
1211
1212
|
this._debug = debug;
|
|
1212
1213
|
this._initialStorage = initialStorage;
|
|
1214
|
+
this._metadata = metadata;
|
|
1213
1215
|
this._presence = presence;
|
|
1214
1216
|
this._wsEndpoint = wsEndpoint;
|
|
1215
1217
|
if (typeof publicKey === "string") this._publicKey = publicKey;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/client",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.3",
|
|
4
4
|
"description": "@pluv/io frontend client",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"wonka": "^6.3.
|
|
21
|
-
"@pluv/crdt": "^0.37.
|
|
22
|
-
"@pluv/types": "^0.37.
|
|
20
|
+
"wonka": "^6.3.5",
|
|
21
|
+
"@pluv/crdt": "^0.37.3",
|
|
22
|
+
"@pluv/types": "^0.37.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"eslint": "^8.57.1",
|
|
26
26
|
"tsup": "^8.4.0",
|
|
27
27
|
"typescript": "^5.8.2",
|
|
28
|
-
"@pluv/tsconfig": "^0.37.
|
|
29
|
-
"eslint-config-pluv": "^0.37.
|
|
28
|
+
"@pluv/tsconfig": "^0.37.3",
|
|
29
|
+
"eslint-config-pluv": "^0.37.3"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvClient.ts
CHANGED
|
@@ -46,6 +46,7 @@ export class PluvClient<
|
|
|
46
46
|
private readonly _authEndpoint: AuthEndpoint<TMetadata> | undefined;
|
|
47
47
|
private readonly _debug: boolean;
|
|
48
48
|
private readonly _initialStorage?: AbstractCrdtDocFactory<TStorage>;
|
|
49
|
+
private readonly _metadata?: InputZodLike<TMetadata>;
|
|
49
50
|
private readonly _presence?: InputZodLike<TPresence>;
|
|
50
51
|
private readonly _publicKey: string | null = null;
|
|
51
52
|
private readonly _rooms = new Map<string, PluvRoom<TIO, TMetadata, TPresence, TStorage, any>>();
|
|
@@ -62,11 +63,12 @@ export class PluvClient<
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
constructor(options: PluvClientOptions<TIO, TPresence, TStorage, TMetadata>) {
|
|
65
|
-
const { authEndpoint, debug = false, initialStorage, presence, publicKey, wsEndpoint } = options;
|
|
66
|
+
const { authEndpoint, debug = false, initialStorage, metadata, presence, publicKey, wsEndpoint } = options;
|
|
66
67
|
|
|
67
68
|
this._authEndpoint = authEndpoint as AuthEndpoint<TMetadata>;
|
|
68
69
|
this._debug = debug;
|
|
69
70
|
this._initialStorage = initialStorage;
|
|
71
|
+
this._metadata = metadata;
|
|
70
72
|
this._presence = presence;
|
|
71
73
|
this._wsEndpoint = wsEndpoint;
|
|
72
74
|
|
|
@@ -81,13 +83,15 @@ export class PluvClient<
|
|
|
81
83
|
|
|
82
84
|
if (oldRoom) return oldRoom;
|
|
83
85
|
|
|
86
|
+
const metadata = this._metadata ? this._metadata.parse(options.metadata) : options.metadata;
|
|
87
|
+
|
|
84
88
|
const newRoom = new PluvRoom<TIO, TMetadata, TPresence, TStorage, TEvents>(room, {
|
|
85
89
|
addons: options.addons,
|
|
86
90
|
authEndpoint: this._authEndpoint,
|
|
87
91
|
debug: options.debug,
|
|
88
92
|
initialPresence: options.initialPresence,
|
|
89
93
|
initialStorage: this._initialStorage,
|
|
90
|
-
metadata
|
|
94
|
+
metadata,
|
|
91
95
|
onAuthorizationFail: options.onAuthorizationFail,
|
|
92
96
|
presence: this._presence,
|
|
93
97
|
publicKey: this._publicKey ?? undefined,
|
package/src/PluvRoom.ts
CHANGED
|
@@ -747,7 +747,7 @@ export class PluvRoom<
|
|
|
747
747
|
private _getWsEndpoint(room: string): string {
|
|
748
748
|
switch (typeof this._endpoints.wsEndpoint) {
|
|
749
749
|
case "undefined":
|
|
750
|
-
return `/api/pluv/room/${room}`;
|
|
750
|
+
return !!this._getPublicKey() ? `https://rooms.pluv.io/${room}` : `/api/pluv/room/${room}`;
|
|
751
751
|
case "string":
|
|
752
752
|
return this._endpoints.wsEndpoint;
|
|
753
753
|
default:
|