@pluv/client 2.3.0 → 3.0.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/client@2.3.0 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@3.0.0 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
- CJS dist/index.js 65.55 KB
12
- CJS ⚡️ Build success in 99ms
13
- ESM dist/index.mjs 63.81 KB
14
- ESM ⚡️ Build success in 101ms
11
+ ESM dist/index.mjs 63.03 KB
12
+ ESM ⚡️ Build success in 137ms
13
+ CJS dist/index.js 64.77 KB
14
+ CJS ⚡️ Build success in 140ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4751ms
17
- DTS dist/index.d.mts 20.11 KB
18
- DTS dist/index.d.ts 20.11 KB
16
+ DTS ⚡️ Build success in 4820ms
17
+ DTS dist/index.d.mts 18.99 KB
18
+ DTS dist/index.d.ts 18.99 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - bc1ae91: **BREAKING** Removed deprecated `event`, `others`, `storageLoaded`, `storageRoot` and `storage` methods on `PluvRoom`. These methods now exist under `PluvRoom.subscribe`.
8
+
9
+ ### Patch Changes
10
+
11
+ - @pluv/crdt@3.0.0
12
+ - @pluv/types@3.0.0
13
+
14
+ ## 2.3.1
15
+
16
+ ### Patch Changes
17
+
18
+ - @pluv/crdt@2.3.1
19
+ - @pluv/types@2.3.1
20
+
3
21
  ## 2.3.0
4
22
 
5
23
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AbstractCrdtDocFactory, InferDocLike, NoopCrdtDocFactory, InferStorage, InferDoc, InferCrdtJson } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, RoomEventListenerMap, BroadcastProxy, EventProxy, WebSocketConnection, OtherSubscriptionCallback, StorageProxy, SubscribeProxy, UpdateMyPresenceAction, MergeEvents } from '@pluv/types';
3
+ import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, RoomEventListenerMap, BroadcastProxy, WebSocketConnection, SubscribeProxy, UpdateMyPresenceAction, MergeEvents } from '@pluv/types';
4
4
  export { BaseUser, ConnectionState, EventMessage, EventNotifierSubscriptionCallback, EventRecord, IOEventMessage, MergeEvents, RoomLike, UserInfo, WebSocketConnection, WebSocketState } from '@pluv/types';
5
5
 
6
6
  declare abstract class AbstractStorageStore {
@@ -167,10 +167,6 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
167
167
  private _windowListeners;
168
168
  private _wsListeners;
169
169
  constructor(room: string, options: RoomConfig<TIO, TMetadata, TPresence, TCrdt, TEvents>);
170
- /**
171
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
172
- */
173
- get storageLoaded(): boolean;
174
170
  get webSocket(): WebSocket | null;
175
171
  addEventListener<TKind extends keyof RoomEventListenerMap>(kind: TKind, handler: RoomEventListenerMap[TKind]): () => void;
176
172
  broadcast: BroadcastProxy<TIO, TEvents>;
@@ -178,10 +174,6 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
178
174
  canUndo: () => boolean;
179
175
  connect(...args: RoomConnectParams<TMetadata>): Promise<void>;
180
176
  disconnect(): Promise<void>;
181
- /**
182
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
183
- */
184
- event: EventProxy<TIO, TEvents>;
185
177
  getConnection: () => WebSocketConnection;
186
178
  getDoc: () => CrdtDocLike<InferDoc<TCrdt>, InferStorage<TCrdt>>;
187
179
  getMyPresence: () => TPresence;
@@ -192,20 +184,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
192
184
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
193
185
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
194
186
  getStorageLoaded: () => boolean;
195
- /**
196
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
197
- */
198
- other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
199
187
  redo: () => void;
200
- /**
201
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
202
- */
203
- storage: StorageProxy<InferStorage<TCrdt>>;
204
- /**
205
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
206
- * @description Subscribes to the root storage object (serialized)
207
- */
208
- storageRoot: (callback: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
209
188
  subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
210
189
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
211
190
  undo: () => void;
@@ -219,6 +198,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
219
198
  private _detachWindowListeners;
220
199
  private _detachWsListeners;
221
200
  private _emitSharedTypes;
201
+ private _event;
222
202
  private _flattenStorageStore;
223
203
  private _getAddon;
224
204
  private _getAuthFetchOptions;
@@ -250,11 +230,13 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
250
230
  private _onNavigatorOnline;
251
231
  private _onVisibilityChange;
252
232
  private _onWindowFocus;
233
+ private _other;
253
234
  private _parseMessage;
254
235
  private _pollReconnect;
255
236
  private _reconnect;
256
237
  private _sendMessage;
257
238
  private _setMetadata;
239
+ private _storage;
258
240
  private _updateState;
259
241
  }
260
242
 
@@ -317,10 +299,6 @@ type MockedRoomConfig<TIO extends IOLike, TPresence extends Record<string, any>,
317
299
  } & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & Omit<UsersManagerConfig<TPresence>, "limits">;
318
300
  declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>>> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
319
301
  readonly id: string;
320
- /**
321
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
322
- */
323
- readonly storageLoaded: boolean;
324
302
  private readonly _crdtManager;
325
303
  private readonly _crdtNotifier;
326
304
  private readonly _eventNotifier;
@@ -337,7 +315,6 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
337
315
  broadcast: BroadcastProxy<TIO, TEvents>;
338
316
  canRedo: () => boolean;
339
317
  canUndo: () => boolean;
340
- event: EventProxy<TIO, TEvents>;
341
318
  getConnection: () => WebSocketConnection;
342
319
  getDoc(): CrdtDocLike<InferDoc<TCrdt>, InferStorage<TCrdt>>;
343
320
  getMyPresence: () => TPresence;
@@ -348,16 +325,17 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
348
325
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
349
326
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
350
327
  getStorageLoaded(): boolean;
351
- other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
352
328
  redo: () => void;
353
- storage: StorageProxy<InferStorage<TCrdt>>;
354
329
  storageRoot: (fn: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
355
330
  subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
356
331
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
357
332
  undo: () => void;
358
333
  updateMyPresence: (presence: UpdateMyPresenceAction<TPresence>) => void;
334
+ private _event;
359
335
  private _observeCrdt;
336
+ private _other;
360
337
  private _simulateEvent;
338
+ private _storage;
361
339
  }
362
340
 
363
341
  interface RegisterParams<TMetadata extends JsonObject> {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AbstractCrdtDocFactory, InferDocLike, NoopCrdtDocFactory, InferStorage, InferDoc, InferCrdtJson } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, RoomEventListenerMap, BroadcastProxy, EventProxy, WebSocketConnection, OtherSubscriptionCallback, StorageProxy, SubscribeProxy, UpdateMyPresenceAction, MergeEvents } from '@pluv/types';
3
+ import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, RoomEventListenerMap, BroadcastProxy, WebSocketConnection, SubscribeProxy, UpdateMyPresenceAction, MergeEvents } from '@pluv/types';
4
4
  export { BaseUser, ConnectionState, EventMessage, EventNotifierSubscriptionCallback, EventRecord, IOEventMessage, MergeEvents, RoomLike, UserInfo, WebSocketConnection, WebSocketState } from '@pluv/types';
5
5
 
6
6
  declare abstract class AbstractStorageStore {
@@ -167,10 +167,6 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
167
167
  private _windowListeners;
168
168
  private _wsListeners;
169
169
  constructor(room: string, options: RoomConfig<TIO, TMetadata, TPresence, TCrdt, TEvents>);
170
- /**
171
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
172
- */
173
- get storageLoaded(): boolean;
174
170
  get webSocket(): WebSocket | null;
175
171
  addEventListener<TKind extends keyof RoomEventListenerMap>(kind: TKind, handler: RoomEventListenerMap[TKind]): () => void;
176
172
  broadcast: BroadcastProxy<TIO, TEvents>;
@@ -178,10 +174,6 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
178
174
  canUndo: () => boolean;
179
175
  connect(...args: RoomConnectParams<TMetadata>): Promise<void>;
180
176
  disconnect(): Promise<void>;
181
- /**
182
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
183
- */
184
- event: EventProxy<TIO, TEvents>;
185
177
  getConnection: () => WebSocketConnection;
186
178
  getDoc: () => CrdtDocLike<InferDoc<TCrdt>, InferStorage<TCrdt>>;
187
179
  getMyPresence: () => TPresence;
@@ -192,20 +184,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
192
184
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
193
185
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
194
186
  getStorageLoaded: () => boolean;
195
- /**
196
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
197
- */
198
- other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
199
187
  redo: () => void;
200
- /**
201
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
202
- */
203
- storage: StorageProxy<InferStorage<TCrdt>>;
204
- /**
205
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
206
- * @description Subscribes to the root storage object (serialized)
207
- */
208
- storageRoot: (callback: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
209
188
  subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
210
189
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
211
190
  undo: () => void;
@@ -219,6 +198,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
219
198
  private _detachWindowListeners;
220
199
  private _detachWsListeners;
221
200
  private _emitSharedTypes;
201
+ private _event;
222
202
  private _flattenStorageStore;
223
203
  private _getAddon;
224
204
  private _getAuthFetchOptions;
@@ -250,11 +230,13 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
250
230
  private _onNavigatorOnline;
251
231
  private _onVisibilityChange;
252
232
  private _onWindowFocus;
233
+ private _other;
253
234
  private _parseMessage;
254
235
  private _pollReconnect;
255
236
  private _reconnect;
256
237
  private _sendMessage;
257
238
  private _setMetadata;
239
+ private _storage;
258
240
  private _updateState;
259
241
  }
260
242
 
@@ -317,10 +299,6 @@ type MockedRoomConfig<TIO extends IOLike, TPresence extends Record<string, any>,
317
299
  } & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & Omit<UsersManagerConfig<TPresence>, "limits">;
318
300
  declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>>> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
319
301
  readonly id: string;
320
- /**
321
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
322
- */
323
- readonly storageLoaded: boolean;
324
302
  private readonly _crdtManager;
325
303
  private readonly _crdtNotifier;
326
304
  private readonly _eventNotifier;
@@ -337,7 +315,6 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
337
315
  broadcast: BroadcastProxy<TIO, TEvents>;
338
316
  canRedo: () => boolean;
339
317
  canUndo: () => boolean;
340
- event: EventProxy<TIO, TEvents>;
341
318
  getConnection: () => WebSocketConnection;
342
319
  getDoc(): CrdtDocLike<InferDoc<TCrdt>, InferStorage<TCrdt>>;
343
320
  getMyPresence: () => TPresence;
@@ -348,16 +325,17 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
348
325
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
349
326
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
350
327
  getStorageLoaded(): boolean;
351
- other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
352
328
  redo: () => void;
353
- storage: StorageProxy<InferStorage<TCrdt>>;
354
329
  storageRoot: (fn: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
355
330
  subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
356
331
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
357
332
  undo: () => void;
358
333
  updateMyPresence: (presence: UpdateMyPresenceAction<TPresence>) => void;
334
+ private _event;
359
335
  private _observeCrdt;
336
+ private _other;
360
337
  private _simulateEvent;
338
+ private _storage;
361
339
  }
362
340
 
363
341
  interface RegisterParams<TMetadata extends JsonObject> {
package/dist/index.js CHANGED
@@ -663,17 +663,6 @@ var PluvRoom = class {
663
663
  this.canUndo = () => {
664
664
  return !!this._crdtManager.doc.canUndo();
665
665
  };
666
- /**
667
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
668
- */
669
- this.event = new Proxy(
670
- (event, callback) => this._eventNotifier.subscribe(event, callback),
671
- {
672
- get(fn, prop) {
673
- return (callback) => fn(prop, callback);
674
- }
675
- }
676
- );
677
666
  this.getConnection = () => {
678
667
  return Object.freeze(JSON.parse(JSON.stringify(this._state.connection)));
679
668
  };
@@ -700,42 +689,9 @@ var PluvRoom = class {
700
689
  this.getStorageLoaded = () => {
701
690
  return this._state.storage.state === import_types.StorageState.Offline || this._state.storage.state === import_types.StorageState.Synced;
702
691
  };
703
- /**
704
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
705
- */
706
- this.other = (connectionId, callback) => {
707
- const clientId = this._usersManager.getClientId(connectionId);
708
- if (!clientId) return () => void 0;
709
- return this._usersNotifier.subscribeOther(clientId, callback);
710
- };
711
692
  this.redo = () => {
712
693
  this._crdtManager.doc.redo();
713
694
  };
714
- /**
715
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
716
- */
717
- this.storage = new Proxy(
718
- (key, callback) => this._crdtNotifier.subscribe(key, callback),
719
- {
720
- get: (fn, prop) => {
721
- if (!!prop) {
722
- return (callback) => {
723
- return this._crdtNotifier.subcribeRoot(callback);
724
- };
725
- }
726
- return (callback) => {
727
- return fn(prop, callback);
728
- };
729
- }
730
- }
731
- );
732
- /**
733
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
734
- * @description Subscribes to the root storage object (serialized)
735
- */
736
- this.storageRoot = (callback) => {
737
- return this._crdtNotifier.subcribeRoot(callback);
738
- };
739
695
  this.subscribe = new Proxy(
740
696
  (name, callback) => this._stateNotifier.subscribe(name, callback),
741
697
  {
@@ -765,9 +721,9 @@ var PluvRoom = class {
765
721
  return fn("storage-loaded", callback);
766
722
  };
767
723
  }
768
- if (prop === "event") return this.event;
769
- if (prop === "other") return this.other;
770
- if (prop === "storage") return this.storage;
724
+ if (prop === "event") return this._event;
725
+ if (prop === "other") return this._other;
726
+ if (prop === "storage") return this._storage;
771
727
  }
772
728
  }
773
729
  );
@@ -795,6 +751,14 @@ var PluvRoom = class {
795
751
  { presence: newPresence }
796
752
  );
797
753
  };
754
+ this._event = new Proxy(
755
+ (event, callback) => this._eventNotifier.subscribe(event, callback),
756
+ {
757
+ get(fn, prop) {
758
+ return (callback) => fn(prop, callback);
759
+ }
760
+ }
761
+ );
798
762
  this._flattenStorageStore = debounce(
799
763
  () => __async(this, null, function* () {
800
764
  const shouldFlatten = yield this._storageStore.getShouldFlatten();
@@ -812,6 +776,26 @@ var PluvRoom = class {
812
776
  DEFAULT_PLUV_CLIENT_ADDON
813
777
  );
814
778
  };
779
+ this._other = (connectionId, callback) => {
780
+ const clientId = this._usersManager.getClientId(connectionId);
781
+ if (!clientId) return () => void 0;
782
+ return this._usersNotifier.subscribeOther(clientId, callback);
783
+ };
784
+ this._storage = new Proxy(
785
+ (key, callback) => this._crdtNotifier.subscribe(key, callback),
786
+ {
787
+ get: (fn, prop) => {
788
+ if (!!prop) {
789
+ return (callback) => {
790
+ return this._crdtNotifier.subcribeRoot(callback);
791
+ };
792
+ }
793
+ return (callback) => {
794
+ return fn(prop, callback);
795
+ };
796
+ }
797
+ }
798
+ );
815
799
  const {
816
800
  addons = [],
817
801
  authEndpoint,
@@ -850,12 +834,6 @@ var PluvRoom = class {
850
834
  });
851
835
  this._crdtManager = new CrdtManager({ initialStorage });
852
836
  }
853
- /**
854
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
855
- */
856
- get storageLoaded() {
857
- return this.getStorageLoaded();
858
- }
859
837
  get webSocket() {
860
838
  return this._state.webSocket;
861
839
  }
@@ -1677,10 +1655,6 @@ var infer = (callback) => callback;
1677
1655
  var import_types2 = require("@pluv/types");
1678
1656
  var MockedRoom = class {
1679
1657
  constructor(room, options) {
1680
- /**
1681
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
1682
- */
1683
- this.storageLoaded = true;
1684
1658
  this._crdtNotifier = new CrdtNotifier();
1685
1659
  this._eventNotifier = new EventNotifier();
1686
1660
  this._usersNotifier = new UsersNotifier();
@@ -1741,14 +1715,6 @@ var MockedRoom = class {
1741
1715
  this.canUndo = () => {
1742
1716
  return !!this._crdtManager.doc.canUndo();
1743
1717
  };
1744
- this.event = new Proxy(
1745
- (event, callback) => this._eventNotifier.subscribe(event, callback),
1746
- {
1747
- get(fn, prop) {
1748
- return (callback) => fn(prop, callback);
1749
- }
1750
- }
1751
- );
1752
1718
  this.getConnection = () => {
1753
1719
  return Object.freeze(JSON.parse(JSON.stringify(this._state.connection)));
1754
1720
  };
@@ -1769,29 +1735,9 @@ var MockedRoom = class {
1769
1735
  if (typeof sharedType === "undefined") return null;
1770
1736
  return sharedType;
1771
1737
  };
1772
- this.other = (connectionId, callback) => {
1773
- const clientId = this._usersManager.getClientId(connectionId);
1774
- if (!clientId) return () => void 0;
1775
- return this._usersNotifier.subscribeOther(clientId, callback);
1776
- };
1777
1738
  this.redo = () => {
1778
1739
  this._crdtManager.doc.redo();
1779
1740
  };
1780
- this.storage = new Proxy(
1781
- (key, callback) => this._crdtNotifier.subscribe(key, callback),
1782
- {
1783
- get: (fn, prop) => {
1784
- if (!!prop) {
1785
- return (callback) => {
1786
- return this._crdtNotifier.subcribeRoot(callback);
1787
- };
1788
- }
1789
- return (callback) => {
1790
- return fn(prop, callback);
1791
- };
1792
- }
1793
- }
1794
- );
1795
1741
  this.storageRoot = (fn) => {
1796
1742
  return this._crdtNotifier.subcribeRoot(fn);
1797
1743
  };
@@ -1826,9 +1772,9 @@ var MockedRoom = class {
1826
1772
  return fn("storage-loaded", callback);
1827
1773
  };
1828
1774
  }
1829
- if (prop === "event") return this.event;
1830
- if (prop === "other") return this.other;
1831
- if (prop === "storage") return this.storage;
1775
+ if (prop === "event") return this._event;
1776
+ if (prop === "other") return this._other;
1777
+ if (prop === "storage") return this._storage;
1832
1778
  }
1833
1779
  }
1834
1780
  );
@@ -1854,6 +1800,34 @@ var MockedRoom = class {
1854
1800
  this._stateNotifier.subjects["my-presence"].next(myPresence);
1855
1801
  if (!!myself) this._stateNotifier.subjects["myself"].next(myself);
1856
1802
  };
1803
+ this._event = new Proxy(
1804
+ (event, callback) => this._eventNotifier.subscribe(event, callback),
1805
+ {
1806
+ get(fn, prop) {
1807
+ return (callback) => fn(prop, callback);
1808
+ }
1809
+ }
1810
+ );
1811
+ this._other = (connectionId, callback) => {
1812
+ const clientId = this._usersManager.getClientId(connectionId);
1813
+ if (!clientId) return () => void 0;
1814
+ return this._usersNotifier.subscribeOther(clientId, callback);
1815
+ };
1816
+ this._storage = new Proxy(
1817
+ (key, callback) => this._crdtNotifier.subscribe(key, callback),
1818
+ {
1819
+ get: (fn, prop) => {
1820
+ if (!!prop) {
1821
+ return (callback) => {
1822
+ return this._crdtNotifier.subcribeRoot(callback);
1823
+ };
1824
+ }
1825
+ return (callback) => {
1826
+ return fn(prop, callback);
1827
+ };
1828
+ }
1829
+ }
1830
+ );
1857
1831
  const { events, initialPresence, initialStorage, limits, presence, router } = options;
1858
1832
  this.id = room;
1859
1833
  this._events = events;
package/dist/index.mjs CHANGED
@@ -635,17 +635,6 @@ var PluvRoom = class {
635
635
  this.canUndo = () => {
636
636
  return !!this._crdtManager.doc.canUndo();
637
637
  };
638
- /**
639
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
640
- */
641
- this.event = new Proxy(
642
- (event, callback) => this._eventNotifier.subscribe(event, callback),
643
- {
644
- get(fn, prop) {
645
- return (callback) => fn(prop, callback);
646
- }
647
- }
648
- );
649
638
  this.getConnection = () => {
650
639
  return Object.freeze(JSON.parse(JSON.stringify(this._state.connection)));
651
640
  };
@@ -672,42 +661,9 @@ var PluvRoom = class {
672
661
  this.getStorageLoaded = () => {
673
662
  return this._state.storage.state === StorageState.Offline || this._state.storage.state === StorageState.Synced;
674
663
  };
675
- /**
676
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
677
- */
678
- this.other = (connectionId, callback) => {
679
- const clientId = this._usersManager.getClientId(connectionId);
680
- if (!clientId) return () => void 0;
681
- return this._usersNotifier.subscribeOther(clientId, callback);
682
- };
683
664
  this.redo = () => {
684
665
  this._crdtManager.doc.redo();
685
666
  };
686
- /**
687
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
688
- */
689
- this.storage = new Proxy(
690
- (key, callback) => this._crdtNotifier.subscribe(key, callback),
691
- {
692
- get: (fn, prop) => {
693
- if (!!prop) {
694
- return (callback) => {
695
- return this._crdtNotifier.subcribeRoot(callback);
696
- };
697
- }
698
- return (callback) => {
699
- return fn(prop, callback);
700
- };
701
- }
702
- }
703
- );
704
- /**
705
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
706
- * @description Subscribes to the root storage object (serialized)
707
- */
708
- this.storageRoot = (callback) => {
709
- return this._crdtNotifier.subcribeRoot(callback);
710
- };
711
667
  this.subscribe = new Proxy(
712
668
  (name, callback) => this._stateNotifier.subscribe(name, callback),
713
669
  {
@@ -737,9 +693,9 @@ var PluvRoom = class {
737
693
  return fn("storage-loaded", callback);
738
694
  };
739
695
  }
740
- if (prop === "event") return this.event;
741
- if (prop === "other") return this.other;
742
- if (prop === "storage") return this.storage;
696
+ if (prop === "event") return this._event;
697
+ if (prop === "other") return this._other;
698
+ if (prop === "storage") return this._storage;
743
699
  }
744
700
  }
745
701
  );
@@ -767,6 +723,14 @@ var PluvRoom = class {
767
723
  { presence: newPresence }
768
724
  );
769
725
  };
726
+ this._event = new Proxy(
727
+ (event, callback) => this._eventNotifier.subscribe(event, callback),
728
+ {
729
+ get(fn, prop) {
730
+ return (callback) => fn(prop, callback);
731
+ }
732
+ }
733
+ );
770
734
  this._flattenStorageStore = debounce(
771
735
  () => __async(this, null, function* () {
772
736
  const shouldFlatten = yield this._storageStore.getShouldFlatten();
@@ -784,6 +748,26 @@ var PluvRoom = class {
784
748
  DEFAULT_PLUV_CLIENT_ADDON
785
749
  );
786
750
  };
751
+ this._other = (connectionId, callback) => {
752
+ const clientId = this._usersManager.getClientId(connectionId);
753
+ if (!clientId) return () => void 0;
754
+ return this._usersNotifier.subscribeOther(clientId, callback);
755
+ };
756
+ this._storage = new Proxy(
757
+ (key, callback) => this._crdtNotifier.subscribe(key, callback),
758
+ {
759
+ get: (fn, prop) => {
760
+ if (!!prop) {
761
+ return (callback) => {
762
+ return this._crdtNotifier.subcribeRoot(callback);
763
+ };
764
+ }
765
+ return (callback) => {
766
+ return fn(prop, callback);
767
+ };
768
+ }
769
+ }
770
+ );
787
771
  const {
788
772
  addons = [],
789
773
  authEndpoint,
@@ -822,12 +806,6 @@ var PluvRoom = class {
822
806
  });
823
807
  this._crdtManager = new CrdtManager({ initialStorage });
824
808
  }
825
- /**
826
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
827
- */
828
- get storageLoaded() {
829
- return this.getStorageLoaded();
830
- }
831
809
  get webSocket() {
832
810
  return this._state.webSocket;
833
811
  }
@@ -1649,10 +1627,6 @@ var infer = (callback) => callback;
1649
1627
  import { ConnectionState as ConnectionState2, StorageState as StorageState2 } from "@pluv/types";
1650
1628
  var MockedRoom = class {
1651
1629
  constructor(room, options) {
1652
- /**
1653
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
1654
- */
1655
- this.storageLoaded = true;
1656
1630
  this._crdtNotifier = new CrdtNotifier();
1657
1631
  this._eventNotifier = new EventNotifier();
1658
1632
  this._usersNotifier = new UsersNotifier();
@@ -1713,14 +1687,6 @@ var MockedRoom = class {
1713
1687
  this.canUndo = () => {
1714
1688
  return !!this._crdtManager.doc.canUndo();
1715
1689
  };
1716
- this.event = new Proxy(
1717
- (event, callback) => this._eventNotifier.subscribe(event, callback),
1718
- {
1719
- get(fn, prop) {
1720
- return (callback) => fn(prop, callback);
1721
- }
1722
- }
1723
- );
1724
1690
  this.getConnection = () => {
1725
1691
  return Object.freeze(JSON.parse(JSON.stringify(this._state.connection)));
1726
1692
  };
@@ -1741,29 +1707,9 @@ var MockedRoom = class {
1741
1707
  if (typeof sharedType === "undefined") return null;
1742
1708
  return sharedType;
1743
1709
  };
1744
- this.other = (connectionId, callback) => {
1745
- const clientId = this._usersManager.getClientId(connectionId);
1746
- if (!clientId) return () => void 0;
1747
- return this._usersNotifier.subscribeOther(clientId, callback);
1748
- };
1749
1710
  this.redo = () => {
1750
1711
  this._crdtManager.doc.redo();
1751
1712
  };
1752
- this.storage = new Proxy(
1753
- (key, callback) => this._crdtNotifier.subscribe(key, callback),
1754
- {
1755
- get: (fn, prop) => {
1756
- if (!!prop) {
1757
- return (callback) => {
1758
- return this._crdtNotifier.subcribeRoot(callback);
1759
- };
1760
- }
1761
- return (callback) => {
1762
- return fn(prop, callback);
1763
- };
1764
- }
1765
- }
1766
- );
1767
1713
  this.storageRoot = (fn) => {
1768
1714
  return this._crdtNotifier.subcribeRoot(fn);
1769
1715
  };
@@ -1798,9 +1744,9 @@ var MockedRoom = class {
1798
1744
  return fn("storage-loaded", callback);
1799
1745
  };
1800
1746
  }
1801
- if (prop === "event") return this.event;
1802
- if (prop === "other") return this.other;
1803
- if (prop === "storage") return this.storage;
1747
+ if (prop === "event") return this._event;
1748
+ if (prop === "other") return this._other;
1749
+ if (prop === "storage") return this._storage;
1804
1750
  }
1805
1751
  }
1806
1752
  );
@@ -1826,6 +1772,34 @@ var MockedRoom = class {
1826
1772
  this._stateNotifier.subjects["my-presence"].next(myPresence);
1827
1773
  if (!!myself) this._stateNotifier.subjects["myself"].next(myself);
1828
1774
  };
1775
+ this._event = new Proxy(
1776
+ (event, callback) => this._eventNotifier.subscribe(event, callback),
1777
+ {
1778
+ get(fn, prop) {
1779
+ return (callback) => fn(prop, callback);
1780
+ }
1781
+ }
1782
+ );
1783
+ this._other = (connectionId, callback) => {
1784
+ const clientId = this._usersManager.getClientId(connectionId);
1785
+ if (!clientId) return () => void 0;
1786
+ return this._usersNotifier.subscribeOther(clientId, callback);
1787
+ };
1788
+ this._storage = new Proxy(
1789
+ (key, callback) => this._crdtNotifier.subscribe(key, callback),
1790
+ {
1791
+ get: (fn, prop) => {
1792
+ if (!!prop) {
1793
+ return (callback) => {
1794
+ return this._crdtNotifier.subcribeRoot(callback);
1795
+ };
1796
+ }
1797
+ return (callback) => {
1798
+ return fn(prop, callback);
1799
+ };
1800
+ }
1801
+ }
1802
+ );
1829
1803
  const { events, initialPresence, initialStorage, limits, presence, router } = options;
1830
1804
  this.id = room;
1831
1805
  this._events = events;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "2.3.0",
3
+ "version": "3.0.0",
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": "^2.3.0",
22
- "@pluv/types": "^2.3.0"
21
+ "@pluv/crdt": "^3.0.0",
22
+ "@pluv/types": "^3.0.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^9.27.0",
26
26
  "tsup": "^8.5.0",
27
27
  "typescript": "^5.8.3",
28
- "@pluv/tsconfig": "^2.3.0",
29
- "eslint-config-pluv": "^2.3.0"
28
+ "@pluv/tsconfig": "^3.0.0",
29
+ "eslint-config-pluv": "^3.0.0"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/MockedRoom.ts CHANGED
@@ -75,11 +75,6 @@ export class MockedRoom<
75
75
  {
76
76
  public readonly id: string;
77
77
 
78
- /**
79
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
80
- */
81
- public readonly storageLoaded: boolean = true;
82
-
83
78
  private readonly _crdtManager: CrdtManager<TCrdt>;
84
79
  private readonly _crdtNotifier = new CrdtNotifier<InferStorage<TCrdt>>();
85
80
  private readonly _eventNotifier = new EventNotifier<MergeEvents<TEvents, TIO>>();
@@ -211,20 +206,6 @@ export class MockedRoom<
211
206
  return !!this._crdtManager.doc.canUndo();
212
207
  };
213
208
 
214
- public event = new Proxy(
215
- <TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(
216
- event: TEvent,
217
- callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
218
- ): (() => void) => this._eventNotifier.subscribe(event, callback),
219
- {
220
- get(fn, prop) {
221
- return (
222
- callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
223
- ): (() => void) => fn(prop as any, callback);
224
- },
225
- },
226
- ) as EventProxy<TIO, TEvents>;
227
-
228
209
  public getConnection = (): WebSocketConnection => {
229
210
  // Create a read-only clone of the connection state
230
211
  return Object.freeze(JSON.parse(JSON.stringify(this._state.connection)));
@@ -275,43 +256,10 @@ export class MockedRoom<
275
256
  return true;
276
257
  }
277
258
 
278
- public other = (
279
- connectionId: string,
280
- callback: OtherSubscriptionCallback<TIO, TPresence>,
281
- ): (() => void) => {
282
- const clientId = this._usersManager.getClientId(connectionId);
283
-
284
- if (!clientId) return () => undefined;
285
-
286
- return this._usersNotifier.subscribeOther(clientId, callback);
287
- };
288
-
289
259
  public redo = (): void => {
290
260
  this._crdtManager.doc.redo();
291
261
  };
292
262
 
293
- public storage = new Proxy(
294
- <TKey extends keyof InferStorage<TCrdt>>(
295
- key: TKey,
296
- callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
297
- ): (() => void) => this._crdtNotifier.subscribe(key, callback),
298
- {
299
- get: (fn, prop) => {
300
- type _Storage = InferStorage<TCrdt>;
301
-
302
- if (!!prop) {
303
- return (callback: StorageRootSubscriptionCallback<_Storage>) => {
304
- return this._crdtNotifier.subcribeRoot(callback);
305
- };
306
- }
307
-
308
- return (callback: StorageSubscriptionCallback<_Storage, keyof _Storage>) => {
309
- return fn(prop as keyof InferStorage<TCrdt>, callback);
310
- };
311
- },
312
- },
313
- ) as StorageProxy<InferStorage<TCrdt>>;
314
-
315
263
  public storageRoot = (
316
264
  fn: (value: {
317
265
  [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>;
@@ -359,9 +307,9 @@ export class MockedRoom<
359
307
  };
360
308
  }
361
309
 
362
- if (prop === "event") return this.event;
363
- if (prop === "other") return this.other;
364
- if (prop === "storage") return this.storage;
310
+ if (prop === "event") return this._event;
311
+ if (prop === "other") return this._other;
312
+ if (prop === "storage") return this._storage;
365
313
  },
366
314
  },
367
315
  ) as SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
@@ -404,6 +352,20 @@ export class MockedRoom<
404
352
  if (!!myself) this._stateNotifier.subjects["myself"].next(myself);
405
353
  };
406
354
 
355
+ private _event = new Proxy(
356
+ <TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(
357
+ event: TEvent,
358
+ callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
359
+ ): (() => void) => this._eventNotifier.subscribe(event, callback),
360
+ {
361
+ get(fn, prop) {
362
+ return (
363
+ callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
364
+ ): (() => void) => fn(prop as any, callback);
365
+ },
366
+ },
367
+ ) as EventProxy<TIO, TEvents>;
368
+
407
369
  private _observeCrdt(): void {
408
370
  this._subscriptions.observeCrdt?.();
409
371
 
@@ -438,6 +400,17 @@ export class MockedRoom<
438
400
  this._subscriptions.observeCrdt = unsubscribe;
439
401
  }
440
402
 
403
+ private _other = (
404
+ connectionId: string,
405
+ callback: OtherSubscriptionCallback<TIO, TPresence>,
406
+ ): (() => void) => {
407
+ const clientId = this._usersManager.getClientId(connectionId);
408
+
409
+ if (!clientId) return () => undefined;
410
+
411
+ return this._usersNotifier.subscribeOther(clientId, callback);
412
+ };
413
+
441
414
  private _simulateEvent<TEvent extends keyof InferIOInput<MergeEvents<TEvents, TIO>>>(
442
415
  event: TEvent,
443
416
  data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[TEvent]>,
@@ -460,4 +433,26 @@ export class MockedRoom<
460
433
  this._eventNotifier.subject(_type).next(data);
461
434
  });
462
435
  }
436
+
437
+ private _storage = new Proxy(
438
+ <TKey extends keyof InferStorage<TCrdt>>(
439
+ key: TKey,
440
+ callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
441
+ ): (() => void) => this._crdtNotifier.subscribe(key, callback),
442
+ {
443
+ get: (fn, prop) => {
444
+ type _Storage = InferStorage<TCrdt>;
445
+
446
+ if (!!prop) {
447
+ return (callback: StorageRootSubscriptionCallback<_Storage>) => {
448
+ return this._crdtNotifier.subcribeRoot(callback);
449
+ };
450
+ }
451
+
452
+ return (callback: StorageSubscriptionCallback<_Storage, keyof _Storage>) => {
453
+ return fn(prop as keyof InferStorage<TCrdt>, callback);
454
+ };
455
+ },
456
+ },
457
+ ) as StorageProxy<InferStorage<TCrdt>>;
463
458
  }
package/src/PluvRoom.ts CHANGED
@@ -311,13 +311,6 @@ export class PluvRoom<
311
311
  this._crdtManager = new CrdtManager<TCrdt>({ initialStorage });
312
312
  }
313
313
 
314
- /**
315
- * @deprecated To be removed in v3. Use `getStorageLoaded` instead.
316
- */
317
- public get storageLoaded(): boolean {
318
- return this.getStorageLoaded();
319
- }
320
-
321
314
  public get webSocket(): WebSocket | null {
322
315
  return this._state.webSocket;
323
316
  }
@@ -493,23 +486,6 @@ export class PluvRoom<
493
486
  this._stateNotifier.subjects["my-presence"].next(null);
494
487
  }
495
488
 
496
- /**
497
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
498
- */
499
- public event = new Proxy(
500
- <TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(
501
- event: TEvent,
502
- callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
503
- ): (() => void) => this._eventNotifier.subscribe(event, callback),
504
- {
505
- get(fn, prop) {
506
- return (
507
- callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
508
- ): (() => void) => fn(prop as any, callback);
509
- },
510
- },
511
- ) as EventProxy<TIO, TEvents>;
512
-
513
489
  public getConnection = (): WebSocketConnection => {
514
490
  // Create a read-only clone of the connection state
515
491
  return Object.freeze(JSON.parse(JSON.stringify(this._state.connection)));
@@ -567,61 +543,10 @@ export class PluvRoom<
567
543
  );
568
544
  };
569
545
 
570
- /**
571
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
572
- */
573
- public other = (
574
- connectionId: string,
575
- callback: OtherSubscriptionCallback<TIO, TPresence>,
576
- ): (() => void) => {
577
- const clientId = this._usersManager.getClientId(connectionId);
578
-
579
- if (!clientId) return () => undefined;
580
-
581
- return this._usersNotifier.subscribeOther(clientId, callback);
582
- };
583
-
584
546
  public redo = (): void => {
585
547
  this._crdtManager.doc.redo();
586
548
  };
587
549
 
588
- /**
589
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
590
- */
591
- public storage = new Proxy(
592
- <TKey extends keyof InferStorage<TCrdt>>(
593
- key: TKey,
594
- callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
595
- ): (() => void) => this._crdtNotifier.subscribe(key, callback),
596
- {
597
- get: (fn, prop) => {
598
- type _Storage = InferStorage<TCrdt>;
599
-
600
- if (!!prop) {
601
- return (callback: StorageRootSubscriptionCallback<_Storage>) => {
602
- return this._crdtNotifier.subcribeRoot(callback);
603
- };
604
- }
605
-
606
- return (callback: StorageSubscriptionCallback<_Storage, keyof _Storage>) => {
607
- return fn(prop as keyof InferStorage<TCrdt>, callback);
608
- };
609
- },
610
- },
611
- ) as StorageProxy<InferStorage<TCrdt>>;
612
-
613
- /**
614
- * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
615
- * @description Subscribes to the root storage object (serialized)
616
- */
617
- public storageRoot = (
618
- callback: (value: {
619
- [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>;
620
- }) => void,
621
- ): (() => void) => {
622
- return this._crdtNotifier.subcribeRoot(callback);
623
- };
624
-
625
550
  public subscribe = new Proxy(
626
551
  <TSubject extends keyof StateNotifierSubjects<TIO, TPresence>>(
627
552
  name: TSubject,
@@ -659,9 +584,9 @@ export class PluvRoom<
659
584
  };
660
585
  }
661
586
 
662
- if (prop === "event") return this.event;
663
- if (prop === "other") return this.other;
664
- if (prop === "storage") return this.storage;
587
+ if (prop === "event") return this._event;
588
+ if (prop === "other") return this._other;
589
+ if (prop === "storage") return this._storage;
665
590
  },
666
591
  },
667
592
  ) as SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
@@ -816,6 +741,20 @@ export class PluvRoom<
816
741
  this._crdtNotifier.rootSubject.next(storageRoot);
817
742
  }
818
743
 
744
+ private _event = new Proxy(
745
+ <TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(
746
+ event: TEvent,
747
+ callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
748
+ ): (() => void) => this._eventNotifier.subscribe(event, callback),
749
+ {
750
+ get(fn, prop) {
751
+ return (
752
+ callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>,
753
+ ): (() => void) => fn(prop as any, callback);
754
+ },
755
+ },
756
+ ) as EventProxy<TIO, TEvents>;
757
+
819
758
  private _flattenStorageStore = debounce(
820
759
  async (): Promise<void> => {
821
760
  const shouldFlatten = await this._storageStore.getShouldFlatten();
@@ -1497,6 +1436,17 @@ export class PluvRoom<
1497
1436
  return await this._onVisibilityChange();
1498
1437
  }
1499
1438
 
1439
+ private _other = (
1440
+ connectionId: string,
1441
+ callback: OtherSubscriptionCallback<TIO, TPresence>,
1442
+ ): (() => void) => {
1443
+ const clientId = this._usersManager.getClientId(connectionId);
1444
+
1445
+ if (!clientId) return () => undefined;
1446
+
1447
+ return this._usersNotifier.subscribeOther(clientId, callback);
1448
+ };
1449
+
1500
1450
  private _parseMessage(message: { data: string | ArrayBuffer }): IOEventMessage<TIO> | null {
1501
1451
  /**
1502
1452
  * !HACK
@@ -1597,6 +1547,28 @@ export class PluvRoom<
1597
1547
  return parsed;
1598
1548
  }
1599
1549
 
1550
+ private _storage = new Proxy(
1551
+ <TKey extends keyof InferStorage<TCrdt>>(
1552
+ key: TKey,
1553
+ callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
1554
+ ): (() => void) => this._crdtNotifier.subscribe(key, callback),
1555
+ {
1556
+ get: (fn, prop) => {
1557
+ type _Storage = InferStorage<TCrdt>;
1558
+
1559
+ if (!!prop) {
1560
+ return (callback: StorageRootSubscriptionCallback<_Storage>) => {
1561
+ return this._crdtNotifier.subcribeRoot(callback);
1562
+ };
1563
+ }
1564
+
1565
+ return (callback: StorageSubscriptionCallback<_Storage, keyof _Storage>) => {
1566
+ return fn(prop as keyof InferStorage<TCrdt>, callback);
1567
+ };
1568
+ },
1569
+ },
1570
+ ) as StorageProxy<InferStorage<TCrdt>>;
1571
+
1600
1572
  private _updateState(
1601
1573
  updater: (oldState: WebSocketState<TIO>) => WebSocketState<TIO>,
1602
1574
  ): WebSocketState<TIO> {