@opengeoweb/store 8.3.0 → 8.3.1

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 (2) hide show
  1. package/index.esm.js +75 -37
  2. package/package.json +5 -5
package/index.esm.js CHANGED
@@ -1577,6 +1577,65 @@ function isPlainObject(value) {
1577
1577
  }
1578
1578
  return proto === baseProto;
1579
1579
  }
1580
+ // src/tsHelpers.ts
1581
+ var hasMatchFunction = function (v) {
1582
+ return v && typeof v.match === "function";
1583
+ };
1584
+ // src/createAction.ts
1585
+ function createAction(type, prepareAction) {
1586
+ function actionCreator() {
1587
+ var args = [];
1588
+ for (var _i = 0; _i < arguments.length; _i++) {
1589
+ args[_i] = arguments[_i];
1590
+ }
1591
+ if (prepareAction) {
1592
+ var prepared = prepareAction.apply(void 0, args);
1593
+ if (!prepared) {
1594
+ throw new Error("prepareAction did not return an object");
1595
+ }
1596
+ return __spreadValues(__spreadValues({
1597
+ type: type,
1598
+ payload: prepared.payload
1599
+ }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
1600
+ }
1601
+ return { type: type, payload: args[0] };
1602
+ }
1603
+ actionCreator.toString = function () { return "" + type; };
1604
+ actionCreator.type = type;
1605
+ actionCreator.match = function (action) { return action.type === type; };
1606
+ return actionCreator;
1607
+ }
1608
+ function isAction(action) {
1609
+ return isPlainObject(action) && "type" in action;
1610
+ }
1611
+ function isActionCreator(action) {
1612
+ return typeof action === "function" && "type" in action && hasMatchFunction(action);
1613
+ }
1614
+ function isFSA(action) {
1615
+ return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
1616
+ }
1617
+ function isValidKey(key) {
1618
+ return ["type", "payload", "error", "meta"].indexOf(key) > -1;
1619
+ }
1620
+ // src/actionCreatorInvariantMiddleware.ts
1621
+ function getMessage(type) {
1622
+ var splitType = type ? ("" + type).split("/") : [];
1623
+ var actionName = splitType[splitType.length - 1] || "actionCreator";
1624
+ return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
1625
+ }
1626
+ function createActionCreatorInvariantMiddleware(options) {
1627
+ if (options === void 0) { options = {}; }
1628
+ if (process.env.NODE_ENV === "production") {
1629
+ return function () { return function (next) { return function (action) { return next(action); }; }; };
1630
+ }
1631
+ var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
1632
+ return function () { return function (next) { return function (action) {
1633
+ if (isActionCreator2(action)) {
1634
+ console.warn(getMessage(action.type));
1635
+ }
1636
+ return next(action);
1637
+ }; }; };
1638
+ }
1580
1639
  function getTimeMeasureUtils(maxDelay, fnName) {
1581
1640
  var elapsed = 0;
1582
1641
  return {
@@ -1722,11 +1781,13 @@ function trackForMutations(isImmutable, ignorePaths, obj) {
1722
1781
  }
1723
1782
  };
1724
1783
  }
1725
- function trackProperties(isImmutable, ignorePaths, obj, path) {
1784
+ function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
1726
1785
  if (ignorePaths === void 0) { ignorePaths = []; }
1727
1786
  if (path === void 0) { path = ""; }
1787
+ if (checkedObjects === void 0) { checkedObjects = new Set(); }
1728
1788
  var tracked = { value: obj };
1729
- if (!isImmutable(obj)) {
1789
+ if (!isImmutable(obj) && !checkedObjects.has(obj)) {
1790
+ checkedObjects.add(obj);
1730
1791
  tracked.children = {};
1731
1792
  for (var key in obj) {
1732
1793
  var childPath = path ? path + "." + key : key;
@@ -1931,7 +1992,7 @@ function curryGetDefaultMiddleware() {
1931
1992
  }
1932
1993
  function getDefaultMiddleware(options) {
1933
1994
  if (options === void 0) { options = {}; }
1934
- var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e;
1995
+ var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
1935
1996
  var middlewareArray = new MiddlewareArray();
1936
1997
  if (thunk) {
1937
1998
  if (isBoolean(thunk)) {
@@ -1956,6 +2017,13 @@ function getDefaultMiddleware(options) {
1956
2017
  }
1957
2018
  middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
1958
2019
  }
2020
+ if (actionCreatorCheck) {
2021
+ var actionCreatorOptions = {};
2022
+ if (!isBoolean(actionCreatorCheck)) {
2023
+ actionCreatorOptions = actionCreatorCheck;
2024
+ }
2025
+ middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
2026
+ }
1959
2027
  }
1960
2028
  return middlewareArray;
1961
2029
  }
@@ -2002,39 +2070,6 @@ function configureStore(options) {
2002
2070
  var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
2003
2071
  return createStore(rootReducer, preloadedState, composedEnhancer);
2004
2072
  }
2005
- // src/createAction.ts
2006
- function createAction(type, prepareAction) {
2007
- function actionCreator() {
2008
- var args = [];
2009
- for (var _i = 0; _i < arguments.length; _i++) {
2010
- args[_i] = arguments[_i];
2011
- }
2012
- if (prepareAction) {
2013
- var prepared = prepareAction.apply(void 0, args);
2014
- if (!prepared) {
2015
- throw new Error("prepareAction did not return an object");
2016
- }
2017
- return __spreadValues(__spreadValues({
2018
- type: type,
2019
- payload: prepared.payload
2020
- }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
2021
- }
2022
- return { type: type, payload: args[0] };
2023
- }
2024
- actionCreator.toString = function () { return "" + type; };
2025
- actionCreator.type = type;
2026
- actionCreator.match = function (action) { return action.type === type; };
2027
- return actionCreator;
2028
- }
2029
- function isAction(action) {
2030
- return isPlainObject(action) && "type" in action;
2031
- }
2032
- function isFSA(action) {
2033
- return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
2034
- }
2035
- function isValidKey(key) {
2036
- return ["type", "payload", "error", "meta"].indexOf(key) > -1;
2037
- }
2038
2073
  // src/mapBuilders.ts
2039
2074
  function executeReducerBuilderCallback(builderCallback) {
2040
2075
  var actionsMap = {};
@@ -2051,8 +2086,11 @@ function executeReducerBuilderCallback(builderCallback) {
2051
2086
  }
2052
2087
  }
2053
2088
  var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
2089
+ if (!type) {
2090
+ throw new Error("`builder.addCase` cannot be called with an empty action type");
2091
+ }
2054
2092
  if (type in actionsMap) {
2055
- throw new Error("addCase cannot be called with two reducers for the same action type");
2093
+ throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");
2056
2094
  }
2057
2095
  actionsMap[type] = reducer;
2058
2096
  return builder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "8.3.0",
3
+ "version": "8.3.1",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -12,13 +12,13 @@
12
12
  "main": "./index.esm.js",
13
13
  "dependencies": {},
14
14
  "peerDependencies": {
15
- "@opengeoweb/shared": "8.3.0",
16
- "@opengeoweb/webmap": "8.3.0",
17
- "@opengeoweb/webmap-react": "8.3.0",
15
+ "@opengeoweb/shared": "8.3.1",
16
+ "@opengeoweb/webmap": "8.3.1",
17
+ "@opengeoweb/webmap-react": "8.3.1",
18
18
  "@redux-eggs/core": "2.2.0",
19
19
  "@redux-eggs/redux-toolkit": "2.2.0",
20
20
  "@redux-eggs/saga-extension": "2.2.0",
21
- "@reduxjs/toolkit": "1.9.5",
21
+ "@reduxjs/toolkit": "1.9.7",
22
22
  "@turf/turf": "6.5.0",
23
23
  "date-fns": "2.30.0",
24
24
  "immer": "9.0.21",