@liveblocks/core 1.12.0 → 2.0.0-alpha1

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 = "1.12.0";
9
+ var PKG_VERSION = "2.0.0-alpha1";
10
10
  var PKG_FORMAT = "esm";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -688,22 +688,6 @@ function shouldRetryWithoutReauth(code) {
688
688
  function isIdle(status) {
689
689
  return status === "initial" || status === "disconnected";
690
690
  }
691
- function newToLegacyStatus(status) {
692
- switch (status) {
693
- case "connecting":
694
- return "connecting";
695
- case "connected":
696
- return "open";
697
- case "reconnecting":
698
- return "unavailable";
699
- case "disconnected":
700
- return "failed";
701
- case "initial":
702
- return "closed";
703
- default:
704
- return "closed";
705
- }
706
- }
707
691
  function toNewConnectionStatus(machine) {
708
692
  const state = machine.currentState;
709
693
  switch (state) {
@@ -1228,9 +1212,6 @@ var ManagedSocket = class {
1228
1212
  this.events = events;
1229
1213
  this.cleanups = cleanups;
1230
1214
  }
1231
- getLegacyStatus() {
1232
- return newToLegacyStatus(this.getStatus());
1233
- }
1234
1215
  getStatus() {
1235
1216
  try {
1236
1217
  return toNewConnectionStatus(this.machine);
@@ -5113,7 +5094,13 @@ function userToTreeNode(key, user) {
5113
5094
  type: "User",
5114
5095
  id: `${user.connectionId}`,
5115
5096
  key,
5116
- payload: user
5097
+ payload: {
5098
+ connectionId: user.connectionId,
5099
+ id: user.id,
5100
+ info: user.info,
5101
+ presence: user.presence,
5102
+ isReadOnly: !user.canWrite
5103
+ }
5117
5104
  };
5118
5105
  }
5119
5106
  function installBackgroundTabSpy() {
@@ -5241,23 +5228,20 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
5241
5228
  commentId,
5242
5229
  threadId
5243
5230
  }) {
5244
- const thread = await fetchJson(
5245
- "/threads",
5246
- {
5247
- method: "POST",
5248
- headers: {
5249
- "Content-Type": "application/json"
5231
+ const thread = await fetchJson("/threads", {
5232
+ method: "POST",
5233
+ headers: {
5234
+ "Content-Type": "application/json"
5235
+ },
5236
+ body: JSON.stringify({
5237
+ id: threadId,
5238
+ comment: {
5239
+ id: commentId,
5240
+ body
5250
5241
  },
5251
- body: JSON.stringify({
5252
- id: threadId,
5253
- comment: {
5254
- id: commentId,
5255
- body
5256
- },
5257
- metadata
5258
- })
5259
- }
5260
- );
5242
+ metadata
5243
+ })
5244
+ });
5261
5245
  return convertToThreadData(thread);
5262
5246
  }
5263
5247
  async function editThreadMetadata({
@@ -5575,8 +5559,6 @@ function createRoom(options, config) {
5575
5559
  }
5576
5560
  };
5577
5561
  const eventHub = {
5578
- connection: makeEventSource(),
5579
- // Old/deprecated API
5580
5562
  status: makeEventSource(),
5581
5563
  // New/recommended API
5582
5564
  lostConnection: makeEventSource(),
@@ -5664,9 +5646,7 @@ function createRoom(options, config) {
5664
5646
  info: staticSession.userInfo,
5665
5647
  presence: myPresence,
5666
5648
  canWrite,
5667
- canComment: canComment(dynamicSession.scopes),
5668
- isReadOnly: !canWrite
5669
- // Deprecated, kept for backward-compatibility
5649
+ canComment: canComment(dynamicSession.scopes)
5670
5650
  };
5671
5651
  }
5672
5652
  }
@@ -6567,7 +6547,6 @@ ${Array.from(traces).join("\n\n")}`
6567
6547
  events,
6568
6548
  // Core
6569
6549
  getStatus: () => managedSocket.getStatus(),
6570
- getConnectionState: () => managedSocket.getLegacyStatus(),
6571
6550
  getSelf: () => self.current,
6572
6551
  // Presence
6573
6552
  getPresence: () => context.myPresence.current,
@@ -6621,12 +6600,6 @@ function makeClassicSubscribeFn(events) {
6621
6600
  }
6622
6601
  case "error":
6623
6602
  return events.error.subscribe(callback);
6624
- case "connection": {
6625
- const cb = callback;
6626
- return events.status.subscribe(
6627
- (status) => cb(newToLegacyStatus(status))
6628
- );
6629
- }
6630
6603
  case "status":
6631
6604
  return events.status.subscribe(callback);
6632
6605
  case "lost-connection":
@@ -7269,7 +7242,7 @@ function createClient(options) {
7269
7242
  roomsById.set(roomId, newRoomInfo);
7270
7243
  setupDevTools(() => Array.from(roomsById.keys()));
7271
7244
  linkDevTools(roomId, newRoom);
7272
- const shouldConnect = options2.autoConnect ?? options2.shouldInitiallyConnect ?? true;
7245
+ const shouldConnect = options2.autoConnect ?? true;
7273
7246
  if (shouldConnect) {
7274
7247
  if (typeof atob === "undefined") {
7275
7248
  if (clientOptions.polyfills?.atob === void 0) {