@liveblocks/redux 0.16.17 → 0.17.0-test1

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.
Files changed (4) hide show
  1. package/index.d.ts +50 -41
  2. package/index.js +332 -201
  3. package/index.mjs +258 -162
  4. package/package.json +10 -8
package/index.d.ts CHANGED
@@ -1,57 +1,66 @@
1
- import { Presence, User, Client } from '@liveblocks/client';
2
- import { StoreEnhancer } from 'redux';
1
+ import { JsonObject, User, Client } from "@liveblocks/client";
2
+ import { StoreEnhancer } from "redux";
3
3
 
4
- declare type Mapping<T> = Partial<{
5
- [Property in keyof T]: boolean;
6
- }>;
7
- declare type LiveblocksState<TState, TPresence extends Presence = Presence> = TState & {
4
+ declare type Mapping<T> = {
5
+ [K in keyof T]?: boolean;
6
+ };
7
+ declare type LiveblocksState<TState, TPresence extends JsonObject> = TState & {
8
+ /**
9
+ * Liveblocks extra state attached by the enhancer
10
+ */
11
+ readonly liveblocks: {
12
+ /**
13
+ * Other users in the room. Empty no room is currently synced
14
+ */
15
+ readonly others: Array<User<TPresence>>;
16
+ /**
17
+ * Whether or not the room storage is currently loading
18
+ */
19
+ readonly isStorageLoading: boolean;
8
20
  /**
9
- * Liveblocks extra state attached by the enhancer
21
+ * Connection state of the room
10
22
  */
11
- readonly liveblocks: {
12
- /**
13
- * Other users in the room. Empty no room is currently synced
14
- */
15
- readonly others: Array<User<TPresence>>;
16
- /**
17
- * Whether or not the room storage is currently loading
18
- */
19
- readonly isStorageLoading: boolean;
20
- /**
21
- * Connection state of the room
22
- */
23
- readonly connection: "closed" | "authenticating" | "unavailable" | "failed" | "open" | "connecting";
24
- };
23
+ readonly connection:
24
+ | "closed"
25
+ | "authenticating"
26
+ | "unavailable"
27
+ | "failed"
28
+ | "open"
29
+ | "connecting";
30
+ };
25
31
  };
26
32
  /**
27
33
  * Actions used to interact with Liveblocks
28
34
  */
29
35
  declare const actions: {
30
- /**
31
- * Enters a room and starts sync it with zustand state
32
- * @param roomId The id of the room
33
- * @param initialState The initial state of the room storage. If a key does not exist if your room storage root, initialState[key] will be used.
34
- */
35
- enterRoom: typeof enterRoom;
36
- /**
37
- * Leaves a room and stops sync it with zustand state.
38
- * @param roomId The id of the room
39
- */
40
- leaveRoom: typeof leaveRoom;
36
+ /**
37
+ * Enters a room and starts sync it with zustand state
38
+ * @param roomId The id of the room
39
+ * @param initialState The initial state of the room storage. If a key does not exist if your room storage root, initialState[key] will be used.
40
+ */
41
+ enterRoom: typeof enterRoom;
42
+ /**
43
+ * Leaves a room and stops sync it with zustand state.
44
+ * @param roomId The id of the room
45
+ */
46
+ leaveRoom: typeof leaveRoom;
41
47
  };
42
- declare function enterRoom(roomId: string, initialState?: any): {
43
- type: string;
44
- roomId: string;
45
- initialState: any;
48
+ declare function enterRoom<T>(
49
+ roomId: string,
50
+ initialState?: T
51
+ ): {
52
+ type: string;
53
+ roomId: string;
54
+ initialState?: T;
46
55
  };
47
56
  declare function leaveRoom(roomId: string): {
48
- type: string;
49
- roomId: string;
57
+ type: string;
58
+ roomId: string;
50
59
  };
51
60
  declare const enhancer: <T>(options: {
52
- client: Client;
53
- storageMapping?: Partial<{ [Property in keyof T]: boolean; }> | undefined;
54
- presenceMapping?: Partial<{ [Property in keyof T]: boolean; }> | undefined;
61
+ client: Client;
62
+ storageMapping?: Mapping<T> | undefined;
63
+ presenceMapping?: Mapping<T> | undefined;
55
64
  }) => StoreEnhancer;
56
65
 
57
66
  export { LiveblocksState, Mapping, actions, enhancer };
package/index.js CHANGED
@@ -1,227 +1,358 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: !0
5
- });
6
-
2
+ Object.defineProperty(exports, "__esModule", { value: !0 });
7
3
  var internal = require("@liveblocks/client/internal");
8
-
9
4
  function _extends() {
10
- return _extends = Object.assign || function(target) {
11
- for (var i = 1; i < arguments.length; i++) {
12
- var source = arguments[i];
13
- for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
14
- }
15
- return target;
16
- }, _extends.apply(this, arguments);
5
+ return (
6
+ (_extends =
7
+ Object.assign ||
8
+ function (target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source)
12
+ Object.prototype.hasOwnProperty.call(source, key) &&
13
+ (target[key] = source[key]);
14
+ }
15
+ return target;
16
+ }),
17
+ _extends.apply(this, arguments)
18
+ );
17
19
  }
18
-
19
20
  function _arrayLikeToArray(arr, len) {
20
- (null == len || len > arr.length) && (len = arr.length);
21
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
22
- return arr2;
21
+ (null == len || len > arr.length) && (len = arr.length);
22
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
23
+ return arr2;
23
24
  }
24
-
25
25
  function _createForOfIteratorHelperLoose(o, allowArrayLike) {
26
- var it = "undefined" != typeof Symbol && o[Symbol.iterator] || o["@@iterator"];
27
- if (it) return (it = it.call(o)).next.bind(it);
28
- if (Array.isArray(o) || (it = function(o, minLen) {
29
- if (o) {
30
- if ("string" == typeof o) return _arrayLikeToArray(o, minLen);
31
- var n = Object.prototype.toString.call(o).slice(8, -1);
32
- return "Object" === n && o.constructor && (n = o.constructor.name), "Map" === n || "Set" === n ? Array.from(o) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? _arrayLikeToArray(o, minLen) : void 0;
26
+ var it =
27
+ ("undefined" != typeof Symbol && o[Symbol.iterator]) || o["@@iterator"];
28
+ if (it) return (it = it.call(o)).next.bind(it);
29
+ if (
30
+ Array.isArray(o) ||
31
+ (it = (function (o, minLen) {
32
+ if (o) {
33
+ if ("string" == typeof o) return _arrayLikeToArray(o, minLen);
34
+ var n = Object.prototype.toString.call(o).slice(8, -1);
35
+ return (
36
+ "Object" === n && o.constructor && (n = o.constructor.name),
37
+ "Map" === n || "Set" === n
38
+ ? Array.from(o)
39
+ : "Arguments" === n ||
40
+ /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)
41
+ ? _arrayLikeToArray(o, minLen)
42
+ : void 0
43
+ );
44
+ }
45
+ })(o)) ||
46
+ (allowArrayLike && o && "number" == typeof o.length)
47
+ ) {
48
+ it && (o = it);
49
+ var i = 0;
50
+ return function () {
51
+ return i >= o.length ? { done: !0 } : { done: !1, value: o[i++] };
52
+ };
33
53
  }
34
- }(o)) || allowArrayLike && o && "number" == typeof o.length) {
35
- it && (o = it);
36
- var i = 0;
37
- return function() {
38
- return i >= o.length ? {
39
- done: !0
40
- } : {
41
- done: !1,
42
- value: o[i++]
43
- };
44
- };
45
- }
46
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
+ throw new TypeError(
55
+ "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
56
+ );
47
57
  }
48
-
49
58
  var ERROR_PREFIX = "Invalid @liveblocks/redux middleware config.";
50
-
51
59
  function mappingValueShouldBeABoolean(mappingType, key) {
52
- return new Error(ERROR_PREFIX + " " + mappingType + "." + key + " value should be a boolean");
60
+ return new Error(
61
+ ERROR_PREFIX + " " + mappingType + "." + key + " value should be a boolean"
62
+ );
53
63
  }
54
-
55
64
  function mappingShouldNotHaveTheSameKeys(key) {
56
- return new Error(ERROR_PREFIX + ' "' + key + "\" is mapped on presenceMapping and storageMapping. A key shouldn't exist on both mapping.");
65
+ return new Error(
66
+ ERROR_PREFIX +
67
+ ' "' +
68
+ key +
69
+ "\" is mapped on presenceMapping and storageMapping. A key shouldn't exist on both mapping."
70
+ );
57
71
  }
58
-
59
72
  function mappingToFunctionIsNotAllowed(key) {
60
- return new Error(ERROR_PREFIX + " mapping." + key + " is invalid. Mapping to a function is not allowed.");
73
+ return new Error(
74
+ ERROR_PREFIX +
75
+ " mapping." +
76
+ key +
77
+ " is invalid. Mapping to a function is not allowed."
78
+ );
61
79
  }
62
-
63
- var ACTION_TYPES_ENTER = "@@LIVEBLOCKS/ENTER", ACTION_TYPES_LEAVE = "@@LIVEBLOCKS/LEAVE", ACTION_TYPES_START_LOADING_STORAGE = "@@LIVEBLOCKS/START_LOADING_STORAGE", ACTION_TYPES_INIT_STORAGE = "@@LIVEBLOCKS/INIT_STORAGE", ACTION_TYPES_PATCH_REDUX_STATE = "@@LIVEBLOCKS/PATCH_REDUX_STATE", ACTION_TYPES_UPDATE_CONNECTION = "@@LIVEBLOCKS/UPDATE_CONNECTION", ACTION_TYPES_UPDATE_OTHERS = "@@LIVEBLOCKS/UPDATE_OTHERS", actions = {
64
- enterRoom: function(roomId, initialState) {
65
- return {
66
- type: ACTION_TYPES_ENTER,
67
- roomId: roomId,
68
- initialState: initialState
69
- };
70
- },
71
- leaveRoom: function(roomId) {
72
- return {
73
- type: ACTION_TYPES_LEAVE,
74
- roomId: roomId
80
+ var ACTION_TYPES_ENTER = "@@LIVEBLOCKS/ENTER",
81
+ ACTION_TYPES_LEAVE = "@@LIVEBLOCKS/LEAVE",
82
+ ACTION_TYPES_START_LOADING_STORAGE = "@@LIVEBLOCKS/START_LOADING_STORAGE",
83
+ ACTION_TYPES_INIT_STORAGE = "@@LIVEBLOCKS/INIT_STORAGE",
84
+ ACTION_TYPES_PATCH_REDUX_STATE = "@@LIVEBLOCKS/PATCH_REDUX_STATE",
85
+ ACTION_TYPES_UPDATE_CONNECTION = "@@LIVEBLOCKS/UPDATE_CONNECTION",
86
+ ACTION_TYPES_UPDATE_OTHERS = "@@LIVEBLOCKS/UPDATE_OTHERS",
87
+ actions = {
88
+ enterRoom: function (roomId, initialState) {
89
+ return {
90
+ type: ACTION_TYPES_ENTER,
91
+ roomId: roomId,
92
+ initialState: initialState,
93
+ };
94
+ },
95
+ leaveRoom: function (roomId) {
96
+ return { type: ACTION_TYPES_LEAVE, roomId: roomId };
97
+ },
75
98
  };
76
- }
77
- };
99
+ var enhancer = function (options) {
100
+ if ("production" !== process.env.NODE_ENV && null == options.client)
101
+ throw new Error(ERROR_PREFIX + " client is missing");
102
+ var client = options.client,
103
+ mapping = validateMapping(options.storageMapping || {}, "storageMapping"),
104
+ presenceMapping = validateMapping(
105
+ options.presenceMapping || {},
106
+ "presenceMapping"
107
+ );
108
+ return (
109
+ "production" !== process.env.NODE_ENV &&
110
+ (function (storageMapping, presenceMapping) {
111
+ for (var key in storageMapping)
112
+ if (void 0 !== presenceMapping[key])
113
+ throw mappingShouldNotHaveTheSameKeys(key);
114
+ })(mapping, presenceMapping),
115
+ function (createStore) {
116
+ return function (reducer, initialState, enhancer) {
117
+ var room = null,
118
+ isPatching = !1,
119
+ storageRoot = null,
120
+ unsubscribeCallbacks = [],
121
+ store = createStore(
122
+ function (state, action) {
123
+ switch (action.type) {
124
+ case ACTION_TYPES_PATCH_REDUX_STATE:
125
+ return _extends({}, state, action.state);
126
+ case ACTION_TYPES_INIT_STORAGE:
127
+ return _extends({}, state, action.state, {
128
+ liveblocks: _extends({}, state.liveblocks, {
129
+ isStorageLoading: !1,
130
+ }),
131
+ });
132
+ case ACTION_TYPES_START_LOADING_STORAGE:
133
+ return _extends({}, state, {
134
+ liveblocks: _extends({}, state.liveblocks, {
135
+ isStorageLoading: !0,
136
+ }),
137
+ });
138
+ case ACTION_TYPES_UPDATE_CONNECTION:
139
+ return _extends({}, state, {
140
+ liveblocks: _extends({}, state.liveblocks, {
141
+ connection: action.connection,
142
+ }),
143
+ });
144
+ case ACTION_TYPES_UPDATE_OTHERS:
145
+ return _extends({}, state, {
146
+ liveblocks: _extends({}, state.liveblocks, {
147
+ others: action.others,
148
+ }),
149
+ });
150
+ default:
151
+ var newState = reducer(state, action);
152
+ return (
153
+ room &&
154
+ ((isPatching = !0),
155
+ (function (room, oldState, newState, presenceMapping) {
156
+ for (var key in presenceMapping) {
157
+ if ("function" == typeof newState[key])
158
+ throw mappingToFunctionIsNotAllowed("value");
159
+ var _room$updatePresence2;
160
+ if (oldState[key] !== newState[key])
161
+ room.updatePresence(
162
+ (((_room$updatePresence2 = {})[key] =
163
+ newState[key]),
164
+ _room$updatePresence2)
165
+ );
166
+ }
167
+ })(room, state, newState, presenceMapping),
168
+ room.batch(function () {
169
+ storageRoot &&
170
+ (function (root, oldState, newState, mapping) {
171
+ for (var key in mapping) {
172
+ if (
173
+ "production" !== process.env.NODE_ENV &&
174
+ "function" == typeof newState[key]
175
+ )
176
+ throw mappingToFunctionIsNotAllowed("value");
177
+ oldState[key] !== newState[key] &&
178
+ internal.patchLiveObjectKey(
179
+ root,
180
+ key,
181
+ oldState[key],
182
+ newState[key]
183
+ );
184
+ }
185
+ })(storageRoot, state, newState, mapping);
186
+ }),
187
+ (isPatching = !1)),
188
+ null == newState.liveblocks
189
+ ? _extends({}, newState, {
190
+ liveblocks: {
191
+ others: [],
192
+ isStorageLoading: !1,
193
+ connection: "closed",
194
+ },
195
+ })
196
+ : newState
197
+ );
198
+ }
199
+ },
200
+ initialState,
201
+ enhancer
202
+ );
203
+ return _extends({}, store, {
204
+ dispatch: function (action, state) {
205
+ var roomId, storageInitialState, reduxState;
206
+ action.type === ACTION_TYPES_ENTER
207
+ ? ((roomId = action.roomId),
208
+ (storageInitialState = action.initialState),
209
+ (reduxState = store.getState()),
210
+ void 0 === storageInitialState && (storageInitialState = {}),
211
+ storageRoot ||
212
+ ((function (room, state, mapping) {
213
+ for (var key in mapping) {
214
+ var _room$updatePresence;
215
+ null == room ||
216
+ room.updatePresence(
217
+ (((_room$updatePresence = {})[key] = state[key]),
218
+ _room$updatePresence)
219
+ );
220
+ }
221
+ })(
222
+ (room = client.enter(roomId)),
223
+ reduxState,
224
+ presenceMapping
225
+ ),
226
+ unsubscribeCallbacks.push(
227
+ room.subscribe("connection", function () {
228
+ store.dispatch({
229
+ type: ACTION_TYPES_UPDATE_CONNECTION,
230
+ connection: room.getConnectionState(),
231
+ });
232
+ })
233
+ ),
234
+ unsubscribeCallbacks.push(
235
+ room.subscribe("others", function (others) {
236
+ store.dispatch({
237
+ type: ACTION_TYPES_UPDATE_OTHERS,
238
+ others: others.toArray(),
239
+ });
240
+ })
241
+ ),
242
+ unsubscribeCallbacks.push(
243
+ room.subscribe("my-presence", function () {
244
+ !1 === isPatching &&
245
+ store.dispatch({
246
+ type: ACTION_TYPES_PATCH_REDUX_STATE,
247
+ state: patchPresenceState(
248
+ room.getPresence(),
249
+ presenceMapping
250
+ ),
251
+ });
252
+ })
253
+ ),
254
+ store.dispatch({ type: ACTION_TYPES_START_LOADING_STORAGE }),
255
+ room.getStorage().then(function (_ref) {
256
+ var root = _ref.root,
257
+ updates = {};
258
+ room.batch(function () {
259
+ for (var key in mapping) {
260
+ var liveblocksStatePart = root.get(key);
261
+ null == liveblocksStatePart
262
+ ? ((updates[key] = storageInitialState[key]),
263
+ internal.patchLiveObjectKey(
264
+ root,
265
+ key,
266
+ void 0,
267
+ storageInitialState[key]
268
+ ))
269
+ : (updates[key] =
270
+ internal.lsonToJson(liveblocksStatePart));
271
+ }
272
+ }),
273
+ store.dispatch({
274
+ type: ACTION_TYPES_INIT_STORAGE,
275
+ state: updates,
276
+ }),
277
+ (storageRoot = root),
278
+ unsubscribeCallbacks.push(
279
+ room.subscribe(
280
+ root,
281
+ function (updates) {
282
+ !1 === isPatching &&
283
+ store.dispatch({
284
+ type: ACTION_TYPES_PATCH_REDUX_STATE,
285
+ state: patchState(
286
+ store.getState(),
287
+ updates,
288
+ mapping
289
+ ),
290
+ });
291
+ },
292
+ { isDeep: !0 }
293
+ )
294
+ );
295
+ })))
296
+ : action.type === ACTION_TYPES_LEAVE
297
+ ? (function (roomId) {
298
+ for (
299
+ var _step,
300
+ _iterator =
301
+ _createForOfIteratorHelperLoose(unsubscribeCallbacks);
302
+ !(_step = _iterator()).done;
78
303
 
79
- var enhancer = function(options) {
80
- if ("production" !== process.env.NODE_ENV && null == options.client) throw new Error(ERROR_PREFIX + " client is missing");
81
- var client = options.client, mapping = validateMapping(options.storageMapping || {}, "storageMapping"), presenceMapping = validateMapping(options.presenceMapping || {}, "presenceMapping");
82
- return "production" !== process.env.NODE_ENV && function(storageMapping, presenceMapping) {
83
- for (var key in storageMapping) if (void 0 !== presenceMapping[key]) throw mappingShouldNotHaveTheSameKeys(key);
84
- }(mapping, presenceMapping), function(createStore) {
85
- return function(reducer, initialState, enhancer) {
86
- var room = null, isPatching = !1, storageRoot = null, unsubscribeCallbacks = [], store = createStore((function(state, action) {
87
- switch (action.type) {
88
- case ACTION_TYPES_PATCH_REDUX_STATE:
89
- return _extends({}, state, action.state);
90
-
91
- case ACTION_TYPES_INIT_STORAGE:
92
- return _extends({}, state, action.state, {
93
- liveblocks: _extends({}, state.liveblocks, {
94
- isStorageLoading: !1
95
- })
96
- });
97
-
98
- case ACTION_TYPES_START_LOADING_STORAGE:
99
- return _extends({}, state, {
100
- liveblocks: _extends({}, state.liveblocks, {
101
- isStorageLoading: !0
102
- })
103
- });
104
-
105
- case ACTION_TYPES_UPDATE_CONNECTION:
106
- return _extends({}, state, {
107
- liveblocks: _extends({}, state.liveblocks, {
108
- connection: action.connection
109
- })
110
- });
111
-
112
- case ACTION_TYPES_UPDATE_OTHERS:
113
- return _extends({}, state, {
114
- liveblocks: _extends({}, state.liveblocks, {
115
- others: action.others
116
- })
117
- });
118
-
119
- default:
120
- var newState = reducer(state, action);
121
- return room && (isPatching = !0, function(room, oldState, newState, presenceMapping) {
122
- for (var key in presenceMapping) {
123
- if ("function" == typeof newState[key]) throw mappingToFunctionIsNotAllowed("value");
124
- var _room$updatePresence2;
125
- if (oldState[key] !== newState[key]) room.updatePresence(((_room$updatePresence2 = {})[key] = newState[key],
126
- _room$updatePresence2));
127
- }
128
- }(room, state, newState, presenceMapping), room.batch((function() {
129
- storageRoot && function(root, oldState, newState, mapping) {
130
- for (var key in mapping) {
131
- if ("production" !== process.env.NODE_ENV && "function" == typeof newState[key]) throw mappingToFunctionIsNotAllowed("value");
132
- oldState[key] !== newState[key] && internal.patchLiveObjectKey(root, key, oldState[key], newState[key]);
133
- }
134
- }(storageRoot, state, newState, mapping);
135
- })), isPatching = !1), null == newState.liveblocks ? _extends({}, newState, {
136
- liveblocks: {
137
- others: [],
138
- isStorageLoading: !1,
139
- connection: "closed"
140
- }
141
- }) : newState;
304
+ )
305
+ (0, _step.value)();
306
+ (storageRoot = null),
307
+ (room = null),
308
+ (isPatching = !1),
309
+ (unsubscribeCallbacks = []),
310
+ client.leave(roomId);
311
+ })(action.roomId)
312
+ : store.dispatch(action, state);
313
+ },
314
+ });
315
+ };
142
316
  }
143
- }), initialState, enhancer);
144
- return _extends({}, store, {
145
- dispatch: function(action, state) {
146
- var roomId, storageInitialState, reduxState;
147
- action.type === ACTION_TYPES_ENTER ? (roomId = action.roomId, storageInitialState = action.initialState,
148
- reduxState = store.getState(), void 0 === storageInitialState && (storageInitialState = {}),
149
- storageRoot || (function(room, state, mapping) {
150
- for (var key in mapping) {
151
- var _room$updatePresence;
152
- null == room || room.updatePresence(((_room$updatePresence = {})[key] = state[key],
153
- _room$updatePresence));
154
- }
155
- }(room = client.enter(roomId), reduxState, presenceMapping), unsubscribeCallbacks.push(room.subscribe("connection", (function() {
156
- store.dispatch({
157
- type: ACTION_TYPES_UPDATE_CONNECTION,
158
- connection: room.getConnectionState()
159
- });
160
- }))), unsubscribeCallbacks.push(room.subscribe("others", (function(others) {
161
- store.dispatch({
162
- type: ACTION_TYPES_UPDATE_OTHERS,
163
- others: others.toArray()
164
- });
165
- }))), unsubscribeCallbacks.push(room.subscribe("my-presence", (function() {
166
- !1 === isPatching && store.dispatch({
167
- type: ACTION_TYPES_PATCH_REDUX_STATE,
168
- state: patchPresenceState(room.getPresence(), presenceMapping)
169
- });
170
- }))), store.dispatch({
171
- type: ACTION_TYPES_START_LOADING_STORAGE
172
- }), room.getStorage().then((function(_ref) {
173
- var root = _ref.root, updates = {};
174
- room.batch((function() {
175
- for (var key in mapping) {
176
- var liveblocksStatePart = root.get(key);
177
- null == liveblocksStatePart ? (updates[key] = storageInitialState[key], internal.patchLiveObjectKey(root, key, void 0, storageInitialState[key])) : updates[key] = internal.lsonToJson(liveblocksStatePart);
178
- }
179
- })), store.dispatch({
180
- type: ACTION_TYPES_INIT_STORAGE,
181
- state: updates
182
- }), storageRoot = root, unsubscribeCallbacks.push(room.subscribe(root, (function(updates) {
183
- !1 === isPatching && store.dispatch({
184
- type: ACTION_TYPES_PATCH_REDUX_STATE,
185
- state: patchState(store.getState(), updates, mapping)
186
- });
187
- }), {
188
- isDeep: !0
189
- }));
190
- })))) : action.type === ACTION_TYPES_LEAVE ? function(roomId) {
191
- for (var _step, _iterator = _createForOfIteratorHelperLoose(unsubscribeCallbacks); !(_step = _iterator()).done; ) (0,
192
- _step.value)();
193
- storageRoot = null, room = null, isPatching = !1, unsubscribeCallbacks = [], client.leave(roomId);
194
- }(action.roomId) : store.dispatch(action, state);
195
- }
196
- });
197
- };
198
- };
317
+ );
199
318
  };
200
-
201
319
  function patchPresenceState(presence, mapping) {
202
- var partialState = {};
203
- for (var key in mapping) partialState[key] = presence[key];
204
- return partialState;
320
+ var partialState = {};
321
+ for (var key in mapping) partialState[key] = presence[key];
322
+ return partialState;
205
323
  }
206
-
207
324
  function patchState(state, updates, mapping) {
208
- var partialState = {};
209
- for (var key in mapping) partialState[key] = state[key];
210
- var patched = internal.patchImmutableObject(partialState, updates), result = {};
211
- for (var _key in mapping) result[_key] = patched[_key];
212
- return result;
325
+ var partialState = {};
326
+ for (var key in mapping) partialState[key] = state[key];
327
+ var patched = internal.patchImmutableObject(partialState, updates),
328
+ result = {};
329
+ for (var _key in mapping) result[_key] = patched[_key];
330
+ return result;
213
331
  }
214
-
215
332
  function validateMapping(mapping, mappingType) {
216
- if ("production" !== process.env.NODE_ENV && (value = mapping, "[object Object]" !== Object.prototype.toString.call(value))) throw function(mappingType) {
217
- return new Error(ERROR_PREFIX + " " + mappingType + " should be an object where the values are boolean.");
218
- }(mappingType);
219
- var value, result = {};
220
- for (var key in mapping) {
221
- if ("production" !== process.env.NODE_ENV && "boolean" != typeof mapping[key]) throw mappingValueShouldBeABoolean(mappingType, key);
222
- !0 === mapping[key] && (result[key] = !0);
223
- }
224
- return result;
333
+ if (
334
+ "production" !== process.env.NODE_ENV &&
335
+ ((value = mapping),
336
+ "[object Object]" !== Object.prototype.toString.call(value))
337
+ )
338
+ throw (function (mappingType) {
339
+ return new Error(
340
+ ERROR_PREFIX +
341
+ " " +
342
+ mappingType +
343
+ " should be an object where the values are boolean."
344
+ );
345
+ })(mappingType);
346
+ var value,
347
+ result = {};
348
+ for (var key in mapping) {
349
+ if (
350
+ "production" !== process.env.NODE_ENV &&
351
+ "boolean" != typeof mapping[key]
352
+ )
353
+ throw mappingValueShouldBeABoolean(mappingType, key);
354
+ !0 === mapping[key] && (result[key] = !0);
355
+ }
356
+ return result;
225
357
  }
226
-
227
- exports.actions = actions, exports.enhancer = enhancer;
358
+ (exports.actions = actions), (exports.enhancer = enhancer);
package/index.mjs CHANGED
@@ -1,179 +1,275 @@
1
- import { patchLiveObjectKey, lsonToJson, patchImmutableObject } from "@liveblocks/client/internal";
2
-
1
+ import {
2
+ patchLiveObjectKey,
3
+ lsonToJson,
4
+ patchImmutableObject,
5
+ } from "@liveblocks/client/internal";
3
6
  const ERROR_PREFIX = "Invalid @liveblocks/redux middleware config.";
4
-
5
7
  function mappingValueShouldBeABoolean(mappingType, key) {
6
- return new Error(`${ERROR_PREFIX} ${mappingType}.${key} value should be a boolean`);
8
+ return new Error(
9
+ `${ERROR_PREFIX} ${mappingType}.${key} value should be a boolean`
10
+ );
7
11
  }
8
-
9
12
  function mappingShouldNotHaveTheSameKeys(key) {
10
- return new Error(`${ERROR_PREFIX} "${key}" is mapped on presenceMapping and storageMapping. A key shouldn't exist on both mapping.`);
13
+ return new Error(
14
+ `${ERROR_PREFIX} "${key}" is mapped on presenceMapping and storageMapping. A key shouldn't exist on both mapping.`
15
+ );
11
16
  }
12
-
13
17
  function mappingToFunctionIsNotAllowed(key) {
14
- return new Error(`${ERROR_PREFIX} mapping.${key} is invalid. Mapping to a function is not allowed.`);
18
+ return new Error(
19
+ `${ERROR_PREFIX} mapping.${key} is invalid. Mapping to a function is not allowed.`
20
+ );
15
21
  }
16
-
17
- const ACTION_TYPES_ENTER = "@@LIVEBLOCKS/ENTER", ACTION_TYPES_LEAVE = "@@LIVEBLOCKS/LEAVE", ACTION_TYPES_START_LOADING_STORAGE = "@@LIVEBLOCKS/START_LOADING_STORAGE", ACTION_TYPES_INIT_STORAGE = "@@LIVEBLOCKS/INIT_STORAGE", ACTION_TYPES_PATCH_REDUX_STATE = "@@LIVEBLOCKS/PATCH_REDUX_STATE", ACTION_TYPES_UPDATE_CONNECTION = "@@LIVEBLOCKS/UPDATE_CONNECTION", ACTION_TYPES_UPDATE_OTHERS = "@@LIVEBLOCKS/UPDATE_OTHERS", actions = {
18
- enterRoom: function(roomId, initialState) {
19
- return {
20
- type: ACTION_TYPES_ENTER,
21
- roomId: roomId,
22
- initialState: initialState
22
+ const ACTION_TYPES_ENTER = "@@LIVEBLOCKS/ENTER",
23
+ ACTION_TYPES_LEAVE = "@@LIVEBLOCKS/LEAVE",
24
+ ACTION_TYPES_START_LOADING_STORAGE = "@@LIVEBLOCKS/START_LOADING_STORAGE",
25
+ ACTION_TYPES_INIT_STORAGE = "@@LIVEBLOCKS/INIT_STORAGE",
26
+ ACTION_TYPES_PATCH_REDUX_STATE = "@@LIVEBLOCKS/PATCH_REDUX_STATE",
27
+ ACTION_TYPES_UPDATE_CONNECTION = "@@LIVEBLOCKS/UPDATE_CONNECTION",
28
+ ACTION_TYPES_UPDATE_OTHERS = "@@LIVEBLOCKS/UPDATE_OTHERS",
29
+ actions = {
30
+ enterRoom: function (roomId, initialState) {
31
+ return {
32
+ type: ACTION_TYPES_ENTER,
33
+ roomId: roomId,
34
+ initialState: initialState,
35
+ };
36
+ },
37
+ leaveRoom: function (roomId) {
38
+ return { type: ACTION_TYPES_LEAVE, roomId: roomId };
39
+ },
23
40
  };
24
- },
25
- leaveRoom: function(roomId) {
26
- return {
27
- type: ACTION_TYPES_LEAVE,
28
- roomId: roomId
29
- };
30
- }
31
- };
32
-
33
- const enhancer = options => {
34
- if ("production" !== process.env.NODE_ENV && null == options.client) throw new Error(`${ERROR_PREFIX} client is missing`);
35
- const client = options.client, mapping = validateMapping(options.storageMapping || {}, "storageMapping"), presenceMapping = validateMapping(options.presenceMapping || {}, "presenceMapping");
36
- return "production" !== process.env.NODE_ENV && function(storageMapping, presenceMapping) {
37
- for (const key in storageMapping) if (void 0 !== presenceMapping[key]) throw mappingShouldNotHaveTheSameKeys(key);
38
- }(mapping, presenceMapping), createStore => (reducer, initialState, enhancer) => {
39
- let room = null, isPatching = !1, storageRoot = null, unsubscribeCallbacks = [];
40
- const store = createStore(((state, action) => {
41
- switch (action.type) {
42
- case ACTION_TYPES_PATCH_REDUX_STATE:
43
- return Object.assign(Object.assign({}, state), action.state);
44
-
45
- case ACTION_TYPES_INIT_STORAGE:
46
- return Object.assign(Object.assign(Object.assign({}, state), action.state), {
47
- liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
48
- isStorageLoading: !1
49
- })
50
- });
51
-
52
- case ACTION_TYPES_START_LOADING_STORAGE:
53
- return Object.assign(Object.assign({}, state), {
54
- liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
55
- isStorageLoading: !0
56
- })
57
- });
58
-
59
- case ACTION_TYPES_UPDATE_CONNECTION:
60
- return Object.assign(Object.assign({}, state), {
61
- liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
62
- connection: action.connection
63
- })
64
- });
65
-
66
- case ACTION_TYPES_UPDATE_OTHERS:
67
- return Object.assign(Object.assign({}, state), {
68
- liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
69
- others: action.others
70
- })
71
- });
72
-
73
- default:
74
- {
75
- const newState = reducer(state, action);
76
- return room && (isPatching = !0, function(room, oldState, newState, presenceMapping) {
77
- for (const key in presenceMapping) {
78
- if ("function" == typeof newState[key]) throw mappingToFunctionIsNotAllowed("value");
79
- oldState[key] !== newState[key] && room.updatePresence({
80
- [key]: newState[key]
81
- });
82
- }
83
- }(room, state, newState, presenceMapping), room.batch((() => {
84
- storageRoot && function(root, oldState, newState, mapping) {
85
- for (const key in mapping) {
86
- if ("production" !== process.env.NODE_ENV && "function" == typeof newState[key]) throw mappingToFunctionIsNotAllowed("value");
87
- oldState[key] !== newState[key] && patchLiveObjectKey(root, key, oldState[key], newState[key]);
88
- }
89
- }(storageRoot, state, newState, mapping);
90
- })), isPatching = !1), null == newState.liveblocks ? Object.assign(Object.assign({}, newState), {
91
- liveblocks: {
92
- others: [],
93
- isStorageLoading: !1,
94
- connection: "closed"
95
- }
96
- }) : newState;
97
- }
98
- }
99
- }), initialState, enhancer);
100
- return Object.assign(Object.assign({}, store), {
101
- dispatch: function(action, state) {
102
- action.type === ACTION_TYPES_ENTER ? function(roomId, storageInitialState = {}, reduxState) {
103
- storageRoot || (room = client.enter(roomId), function(room, state, mapping) {
104
- for (const key in mapping) null == room || room.updatePresence({
105
- [key]: state[key]
106
- });
107
- }(room, reduxState, presenceMapping), unsubscribeCallbacks.push(room.subscribe("connection", (() => {
108
- store.dispatch({
109
- type: ACTION_TYPES_UPDATE_CONNECTION,
110
- connection: room.getConnectionState()
41
+ const enhancer = (options) => {
42
+ if ("production" !== process.env.NODE_ENV && null == options.client)
43
+ throw new Error(`${ERROR_PREFIX} client is missing`);
44
+ const client = options.client,
45
+ mapping = validateMapping(options.storageMapping || {}, "storageMapping"),
46
+ presenceMapping = validateMapping(
47
+ options.presenceMapping || {},
48
+ "presenceMapping"
49
+ );
50
+ return (
51
+ "production" !== process.env.NODE_ENV &&
52
+ (function (storageMapping, presenceMapping) {
53
+ for (const key in storageMapping)
54
+ if (void 0 !== presenceMapping[key])
55
+ throw mappingShouldNotHaveTheSameKeys(key);
56
+ })(mapping, presenceMapping),
57
+ (createStore) => (reducer, initialState, enhancer) => {
58
+ let room = null,
59
+ isPatching = !1,
60
+ storageRoot = null,
61
+ unsubscribeCallbacks = [];
62
+ const store = createStore(
63
+ (state, action) => {
64
+ switch (action.type) {
65
+ case ACTION_TYPES_PATCH_REDUX_STATE:
66
+ return Object.assign(Object.assign({}, state), action.state);
67
+ case ACTION_TYPES_INIT_STORAGE:
68
+ return Object.assign(
69
+ Object.assign(Object.assign({}, state), action.state),
70
+ {
71
+ liveblocks: Object.assign(
72
+ Object.assign({}, state.liveblocks),
73
+ { isStorageLoading: !1 }
74
+ ),
75
+ }
76
+ );
77
+ case ACTION_TYPES_START_LOADING_STORAGE:
78
+ return Object.assign(Object.assign({}, state), {
79
+ liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
80
+ isStorageLoading: !0,
81
+ }),
82
+ });
83
+ case ACTION_TYPES_UPDATE_CONNECTION:
84
+ return Object.assign(Object.assign({}, state), {
85
+ liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
86
+ connection: action.connection,
87
+ }),
88
+ });
89
+ case ACTION_TYPES_UPDATE_OTHERS:
90
+ return Object.assign(Object.assign({}, state), {
91
+ liveblocks: Object.assign(Object.assign({}, state.liveblocks), {
92
+ others: action.others,
93
+ }),
94
+ });
95
+ default: {
96
+ const newState = reducer(state, action);
97
+ return (
98
+ room &&
99
+ ((isPatching = !0),
100
+ (function (room, oldState, newState, presenceMapping) {
101
+ for (const key in presenceMapping) {
102
+ if ("function" == typeof newState[key])
103
+ throw mappingToFunctionIsNotAllowed("value");
104
+ oldState[key] !== newState[key] &&
105
+ room.updatePresence({ [key]: newState[key] });
106
+ }
107
+ })(room, state, newState, presenceMapping),
108
+ room.batch(() => {
109
+ storageRoot &&
110
+ (function (root, oldState, newState, mapping) {
111
+ for (const key in mapping) {
112
+ if (
113
+ "production" !== process.env.NODE_ENV &&
114
+ "function" == typeof newState[key]
115
+ )
116
+ throw mappingToFunctionIsNotAllowed("value");
117
+ oldState[key] !== newState[key] &&
118
+ patchLiveObjectKey(
119
+ root,
120
+ key,
121
+ oldState[key],
122
+ newState[key]
123
+ );
124
+ }
125
+ })(storageRoot, state, newState, mapping);
126
+ }),
127
+ (isPatching = !1)),
128
+ null == newState.liveblocks
129
+ ? Object.assign(Object.assign({}, newState), {
130
+ liveblocks: {
131
+ others: [],
132
+ isStorageLoading: !1,
133
+ connection: "closed",
134
+ },
135
+ })
136
+ : newState
137
+ );
138
+ }
139
+ }
140
+ },
141
+ initialState,
142
+ enhancer
143
+ );
144
+ return Object.assign(Object.assign({}, store), {
145
+ dispatch: function (action, state) {
146
+ action.type === ACTION_TYPES_ENTER
147
+ ? (function (roomId, storageInitialState = {}, reduxState) {
148
+ storageRoot ||
149
+ ((room = client.enter(roomId)),
150
+ (function (room, state, mapping) {
151
+ for (const key in mapping)
152
+ null == room ||
153
+ room.updatePresence({ [key]: state[key] });
154
+ })(room, reduxState, presenceMapping),
155
+ unsubscribeCallbacks.push(
156
+ room.subscribe("connection", () => {
157
+ store.dispatch({
158
+ type: ACTION_TYPES_UPDATE_CONNECTION,
159
+ connection: room.getConnectionState(),
160
+ });
161
+ })
162
+ ),
163
+ unsubscribeCallbacks.push(
164
+ room.subscribe("others", (others) => {
165
+ store.dispatch({
166
+ type: ACTION_TYPES_UPDATE_OTHERS,
167
+ others: others.toArray(),
168
+ });
169
+ })
170
+ ),
171
+ unsubscribeCallbacks.push(
172
+ room.subscribe("my-presence", () => {
173
+ !1 === isPatching &&
174
+ store.dispatch({
175
+ type: ACTION_TYPES_PATCH_REDUX_STATE,
176
+ state: patchPresenceState(
177
+ room.getPresence(),
178
+ presenceMapping
179
+ ),
180
+ });
181
+ })
182
+ ),
183
+ store.dispatch({ type: ACTION_TYPES_START_LOADING_STORAGE }),
184
+ room.getStorage().then(({ root: root }) => {
185
+ const updates = {};
186
+ room.batch(() => {
187
+ for (const key in mapping) {
188
+ const liveblocksStatePart = root.get(key);
189
+ null == liveblocksStatePart
190
+ ? ((updates[key] = storageInitialState[key]),
191
+ patchLiveObjectKey(
192
+ root,
193
+ key,
194
+ void 0,
195
+ storageInitialState[key]
196
+ ))
197
+ : (updates[key] = lsonToJson(liveblocksStatePart));
198
+ }
199
+ }),
200
+ store.dispatch({
201
+ type: ACTION_TYPES_INIT_STORAGE,
202
+ state: updates,
203
+ }),
204
+ (storageRoot = root),
205
+ unsubscribeCallbacks.push(
206
+ room.subscribe(
207
+ root,
208
+ (updates) => {
209
+ !1 === isPatching &&
210
+ store.dispatch({
211
+ type: ACTION_TYPES_PATCH_REDUX_STATE,
212
+ state: patchState(
213
+ store.getState(),
214
+ updates,
215
+ mapping
216
+ ),
217
+ });
218
+ },
219
+ { isDeep: !0 }
220
+ )
221
+ );
222
+ }));
223
+ })(action.roomId, action.initialState, store.getState())
224
+ : action.type === ACTION_TYPES_LEAVE
225
+ ? (function (roomId) {
226
+ for (const unsubscribe of unsubscribeCallbacks) unsubscribe();
227
+ (storageRoot = null),
228
+ (room = null),
229
+ (isPatching = !1),
230
+ (unsubscribeCallbacks = []),
231
+ client.leave(roomId);
232
+ })(action.roomId)
233
+ : store.dispatch(action, state);
234
+ },
111
235
  });
112
- }))), unsubscribeCallbacks.push(room.subscribe("others", (others => {
113
- store.dispatch({
114
- type: ACTION_TYPES_UPDATE_OTHERS,
115
- others: others.toArray()
116
- });
117
- }))), unsubscribeCallbacks.push(room.subscribe("my-presence", (() => {
118
- !1 === isPatching && store.dispatch({
119
- type: ACTION_TYPES_PATCH_REDUX_STATE,
120
- state: patchPresenceState(room.getPresence(), presenceMapping)
121
- });
122
- }))), store.dispatch({
123
- type: ACTION_TYPES_START_LOADING_STORAGE
124
- }), room.getStorage().then((({root: root}) => {
125
- const updates = {};
126
- room.batch((() => {
127
- for (const key in mapping) {
128
- const liveblocksStatePart = root.get(key);
129
- null == liveblocksStatePart ? (updates[key] = storageInitialState[key], patchLiveObjectKey(root, key, void 0, storageInitialState[key])) : updates[key] = lsonToJson(liveblocksStatePart);
130
- }
131
- })), store.dispatch({
132
- type: ACTION_TYPES_INIT_STORAGE,
133
- state: updates
134
- }), storageRoot = root, unsubscribeCallbacks.push(room.subscribe(root, (updates => {
135
- !1 === isPatching && store.dispatch({
136
- type: ACTION_TYPES_PATCH_REDUX_STATE,
137
- state: patchState(store.getState(), updates, mapping)
138
- });
139
- }), {
140
- isDeep: !0
141
- }));
142
- })));
143
- }(action.roomId, action.initialState, store.getState()) : action.type === ACTION_TYPES_LEAVE ? function(roomId) {
144
- for (const unsubscribe of unsubscribeCallbacks) unsubscribe();
145
- storageRoot = null, room = null, isPatching = !1, unsubscribeCallbacks = [], client.leave(roomId);
146
- }(action.roomId) : store.dispatch(action, state);
147
- }
148
- });
149
- };
236
+ }
237
+ );
150
238
  };
151
-
152
239
  function patchPresenceState(presence, mapping) {
153
- const partialState = {};
154
- for (const key in mapping) partialState[key] = presence[key];
155
- return partialState;
240
+ const partialState = {};
241
+ for (const key in mapping) partialState[key] = presence[key];
242
+ return partialState;
156
243
  }
157
-
158
244
  function patchState(state, updates, mapping) {
159
- const partialState = {};
160
- for (const key in mapping) partialState[key] = state[key];
161
- const patched = patchImmutableObject(partialState, updates), result = {};
162
- for (const key in mapping) result[key] = patched[key];
163
- return result;
245
+ const partialState = {};
246
+ for (const key in mapping) partialState[key] = state[key];
247
+ const patched = patchImmutableObject(partialState, updates),
248
+ result = {};
249
+ for (const key in mapping) result[key] = patched[key];
250
+ return result;
164
251
  }
165
-
166
252
  function validateMapping(mapping, mappingType) {
167
- if ("production" !== process.env.NODE_ENV && (value = mapping, "[object Object]" !== Object.prototype.toString.call(value))) throw function(mappingType) {
168
- return new Error(`${ERROR_PREFIX} ${mappingType} should be an object where the values are boolean.`);
169
- }(mappingType);
170
- var value;
171
- const result = {};
172
- for (const key in mapping) {
173
- if ("production" !== process.env.NODE_ENV && "boolean" != typeof mapping[key]) throw mappingValueShouldBeABoolean(mappingType, key);
174
- !0 === mapping[key] && (result[key] = !0);
175
- }
176
- return result;
253
+ if (
254
+ "production" !== process.env.NODE_ENV &&
255
+ ((value = mapping),
256
+ "[object Object]" !== Object.prototype.toString.call(value))
257
+ )
258
+ throw (function (mappingType) {
259
+ return new Error(
260
+ `${ERROR_PREFIX} ${mappingType} should be an object where the values are boolean.`
261
+ );
262
+ })(mappingType);
263
+ var value;
264
+ const result = {};
265
+ for (const key in mapping) {
266
+ if (
267
+ "production" !== process.env.NODE_ENV &&
268
+ "boolean" != typeof mapping[key]
269
+ )
270
+ throw mappingValueShouldBeABoolean(mappingType, key);
271
+ !0 === mapping[key] && (result[key] = !0);
272
+ }
273
+ return result;
177
274
  }
178
-
179
275
  export { actions, enhancer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/redux",
3
- "version": "0.16.17",
3
+ "version": "0.17.0-test1",
4
4
  "description": "A store enhancer to integrate Liveblocks into Redux stores.",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -20,8 +20,8 @@
20
20
  "build": "rollup -c && cp ./package.json ./README.md ./lib",
21
21
  "format": "eslint --fix src/ test/ && prettier --write src/ test/",
22
22
  "lint": "eslint src/ test/",
23
- "test": "jest --watch",
24
- "test-ci": "jest",
23
+ "test": "jest --watch --silent --verbose",
24
+ "test-ci": "jest --silent --verbose",
25
25
  "dtslint": "dtslint --localTs node_modules/typescript/lib --expectOnly types"
26
26
  },
27
27
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "directory": "packages/liveblocks-redux"
32
32
  },
33
33
  "peerDependencies": {
34
- "@liveblocks/client": "0.16.17",
34
+ "@liveblocks/client": "0.17.0-test1",
35
35
  "redux": "^4"
36
36
  },
37
37
  "devDependencies": {
@@ -47,9 +47,9 @@
47
47
  "@testing-library/jest-dom": "^5.16.1",
48
48
  "@testing-library/react": "^12.1.2",
49
49
  "@testing-library/react-hooks": "^7.0.2",
50
- "@types/jest": "^27.4.1",
51
- "@typescript-eslint/eslint-plugin": "^5.18.0",
52
- "@typescript-eslint/parser": "^5.18.0",
50
+ "@types/jest": "^27.5.1",
51
+ "@typescript-eslint/eslint-plugin": "^5.26.0",
52
+ "@typescript-eslint/parser": "^5.26.0",
53
53
  "eslint": "^8.12.0",
54
54
  "eslint-plugin-import": "^2.26.0",
55
55
  "eslint-plugin-simple-import-sort": "^7.0.0",
@@ -58,8 +58,10 @@
58
58
  "redux": "^4.1.2",
59
59
  "rollup": "^2.64.0",
60
60
  "rollup-plugin-command": "^1.1.3",
61
- "rollup-plugin-dts": "^4.2.1",
61
+ "rollup-plugin-dts": "^4.2.2",
62
+ "rollup-plugin-prettier": "^2.2.2",
62
63
  "rollup-plugin-terser": "^7.0.2",
64
+ "typescript": "^4.7.2",
63
65
  "whatwg-fetch": "^3.6.2"
64
66
  },
65
67
  "sideEffects": false