@liveblocks/client 0.13.0-beta.1 → 0.13.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/README.md CHANGED
@@ -8,17 +8,17 @@
8
8
 
9
9
  **At [Liveblocks](https://liveblocks.io), we’re building tools to help companies create world-class collaborative products that attract, engage and retain users.** This repository is a set of open-source packages for building performant and reliable multiplayer experiences.
10
10
 
11
+ ## Installation
12
+
13
+ ```
14
+ npm install @liveblocks/client
15
+ ```
16
+
11
17
  ## Examples
12
18
 
13
19
  - Browse our gallery of collaborative UI patterns. [View examples gallery](https://liveblocks.io/examples)
14
20
  - Explore and clone any of our open-source examples. [View code examples](https://github.com/liveblocks/liveblocks/tree/main/examples)
15
21
 
16
- ## Packages
17
-
18
- - [@liveblocks/client](https://github.com/liveblocks/liveblocks/tree/main/packages/liveblocks)
19
- - [@liveblocks/react](https://github.com/liveblocks/liveblocks/tree/main/packages/liveblocks-react)
20
- - [@liveblocks/node](https://github.com/liveblocks/liveblocks/tree/main/packages/liveblocks-node)
21
-
22
22
  ## Documentation
23
23
 
24
24
  [Read the documentation](https://liveblocks.io/docs) to start using Liveblocks.
@@ -35,11 +35,11 @@ For changelog, visit [https://github.com/liveblocks/liveblocks/releases](https:/
35
35
 
36
36
  ## Community
37
37
 
38
- - [Slack](https://join.slack.com/t/liveblocks-community/shared_invite/zt-qozwnk75-6RB0i1wk1lx470KX0YuZxQ) - To get involved with the Liveblocks community, ask questions and share tips.
38
+ - [Discord](https://discord.gg/X4YWJuH9VY) - To get involved with the Liveblocks community, ask questions and share tips.
39
39
  - [Twitter](https://twitter.com/liveblocks) - To receive updates, announcements, blog posts, and general Liveblocks tips.
40
40
 
41
41
  ## License
42
42
 
43
43
  Licensed under the Apache License 2.0, Copyright © 2021-present [Liveblocks](https://liveblocks.io).
44
44
 
45
- See [LICENSE](./LICENSE) for more information.
45
+ See [LICENSE](../../LICENSE) for more information.
@@ -64,6 +64,7 @@ export declare class LiveList<T> extends AbstractCrdt {
64
64
  * @param index The index of the element to delete
65
65
  */
66
66
  delete(index: number): void;
67
+ clear(): void;
67
68
  /**
68
69
  * Returns an Array of all the elements in the LiveList.
69
70
  */
@@ -256,6 +256,28 @@ class LiveList extends AbstractCrdt_1.AbstractCrdt {
256
256
  }
257
257
  }
258
258
  }
259
+ clear() {
260
+ if (this._doc) {
261
+ let ops = [];
262
+ let reverseOps = [];
263
+ for (const item of __classPrivateFieldGet(this, _LiveList_items, "f")) {
264
+ item[0]._detach();
265
+ const childId = item[0]._id;
266
+ if (childId) {
267
+ ops.push({ id: childId, type: live_1.OpType.DeleteCrdt });
268
+ reverseOps.push(...item[0]._serialize(this._id, item[1]));
269
+ }
270
+ }
271
+ __classPrivateFieldSet(this, _LiveList_items, [], "f");
272
+ this._doc.dispatch(ops, reverseOps, [this]);
273
+ }
274
+ else {
275
+ for (const item of __classPrivateFieldGet(this, _LiveList_items, "f")) {
276
+ item[0]._detach();
277
+ }
278
+ __classPrivateFieldSet(this, _LiveList_items, [], "f");
279
+ }
280
+ }
259
281
  /**
260
282
  * Returns an Array of all the elements in the LiveList.
261
283
  */
@@ -53,6 +53,11 @@ export declare class LiveObject<T extends Record<string, any> = Record<string, a
53
53
  * @param key The key of the property to get
54
54
  */
55
55
  get<TKey extends keyof T>(key: TKey): T[TKey];
56
+ /**
57
+ * Deletes a key from the LiveObject
58
+ * @param key The key of the property to delete
59
+ */
60
+ delete(key: keyof T): void;
56
61
  /**
57
62
  * Adds or updates multiple properties at once with an object.
58
63
  * @param overrides The object used to overrides properties
@@ -186,6 +186,40 @@ class LiveObject extends AbstractCrdt_1.AbstractCrdt {
186
186
  get(key) {
187
187
  return __classPrivateFieldGet(this, _LiveObject_map, "f").get(key);
188
188
  }
189
+ /**
190
+ * Deletes a key from the LiveObject
191
+ * @param key The key of the property to delete
192
+ */
193
+ delete(key) {
194
+ const keyAsString = key;
195
+ const oldValue = __classPrivateFieldGet(this, _LiveObject_map, "f").get(keyAsString);
196
+ if (oldValue === undefined) {
197
+ return;
198
+ }
199
+ if (this._doc == null || this._id == null) {
200
+ if (oldValue instanceof AbstractCrdt_1.AbstractCrdt) {
201
+ oldValue._detach();
202
+ }
203
+ __classPrivateFieldGet(this, _LiveObject_map, "f").delete(keyAsString);
204
+ return;
205
+ }
206
+ let reverse;
207
+ if (oldValue instanceof AbstractCrdt_1.AbstractCrdt) {
208
+ oldValue._detach();
209
+ reverse = oldValue._serialize(this._id, keyAsString);
210
+ }
211
+ else {
212
+ reverse = [
213
+ {
214
+ type: live_1.OpType.UpdateObject,
215
+ data: { [keyAsString]: oldValue },
216
+ id: this._id,
217
+ },
218
+ ];
219
+ }
220
+ __classPrivateFieldGet(this, _LiveObject_map, "f").delete(keyAsString);
221
+ this._doc.dispatch([{ type: live_1.OpType.DeleteObjectKey, key: keyAsString, id: this._id }], reverse, [this]);
222
+ }
189
223
  /**
190
224
  * Adds or updates multiple properties at once with an object.
191
225
  * @param overrides The object used to overrides properties
@@ -310,6 +344,10 @@ _LiveObject_map = new WeakMap(), _LiveObject_propToLastUpdate = new WeakMap(), _
310
344
  return isModified ? { modified: this, reverse } : { modified: false };
311
345
  }, _LiveObject_applyDeleteObjectKey = function _LiveObject_applyDeleteObjectKey(op) {
312
346
  const key = op.key;
347
+ // If property does not exist, exit without notifying
348
+ if (__classPrivateFieldGet(this, _LiveObject_map, "f").has(key) === false) {
349
+ return { modified: false };
350
+ }
313
351
  const oldValue = __classPrivateFieldGet(this, _LiveObject_map, "f").get(key);
314
352
  let reverse = [];
315
353
  if ((0, utils_1.isCrdt)(oldValue)) {
@@ -0,0 +1,7 @@
1
+ import { LiveList } from "../LiveList";
2
+ import { LiveObject } from "../LiveObject";
3
+ import { StorageUpdate } from "../types";
4
+ export declare function liveObjectToJson(liveObject: LiveObject<any>): any;
5
+ export declare function patchLiveList<T>(liveList: LiveList<T>, prev: Array<T>, next: Array<T>): void;
6
+ export declare function patchLiveObject<T extends Record<string, any>>(root: LiveObject<T>, prev: T, next: T): void;
7
+ export declare function patchImmutableObject<T>(state: T, updates: StorageUpdate[]): T;
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchImmutableObject = exports.patchLiveObject = exports.patchLiveList = exports.liveObjectToJson = void 0;
4
+ const LiveList_1 = require("../LiveList");
5
+ const LiveMap_1 = require("../LiveMap");
6
+ const LiveObject_1 = require("../LiveObject");
7
+ function liveObjectToJson(liveObject) {
8
+ const result = {};
9
+ const obj = liveObject.toObject();
10
+ for (const key in obj) {
11
+ result[key] = liveNodeToJson(obj[key]);
12
+ }
13
+ return result;
14
+ }
15
+ exports.liveObjectToJson = liveObjectToJson;
16
+ function liveMapToJson(map) {
17
+ const result = {};
18
+ const obj = Object.fromEntries(map);
19
+ for (const key in obj) {
20
+ result[key] = liveNodeToJson(obj[key]);
21
+ }
22
+ return result;
23
+ }
24
+ function liveListToJson(value) {
25
+ return value.toArray().map(liveNodeToJson);
26
+ }
27
+ function liveNodeToJson(value) {
28
+ if (value instanceof LiveObject_1.LiveObject) {
29
+ return liveObjectToJson(value);
30
+ }
31
+ else if (value instanceof LiveList_1.LiveList) {
32
+ return liveListToJson(value);
33
+ }
34
+ else if (value instanceof LiveMap_1.LiveMap) {
35
+ return liveMapToJson(value);
36
+ }
37
+ return value;
38
+ }
39
+ function isPlainObject(obj) {
40
+ return Object.prototype.toString.call(obj) === "[object Object]";
41
+ }
42
+ function anyToCrdt(obj) {
43
+ if (obj == null) {
44
+ return obj;
45
+ }
46
+ if (Array.isArray(obj)) {
47
+ return new LiveList_1.LiveList(obj.map(anyToCrdt));
48
+ }
49
+ if (isPlainObject(obj)) {
50
+ const init = {};
51
+ for (const key in obj) {
52
+ init[key] = anyToCrdt(obj[key]);
53
+ }
54
+ return new LiveObject_1.LiveObject(init);
55
+ }
56
+ return obj;
57
+ }
58
+ function patchLiveList(liveList, prev, next) {
59
+ let i = 0;
60
+ let prevEnd = prev.length - 1;
61
+ let nextEnd = next.length - 1;
62
+ let prevNode = prev[0];
63
+ let nextNode = next[0];
64
+ /**
65
+ * For A,B,C => A,B,C,D
66
+ * i = 3, prevEnd = 2, nextEnd = 3
67
+ *
68
+ * For A,B,C => B,C
69
+ * i = 2, prevEnd = 2, nextEnd = 1
70
+ *
71
+ * For B,C => A,B,C
72
+ * i = 0, pre
73
+ */
74
+ outer: {
75
+ while (prevNode === nextNode) {
76
+ ++i;
77
+ if (i > prevEnd || i > nextEnd) {
78
+ break outer;
79
+ }
80
+ prevNode = prev[i];
81
+ nextNode = next[i];
82
+ }
83
+ prevNode = prev[prevEnd];
84
+ nextNode = next[nextEnd];
85
+ while (prevNode === nextNode) {
86
+ prevEnd--;
87
+ nextEnd--;
88
+ if (i > prevEnd || i > nextEnd) {
89
+ break outer;
90
+ }
91
+ prevNode = prev[prevEnd];
92
+ nextNode = next[nextEnd];
93
+ }
94
+ }
95
+ if (i > prevEnd) {
96
+ if (i <= nextEnd) {
97
+ while (i <= nextEnd) {
98
+ liveList.insert(anyToCrdt(next[i]), i);
99
+ i++;
100
+ }
101
+ }
102
+ }
103
+ else if (i > nextEnd) {
104
+ while (i <= prevEnd) {
105
+ liveList.delete(i++);
106
+ }
107
+ }
108
+ else {
109
+ while (i <= prevEnd && i <= nextEnd) {
110
+ prevNode = prev[i];
111
+ nextNode = next[i];
112
+ const liveListNode = liveList.get(i);
113
+ if (liveListNode instanceof LiveObject_1.LiveObject &&
114
+ isPlainObject(prevNode) &&
115
+ isPlainObject(nextNode)) {
116
+ patchLiveObject(liveListNode, prevNode, nextNode);
117
+ }
118
+ else {
119
+ liveList.delete(i);
120
+ liveList.insert(anyToCrdt(nextNode), i);
121
+ }
122
+ i++;
123
+ }
124
+ while (i <= nextEnd) {
125
+ liveList.insert(anyToCrdt(next[i]), i);
126
+ i++;
127
+ }
128
+ while (i <= prevEnd) {
129
+ liveList.delete(i);
130
+ i++;
131
+ }
132
+ }
133
+ }
134
+ exports.patchLiveList = patchLiveList;
135
+ function patchLiveObject(root, prev, next) {
136
+ const updates = {};
137
+ for (const key in next) {
138
+ if (prev[key] === next[key]) {
139
+ continue;
140
+ }
141
+ else if (Array.isArray(prev[key]) && Array.isArray(next[key])) {
142
+ patchLiveList(root.get(key), prev[key], next[key]);
143
+ }
144
+ else if (isPlainObject(prev[key]) && isPlainObject(next[key])) {
145
+ patchLiveObject(root.get(key), prev[key], next[key]);
146
+ }
147
+ else {
148
+ updates[key] = anyToCrdt(next[key]);
149
+ }
150
+ }
151
+ for (const key in prev) {
152
+ if (next[key] === undefined) {
153
+ root.delete(key);
154
+ }
155
+ }
156
+ if (Object.keys(updates).length > 0) {
157
+ root.update(updates);
158
+ }
159
+ }
160
+ exports.patchLiveObject = patchLiveObject;
161
+ function getParentsPath(node) {
162
+ const path = [];
163
+ while (node._parentKey != null && node._parent != null) {
164
+ if (node._parent instanceof LiveList_1.LiveList) {
165
+ path.push(node._parent._indexOfPosition(node._parentKey));
166
+ }
167
+ else {
168
+ path.push(node._parentKey);
169
+ }
170
+ node = node._parent;
171
+ }
172
+ return path;
173
+ }
174
+ function patchImmutableObject(state, updates) {
175
+ return updates.reduce((state, update) => patchImmutableObjectWithUpdate(state, update), state);
176
+ }
177
+ exports.patchImmutableObject = patchImmutableObject;
178
+ function patchImmutableObjectWithUpdate(state, update) {
179
+ const path = getParentsPath(update.node);
180
+ return patchImmutableNode(state, path, update);
181
+ }
182
+ function patchImmutableNode(state, path, update) {
183
+ const pathItem = path.pop();
184
+ if (pathItem === undefined) {
185
+ switch (update.type) {
186
+ case "LiveObject": {
187
+ if (typeof state !== "object") {
188
+ throw new Error("Internal: received update on LiveObject but state was not an object");
189
+ }
190
+ return liveObjectToJson(update.node);
191
+ }
192
+ case "LiveList": {
193
+ if (Array.isArray(state) === false) {
194
+ throw new Error("Internal: received update on LiveList but state was not an array");
195
+ }
196
+ return liveListToJson(update.node);
197
+ }
198
+ case "LiveMap": {
199
+ if (typeof state !== "object") {
200
+ throw new Error("Internal: received update on LiveMap but state was not an object");
201
+ }
202
+ return liveMapToJson(update.node);
203
+ }
204
+ }
205
+ }
206
+ if (Array.isArray(state)) {
207
+ const newArray = [...state];
208
+ newArray[pathItem] = patchImmutableNode(state[pathItem], path, update);
209
+ return newArray;
210
+ }
211
+ else {
212
+ return Object.assign(Object.assign({}, state), { [pathItem]: patchImmutableNode(state[pathItem], path, update) });
213
+ }
214
+ }
@@ -0,0 +1,8 @@
1
+ import { LiveList } from "./LiveList";
2
+ import { LiveObject } from "./LiveObject";
3
+ import { StorageUpdate } from "./types";
4
+ export declare function liveObjectToJson(liveObject: LiveObject<any>): any;
5
+ export declare function patchLiveList<T>(liveList: LiveList<T>, prev: Array<T>, next: Array<T>): void;
6
+ export declare function patchLiveObjectKey<T>(liveObject: LiveObject<T>, key: keyof T, prev: any, next: any): void;
7
+ export declare function patchLiveObject<T extends Record<string, any>>(root: LiveObject<T>, prev: T, next: T): void;
8
+ export declare function patchImmutableObject<T>(state: T, updates: StorageUpdate[]): T;
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchImmutableObject = exports.patchLiveObject = exports.patchLiveObjectKey = exports.patchLiveList = exports.liveObjectToJson = void 0;
4
+ const LiveList_1 = require("./LiveList");
5
+ const LiveMap_1 = require("./LiveMap");
6
+ const LiveObject_1 = require("./LiveObject");
7
+ const LiveRegister_1 = require("./LiveRegister");
8
+ function liveObjectToJson(liveObject) {
9
+ const result = {};
10
+ const obj = liveObject.toObject();
11
+ for (const key in obj) {
12
+ result[key] = liveNodeToJson(obj[key]);
13
+ }
14
+ return result;
15
+ }
16
+ exports.liveObjectToJson = liveObjectToJson;
17
+ function liveMapToJson(map) {
18
+ const result = {};
19
+ const obj = Object.fromEntries(map);
20
+ for (const key in obj) {
21
+ result[key] = liveNodeToJson(obj[key]);
22
+ }
23
+ return result;
24
+ }
25
+ function liveListToJson(value) {
26
+ return value.toArray().map(liveNodeToJson);
27
+ }
28
+ function liveNodeToJson(value) {
29
+ if (value instanceof LiveObject_1.LiveObject) {
30
+ return liveObjectToJson(value);
31
+ }
32
+ else if (value instanceof LiveList_1.LiveList) {
33
+ return liveListToJson(value);
34
+ }
35
+ else if (value instanceof LiveMap_1.LiveMap) {
36
+ return liveMapToJson(value);
37
+ }
38
+ else if (value instanceof LiveRegister_1.LiveRegister) {
39
+ return value.data;
40
+ }
41
+ return value;
42
+ }
43
+ function isPlainObject(obj) {
44
+ return Object.prototype.toString.call(obj) === "[object Object]";
45
+ }
46
+ function anyToCrdt(obj) {
47
+ if (obj == null) {
48
+ return obj;
49
+ }
50
+ if (Array.isArray(obj)) {
51
+ return new LiveList_1.LiveList(obj.map(anyToCrdt));
52
+ }
53
+ if (isPlainObject(obj)) {
54
+ const init = {};
55
+ for (const key in obj) {
56
+ init[key] = anyToCrdt(obj[key]);
57
+ }
58
+ return new LiveObject_1.LiveObject(init);
59
+ }
60
+ return obj;
61
+ }
62
+ function patchLiveList(liveList, prev, next) {
63
+ let i = 0;
64
+ let prevEnd = prev.length - 1;
65
+ let nextEnd = next.length - 1;
66
+ let prevNode = prev[0];
67
+ let nextNode = next[0];
68
+ /**
69
+ * For A,B,C => A,B,C,D
70
+ * i = 3, prevEnd = 2, nextEnd = 3
71
+ *
72
+ * For A,B,C => B,C
73
+ * i = 2, prevEnd = 2, nextEnd = 1
74
+ *
75
+ * For B,C => A,B,C
76
+ * i = 0, pre
77
+ */
78
+ outer: {
79
+ while (prevNode === nextNode) {
80
+ ++i;
81
+ if (i > prevEnd || i > nextEnd) {
82
+ break outer;
83
+ }
84
+ prevNode = prev[i];
85
+ nextNode = next[i];
86
+ }
87
+ prevNode = prev[prevEnd];
88
+ nextNode = next[nextEnd];
89
+ while (prevNode === nextNode) {
90
+ prevEnd--;
91
+ nextEnd--;
92
+ if (i > prevEnd || i > nextEnd) {
93
+ break outer;
94
+ }
95
+ prevNode = prev[prevEnd];
96
+ nextNode = next[nextEnd];
97
+ }
98
+ }
99
+ if (i > prevEnd) {
100
+ if (i <= nextEnd) {
101
+ while (i <= nextEnd) {
102
+ liveList.insert(anyToCrdt(next[i]), i);
103
+ i++;
104
+ }
105
+ }
106
+ }
107
+ else if (i > nextEnd) {
108
+ while (i <= prevEnd) {
109
+ liveList.delete(i++);
110
+ }
111
+ }
112
+ else {
113
+ while (i <= prevEnd && i <= nextEnd) {
114
+ prevNode = prev[i];
115
+ nextNode = next[i];
116
+ const liveListNode = liveList.get(i);
117
+ if (liveListNode instanceof LiveObject_1.LiveObject &&
118
+ isPlainObject(prevNode) &&
119
+ isPlainObject(nextNode)) {
120
+ patchLiveObject(liveListNode, prevNode, nextNode);
121
+ }
122
+ else {
123
+ liveList.delete(i);
124
+ liveList.insert(anyToCrdt(nextNode), i);
125
+ }
126
+ i++;
127
+ }
128
+ while (i <= nextEnd) {
129
+ liveList.insert(anyToCrdt(next[i]), i);
130
+ i++;
131
+ }
132
+ while (i <= prevEnd) {
133
+ liveList.delete(i);
134
+ i++;
135
+ }
136
+ }
137
+ }
138
+ exports.patchLiveList = patchLiveList;
139
+ function patchLiveObjectKey(liveObject, key, prev, next) {
140
+ const value = liveObject.get(key);
141
+ if (next === undefined) {
142
+ liveObject.delete(key);
143
+ }
144
+ else if (value === undefined) {
145
+ liveObject.set(key, anyToCrdt(next));
146
+ }
147
+ else if (prev === next) {
148
+ return;
149
+ }
150
+ else if (value instanceof LiveList_1.LiveList &&
151
+ Array.isArray(prev) &&
152
+ Array.isArray(next)) {
153
+ patchLiveList(value, prev, next);
154
+ }
155
+ else if (value instanceof LiveObject_1.LiveObject &&
156
+ isPlainObject(prev) &&
157
+ isPlainObject(next)) {
158
+ patchLiveObject(value, prev, next);
159
+ }
160
+ else {
161
+ liveObject.set(key, anyToCrdt(next));
162
+ }
163
+ }
164
+ exports.patchLiveObjectKey = patchLiveObjectKey;
165
+ function patchLiveObject(root, prev, next) {
166
+ const updates = {};
167
+ for (const key in next) {
168
+ patchLiveObjectKey(root, key, prev[key], next[key]);
169
+ }
170
+ for (const key in prev) {
171
+ if (next[key] === undefined) {
172
+ root.delete(key);
173
+ }
174
+ }
175
+ if (Object.keys(updates).length > 0) {
176
+ root.update(updates);
177
+ }
178
+ }
179
+ exports.patchLiveObject = patchLiveObject;
180
+ function getParentsPath(node) {
181
+ const path = [];
182
+ while (node._parentKey != null && node._parent != null) {
183
+ if (node._parent instanceof LiveList_1.LiveList) {
184
+ path.push(node._parent._indexOfPosition(node._parentKey));
185
+ }
186
+ else {
187
+ path.push(node._parentKey);
188
+ }
189
+ node = node._parent;
190
+ }
191
+ return path;
192
+ }
193
+ function patchImmutableObject(state, updates) {
194
+ return updates.reduce((state, update) => patchImmutableObjectWithUpdate(state, update), state);
195
+ }
196
+ exports.patchImmutableObject = patchImmutableObject;
197
+ function patchImmutableObjectWithUpdate(state, update) {
198
+ const path = getParentsPath(update.node);
199
+ return patchImmutableNode(state, path, update);
200
+ }
201
+ function patchImmutableNode(state, path, update) {
202
+ const pathItem = path.pop();
203
+ if (pathItem === undefined) {
204
+ switch (update.type) {
205
+ case "LiveObject": {
206
+ if (typeof state !== "object") {
207
+ throw new Error("Internal: received update on LiveObject but state was not an object");
208
+ }
209
+ return liveObjectToJson(update.node);
210
+ }
211
+ case "LiveList": {
212
+ if (Array.isArray(state) === false) {
213
+ throw new Error("Internal: received update on LiveList but state was not an array");
214
+ }
215
+ return liveListToJson(update.node);
216
+ }
217
+ case "LiveMap": {
218
+ if (typeof state !== "object") {
219
+ throw new Error("Internal: received update on LiveMap but state was not an object");
220
+ }
221
+ return liveMapToJson(update.node);
222
+ }
223
+ }
224
+ }
225
+ if (Array.isArray(state)) {
226
+ const newArray = [...state];
227
+ newArray[pathItem] = patchImmutableNode(state[pathItem], path, update);
228
+ return newArray;
229
+ }
230
+ else {
231
+ return Object.assign(Object.assign({}, state), { [pathItem]: patchImmutableNode(state[pathItem], path, update) });
232
+ }
233
+ }
@@ -1,5 +1,5 @@
1
1
  export { LiveObject } from "./LiveObject";
2
2
  export { LiveMap } from "./LiveMap";
3
3
  export { LiveList } from "./LiveList";
4
- export type { Others, Presence, Room, Client, User } from "./types";
4
+ export type { Others, Presence, Room, Client, User, BroadcastOptions, } from "./types";
5
5
  export { createClient } from "./client";
package/lib/cjs/room.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Others, Presence, ClientOptions, Room, MyPresenceCallback, OthersEventCallback, AuthEndpoint, EventCallback, User, Connection, ErrorCallback, AuthenticationToken, ConnectionCallback, StorageCallback, StorageUpdate } from "./types";
1
+ import { Others, Presence, ClientOptions, Room, MyPresenceCallback, OthersEventCallback, AuthEndpoint, EventCallback, User, Connection, ErrorCallback, AuthenticationToken, ConnectionCallback, StorageCallback, StorageUpdate, BroadcastOptions } from "./types";
2
2
  import { ClientMessage, Op } from "./live";
3
3
  import { LiveMap } from "./LiveMap";
4
4
  import { LiveObject } from "./LiveObject";
@@ -118,7 +118,7 @@ export declare function makeStateMachine(state: State, context: Context, mockedE
118
118
  updatePresence: <T_4 extends Presence>(overrides: Partial<T_4>, options?: {
119
119
  addToHistory: boolean;
120
120
  } | undefined) => void;
121
- broadcastEvent: (event: any) => void;
121
+ broadcastEvent: (event: any, options?: BroadcastOptions) => void;
122
122
  batch: (callback: () => void) => void;
123
123
  undo: () => void;
124
124
  redo: () => void;