@liveblocks/redux 0.15.1 → 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/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.1",
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.1",
39
+ "@liveblocks/client": "0.15.3",
40
40
  "redux": "^4"
41
41
  },
42
42
  "devDependencies": {
@@ -60,4 +60,4 @@
60
60
  "rollup-plugin-esbuild": "^4.8.2",
61
61
  "whatwg-fetch": "^3.6.2"
62
62
  }
63
- }
63
+ }