@liveblocks/core 0.19.2 → 0.19.3-beta0

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
@@ -3,3 +3,10 @@
3
3
  Shared code and foundational internals for all other Liveblocks packages. None
4
4
  of the APIs exposed by this package are considered stable or public. Please **do
5
5
  not import anything directly from this package**.
6
+
7
+ ## Run e2e tests locally
8
+
9
+ - At the `packages/liveblocks-core` root level, add a file `.env`
10
+ - In this file, add the environment variable:
11
+ `LIVEBLOCKS_PUBLIC_KEY="pk_YOUR_PUBLIC_API_KEY"`
12
+ - Run `npm run test:e2e`
package/dist/index.d.ts CHANGED
@@ -962,6 +962,14 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
962
962
  * });
963
963
  */
964
964
  batch<T>(fn: () => T): T;
965
+ /**
966
+ * Whether or not the room has storage modifications that have not been acknowledged by the server.
967
+ */
968
+ hasPendingStorageModifications(): boolean;
969
+ /**
970
+ * Close room connection and try to reconnect
971
+ */
972
+ reconnect(): void;
965
973
  };
966
974
  declare type Polyfills = {
967
975
  atob?: (data: string) => string;
package/dist/index.js CHANGED
@@ -3673,6 +3673,9 @@ function makeStateMachine(state, config, mockedEffects) {
3673
3673
  _addToRealUndoStack(historyOps, batchUpdates);
3674
3674
  }
3675
3675
  }
3676
+ function hasPendingStorageModifications() {
3677
+ return state.offlineOperations.size > 0;
3678
+ }
3676
3679
  function simulateSocketClose() {
3677
3680
  if (state.socket) {
3678
3681
  state.socket = null;
@@ -3694,6 +3697,7 @@ function makeStateMachine(state, config, mockedEffects) {
3694
3697
  getItemsCount: () => state.nodes.size,
3695
3698
  connect,
3696
3699
  disconnect,
3700
+ reconnect,
3697
3701
  subscribe,
3698
3702
  updatePresence,
3699
3703
  broadcastEvent,
@@ -3704,6 +3708,7 @@ function makeStateMachine(state, config, mockedEffects) {
3704
3708
  canRedo,
3705
3709
  pauseHistory,
3706
3710
  resumeHistory,
3711
+ hasPendingStorageModifications,
3707
3712
  getStorage,
3708
3713
  getStorageSnapshot,
3709
3714
  events: {
@@ -3779,6 +3784,7 @@ function createRoom(options, config) {
3779
3784
  getConnectionState: machine.getConnectionState,
3780
3785
  isSelfAware: machine.isSelfAware,
3781
3786
  getSelf: machine.getSelf,
3787
+ reconnect: machine.reconnect,
3782
3788
  subscribe: machine.subscribe,
3783
3789
  getPresence: machine.getPresence,
3784
3790
  updatePresence: machine.updatePresence,
@@ -3796,6 +3802,7 @@ function createRoom(options, config) {
3796
3802
  pause: machine.pauseHistory,
3797
3803
  resume: machine.resumeHistory
3798
3804
  },
3805
+ hasPendingStorageModifications: machine.hasPendingStorageModifications,
3799
3806
  __INTERNAL_DO_NOT_USE: {
3800
3807
  simulateCloseWebsocket: machine.simulateSocketClose,
3801
3808
  simulateSendCloseEvent: machine.simulateSendCloseEvent
@@ -3824,7 +3831,7 @@ function prepareCreateWebSocket(liveblocksServer, WebSocketPolyfill) {
3824
3831
  const ws = WebSocketPolyfill || WebSocket;
3825
3832
  return (token) => {
3826
3833
  return new ws(
3827
- `${liveblocksServer}/?token=${token}&version=${true ? "0.19.2" : "dev"}`
3834
+ `${liveblocksServer}/?token=${token}&version=${true ? "0.19.3-beta0" : "dev"}`
3828
3835
  );
3829
3836
  };
3830
3837
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/core",
3
- "version": "0.19.2",
3
+ "version": "0.19.3-beta0",
4
4
  "description": "Shared code and foundational internals for Liveblocks",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",