@pluv/client 2.0.1 → 2.1.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.0.1 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@2.1.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
- ESM dist/index.mjs 57.33 KB
12
- ESM ⚡️ Build success in 127ms
13
- CJS dist/index.js 58.82 KB
14
- CJS ⚡️ Build success in 128ms
11
+ ESM dist/index.mjs 61.64 KB
12
+ ESM ⚡️ Build success in 102ms
13
+ CJS dist/index.js 63.17 KB
14
+ CJS ⚡️ Build success in 108ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4134ms
17
- DTS dist/index.d.mts 21.88 KB
18
- DTS dist/index.d.ts 21.88 KB
16
+ DTS ⚡️ Build success in 4639ms
17
+ DTS dist/index.d.mts 20.08 KB
18
+ DTS dist/index.d.ts 20.08 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,109 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e8d8fbc: **DEPRECATED** Subscribing to data via string parameters on `PluvRoom.subscribe` is deprecated, to be removed in v3. To subscribe to things such as `myself`, `my-presence` and `others`, you must now do so via nested properties on the `subscribe` object (see example below).
8
+
9
+ ```ts
10
+ const room = client.createRoom("example-room");
11
+
12
+ // Before (now deprecated)
13
+ room.subscribe("connection", (state) => {});
14
+ room.subscribe("my-presence", (myPresence) => {});
15
+ room.subscribe("myself", (myself) => {});
16
+ room.subscribe("others", (others) => {});
17
+ room.subscribe("storage-loaded", (storageLoaded) => {});
18
+
19
+ // After
20
+ room.subscribe.connection((state) => {});
21
+ room.subscribe.myPresence((myPresence) => {});
22
+ room.subscribe.myself((myself) => {});
23
+ room.subscribe.others((others) => {});
24
+ room.subscribe.storageLoaded((storageLoaded) => {});
25
+ ```
26
+
27
+ - d5ac29e: **DEPRECATED** `PluvRoom.event`, `PluvRoom.storage`, `PluvRoom.storageRoot` and `PluvRoom.other` have all been deprecated, to be removed in v3. These now exist under `PluvRoom.subscribe` instead.
28
+
29
+ ```ts
30
+ const room = client.createRoom("example-room");
31
+
32
+ // Before (now deprecated)
33
+ room.event.receiveMessage((event) => {});
34
+ room.storage.messages((messages) => {});
35
+ room.storageRoot((storage) => {});
36
+ room.other(("id_...", other) => {});
37
+
38
+ // After
39
+ room.subscribe.event.receiveMessage((event) => {});
40
+ room.subscribe.storage.messages((messages) => {});
41
+ room.subscribe.storageRoot((storage) => {});
42
+ room.subscribe.other(("id_...", other) => {});
43
+ ```
44
+
45
+ - 5ca5cb6: Updated `PluvRoom.storage` to also allow subscribing to storage fields as nested properties.
46
+
47
+ ```ts
48
+ const client = createClient({
49
+ // ...
50
+ initialStorage: yjs.doc((t) => ({
51
+ messages: yjs.array<string>(),
52
+ })),
53
+ });
54
+
55
+ const room = client.createRoom("example-room");
56
+
57
+ // The two statements below are equivalent.
58
+ room.storage("messages", (value) => {});
59
+
60
+ // You can now subscribe to storage fields as nested properties like so
61
+ room.storage.messages((value) => {});
62
+ ```
63
+
64
+ - 4acbe1e: Updated `PluvRoom.storage` to also allow subscribing to the root storage when no field is provided.
65
+
66
+ ```ts
67
+ const client = createClient({
68
+ // ...
69
+ initialStorage: yjs.doc((t) => ({
70
+ messages: yjs.array<string>(),
71
+ })),
72
+ });
73
+
74
+ const room = client.createRoom("example-room");
75
+
76
+ room.storage("messages", (value) => {});
77
+ // ^? const value: string[];
78
+
79
+ // You can now subscribe to the storage root when no key is provided
80
+ room.storage((value) => {});
81
+ // ^? const value: { messages: string[] };
82
+ ```
83
+
84
+ - e8d8fbc: Updated `PluvRoom.subscribe` so that `PluvRoom.event` and `PluvRoom.storage` can be accessed as properties under `PluvRoom.subscribe`.
85
+
86
+ ```ts
87
+ const room = client.createRoom("example-room");
88
+
89
+ // These are now available under the subscribe object
90
+ room.subscribe.event.receiveEvent((event) => {});
91
+ room.subscribe.storage.messages((data) => {});
92
+ ```
93
+
94
+ ### Patch Changes
95
+
96
+ - a86ff5e: Updated internal types to simplify the type for `PluvRoom.broadcast` and `PluvRoom.event`.
97
+ - @pluv/crdt@2.1.0
98
+ - @pluv/types@2.1.0
99
+
100
+ ## 2.0.2
101
+
102
+ ### Patch Changes
103
+
104
+ - @pluv/crdt@2.0.2
105
+ - @pluv/types@2.0.2
106
+
3
107
  ## 2.0.1
4
108
 
5
109
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { CrdtType, AbstractCrdtDocFactory, NoopCrdtDocFactory, InferStorage, InferCrdtJson } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ConnectionState, ProcedureLike, InputZodLike, IORouterLike, WebSocketState, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, MergeEvents, EventNotifierSubscriptionCallback, OtherNotifierSubscriptionCallback, UpdateMyPresenceAction } from '@pluv/types';
3
+ import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ConnectionState, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, BroadcastProxy, EventProxy, OtherSubscriptionCallback, StorageProxy, SubscribeProxy, UpdateMyPresenceAction, MergeEvents } from '@pluv/types';
4
4
  export { BaseUser, ConnectionState, EventMessage, EventNotifierSubscriptionCallback, EventRecord, IOEventMessage, MergeEvents, RoomLike, UserInfo, WebSocketState } from '@pluv/types';
5
- import { Subject } from 'wonka';
6
5
 
7
6
  declare abstract class AbstractStorageStore {
8
7
  room: string;
@@ -104,16 +103,6 @@ declare class PluvRouter<TIO extends IOLike = IOLike, TPresence extends JsonObje
104
103
  private _isValidEventName;
105
104
  }
106
105
 
107
- interface StateNotifierSubjects<TIO extends IOLike, TPresence extends JsonObject> {
108
- connection: Subject<Id<WebSocketState<TIO>>>;
109
- "my-presence": Subject<TPresence | null>;
110
- myself: Subject<Readonly<Id<UserInfo<TIO>>> | null>;
111
- others: Subject<readonly Id<UserInfo<TIO>>[]>;
112
- "storage-loaded": Subject<boolean>;
113
- }
114
- type InferSubjectValue<TIO extends IOLike, TPresence extends JsonObject, TSubject extends keyof StateNotifierSubjects<TIO, TPresence>> = StateNotifierSubjects<TIO, TPresence>[TSubject] extends Subject<infer IValue> ? Id<IValue> : never;
115
- type SubscriptionCallback<TIO extends IOLike, TPresence extends JsonObject, TSubject extends keyof StateNotifierSubjects<TIO, TPresence>> = (value: InferSubjectValue<TIO, TPresence, TSubject>) => void;
116
-
117
106
  type UsersManagerConfig<TPresence extends JsonObject = {}> = {
118
107
  initialPresence?: TPresence;
119
108
  limits: PluvClientLimits;
@@ -181,7 +170,6 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
181
170
  private readonly _intervals;
182
171
  private readonly _limits;
183
172
  private readonly _listeners;
184
- private readonly _otherNotifier;
185
173
  private readonly _publicKey;
186
174
  private readonly _reconnectTimeoutMs;
187
175
  private readonly _router;
@@ -190,6 +178,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
190
178
  private readonly _subscriptions;
191
179
  private readonly _timeouts;
192
180
  private readonly _usersManager;
181
+ private readonly _usersNotifier;
193
182
  private _lastMetadata;
194
183
  private _state;
195
184
  private _windowListeners;
@@ -197,12 +186,15 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
197
186
  constructor(room: string, options: RoomConfig<TIO, TMetadata, TPresence, TCrdt, TEvents>);
198
187
  get storageLoaded(): boolean;
199
188
  get webSocket(): WebSocket | null;
200
- broadcast: (<TEvent extends keyof InferIOInput<MergeEvents<TEvents, TIO>>>(event: TEvent, data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[TEvent]>) => Promise<void>) & { [PEvent in keyof InferIOInput<MergeEvents<TEvents, TIO>>]: (data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[PEvent]>) => Promise<void>; };
189
+ broadcast: BroadcastProxy<TIO, TEvents>;
201
190
  canRedo: () => boolean;
202
191
  canUndo: () => boolean;
203
192
  connect(...args: RoomConnectParams<TMetadata>): Promise<void>;
204
193
  disconnect(): Promise<void>;
205
- event: (<TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(event: TEvent, callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, TEvent>) => () => void) & { [PEvent in keyof InferIOOutput<MergeEvents<TEvents, TIO>>]: (callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, PEvent>) => () => void; };
194
+ /**
195
+ * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
196
+ */
197
+ event: EventProxy<TIO, TEvents>;
206
198
  getConnection: () => WebSocketConnection;
207
199
  getDoc: () => CrdtDocLike<InferStorage<TCrdt>>;
208
200
  getMyPresence: () => TPresence;
@@ -212,11 +204,21 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
212
204
  getStorage: <TKey extends keyof InferStorage<TCrdt>>(type: TKey) => InferStorage<TCrdt>[TKey] | null;
213
205
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
214
206
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
215
- other: (connectionId: string, callback: OtherNotifierSubscriptionCallback<TIO, TPresence>) => (() => void);
207
+ /**
208
+ * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
209
+ */
210
+ other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
216
211
  redo: () => void;
217
- storage: <TKey extends keyof InferStorage<TCrdt>>(key: TKey, fn: (value: InferCrdtJson<InferStorage<TCrdt>[TKey]>) => void) => (() => void);
218
- storageRoot: (fn: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
219
- subscribe: <TSubject extends keyof StateNotifierSubjects<TIO, TPresence>>(name: TSubject, callback: SubscriptionCallback<TIO, TPresence, TSubject>) => (() => void);
212
+ /**
213
+ * @deprecated To be removed in v3. To be removed in v3. Use PluvRoom.subscribe.storage instead
214
+ */
215
+ storage: StorageProxy<InferStorage<TCrdt>>;
216
+ /**
217
+ * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
218
+ * @description Subscribes to the root storage object (serialized)
219
+ */
220
+ storageRoot: (callback: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
221
+ subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
220
222
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
221
223
  undo: () => void;
222
224
  updateMyPresence: (presence: UpdateMyPresenceAction<TPresence>) => void;
@@ -332,7 +334,7 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject, TCrdt
332
334
  private readonly _eventNotifier;
333
335
  private readonly _events?;
334
336
  private readonly _limits;
335
- private readonly _otherNotifier;
337
+ private readonly _usersNotifier;
336
338
  private readonly _router;
337
339
  private _state;
338
340
  private readonly _stateNotifier;
@@ -340,10 +342,10 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject, TCrdt
340
342
  private readonly _usersManager;
341
343
  constructor(room: string, options: MockedRoomConfig<TIO, TPresence, TCrdt, TEvents>);
342
344
  get storageLoaded(): boolean;
343
- broadcast: (<TEvent extends keyof InferIOInput<MergeEvents<TEvents, TIO>>>(event: TEvent, data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[TEvent]>) => Promise<void>) & { [event in keyof InferIOInput<TIO>]: (data: Id<InferIOInput<TIO>[event]>) => Promise<void>; };
345
+ broadcast: BroadcastProxy<TIO, TEvents>;
344
346
  canRedo: () => boolean;
345
347
  canUndo: () => boolean;
346
- event: (<TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(event: TEvent, callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, TEvent>) => () => void) & { [event in keyof InferIOOutput<MergeEvents<TEvents, TIO>>]: (callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>) => () => void; };
348
+ event: EventProxy<TIO, TEvents>;
347
349
  getConnection: () => WebSocketConnection;
348
350
  getDoc(): CrdtDocLike<InferStorage<TCrdt>>;
349
351
  getMyPresence: () => TPresence;
@@ -353,11 +355,11 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject, TCrdt
353
355
  getStorage: <TKey extends keyof InferStorage<TCrdt>>(type: TKey) => InferStorage<TCrdt>[TKey] | null;
354
356
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
355
357
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
356
- other: (connectionId: string, callback: OtherNotifierSubscriptionCallback<TIO, TPresence>) => (() => void);
358
+ other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
357
359
  redo: () => void;
358
- storage: <TKey extends keyof InferStorage<TCrdt>>(key: TKey, fn: (value: InferCrdtJson<InferStorage<TCrdt>[TKey]>) => void) => (() => void);
360
+ storage: StorageProxy<InferStorage<TCrdt>>;
359
361
  storageRoot: (fn: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
360
- subscribe: <TSubject extends keyof StateNotifierSubjects<TIO, TPresence>>(name: TSubject, callback: SubscriptionCallback<TIO, TPresence, TSubject>) => (() => void);
362
+ subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
361
363
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
362
364
  undo: () => void;
363
365
  updateMyPresence: (presence: UpdateMyPresenceAction<TPresence>) => void;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { CrdtType, AbstractCrdtDocFactory, NoopCrdtDocFactory, InferStorage, InferCrdtJson } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ConnectionState, ProcedureLike, InputZodLike, IORouterLike, WebSocketState, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, MergeEvents, EventNotifierSubscriptionCallback, OtherNotifierSubscriptionCallback, UpdateMyPresenceAction } from '@pluv/types';
3
+ import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ConnectionState, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, InferIOAuthorize, BaseUser, RoomLike, InferIOOutput, InferIOInput, BroadcastProxy, EventProxy, OtherSubscriptionCallback, StorageProxy, SubscribeProxy, UpdateMyPresenceAction, MergeEvents } from '@pluv/types';
4
4
  export { BaseUser, ConnectionState, EventMessage, EventNotifierSubscriptionCallback, EventRecord, IOEventMessage, MergeEvents, RoomLike, UserInfo, WebSocketState } from '@pluv/types';
5
- import { Subject } from 'wonka';
6
5
 
7
6
  declare abstract class AbstractStorageStore {
8
7
  room: string;
@@ -104,16 +103,6 @@ declare class PluvRouter<TIO extends IOLike = IOLike, TPresence extends JsonObje
104
103
  private _isValidEventName;
105
104
  }
106
105
 
107
- interface StateNotifierSubjects<TIO extends IOLike, TPresence extends JsonObject> {
108
- connection: Subject<Id<WebSocketState<TIO>>>;
109
- "my-presence": Subject<TPresence | null>;
110
- myself: Subject<Readonly<Id<UserInfo<TIO>>> | null>;
111
- others: Subject<readonly Id<UserInfo<TIO>>[]>;
112
- "storage-loaded": Subject<boolean>;
113
- }
114
- type InferSubjectValue<TIO extends IOLike, TPresence extends JsonObject, TSubject extends keyof StateNotifierSubjects<TIO, TPresence>> = StateNotifierSubjects<TIO, TPresence>[TSubject] extends Subject<infer IValue> ? Id<IValue> : never;
115
- type SubscriptionCallback<TIO extends IOLike, TPresence extends JsonObject, TSubject extends keyof StateNotifierSubjects<TIO, TPresence>> = (value: InferSubjectValue<TIO, TPresence, TSubject>) => void;
116
-
117
106
  type UsersManagerConfig<TPresence extends JsonObject = {}> = {
118
107
  initialPresence?: TPresence;
119
108
  limits: PluvClientLimits;
@@ -181,7 +170,6 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
181
170
  private readonly _intervals;
182
171
  private readonly _limits;
183
172
  private readonly _listeners;
184
- private readonly _otherNotifier;
185
173
  private readonly _publicKey;
186
174
  private readonly _reconnectTimeoutMs;
187
175
  private readonly _router;
@@ -190,6 +178,7 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
190
178
  private readonly _subscriptions;
191
179
  private readonly _timeouts;
192
180
  private readonly _usersManager;
181
+ private readonly _usersNotifier;
193
182
  private _lastMetadata;
194
183
  private _state;
195
184
  private _windowListeners;
@@ -197,12 +186,15 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
197
186
  constructor(room: string, options: RoomConfig<TIO, TMetadata, TPresence, TCrdt, TEvents>);
198
187
  get storageLoaded(): boolean;
199
188
  get webSocket(): WebSocket | null;
200
- broadcast: (<TEvent extends keyof InferIOInput<MergeEvents<TEvents, TIO>>>(event: TEvent, data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[TEvent]>) => Promise<void>) & { [PEvent in keyof InferIOInput<MergeEvents<TEvents, TIO>>]: (data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[PEvent]>) => Promise<void>; };
189
+ broadcast: BroadcastProxy<TIO, TEvents>;
201
190
  canRedo: () => boolean;
202
191
  canUndo: () => boolean;
203
192
  connect(...args: RoomConnectParams<TMetadata>): Promise<void>;
204
193
  disconnect(): Promise<void>;
205
- event: (<TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(event: TEvent, callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, TEvent>) => () => void) & { [PEvent in keyof InferIOOutput<MergeEvents<TEvents, TIO>>]: (callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, PEvent>) => () => void; };
194
+ /**
195
+ * @deprecated To be removed in v3. Use PluvRoom.subscribe.event instead
196
+ */
197
+ event: EventProxy<TIO, TEvents>;
206
198
  getConnection: () => WebSocketConnection;
207
199
  getDoc: () => CrdtDocLike<InferStorage<TCrdt>>;
208
200
  getMyPresence: () => TPresence;
@@ -212,11 +204,21 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
212
204
  getStorage: <TKey extends keyof InferStorage<TCrdt>>(type: TKey) => InferStorage<TCrdt>[TKey] | null;
213
205
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
214
206
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
215
- other: (connectionId: string, callback: OtherNotifierSubscriptionCallback<TIO, TPresence>) => (() => void);
207
+ /**
208
+ * @deprecated To be removed in v3. Use PluvRoom.subscribe.other instead
209
+ */
210
+ other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
216
211
  redo: () => void;
217
- storage: <TKey extends keyof InferStorage<TCrdt>>(key: TKey, fn: (value: InferCrdtJson<InferStorage<TCrdt>[TKey]>) => void) => (() => void);
218
- storageRoot: (fn: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
219
- subscribe: <TSubject extends keyof StateNotifierSubjects<TIO, TPresence>>(name: TSubject, callback: SubscriptionCallback<TIO, TPresence, TSubject>) => (() => void);
212
+ /**
213
+ * @deprecated To be removed in v3. To be removed in v3. Use PluvRoom.subscribe.storage instead
214
+ */
215
+ storage: StorageProxy<InferStorage<TCrdt>>;
216
+ /**
217
+ * @deprecated To be removed in v3. Use PluvRoom.subscribe.storage instead
218
+ * @description Subscribes to the root storage object (serialized)
219
+ */
220
+ storageRoot: (callback: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
221
+ subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
220
222
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
221
223
  undo: () => void;
222
224
  updateMyPresence: (presence: UpdateMyPresenceAction<TPresence>) => void;
@@ -332,7 +334,7 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject, TCrdt
332
334
  private readonly _eventNotifier;
333
335
  private readonly _events?;
334
336
  private readonly _limits;
335
- private readonly _otherNotifier;
337
+ private readonly _usersNotifier;
336
338
  private readonly _router;
337
339
  private _state;
338
340
  private readonly _stateNotifier;
@@ -340,10 +342,10 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject, TCrdt
340
342
  private readonly _usersManager;
341
343
  constructor(room: string, options: MockedRoomConfig<TIO, TPresence, TCrdt, TEvents>);
342
344
  get storageLoaded(): boolean;
343
- broadcast: (<TEvent extends keyof InferIOInput<MergeEvents<TEvents, TIO>>>(event: TEvent, data: Id<InferIOInput<MergeEvents<TEvents, TIO>>[TEvent]>) => Promise<void>) & { [event in keyof InferIOInput<TIO>]: (data: Id<InferIOInput<TIO>[event]>) => Promise<void>; };
345
+ broadcast: BroadcastProxy<TIO, TEvents>;
344
346
  canRedo: () => boolean;
345
347
  canUndo: () => boolean;
346
- event: (<TEvent extends keyof InferIOOutput<MergeEvents<TEvents, TIO>>>(event: TEvent, callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, TEvent>) => () => void) & { [event in keyof InferIOOutput<MergeEvents<TEvents, TIO>>]: (callback: EventNotifierSubscriptionCallback<MergeEvents<TEvents, TIO>, any>) => () => void; };
348
+ event: EventProxy<TIO, TEvents>;
347
349
  getConnection: () => WebSocketConnection;
348
350
  getDoc(): CrdtDocLike<InferStorage<TCrdt>>;
349
351
  getMyPresence: () => TPresence;
@@ -353,11 +355,11 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject, TCrdt
353
355
  getStorage: <TKey extends keyof InferStorage<TCrdt>>(type: TKey) => InferStorage<TCrdt>[TKey] | null;
354
356
  getStorageJson(): InferCrdtJson<InferStorage<TCrdt>> | null;
355
357
  getStorageJson<TKey extends keyof InferStorage<TCrdt>>(type: TKey): InferCrdtJson<InferStorage<TCrdt>[TKey]> | null;
356
- other: (connectionId: string, callback: OtherNotifierSubscriptionCallback<TIO, TPresence>) => (() => void);
358
+ other: (connectionId: string, callback: OtherSubscriptionCallback<TIO, TPresence>) => (() => void);
357
359
  redo: () => void;
358
- storage: <TKey extends keyof InferStorage<TCrdt>>(key: TKey, fn: (value: InferCrdtJson<InferStorage<TCrdt>[TKey]>) => void) => (() => void);
360
+ storage: StorageProxy<InferStorage<TCrdt>>;
359
361
  storageRoot: (fn: (value: { [P in keyof InferStorage<TCrdt>]: InferCrdtJson<InferStorage<TCrdt>[P]>; }) => void) => (() => void);
360
- subscribe: <TSubject extends keyof StateNotifierSubjects<TIO, TPresence>>(name: TSubject, callback: SubscriptionCallback<TIO, TPresence, TSubject>) => (() => void);
362
+ subscribe: SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
361
363
  transact: (fn: (storage: InferStorage<TCrdt>) => void, origin?: string) => void;
362
364
  undo: () => void;
363
365
  updateMyPresence: (presence: UpdateMyPresenceAction<TPresence>) => void;