@liveblocks/core 2.7.0-versions2 → 2.7.1

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/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "2.7.0-versions2";
9
+ var PKG_VERSION = "2.7.1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -590,6 +590,18 @@ function isPlainObject(blob) {
590
590
  function entries(obj) {
591
591
  return Object.entries(obj);
592
592
  }
593
+ function mapValues(obj, mapFn) {
594
+ const result = {};
595
+ for (const pair of Object.entries(obj)) {
596
+ const key = pair[0];
597
+ if (key === "__proto__") {
598
+ continue;
599
+ }
600
+ const value = pair[1];
601
+ result[key] = mapFn(value, key);
602
+ }
603
+ return result;
604
+ }
593
605
  function tryParseJson(rawMessage) {
594
606
  try {
595
607
  return JSON.parse(rawMessage);
@@ -1899,24 +1911,47 @@ function createBatchStore(callback, options) {
1899
1911
 
1900
1912
  // src/lib/create-store.ts
1901
1913
  function createStore(initialState) {
1914
+ let notifyImmediately = true;
1915
+ let dirty = false;
1902
1916
  let state = initialState;
1903
1917
  const subscribers = /* @__PURE__ */ new Set();
1904
1918
  function get() {
1905
1919
  return state;
1906
1920
  }
1907
1921
  function set(callback) {
1908
- const newState = callback(state);
1909
- if (state === newState) {
1922
+ const oldState = state;
1923
+ const newState = callback(oldState);
1924
+ if (newState !== oldState) {
1925
+ state = newState;
1926
+ dirty = true;
1927
+ }
1928
+ if (notifyImmediately) {
1929
+ notify();
1930
+ }
1931
+ }
1932
+ function notify() {
1933
+ if (!dirty) {
1910
1934
  return;
1911
1935
  }
1912
- state = newState;
1936
+ dirty = false;
1913
1937
  for (const subscriber of subscribers) {
1914
1938
  subscriber(state);
1915
1939
  }
1916
1940
  }
1941
+ function batch(cb) {
1942
+ if (notifyImmediately === false) {
1943
+ return cb();
1944
+ }
1945
+ notifyImmediately = false;
1946
+ try {
1947
+ cb();
1948
+ } finally {
1949
+ notifyImmediately = true;
1950
+ notify();
1951
+ }
1952
+ }
1917
1953
  function subscribe(callback) {
1918
1954
  subscribers.add(callback);
1919
- callback(state);
1920
1955
  return () => {
1921
1956
  subscribers.delete(callback);
1922
1957
  };
@@ -1924,6 +1959,7 @@ function createStore(initialState) {
1924
1959
  return {
1925
1960
  get,
1926
1961
  set,
1962
+ batch,
1927
1963
  subscribe
1928
1964
  };
1929
1965
  }
@@ -2152,8 +2188,14 @@ function createNotificationsApi({
2152
2188
  }
2153
2189
  );
2154
2190
  }
2155
- async function getThreads() {
2156
- const json = await fetchJson("/threads", void 0, {});
2191
+ async function getThreads(options) {
2192
+ let query;
2193
+ if (options?.query) {
2194
+ query = objectToQuery(options.query);
2195
+ }
2196
+ const json = await fetchJson("/threads", void 0, {
2197
+ query
2198
+ });
2157
2199
  return {
2158
2200
  threads: json.threads.map(convertToThreadData),
2159
2201
  inboxNotifications: json.inboxNotifications.map(
@@ -2163,8 +2205,13 @@ function createNotificationsApi({
2163
2205
  };
2164
2206
  }
2165
2207
  async function getThreadsSince(options) {
2208
+ let query;
2209
+ if (options?.query) {
2210
+ query = objectToQuery(options.query);
2211
+ }
2166
2212
  const json = await fetchJson("/threads", void 0, {
2167
- since: options.since.toISOString()
2213
+ since: options.since.toISOString(),
2214
+ query
2168
2215
  });
2169
2216
  return {
2170
2217
  threads: {
@@ -6552,7 +6599,7 @@ ${Array.from(traces).join("\n\n")}`
6552
6599
  );
6553
6600
  return convertToCommentData(comment);
6554
6601
  }
6555
- async function deleteComment2({
6602
+ async function deleteComment({
6556
6603
  threadId,
6557
6604
  commentId
6558
6605
  }) {
@@ -6565,7 +6612,7 @@ ${Array.from(traces).join("\n\n")}`
6565
6612
  }
6566
6613
  );
6567
6614
  }
6568
- async function addReaction2({
6615
+ async function addReaction({
6569
6616
  threadId,
6570
6617
  commentId,
6571
6618
  emoji
@@ -6584,7 +6631,7 @@ ${Array.from(traces).join("\n\n")}`
6584
6631
  );
6585
6632
  return convertToCommentUserReaction(reaction);
6586
6633
  }
6587
- async function removeReaction2({
6634
+ async function removeReaction({
6588
6635
  threadId,
6589
6636
  commentId,
6590
6637
  emoji
@@ -6765,9 +6812,9 @@ ${Array.from(traces).join("\n\n")}`
6765
6812
  markThreadAsUnresolved,
6766
6813
  createComment,
6767
6814
  editComment,
6768
- deleteComment: deleteComment2,
6769
- addReaction: addReaction2,
6770
- removeReaction: removeReaction2,
6815
+ deleteComment,
6816
+ addReaction,
6817
+ removeReaction,
6771
6818
  // Notifications
6772
6819
  getNotificationSettings,
6773
6820
  updateNotificationSettings,
@@ -6900,533 +6947,6 @@ function makeCreateSocketDelegateForRoom(roomId, baseUrl, WebSocketPolyfill) {
6900
6947
  };
6901
6948
  }
6902
6949
 
6903
- // src/store.ts
6904
- function createClientStore() {
6905
- const store = createStore({
6906
- threads: {},
6907
- queries: {},
6908
- optimisticUpdates: [],
6909
- inboxNotifications: {},
6910
- notificationSettings: {},
6911
- versions: {}
6912
- });
6913
- const optimisticUpdatesEventSource = makeEventSource();
6914
- return {
6915
- ...store,
6916
- deleteThread(threadId) {
6917
- store.set((state) => {
6918
- return {
6919
- ...state,
6920
- threads: deleteKeyImmutable(state.threads, threadId),
6921
- inboxNotifications: Object.fromEntries(
6922
- Object.entries(state.inboxNotifications).filter(
6923
- ([_id, notification]) => notification.kind === "thread" && notification.threadId === threadId
6924
- )
6925
- )
6926
- };
6927
- });
6928
- },
6929
- updateThreadAndNotification(thread, inboxNotification) {
6930
- store.set((state) => {
6931
- const existingThread = state.threads[thread.id];
6932
- return {
6933
- ...state,
6934
- threads: existingThread === void 0 || compareThreads(thread, existingThread) === 1 ? { ...state.threads, [thread.id]: thread } : state.threads,
6935
- inboxNotifications: inboxNotification === void 0 ? state.inboxNotifications : {
6936
- ...state.inboxNotifications,
6937
- [inboxNotification.id]: inboxNotification
6938
- }
6939
- };
6940
- });
6941
- },
6942
- updateRoomVersions(roomId, versions, queryKey) {
6943
- store.set((state) => ({
6944
- ...state,
6945
- versions: {
6946
- ...state.versions,
6947
- [roomId]: versions
6948
- },
6949
- queries: queryKey !== void 0 ? {
6950
- ...state.queries,
6951
- [queryKey]: { isLoading: false, data: void 0 }
6952
- } : state.queries
6953
- }));
6954
- },
6955
- updateThreadsAndNotifications(threads, inboxNotifications, deletedThreads, deletedInboxNotifications, queryKey) {
6956
- store.set((state) => ({
6957
- ...state,
6958
- threads: applyThreadUpdates(state.threads, {
6959
- newThreads: threads,
6960
- deletedThreads
6961
- }),
6962
- inboxNotifications: applyNotificationsUpdates(
6963
- state.inboxNotifications,
6964
- {
6965
- newInboxNotifications: inboxNotifications,
6966
- deletedNotifications: deletedInboxNotifications
6967
- }
6968
- ),
6969
- queries: queryKey !== void 0 ? {
6970
- ...state.queries,
6971
- [queryKey]: { isLoading: false, data: void 0 }
6972
- } : state.queries
6973
- }));
6974
- },
6975
- updateRoomInboxNotificationSettings(roomId, settings, queryKey) {
6976
- store.set((state) => ({
6977
- ...state,
6978
- notificationSettings: {
6979
- ...state.notificationSettings,
6980
- [roomId]: settings
6981
- },
6982
- queries: {
6983
- ...state.queries,
6984
- [queryKey]: { isLoading: false, data: void 0 }
6985
- }
6986
- }));
6987
- },
6988
- pushOptimisticUpdate(optimisticUpdate) {
6989
- optimisticUpdatesEventSource.notify(optimisticUpdate);
6990
- store.set((state) => ({
6991
- ...state,
6992
- optimisticUpdates: [...state.optimisticUpdates, optimisticUpdate]
6993
- }));
6994
- },
6995
- setQueryState(queryKey, queryState) {
6996
- store.set((state) => ({
6997
- ...state,
6998
- queries: {
6999
- ...state.queries,
7000
- [queryKey]: queryState
7001
- }
7002
- }));
7003
- },
7004
- optimisticUpdatesEventSource
7005
- };
7006
- }
7007
- function deleteKeyImmutable(record, key) {
7008
- if (Object.prototype.hasOwnProperty.call(record, key)) {
7009
- const { [key]: _toDelete, ...rest } = record;
7010
- return rest;
7011
- }
7012
- return record;
7013
- }
7014
- function compareThreads(thread1, thread2) {
7015
- if (thread1.updatedAt && thread2.updatedAt) {
7016
- return thread1.updatedAt > thread2.updatedAt ? 1 : thread1.updatedAt < thread2.updatedAt ? -1 : 0;
7017
- } else if (thread1.updatedAt || thread2.updatedAt) {
7018
- return thread1.updatedAt ? 1 : -1;
7019
- }
7020
- if (thread1.createdAt > thread2.createdAt) {
7021
- return 1;
7022
- } else if (thread1.createdAt < thread2.createdAt) {
7023
- return -1;
7024
- }
7025
- return 0;
7026
- }
7027
- function applyOptimisticUpdates(state) {
7028
- const result = {
7029
- threads: {
7030
- ...state.threads
7031
- },
7032
- inboxNotifications: {
7033
- ...state.inboxNotifications
7034
- },
7035
- notificationSettings: {
7036
- ...state.notificationSettings
7037
- }
7038
- };
7039
- for (const optimisticUpdate of state.optimisticUpdates) {
7040
- switch (optimisticUpdate.type) {
7041
- case "create-thread": {
7042
- result.threads[optimisticUpdate.thread.id] = optimisticUpdate.thread;
7043
- break;
7044
- }
7045
- case "edit-thread-metadata": {
7046
- const thread = result.threads[optimisticUpdate.threadId];
7047
- if (thread === void 0) {
7048
- break;
7049
- }
7050
- if (thread.deletedAt !== void 0) {
7051
- break;
7052
- }
7053
- if (thread.updatedAt !== void 0 && thread.updatedAt > optimisticUpdate.updatedAt) {
7054
- break;
7055
- }
7056
- result.threads[thread.id] = {
7057
- ...thread,
7058
- updatedAt: optimisticUpdate.updatedAt,
7059
- metadata: {
7060
- ...thread.metadata,
7061
- ...optimisticUpdate.metadata
7062
- }
7063
- };
7064
- break;
7065
- }
7066
- case "mark-thread-as-resolved": {
7067
- const thread = result.threads[optimisticUpdate.threadId];
7068
- if (thread === void 0) {
7069
- break;
7070
- }
7071
- if (thread.deletedAt !== void 0) {
7072
- break;
7073
- }
7074
- result.threads[thread.id] = {
7075
- ...thread,
7076
- resolved: true
7077
- };
7078
- break;
7079
- }
7080
- case "mark-thread-as-unresolved": {
7081
- const thread = result.threads[optimisticUpdate.threadId];
7082
- if (thread === void 0) {
7083
- break;
7084
- }
7085
- if (thread.deletedAt !== void 0) {
7086
- break;
7087
- }
7088
- result.threads[thread.id] = {
7089
- ...thread,
7090
- resolved: false
7091
- };
7092
- break;
7093
- }
7094
- case "create-comment": {
7095
- const thread = result.threads[optimisticUpdate.comment.threadId];
7096
- if (thread === void 0) {
7097
- break;
7098
- }
7099
- result.threads[thread.id] = upsertComment(
7100
- thread,
7101
- optimisticUpdate.comment
7102
- );
7103
- const inboxNotification = Object.values(result.inboxNotifications).find(
7104
- (notification) => notification.kind === "thread" && notification.threadId === thread.id
7105
- );
7106
- if (inboxNotification === void 0) {
7107
- break;
7108
- }
7109
- result.inboxNotifications[inboxNotification.id] = {
7110
- ...inboxNotification,
7111
- notifiedAt: optimisticUpdate.comment.createdAt,
7112
- readAt: optimisticUpdate.comment.createdAt
7113
- };
7114
- break;
7115
- }
7116
- case "edit-comment": {
7117
- const thread = result.threads[optimisticUpdate.comment.threadId];
7118
- if (thread === void 0) {
7119
- break;
7120
- }
7121
- result.threads[thread.id] = upsertComment(
7122
- thread,
7123
- optimisticUpdate.comment
7124
- );
7125
- break;
7126
- }
7127
- case "delete-comment": {
7128
- const thread = result.threads[optimisticUpdate.threadId];
7129
- if (thread === void 0) {
7130
- break;
7131
- }
7132
- result.threads[thread.id] = deleteComment(
7133
- thread,
7134
- optimisticUpdate.commentId,
7135
- optimisticUpdate.deletedAt
7136
- );
7137
- break;
7138
- }
7139
- case "delete-thread": {
7140
- const thread = result.threads[optimisticUpdate.threadId];
7141
- if (thread === void 0) {
7142
- break;
7143
- }
7144
- result.threads[optimisticUpdate.threadId] = {
7145
- ...result.threads[optimisticUpdate.threadId],
7146
- deletedAt: optimisticUpdate.deletedAt,
7147
- updatedAt: optimisticUpdate.deletedAt,
7148
- comments: []
7149
- };
7150
- break;
7151
- }
7152
- case "add-reaction": {
7153
- const thread = result.threads[optimisticUpdate.threadId];
7154
- if (thread === void 0) {
7155
- break;
7156
- }
7157
- result.threads[thread.id] = addReaction(
7158
- thread,
7159
- optimisticUpdate.commentId,
7160
- optimisticUpdate.reaction
7161
- );
7162
- break;
7163
- }
7164
- case "remove-reaction": {
7165
- const thread = result.threads[optimisticUpdate.threadId];
7166
- if (thread === void 0) {
7167
- break;
7168
- }
7169
- result.threads[thread.id] = removeReaction(
7170
- thread,
7171
- optimisticUpdate.commentId,
7172
- optimisticUpdate.emoji,
7173
- optimisticUpdate.userId,
7174
- optimisticUpdate.removedAt
7175
- );
7176
- break;
7177
- }
7178
- case "mark-inbox-notification-as-read": {
7179
- result.inboxNotifications[optimisticUpdate.inboxNotificationId] = {
7180
- ...state.inboxNotifications[optimisticUpdate.inboxNotificationId],
7181
- readAt: optimisticUpdate.readAt
7182
- };
7183
- break;
7184
- }
7185
- case "mark-all-inbox-notifications-as-read": {
7186
- for (const id in result.inboxNotifications) {
7187
- result.inboxNotifications[id] = {
7188
- ...result.inboxNotifications[id],
7189
- readAt: optimisticUpdate.readAt
7190
- };
7191
- }
7192
- break;
7193
- }
7194
- case "delete-inbox-notification": {
7195
- const {
7196
- [optimisticUpdate.inboxNotificationId]: _,
7197
- ...inboxNotifications
7198
- } = result.inboxNotifications;
7199
- result.inboxNotifications = inboxNotifications;
7200
- break;
7201
- }
7202
- case "delete-all-inbox-notifications": {
7203
- result.inboxNotifications = {};
7204
- break;
7205
- }
7206
- case "update-notification-settings": {
7207
- result.notificationSettings[optimisticUpdate.roomId] = {
7208
- ...result.notificationSettings[optimisticUpdate.roomId],
7209
- ...optimisticUpdate.settings
7210
- };
7211
- }
7212
- }
7213
- }
7214
- return result;
7215
- }
7216
- function applyThreadUpdates(existingThreads, updates) {
7217
- const updatedThreads = { ...existingThreads };
7218
- updates.newThreads.forEach((thread) => {
7219
- const existingThread = updatedThreads[thread.id];
7220
- if (existingThread) {
7221
- const result = compareThreads(existingThread, thread);
7222
- if (result === 1) return;
7223
- }
7224
- updatedThreads[thread.id] = thread;
7225
- });
7226
- updates.deletedThreads.forEach(({ id, deletedAt }) => {
7227
- const existingThread = updatedThreads[id];
7228
- if (existingThread === void 0) return;
7229
- existingThread.deletedAt = deletedAt;
7230
- existingThread.updatedAt = deletedAt;
7231
- existingThread.comments = [];
7232
- });
7233
- return updatedThreads;
7234
- }
7235
- function applyNotificationsUpdates(existingInboxNotifications, updates) {
7236
- const updatedInboxNotifications = { ...existingInboxNotifications };
7237
- updates.newInboxNotifications.forEach((notification) => {
7238
- const existingNotification = updatedInboxNotifications[notification.id];
7239
- if (existingNotification) {
7240
- const result = compareInboxNotifications(
7241
- existingNotification,
7242
- notification
7243
- );
7244
- if (result === 1) return;
7245
- }
7246
- updatedInboxNotifications[notification.id] = notification;
7247
- });
7248
- updates.deletedNotifications.forEach(
7249
- ({ id }) => delete updatedInboxNotifications[id]
7250
- );
7251
- return updatedInboxNotifications;
7252
- }
7253
- function compareInboxNotifications(inboxNotificationA, inboxNotificationB) {
7254
- if (inboxNotificationA.notifiedAt > inboxNotificationB.notifiedAt) {
7255
- return 1;
7256
- } else if (inboxNotificationA.notifiedAt < inboxNotificationB.notifiedAt) {
7257
- return -1;
7258
- }
7259
- if (inboxNotificationA.readAt && inboxNotificationB.readAt) {
7260
- return inboxNotificationA.readAt > inboxNotificationB.readAt ? 1 : inboxNotificationA.readAt < inboxNotificationB.readAt ? -1 : 0;
7261
- } else if (inboxNotificationA.readAt || inboxNotificationB.readAt) {
7262
- return inboxNotificationA.readAt ? 1 : -1;
7263
- }
7264
- return 0;
7265
- }
7266
- function upsertComment(thread, comment) {
7267
- if (thread.deletedAt !== void 0) {
7268
- return thread;
7269
- }
7270
- if (comment.threadId !== thread.id) {
7271
- warn(
7272
- `Comment ${comment.id} does not belong to thread ${thread.id}`
7273
- );
7274
- return thread;
7275
- }
7276
- const existingComment = thread.comments.find(
7277
- (existingComment2) => existingComment2.id === comment.id
7278
- );
7279
- if (existingComment === void 0) {
7280
- const updatedAt = new Date(
7281
- Math.max(thread.updatedAt?.getTime() || 0, comment.createdAt.getTime())
7282
- );
7283
- const updatedThread = {
7284
- ...thread,
7285
- updatedAt,
7286
- comments: [...thread.comments, comment]
7287
- };
7288
- return updatedThread;
7289
- }
7290
- if (existingComment.deletedAt !== void 0) {
7291
- return thread;
7292
- }
7293
- if (existingComment.editedAt === void 0 || comment.editedAt === void 0 || existingComment.editedAt <= comment.editedAt) {
7294
- const updatedComments = thread.comments.map(
7295
- (existingComment2) => existingComment2.id === comment.id ? comment : existingComment2
7296
- );
7297
- const updatedThread = {
7298
- ...thread,
7299
- updatedAt: new Date(
7300
- Math.max(
7301
- thread.updatedAt?.getTime() || 0,
7302
- comment.editedAt?.getTime() || comment.createdAt.getTime()
7303
- )
7304
- ),
7305
- comments: updatedComments
7306
- };
7307
- return updatedThread;
7308
- }
7309
- return thread;
7310
- }
7311
- function deleteComment(thread, commentId, deletedAt) {
7312
- if (thread.deletedAt !== void 0) {
7313
- return thread;
7314
- }
7315
- const existingComment = thread.comments.find(
7316
- (comment) => comment.id === commentId
7317
- );
7318
- if (existingComment === void 0) {
7319
- return thread;
7320
- }
7321
- if (existingComment.deletedAt !== void 0) {
7322
- return thread;
7323
- }
7324
- const updatedComments = thread.comments.map(
7325
- (comment) => comment.id === commentId ? {
7326
- ...comment,
7327
- deletedAt,
7328
- body: void 0
7329
- } : comment
7330
- );
7331
- if (!updatedComments.some((comment) => comment.deletedAt === void 0)) {
7332
- return {
7333
- ...thread,
7334
- deletedAt,
7335
- updatedAt: deletedAt,
7336
- comments: []
7337
- };
7338
- }
7339
- return {
7340
- ...thread,
7341
- updatedAt: deletedAt,
7342
- comments: updatedComments
7343
- };
7344
- }
7345
- function addReaction(thread, commentId, reaction) {
7346
- if (thread.deletedAt !== void 0) {
7347
- return thread;
7348
- }
7349
- const existingComment = thread.comments.find(
7350
- (comment) => comment.id === commentId
7351
- );
7352
- if (existingComment === void 0) {
7353
- return thread;
7354
- }
7355
- if (existingComment.deletedAt !== void 0) {
7356
- return thread;
7357
- }
7358
- const updatedComments = thread.comments.map(
7359
- (comment) => comment.id === commentId ? {
7360
- ...comment,
7361
- reactions: upsertReaction(comment.reactions, reaction)
7362
- } : comment
7363
- );
7364
- return {
7365
- ...thread,
7366
- updatedAt: new Date(
7367
- Math.max(reaction.createdAt.getTime(), thread.updatedAt?.getTime() || 0)
7368
- ),
7369
- comments: updatedComments
7370
- };
7371
- }
7372
- function removeReaction(thread, commentId, emoji, userId, removedAt) {
7373
- if (thread.deletedAt !== void 0) {
7374
- return thread;
7375
- }
7376
- const existingComment = thread.comments.find(
7377
- (comment) => comment.id === commentId
7378
- );
7379
- if (existingComment === void 0) {
7380
- return thread;
7381
- }
7382
- if (existingComment.deletedAt !== void 0) {
7383
- return thread;
7384
- }
7385
- const updatedComments = thread.comments.map(
7386
- (comment) => comment.id === commentId ? {
7387
- ...comment,
7388
- reactions: comment.reactions.map(
7389
- (reaction) => reaction.emoji === emoji ? {
7390
- ...reaction,
7391
- users: reaction.users.filter((user) => user.id !== userId)
7392
- } : reaction
7393
- ).filter((reaction) => reaction.users.length > 0)
7394
- // Remove reactions with no users left
7395
- } : comment
7396
- );
7397
- return {
7398
- ...thread,
7399
- updatedAt: new Date(
7400
- Math.max(removedAt.getTime(), thread.updatedAt?.getTime() || 0)
7401
- ),
7402
- comments: updatedComments
7403
- };
7404
- }
7405
- function upsertReaction(reactions, reaction) {
7406
- const existingReaction = reactions.find(
7407
- (existingReaction2) => existingReaction2.emoji === reaction.emoji
7408
- );
7409
- if (existingReaction === void 0) {
7410
- return [
7411
- ...reactions,
7412
- {
7413
- emoji: reaction.emoji,
7414
- createdAt: reaction.createdAt,
7415
- users: [{ id: reaction.userId }]
7416
- }
7417
- ];
7418
- }
7419
- if (existingReaction.users.some((user) => user.id === reaction.userId) === false) {
7420
- return reactions.map(
7421
- (existingReaction2) => existingReaction2.emoji === reaction.emoji ? {
7422
- ...existingReaction2,
7423
- users: [...existingReaction2.users, { id: reaction.userId }]
7424
- } : existingReaction2
7425
- );
7426
- }
7427
- return reactions;
7428
- }
7429
-
7430
6950
  // src/client.ts
7431
6951
  var MIN_THROTTLE = 16;
7432
6952
  var MAX_THROTTLE = 1e3;
@@ -7570,7 +7090,6 @@ function createClient(options) {
7570
7090
  authManager,
7571
7091
  currentUserIdStore
7572
7092
  });
7573
- const cacheStore = createClientStore();
7574
7093
  const resolveUsers = clientOptions.resolveUsers;
7575
7094
  const warnIfNoResolveUsers = createDevelopmentWarning(
7576
7095
  () => !resolveUsers,
@@ -7616,7 +7135,6 @@ function createClient(options) {
7616
7135
  [kInternal]: {
7617
7136
  currentUserIdStore,
7618
7137
  resolveMentionSuggestions: clientOptions.resolveMentionSuggestions,
7619
- cacheStore,
7620
7138
  usersStore,
7621
7139
  roomsInfoStore,
7622
7140
  getRoomIds() {
@@ -8458,7 +7976,7 @@ function shallowArray(xs, ys) {
8458
7976
  return true;
8459
7977
  }
8460
7978
  function shallowObj(objA, objB) {
8461
- if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null || Object.prototype.toString.call(objA) !== "[object Object]" || Object.prototype.toString.call(objB) !== "[object Object]") {
7979
+ if (!isPlainObject(objA) || !isPlainObject(objB)) {
8462
7980
  return false;
8463
7981
  }
8464
7982
  const keysA = Object.keys(objA);
@@ -8498,13 +8016,12 @@ export {
8498
8016
  ServerMsgCode,
8499
8017
  WebsocketCloseCodes,
8500
8018
  ackOp,
8501
- addReaction,
8502
- applyOptimisticUpdates,
8503
8019
  asPos,
8504
8020
  assert,
8505
8021
  assertNever,
8506
8022
  b64decode,
8507
8023
  cloneLson,
8024
+ compactObject,
8508
8025
  fancy_console_exports as console,
8509
8026
  convertToCommentData,
8510
8027
  convertToCommentUserReaction,
@@ -8513,8 +8030,8 @@ export {
8513
8030
  createClient,
8514
8031
  createCommentId,
8515
8032
  createInboxNotificationId,
8033
+ createStore,
8516
8034
  createThreadId,
8517
- deleteComment,
8518
8035
  deprecate,
8519
8036
  deprecateIf,
8520
8037
  detectDupes,
@@ -8534,20 +8051,19 @@ export {
8534
8051
  makeEventSource,
8535
8052
  makePoller,
8536
8053
  makePosition,
8054
+ mapValues,
8537
8055
  memoizeOnSuccess,
8538
8056
  nanoid,
8539
8057
  nn,
8540
8058
  objectToQuery,
8541
8059
  patchLiveObjectKey,
8542
8060
  raise,
8543
- removeReaction,
8544
8061
  shallow,
8545
8062
  stringify,
8546
8063
  stringifyCommentBody,
8547
8064
  throwUsageError,
8548
8065
  toPlainLson,
8549
8066
  tryParseJson,
8550
- upsertComment,
8551
8067
  wait,
8552
8068
  withTimeout
8553
8069
  };