strange-middle-end
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -11,4 +11,7 @@ 'use strict'; | ||
var Immer = require('immer'); | ||
var React = require('react'); | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -97,3 +100,3 @@ _typeof = function (obj) { | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -104,3 +107,3 @@ }); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -115,15 +118,11 @@ }); | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
@@ -136,10 +135,7 @@ | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
@@ -170,8 +166,25 @@ var _n = true; | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -351,3 +364,3 @@ | ||
return _objectSpread2({}, collect, _defineProperty({}, key, value[prop])); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, key, value[prop])); | ||
}, {}); | ||
@@ -362,3 +375,3 @@ }; | ||
return _objectSpread2({}, collect, _defineProperty({}, key, typeof value === 'function' ? map(value) : value && _typeof(value) === 'object' ? internals.mapEachLeafFunction(value, map) : value)); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, key, typeof value === 'function' ? map(value) : value && _typeof(value) === 'object' ? internals.mapEachLeafFunction(value, map) : value)); | ||
}, {}); | ||
@@ -420,96 +433,91 @@ }; | ||
return ( | ||
/*#__PURE__*/ | ||
function () { | ||
var _ref = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee(dispatch) { | ||
var beginPayload, computedArgs, index, successPayload, error; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
beginPayload = transform.apply(void 0, args); | ||
computedArgs = [].concat(beginPayload); | ||
return /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch) { | ||
var beginPayload, computedArgs, index, successPayload, error; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
beginPayload = transform.apply(void 0, args); | ||
computedArgs = [].concat(beginPayload); | ||
index = function () { | ||
if (!indexed) { | ||
return null; | ||
} | ||
index = function () { | ||
if (!indexed) { | ||
return null; | ||
} | ||
if (typeof indexed === 'string') { | ||
return indexed; | ||
} | ||
if (typeof indexed === 'string') { | ||
return indexed; | ||
} | ||
if (typeof indexed === 'function') { | ||
return indexed.apply(void 0, _toConsumableArray(computedArgs)); | ||
} | ||
if (typeof indexed === 'function') { | ||
return indexed.apply(void 0, _toConsumableArray(computedArgs)); | ||
} | ||
return actionTypes.BASE; | ||
}(); | ||
return actionTypes.BASE; | ||
}(); | ||
_context.prev = 3; | ||
dispatch({ | ||
type: actionTypes.BEGIN, | ||
payload: beginPayload, | ||
meta: { | ||
index: index | ||
} | ||
}); | ||
_context.next = 7; | ||
return handler.apply(void 0, _toConsumableArray(computedArgs)); | ||
_context.prev = 3; | ||
dispatch({ | ||
type: actionTypes.BEGIN, | ||
payload: beginPayload, | ||
meta: { | ||
index: index | ||
} | ||
}); | ||
_context.next = 7; | ||
return handler.apply(void 0, _toConsumableArray(computedArgs)); | ||
case 7: | ||
successPayload = _context.sent; | ||
case 7: | ||
successPayload = _context.sent; | ||
if (schema) { | ||
successPayload = Normalizr.normalize(successPayload, schema); | ||
if (schema) { | ||
successPayload = Normalizr.normalize(successPayload, schema); | ||
} | ||
dispatch({ | ||
type: actionTypes.SUCCESS, | ||
payload: successPayload, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); // after will possibly fire async | ||
dispatch({ | ||
type: actionTypes.SUCCESS, | ||
payload: successPayload, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); // after will possibly fire async | ||
if (after) { | ||
after({ | ||
original: beginPayload, | ||
result: successPayload | ||
}); | ||
} | ||
if (after) { | ||
after({ | ||
original: beginPayload, | ||
result: successPayload | ||
}); | ||
return _context.abrupt("return", [null, successPayload]); | ||
case 14: | ||
_context.prev = 14; | ||
_context.t0 = _context["catch"](3); | ||
error = internals$1.ensureError(_context.t0); | ||
dispatch({ | ||
type: actionTypes.FAIL, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); | ||
return _context.abrupt("return", [error]); | ||
return _context.abrupt("return", [null, successPayload]); | ||
case 14: | ||
_context.prev = 14; | ||
_context.t0 = _context["catch"](3); | ||
error = internals$1.ensureError(_context.t0); | ||
dispatch({ | ||
type: actionTypes.FAIL, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); | ||
return _context.abrupt("return", [error]); | ||
case 19: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
case 19: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[3, 14]]); | ||
})); | ||
} | ||
}, _callee, null, [[3, 14]]); | ||
})); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}() | ||
); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
}; | ||
@@ -564,3 +572,3 @@ }; | ||
if (type.isAsync) { | ||
return _objectSpread2({}, collect, _defineProperty({}, name, { | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, name, { | ||
BASE: base, | ||
@@ -574,6 +582,6 @@ BEGIN: "".concat(base, "/BEGIN"), | ||
if (type.isSimple || type === true) { | ||
return _objectSpread2({}, collect, _defineProperty({}, name, base)); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, name, base)); | ||
} | ||
return _objectSpread2({}, collect, _defineProperty({}, name, type)); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, name, type)); | ||
}, {}); | ||
@@ -752,3 +760,3 @@ }; | ||
}).reduce(function (collect, entity) { | ||
return _objectSpread2({}, collect, _defineProperty({}, entity.key, {})); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, entity.key, {})); | ||
}, {}); | ||
@@ -761,2 +769,28 @@ }; | ||
var Context = React.createContext(); | ||
Context.displayName = 'StrangeMiddleEnd'; | ||
var _export_Provider_ = function Provider(_ref) { | ||
var middleEnd = _ref.middleEnd, | ||
children = _ref.children; | ||
if (!middleEnd || !middleEnd.initialized) { | ||
throw new Error('StrangeMiddleEnd.Provider received an unitialized middle-end. Please pass an initialized middle-end.'); | ||
} | ||
return React.createElement(Context.Provider, { | ||
value: middleEnd | ||
}, children); | ||
}; | ||
var _export_useMiddleEnd_ = function useMiddleEnd() { | ||
var m = React.useContext(Context); | ||
if (!m) { | ||
throw new Error('No middle-end found. Make sure this component is wrapped in strange-middle-end\'s <Provider>.'); | ||
} | ||
return m; | ||
}; | ||
var _export_create_$1 = _export_create_; | ||
@@ -774,3 +808,6 @@ var _export_middleware_$1 = _export_middleware_; | ||
var _export_createEntityReducer_$1 = _export_createEntityReducer_; | ||
var _export_Provider_$1 = _export_Provider_; | ||
var _export_useMiddleEnd_$1 = _export_useMiddleEnd_; | ||
exports.Provider = _export_Provider_$1; | ||
exports.create = _export_create_$1; | ||
@@ -788,2 +825,3 @@ exports.createAction = _export_createAction_$1; | ||
exports.type = _export_type_$1; | ||
exports.useMiddleEnd = _export_useMiddleEnd_$1; | ||
//# sourceMappingURL=strange-middle-end.js.map |
@@ -5,4 +5,7 @@ import { combineReducers } from 'redux'; | ||
import { produce } from 'immer'; | ||
import { createContext, createElement, useContext } from 'react'; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -91,3 +94,3 @@ _typeof = function (obj) { | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
@@ -98,3 +101,3 @@ }); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
@@ -109,15 +112,11 @@ }); | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
@@ -130,10 +129,7 @@ | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _arr = []; | ||
@@ -164,8 +160,25 @@ var _n = true; | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -345,3 +358,3 @@ | ||
return _objectSpread2({}, collect, _defineProperty({}, key, value[prop])); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, key, value[prop])); | ||
}, {}); | ||
@@ -356,3 +369,3 @@ }; | ||
return _objectSpread2({}, collect, _defineProperty({}, key, typeof value === 'function' ? map(value) : value && _typeof(value) === 'object' ? internals.mapEachLeafFunction(value, map) : value)); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, key, typeof value === 'function' ? map(value) : value && _typeof(value) === 'object' ? internals.mapEachLeafFunction(value, map) : value)); | ||
}, {}); | ||
@@ -414,96 +427,91 @@ }; | ||
return ( | ||
/*#__PURE__*/ | ||
function () { | ||
var _ref = _asyncToGenerator( | ||
/*#__PURE__*/ | ||
regeneratorRuntime.mark(function _callee(dispatch) { | ||
var beginPayload, computedArgs, index, successPayload, error; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
beginPayload = transform.apply(void 0, args); | ||
computedArgs = [].concat(beginPayload); | ||
return /*#__PURE__*/function () { | ||
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch) { | ||
var beginPayload, computedArgs, index, successPayload, error; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
beginPayload = transform.apply(void 0, args); | ||
computedArgs = [].concat(beginPayload); | ||
index = function () { | ||
if (!indexed) { | ||
return null; | ||
} | ||
index = function () { | ||
if (!indexed) { | ||
return null; | ||
} | ||
if (typeof indexed === 'string') { | ||
return indexed; | ||
} | ||
if (typeof indexed === 'string') { | ||
return indexed; | ||
} | ||
if (typeof indexed === 'function') { | ||
return indexed.apply(void 0, _toConsumableArray(computedArgs)); | ||
} | ||
if (typeof indexed === 'function') { | ||
return indexed.apply(void 0, _toConsumableArray(computedArgs)); | ||
} | ||
return actionTypes.BASE; | ||
}(); | ||
return actionTypes.BASE; | ||
}(); | ||
_context.prev = 3; | ||
dispatch({ | ||
type: actionTypes.BEGIN, | ||
payload: beginPayload, | ||
meta: { | ||
index: index | ||
} | ||
}); | ||
_context.next = 7; | ||
return handler.apply(void 0, _toConsumableArray(computedArgs)); | ||
_context.prev = 3; | ||
dispatch({ | ||
type: actionTypes.BEGIN, | ||
payload: beginPayload, | ||
meta: { | ||
index: index | ||
} | ||
}); | ||
_context.next = 7; | ||
return handler.apply(void 0, _toConsumableArray(computedArgs)); | ||
case 7: | ||
successPayload = _context.sent; | ||
case 7: | ||
successPayload = _context.sent; | ||
if (schema) { | ||
successPayload = normalize(successPayload, schema); | ||
if (schema) { | ||
successPayload = normalize(successPayload, schema); | ||
} | ||
dispatch({ | ||
type: actionTypes.SUCCESS, | ||
payload: successPayload, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); // after will possibly fire async | ||
dispatch({ | ||
type: actionTypes.SUCCESS, | ||
payload: successPayload, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); // after will possibly fire async | ||
if (after) { | ||
after({ | ||
original: beginPayload, | ||
result: successPayload | ||
}); | ||
} | ||
if (after) { | ||
after({ | ||
original: beginPayload, | ||
result: successPayload | ||
}); | ||
return _context.abrupt("return", [null, successPayload]); | ||
case 14: | ||
_context.prev = 14; | ||
_context.t0 = _context["catch"](3); | ||
error = internals$1.ensureError(_context.t0); | ||
dispatch({ | ||
type: actionTypes.FAIL, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); | ||
return _context.abrupt("return", [error]); | ||
return _context.abrupt("return", [null, successPayload]); | ||
case 14: | ||
_context.prev = 14; | ||
_context.t0 = _context["catch"](3); | ||
error = internals$1.ensureError(_context.t0); | ||
dispatch({ | ||
type: actionTypes.FAIL, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
original: beginPayload, | ||
index: index | ||
} | ||
}); | ||
return _context.abrupt("return", [error]); | ||
case 19: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
case 19: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee, null, [[3, 14]]); | ||
})); | ||
} | ||
}, _callee, null, [[3, 14]]); | ||
})); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}() | ||
); | ||
return function (_x) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
}(); | ||
}; | ||
@@ -558,3 +566,3 @@ }; | ||
if (type.isAsync) { | ||
return _objectSpread2({}, collect, _defineProperty({}, name, { | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, name, { | ||
BASE: base, | ||
@@ -568,6 +576,6 @@ BEGIN: "".concat(base, "/BEGIN"), | ||
if (type.isSimple || type === true) { | ||
return _objectSpread2({}, collect, _defineProperty({}, name, base)); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, name, base)); | ||
} | ||
return _objectSpread2({}, collect, _defineProperty({}, name, type)); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, name, type)); | ||
}, {}); | ||
@@ -746,3 +754,3 @@ }; | ||
}).reduce(function (collect, entity) { | ||
return _objectSpread2({}, collect, _defineProperty({}, entity.key, {})); | ||
return _objectSpread2(_objectSpread2({}, collect), {}, _defineProperty({}, entity.key, {})); | ||
}, {}); | ||
@@ -755,2 +763,28 @@ }; | ||
var Context = createContext(); | ||
Context.displayName = 'StrangeMiddleEnd'; | ||
var _export_Provider_ = function Provider(_ref) { | ||
var middleEnd = _ref.middleEnd, | ||
children = _ref.children; | ||
if (!middleEnd || !middleEnd.initialized) { | ||
throw new Error('StrangeMiddleEnd.Provider received an unitialized middle-end. Please pass an initialized middle-end.'); | ||
} | ||
return createElement(Context.Provider, { | ||
value: middleEnd | ||
}, children); | ||
}; | ||
var _export_useMiddleEnd_ = function useMiddleEnd() { | ||
var m = useContext(Context); | ||
if (!m) { | ||
throw new Error('No middle-end found. Make sure this component is wrapped in strange-middle-end\'s <Provider>.'); | ||
} | ||
return m; | ||
}; | ||
var _export_create_$1 = _export_create_; | ||
@@ -768,4 +802,6 @@ var _export_middleware_$1 = _export_middleware_; | ||
var _export_createEntityReducer_$1 = _export_createEntityReducer_; | ||
var _export_Provider_$1 = _export_Provider_; | ||
var _export_useMiddleEnd_$1 = _export_useMiddleEnd_; | ||
export { _export_create_$1 as create, _export_createAction_$1 as createAction, _export_createEntityReducer_$1 as createEntityReducer, _export_createReducer_$1 as createReducer, _export_createTypes_$1 as createTypes, _export_isTypeBegin_$1 as isTypeBegin, _export_isTypeFail_$1 as isTypeFail, _export_isTypeOfBase_$1 as isTypeOfBase, _export_isTypeSuccess_$1 as isTypeSuccess, _export_middleware_$1 as middleware, _export_relatedFields_$1 as relatedFields, _export_type_$1 as type }; | ||
export { _export_Provider_$1 as Provider, _export_create_$1 as create, _export_createAction_$1 as createAction, _export_createEntityReducer_$1 as createEntityReducer, _export_createReducer_$1 as createReducer, _export_createTypes_$1 as createTypes, _export_isTypeBegin_$1 as isTypeBegin, _export_isTypeFail_$1 as isTypeFail, _export_isTypeOfBase_$1 as isTypeOfBase, _export_isTypeSuccess_$1 as isTypeSuccess, _export_middleware_$1 as middleware, _export_relatedFields_$1 as relatedFields, _export_type_$1 as type, _export_useMiddleEnd_$1 as useMiddleEnd }; | ||
//# sourceMappingURL=strange-middle-end.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("redux"),require("normalizr"),require("redux-thunk"),require("immer")):"function"==typeof define&&define.amd?define(["exports","redux","normalizr","redux-thunk","immer"],t):t((e=e||self).StrangeMiddleEnd={},e.Redux,e.normalizr,e.ReduxThunk,e.immer)}(this,(function(e,t,r,n,i){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t,r,n,i,o,u){try{var a=e[o](u),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,i)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){u(o,n,i,a,c,"next",e)}function c(e){u(o,n,i,a,c,"throw",e)}a(void 0)}))}}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(r,!0).forEach((function(t){c(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(n=(u=a.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function d(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}n=n&&n.hasOwnProperty("default")?n.default:n;var p={},y={thunk:n,errorLogger:function(){return function(e){return function(t){var r=t.type,n=t.error,i=t.payload,o=t.meta;return n&&console.error('Error from action "'.concat(r,'"'),o,"\n",i),e(t)}}}};p.pickEach=function(e,t){return Object.entries(e).filter((function(e){var r=s(e,2)[1];return r&&void 0!==r[t]})).reduce((function(e,r){var n=s(r,2);return l({},e,c({},n[0],n[1][t]))}),{})},p.mapEachLeafFunction=function(e,t){return Object.entries(e).reduce((function(e,r){var n=s(r,2),i=n[0],u=n[1];return l({},e,c({},i,"function"==typeof u?t(u):u&&"object"===o(u)?p.mapEachLeafFunction(u,t):u))}),{})};var v={};v.simpleAction=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"function"==typeof t&&(t={transform:t});var r=t,n=r.transform,i=void 0===n?v.defaultTransform:n;return function(){return{type:e,payload:i.apply(void 0,arguments)}}},v.asyncAction=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"function"==typeof t&&(t={handler:t});var n=t,i=n.handler,o=void 0===i?v.defaultTransform:i,u=n.transform,c=void 0===u?v.defaultTransform:u,f=n.after,l=n.schema,s=n.index,p=void 0!==s&&s;return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return function(){var t=a(regeneratorRuntime.mark((function t(i){var u,a,s,y,h;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=c.apply(void 0,n),a=[].concat(u),s=p?"string"==typeof p?p:"function"==typeof p?p.apply(void 0,d(a)):e.BASE:null,t.prev=3,i({type:e.BEGIN,payload:u,meta:{index:s}}),t.next=7,o.apply(void 0,d(a));case 7:return y=t.sent,l&&(y=r.normalize(y,l)),i({type:e.SUCCESS,payload:y,meta:{original:u,index:s}}),f&&f({original:u,result:y}),t.abrupt("return",[null,y]);case 14:return t.prev=14,t.t0=t.catch(3),h=v.ensureError(t.t0),i({type:e.FAIL,payload:h,error:!0,meta:{original:u,index:s}}),t.abrupt("return",[h]);case 19:case"end":return t.stop()}}),t,null,[[3,14]])})));return function(e){return t.apply(this,arguments)}}()}},v.defaultTransform=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.length<=1?t[0]:t},v.ensureError=function(e){if(e instanceof Error)return e;var t=new Error(e.message);return t.data=e,t};var h=function(e){return e.endsWith("/BEGIN")},m=function(e){return e.endsWith("/SUCCESS")},b=function(e){return e.endsWith("/FAIL")},g={};g.defaultShouldMerge=function(e){return Boolean(e._top)},g.getInitialEntityState=function(e){return Object.values(e).filter((function(e){return e instanceof r.schema.Entity})).reduce((function(e,t){return l({},e,c({},t.key,{}))}),{})},g.isNormalizedPayload=function(e){return e&&e.hasOwnProperty("result")&&e.entities};var E=function(n){var i=n.createStore,o=n.mods,u=void 0===o?{}:o,a={initialized:!1,initialize:function(){return!1!==a.initialized?a:(a.initialized=null,Object.values(p.pickEach(a.mods,"schema")).forEach((function(t){Object.values(t).filter((function(e){return e instanceof r.schema.Entity})).forEach((function(r){r.relatedFields=function(){for(var t,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return(t=e).relatedFields.apply(t,i.concat([{idAttribute:r.idAttribute}]))},r.relations&&r.define(r.relations(t))}))})),Object.values(a.mods).filter((function(e){return e&&e.initialize})).forEach((function(e){return e.initialize(a,e)})),a.initialized=!0,a)}},c=function(e,t){Object.defineProperty(a,e,{configurable:!0,enumerable:!0,get:function(){if(!1===a.initialized)throw new Error('Cannot access property "'.concat(e,'" until middle-end is initialized.'));var r=t();return Object.defineProperty(a,e,{value:r,writable:!0}),r}})};return c("mods",(function(){return"function"==typeof u?u():u})),c("store",(function(){var e=t.combineReducers(p.pickEach(a.mods,"reducer"));return i(e,a.mods)})),c("getState",(function(){return a.store.getState})),c("dispatch",(function(){var e=function(){var e;return(e=a.store).dispatch.apply(e,arguments)};return Object.entries(a.actions).forEach((function(t){var r=s(t,2),n=r[0],i=r[1];e[n]={},Object.entries(i).forEach((function(t){var r=s(t,2),i=r[0],o=r[1];e[n][i]=function(){return e(o.apply(void 0,arguments))}}))})),e})),c("actions",(function(){return p.pickEach(a.mods,"actions")})),c("select",(function(){var e=a.selectors,t=a.getState;return p.mapEachLeafFunction(e,(function(e){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return e.apply(void 0,[t()].concat(n))}}))})),c("selectors",(function(){return p.pickEach(a.mods,"selectors")})),a},O=y,S=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.idAttribute,i=void 0===n?"id":n,o=c({},i,e[i]);return t.forEach((function(t){e.hasOwnProperty(t)&&(o[t]=e[t])})),Object.keys(o).length>1?o:void 0},j=function(e,t){return"string"==typeof e?v.simpleAction(e,t):v.asyncAction(e,t)},w=function(e,t){return t||(t=e,e=null),e=e?"".concat(e,"/"):"",Object.entries(t).reduce((function(t,r){var n=s(r,2),i=n[0],o=n[1],u="".concat(e).concat(i);return o.isAsync?l({},t,c({},i,{BASE:u,BEGIN:"".concat(u,"/BEGIN"),SUCCESS:"".concat(u,"/SUCCESS"),FAIL:"".concat(u,"/FAIL")})):o.isSimple||!0===o?l({},t,c({},i,u)):l({},t,c({},i,o))}),{})},A={async:{isAsync:!0},simple:{isSimple:!0}},x=function(e,t){return e.startsWith("".concat(t,"/"))||e===t},P=h,k=m,z=b,F=function(e,t,r){if(void 0===r&&(r=t,t=e,e={}),r.hasOwnProperty("undefined"))throw new Error("Reducer has an undefined handler. Ensure that all actions used in this reducer exist.");var n=e.mutable;void 0!==n&&n&&(r=l({},r),Object.keys(r).forEach((function(e){r[e]=i.produce(r[e])})));var o=function(e){return"function"==typeof e?e():e};return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o(t),n=arguments.length>1?arguments[1]:void 0;return r.hasOwnProperty(n.type)?r[n.type](e,n):e}},I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.schema,n=void 0===r?{}:r,o=e.shouldMerge,u=void 0===o?g.defaultShouldMerge:o,a=e.shouldIndex,c=void 0===a||a,f="function"==typeof u?u:function(){return u},l="function"==typeof c?c:function(){return c};return t.combineReducers({indexes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=t.type,n=t.payload,o=t.error,u=t.meta;return u&&u.index&&l(u.index)?i.produce(e,(function(e){var t=e[u.index]=e[u.index]||{original:void 0,result:void 0,error:null,inFlight:0};h(r)&&(t.inFlight++,t.original=n),(m(r)||b(r))&&(t.inFlight--,u.hasOwnProperty("original")&&(t.original=u.original)),m(r)&&(t.result=g.isNormalizedPayload(n)?n.result:n,t.error=null),o&&(t.error=n||!0)})):e},entities:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.getInitialEntityState(n),t=arguments.length>1?arguments[1]:void 0,r=t.payload,o=t.error;return o||!g.isNormalizedPayload(r)?e:i.produce(e,(function(t){var n=r.entities;Object.keys(n).forEach((function(r){e[r]&&Object.keys(n[r]).forEach((function(e){var i=n[r][e];f(i)?(t[r][e]=t[r][e]||{},Object.entries(i).forEach((function(n){var i=s(n,2),o=i[0],u=i[1];void 0!==u&&(t[r][e][o]=u)}))):t[r][e]=i}))}))}))}})};e.create=E,e.createAction=j,e.createEntityReducer=I,e.createReducer=F,e.createTypes=w,e.isTypeBegin=P,e.isTypeFail=z,e.isTypeOfBase=x,e.isTypeSuccess=k,e.middleware=O,e.relatedFields=S,e.type=A})); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("redux"),require("normalizr"),require("redux-thunk"),require("immer"),require("react")):"function"==typeof define&&define.amd?define(["exports","redux","normalizr","redux-thunk","immer","react"],r):r((e=e||self).StrangeMiddleEnd={},e.Redux,e.normalizr,e.ReduxThunk,e.immer,e.React)}(this,(function(e,r,t,n,i,o){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,r,t,n,i,o,a){try{var u=e[o](a),c=u.value}catch(e){return void t(e)}u.done?r(c):Promise.resolve(c).then(n,i)}function c(e){return function(){var r=this,t=arguments;return new Promise((function(n,i){var o=e.apply(r,t);function a(e){u(o,n,i,a,c,"next",e)}function c(e){u(o,n,i,a,c,"throw",e)}a(void 0)}))}}function f(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?l(Object(t),!0).forEach((function(r){f(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):l(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function s(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return t}(e,r)||y(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e){return function(e){if(Array.isArray(e))return v(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,r){if(e){if("string"==typeof e)return v(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(e,r):void 0}}function v(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;var h={},m={thunk:n,errorLogger:function(){return function(e){return function(r){var t=r.type,n=r.error,i=r.payload,o=r.meta;return n&&console.error('Error from action "'.concat(t,'"'),o,"\n",i),e(r)}}}};h.pickEach=function(e,r){return Object.entries(e).filter((function(e){var t=s(e,2)[1];return t&&void 0!==t[r]})).reduce((function(e,t){var n=s(t,2),i=n[0],o=n[1];return d(d({},e),{},f({},i,o[r]))}),{})},h.mapEachLeafFunction=function(e,r){return Object.entries(e).reduce((function(e,t){var n=s(t,2),i=n[0],o=n[1];return d(d({},e),{},f({},i,"function"==typeof o?r(o):o&&"object"===a(o)?h.mapEachLeafFunction(o,r):o))}),{})};var b={};b.simpleAction=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"function"==typeof r&&(r={transform:r});var t=r,n=t.transform,i=void 0===n?b.defaultTransform:n;return function(){return{type:e,payload:i.apply(void 0,arguments)}}},b.asyncAction=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"function"==typeof r&&(r={handler:r});var n=r,i=n.handler,o=void 0===i?b.defaultTransform:i,a=n.transform,u=void 0===a?b.defaultTransform:a,f=n.after,l=n.schema,d=n.index,s=void 0!==d&&d;return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return function(){var r=c(regeneratorRuntime.mark((function r(i){var a,c,d,y,v;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=u.apply(void 0,n),c=[].concat(a),d=s?"string"==typeof s?s:"function"==typeof s?s.apply(void 0,p(c)):e.BASE:null,r.prev=3,i({type:e.BEGIN,payload:a,meta:{index:d}}),r.next=7,o.apply(void 0,p(c));case 7:return y=r.sent,l&&(y=t.normalize(y,l)),i({type:e.SUCCESS,payload:y,meta:{original:a,index:d}}),f&&f({original:a,result:y}),r.abrupt("return",[null,y]);case 14:return r.prev=14,r.t0=r.catch(3),v=b.ensureError(r.t0),i({type:e.FAIL,payload:v,error:!0,meta:{original:a,index:d}}),r.abrupt("return",[v]);case 19:case"end":return r.stop()}}),r,null,[[3,14]])})));return function(e){return r.apply(this,arguments)}}()}},b.defaultTransform=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r.length<=1?r[0]:r},b.ensureError=function(e){if(e instanceof Error)return e;var r=new Error(e.message);return r.data=e,r};var g=function(e){return e.endsWith("/BEGIN")},E=function(e){return e.endsWith("/SUCCESS")},O=function(e){return e.endsWith("/FAIL")},S={};S.defaultShouldMerge=function(e){return Boolean(e._top)},S.getInitialEntityState=function(e){return Object.values(e).filter((function(e){return e instanceof t.schema.Entity})).reduce((function(e,r){return d(d({},e),{},f({},r.key,{}))}),{})},S.isNormalizedPayload=function(e){return e&&e.hasOwnProperty("result")&&e.entities};var w=o.createContext();w.displayName="StrangeMiddleEnd";var j=function(n){var i=n.createStore,o=n.mods,a=void 0===o?{}:o,u={initialized:!1,initialize:function(){return!1!==u.initialized||(u.initialized=null,Object.values(h.pickEach(u.mods,"schema")).forEach((function(r){Object.values(r).filter((function(e){return e instanceof t.schema.Entity})).forEach((function(t){t.relatedFields=function(){for(var r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return(r=e).relatedFields.apply(r,i.concat([{idAttribute:t.idAttribute}]))},t.relations&&t.define(t.relations(r))}))})),Object.values(u.mods).filter((function(e){return e&&e.initialize})).forEach((function(e){return e.initialize(u,e)})),u.initialized=!0),u}},c=function(e,r){Object.defineProperty(u,e,{configurable:!0,enumerable:!0,get:function(){if(!1===u.initialized)throw new Error('Cannot access property "'.concat(e,'" until middle-end is initialized.'));var t=r();return Object.defineProperty(u,e,{value:t,writable:!0}),t}})};return c("mods",(function(){return"function"==typeof a?a():a})),c("store",(function(){var e=r.combineReducers(h.pickEach(u.mods,"reducer"));return i(e,u.mods)})),c("getState",(function(){return u.store.getState})),c("dispatch",(function(){var e=function(){var e;return(e=u.store).dispatch.apply(e,arguments)};return Object.entries(u.actions).forEach((function(r){var t=s(r,2),n=t[0],i=t[1];e[n]={},Object.entries(i).forEach((function(r){var t=s(r,2),i=t[0],o=t[1];e[n][i]=function(){return e(o.apply(void 0,arguments))}}))})),e})),c("actions",(function(){return h.pickEach(u.mods,"actions")})),c("select",(function(){var e=u.selectors,r=u.getState;return h.mapEachLeafFunction(e,(function(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return e.apply(void 0,[r()].concat(n))}}))})),c("selectors",(function(){return h.pickEach(u.mods,"selectors")})),u},A=m,P=function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.idAttribute,i=void 0===n?"id":n,o=f({},i,e[i]);return r.forEach((function(r){e.hasOwnProperty(r)&&(o[r]=e[r])})),Object.keys(o).length>1?o:void 0},x=function(e,r){return"string"==typeof e?b.simpleAction(e,r):b.asyncAction(e,r)},z=function(e,r){return r||(r=e,e=null),e=e?"".concat(e,"/"):"",Object.entries(r).reduce((function(r,t){var n=s(t,2),i=n[0],o=n[1],a="".concat(e).concat(i);return o.isAsync?d(d({},r),{},f({},i,{BASE:a,BEGIN:"".concat(a,"/BEGIN"),SUCCESS:"".concat(a,"/SUCCESS"),FAIL:"".concat(a,"/FAIL")})):o.isSimple||!0===o?d(d({},r),{},f({},i,a)):d(d({},r),{},f({},i,o))}),{})},k={async:{isAsync:!0},simple:{isSimple:!0}},I=function(e,r){return e.startsWith("".concat(r,"/"))||e===r},F=g,C=E,T=O,R=function(e,r,t){if(void 0===t&&(t=r,r=e,e={}),t.hasOwnProperty("undefined"))throw new Error("Reducer has an undefined handler. Ensure that all actions used in this reducer exist.");var n=e.mutable;void 0!==n&&n&&(t=d({},t),Object.keys(t).forEach((function(e){t[e]=i.produce(t[e])})));var o=function(e){return"function"==typeof e?e():e};return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o(r),n=arguments.length>1?arguments[1]:void 0;return t.hasOwnProperty(n.type)?t[n.type](e,n):e}},B=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.schema,n=void 0===t?{}:t,o=e.shouldMerge,a=void 0===o?S.defaultShouldMerge:o,u=e.shouldIndex,c=void 0===u||u,f="function"==typeof a?a:function(){return a},l="function"==typeof c?c:function(){return c};return r.combineReducers({indexes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0,t=r.type,n=r.payload,o=r.error,a=r.meta;return a&&a.index&&l(a.index)?i.produce(e,(function(e){var r=e[a.index]=e[a.index]||{original:void 0,result:void 0,error:null,inFlight:0};g(t)&&(r.inFlight++,r.original=n),(E(t)||O(t))&&(r.inFlight--,a.hasOwnProperty("original")&&(r.original=a.original)),E(t)&&(r.result=S.isNormalizedPayload(n)?n.result:n,r.error=null),o&&(r.error=n||!0)})):e},entities:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:S.getInitialEntityState(n),r=arguments.length>1?arguments[1]:void 0,t=r.payload,o=r.error;return o||!S.isNormalizedPayload(t)?e:i.produce(e,(function(r){var n=t.entities;Object.keys(n).forEach((function(t){e[t]&&Object.keys(n[t]).forEach((function(e){var i=n[t][e];f(i)?(r[t][e]=r[t][e]||{},Object.entries(i).forEach((function(n){var i=s(n,2),o=i[0],a=i[1];void 0!==a&&(r[t][e][o]=a)}))):r[t][e]=i}))}))}))}})},M=function(e){var r=e.middleEnd,t=e.children;if(!r||!r.initialized)throw new Error("StrangeMiddleEnd.Provider received an unitialized middle-end. Please pass an initialized middle-end.");return o.createElement(w.Provider,{value:r},t)},N=function(){var e=o.useContext(w);if(!e)throw new Error("No middle-end found. Make sure this component is wrapped in strange-middle-end's <Provider>.");return e};e.Provider=M,e.create=j,e.createAction=x,e.createEntityReducer=B,e.createReducer=R,e.createTypes=z,e.isTypeBegin=F,e.isTypeFail=T,e.isTypeOfBase=I,e.isTypeSuccess=C,e.middleware=A,e.relatedFields=P,e.type=k,e.useMiddleEnd=N})); | ||
//# sourceMappingURL=strange-middle-end.umd.min.js.map |
@@ -7,2 +7,3 @@ 'use strict'; | ||
const Reducers = require('./reducers'); | ||
const ReactBindings = require('./react'); | ||
@@ -32,1 +33,5 @@ exports.create = Core.create; | ||
exports.createEntityReducer = Reducers.createEntityReducer; | ||
exports.Provider = ReactBindings.Provider; | ||
exports.useMiddleEnd = ReactBindings.useMiddleEnd; |
{ | ||
"name": "strange-middle-end", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "a middle-end composer using redux, normalizr, and immer", | ||
@@ -13,4 +13,4 @@ "main": "dist/strange-middle-end.js", | ||
"clean": "rimraf dist", | ||
"test": "lab -a @hapi/code -t 100 -L", | ||
"lint": "lab -dL", | ||
"test": "lab -a @hapi/code -t 100 -L -I 'regeneratorRuntime'", | ||
"lint": "lab -dL -I 'regeneratorRuntime'", | ||
"coveralls": "lab -r lcov | coveralls" | ||
@@ -41,3 +41,4 @@ }, | ||
"immer": ">=1 <7", | ||
"normalizr": "3.x.x" | ||
"normalizr": "3.x.x", | ||
"react": ">=16.8.x <17" | ||
}, | ||
@@ -47,19 +48,22 @@ "devDependencies": { | ||
"@babel/preset-env": "7.x.x", | ||
"@hapi/code": "7.x.x", | ||
"@hapi/lab": "21.x.x", | ||
"@hapi/code": "8.x.x", | ||
"@hapi/lab": "22.x.x", | ||
"@rollup/plugin-node-resolve": "7.x.x", | ||
"@testing-library/react-hooks": "3.x.x", | ||
"coveralls": "3.x.x", | ||
"immer": "6.x.x", | ||
"normalizr": "3.x.x", | ||
"npm-run-all": "4.x.x", | ||
"react": "^16.8.x", | ||
"react-test-renderer": "^16.8.x", | ||
"redux": "4.x.x", | ||
"redux-thunk": "2.x.x", | ||
"rollup": "1.x.x", | ||
"rimraf": "3.x.x", | ||
"rollup": "2.x.x", | ||
"rollup-plugin-babel": "4.x.x", | ||
"rollup-plugin-cjs-es": "0.9.x", | ||
"rollup-plugin-filesize": "6.x.x", | ||
"rollup-plugin-node-resolve": "5.x.x", | ||
"rollup-plugin-cjs-es": "1.x.x", | ||
"rollup-plugin-filesize": "7.x.x", | ||
"rollup-plugin-peer-deps-external": "2.x.x", | ||
"rollup-plugin-terser": "5.x.x", | ||
"immer": "6.x.x", | ||
"normalizr": "3.x.x", | ||
"npm-run-all": "4.x.x", | ||
"rimraf": "3.x.x" | ||
"rollup-plugin-terser": "5.x.x" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174038
15
1805
5
21
1