@pluv/client 0.37.2 → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/client@0.37.2 build /home/runner/work/pluv/pluv/packages/client
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
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 47.50 KB
12
- ESM ⚡️ Build success in 134ms
13
- CJS dist/index.js 48.82 KB
14
- CJS ⚡️ Build success in 135ms
11
+ CJS dist/index.js 48.94 KB
12
+ CJS ⚡️ Build success in 107ms
13
+ ESM dist/index.mjs 47.62 KB
14
+ ESM ⚡️ Build success in 108ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3258ms
17
- DTS dist/index.d.mts 23.10 KB
18
- DTS dist/index.d.ts 23.10 KB
16
+ DTS ⚡️ Build success in 3530ms
17
+ DTS dist/index.d.mts 23.13 KB
18
+ DTS dist/index.d.ts 23.13 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 0.37.2
4
12
 
5
13
  ### 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
@@ -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: options.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
@@ -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: options.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.2",
3
+ "version": "0.37.3",
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.37.2",
22
- "@pluv/types": "^0.37.2"
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.2",
29
- "eslint-config-pluv": "^0.37.2"
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: options.metadata,
94
+ metadata,
91
95
  onAuthorizationFail: options.onAuthorizationFail,
92
96
  presence: this._presence,
93
97
  publicKey: this._publicKey ?? undefined,