@liveblocks/redux 0.15.0-alpha.4 → 0.15.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
@@ -0,0 +1,40 @@
1
+ <p align="center">
2
+ <a href="https://liveblocks.io">
3
+ <img src="https://liveblocks.io/images/blog/introducing-liveblocks.png">
4
+ </a>
5
+ </p>
6
+
7
+ # Liveblocks · [![Twitter Follow](https://shields.io/twitter/follow/liveblocks?label=Follow)](https://twitter.com/liveblocks)
8
+
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
+
11
+ ## Installation
12
+
13
+ ```
14
+ npm install @liveblocks/client @liveblocks/redux
15
+ ```
16
+
17
+ ## Documentation
18
+
19
+ - Start with the [React-Redux guide](https://liveblocks.io/docs/get-started/react-redux).
20
+ - Explore the [API Reference](https://liveblocks.io/docs/api-reference/liveblocks-redux).
21
+
22
+ ## Examples
23
+
24
+ - Browse our gallery of collaborative UI patterns. [View examples gallery](https://liveblocks.io/examples)
25
+ - Explore and clone any of our open-source examples. [View code examples](https://github.com/liveblocks/liveblocks/tree/main/examples)
26
+
27
+ ## Releases
28
+
29
+ For changelog, visit [https://github.com/liveblocks/liveblocks/releases](https://github.com/liveblocks/liveblocks/releases).
30
+
31
+ ## Community
32
+
33
+ - [Discord](https://discord.gg/X4YWJuH9VY) - To get involved with the Liveblocks community, ask questions and share tips.
34
+ - [Twitter](https://twitter.com/liveblocks) - To receive updates, announcements, blog posts, and general Liveblocks tips.
35
+
36
+ ## License
37
+
38
+ Licensed under the Apache License 2.0, Copyright © 2021-present [Liveblocks](https://liveblocks.io).
39
+
40
+ See [LICENSE](../../LICENSE) for more information.
package/lib/esm/index.js CHANGED
@@ -4,9 +4,6 @@ const ERROR_PREFIX = "Invalid @liveblocks/redux middleware config.";
4
4
  function missingClient() {
5
5
  return new Error(`${ERROR_PREFIX} client is missing`);
6
6
  }
7
- function missingMapping(mappingType) {
8
- return new Error(`${ERROR_PREFIX} ${mappingType} is missing.`);
9
- }
10
7
  function mappingShouldBeAnObject(mappingType) {
11
8
  return new Error(`${ERROR_PREFIX} ${mappingType} should be an object where the values are boolean.`);
12
9
  }
@@ -54,7 +51,7 @@ const internalEnhancer = (options) => {
54
51
  throw missingClient();
55
52
  }
56
53
  const client = options.client;
57
- const mapping = validateMapping(options.storageMapping, "storageMapping");
54
+ const mapping = validateMapping(options.storageMapping || {}, "storageMapping");
58
55
  const presenceMapping = validateMapping(options.presenceMapping || {}, "presenceMapping");
59
56
  if (process.env.NODE_ENV !== "production") {
60
57
  validateNoDuplicateKeys(mapping, presenceMapping);
@@ -260,9 +257,6 @@ function patchState(state, updates, mapping) {
260
257
  }
261
258
  function validateMapping(mapping, mappingType) {
262
259
  if (process.env.NODE_ENV !== "production") {
263
- if (mapping == null) {
264
- throw missingMapping(mappingType);
265
- }
266
260
  if (!isObject(mapping)) {
267
261
  throw mappingShouldBeAnObject(mappingType);
268
262
  }
package/lib/esm/index.mjs CHANGED
@@ -4,9 +4,6 @@ const ERROR_PREFIX = "Invalid @liveblocks/redux middleware config.";
4
4
  function missingClient() {
5
5
  return new Error(`${ERROR_PREFIX} client is missing`);
6
6
  }
7
- function missingMapping(mappingType) {
8
- return new Error(`${ERROR_PREFIX} ${mappingType} is missing.`);
9
- }
10
7
  function mappingShouldBeAnObject(mappingType) {
11
8
  return new Error(`${ERROR_PREFIX} ${mappingType} should be an object where the values are boolean.`);
12
9
  }
@@ -54,7 +51,7 @@ const internalEnhancer = (options) => {
54
51
  throw missingClient();
55
52
  }
56
53
  const client = options.client;
57
- const mapping = validateMapping(options.storageMapping, "storageMapping");
54
+ const mapping = validateMapping(options.storageMapping || {}, "storageMapping");
58
55
  const presenceMapping = validateMapping(options.presenceMapping || {}, "presenceMapping");
59
56
  if (process.env.NODE_ENV !== "production") {
60
57
  validateNoDuplicateKeys(mapping, presenceMapping);
@@ -260,9 +257,6 @@ function patchState(state, updates, mapping) {
260
257
  }
261
258
  function validateMapping(mapping, mappingType) {
262
259
  if (process.env.NODE_ENV !== "production") {
263
- if (mapping == null) {
264
- throw missingMapping(mappingType);
265
- }
266
260
  if (!isObject(mapping)) {
267
261
  throw mappingShouldBeAnObject(mappingType);
268
262
  }
package/lib/index.d.ts CHANGED
@@ -49,7 +49,7 @@ declare function leaveRoom(roomId: string): {
49
49
  };
50
50
  export declare const enhancer: <T>(options: {
51
51
  client: Client;
52
- storageMapping: Partial<{ [Property in keyof T]: boolean; }>;
52
+ storageMapping?: Partial<{ [Property in keyof T]: boolean; }> | undefined;
53
53
  presenceMapping?: Partial<{ [Property in keyof T]: boolean; }> | undefined;
54
54
  }) => StoreEnhancer;
55
55
  export {};
package/lib/index.js CHANGED
@@ -64,9 +64,6 @@ var ERROR_PREFIX = "Invalid @liveblocks/redux middleware config.";
64
64
  function missingClient() {
65
65
  return new Error(ERROR_PREFIX + " client is missing");
66
66
  }
67
- function missingMapping(mappingType) {
68
- return new Error(ERROR_PREFIX + " " + mappingType + " is missing.");
69
- }
70
67
  function mappingShouldBeAnObject(mappingType) {
71
68
  return new Error(ERROR_PREFIX + " " + mappingType + " should be an object where the values are boolean.");
72
69
  }
@@ -99,7 +96,7 @@ var internalEnhancer = function internalEnhancer(options) {
99
96
  }
100
97
 
101
98
  var client = options.client;
102
- var mapping = validateMapping(options.storageMapping, "storageMapping");
99
+ var mapping = validateMapping(options.storageMapping || {}, "storageMapping");
103
100
  var presenceMapping = validateMapping(options.presenceMapping || {}, "presenceMapping");
104
101
 
105
102
  if (process.env.NODE_ENV !== "production") {
@@ -358,10 +355,6 @@ function patchState(state, updates, mapping) {
358
355
 
359
356
  function validateMapping(mapping, mappingType) {
360
357
  if (process.env.NODE_ENV !== "production") {
361
- if (mapping == null) {
362
- throw missingMapping(mappingType);
363
- }
364
-
365
358
  if (!isObject(mapping)) {
366
359
  throw mappingShouldBeAnObject(mappingType);
367
360
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/redux",
3
- "version": "0.15.0-alpha.4",
3
+ "version": "0.15.3",
4
4
  "sideEffects": false,
5
5
  "description": "",
6
6
  "main": "./lib/index.js",
@@ -36,7 +36,7 @@
36
36
  "directory": "packages/liveblocks-redux"
37
37
  },
38
38
  "peerDependencies": {
39
- "@liveblocks/client": "0.15.0-alpha.4",
39
+ "@liveblocks/client": "0.15.3",
40
40
  "redux": "^4"
41
41
  },
42
42
  "devDependencies": {
@@ -52,7 +52,6 @@
52
52
  "@testing-library/react": "^12.1.2",
53
53
  "@testing-library/react-hooks": "^7.0.2",
54
54
  "@types/jest": "^27.4.1",
55
- "@types/regenerator-runtime": "^0.13.1",
56
55
  "esbuild": "0.14.11",
57
56
  "jest": "^27.4.7",
58
57
  "msw": "^0.36.4",
@@ -61,4 +60,4 @@
61
60
  "rollup-plugin-esbuild": "^4.8.2",
62
61
  "whatwg-fetch": "^3.6.2"
63
62
  }
64
- }
63
+ }