@lab009/erebus
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,10 @@ | ||
## v3.0.1 (2017-03-13) | ||
#### :nail_care: Enhancement | ||
* Fix build for commonjs and es6 | ||
* Update dependencies | ||
#### Committers: 1 | ||
- Oleg Orlov ([Graf009](https://github.com/Graf009)) | ||
## v3.0.0 (2017-03-06) | ||
@@ -2,0 +11,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.reducers = exports.createAction = exports.unionOf = exports.valuesOf = exports.arrayOf = exports.Schema = undefined; | ||
@@ -5,0 +7,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.mergeOptions = undefined; | ||
@@ -5,0 +7,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
@@ -5,0 +7,0 @@ var _normalizr = require('normalizr'); |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
@@ -15,2 +17,4 @@ var _superagent = require('superagent'); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
var prepareOptions = function prepareOptions(_ref) { | ||
@@ -42,3 +46,3 @@ var req = _ref.req, | ||
if (options.auth) { | ||
req.auth.apply(req, options.auth); | ||
req.auth.apply(req, _toConsumableArray(options.auth)); | ||
} | ||
@@ -45,0 +49,0 @@ }; |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.api = undefined; | ||
@@ -5,0 +7,0 @@ |
@@ -1,25 +0,6 @@ | ||
'use strict'; | ||
import { Schema, arrayOf, valuesOf, unionOf } from 'normalizr'; | ||
exports.__esModule = true; | ||
exports.reducers = exports.createAction = exports.unionOf = exports.valuesOf = exports.arrayOf = exports.Schema = undefined; | ||
import createAction from './lib/createAction'; | ||
import * as reducers from './reducers'; | ||
var _normalizr = require('normalizr'); | ||
var _createAction = require('./lib/createAction'); | ||
var _createAction2 = _interopRequireDefault(_createAction); | ||
var _reducers = require('./reducers'); | ||
var reducers = _interopRequireWildcard(_reducers); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.Schema = _normalizr.Schema; | ||
exports.arrayOf = _normalizr.arrayOf; | ||
exports.valuesOf = _normalizr.valuesOf; | ||
exports.unionOf = _normalizr.unionOf; | ||
exports.createAction = _createAction2.default; | ||
exports.reducers = reducers; | ||
export { Schema, arrayOf, valuesOf, unionOf, createAction, reducers }; |
@@ -1,20 +0,5 @@ | ||
'use strict'; | ||
import mapValues from 'lodash.mapvalues'; | ||
import merge from 'lodash.merge'; | ||
import sendRequest from './sendRequest'; | ||
exports.__esModule = true; | ||
exports.mergeOptions = undefined; | ||
var _lodash = require('lodash.mapvalues'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _lodash3 = require('lodash.merge'); | ||
var _lodash4 = _interopRequireDefault(_lodash3); | ||
var _sendRequest = require('./sendRequest'); | ||
var _sendRequest2 = _interopRequireDefault(_sendRequest); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var reserved = ['onResponse', 'onError']; | ||
@@ -71,4 +56,4 @@ var result = function result(fn) { | ||
*/ | ||
var mergeOptions = exports.mergeOptions = function mergeOptions(defaults, opt, state) { | ||
return (0, _lodash2.default)((0, _lodash4.default)({}, defaults, opt), function (v, k, _ref) { | ||
export var mergeOptions = function mergeOptions(defaults, opt, state) { | ||
return mapValues(merge({}, defaults, opt), function (v, k, _ref) { | ||
var _ref$params = _ref.params, | ||
@@ -92,3 +77,3 @@ params = _ref$params === undefined ? {} : _ref$params; | ||
var reqPromise = (0, _sendRequest2.default)({ options: options, dispatch: dispatch }); | ||
var reqPromise = sendRequest({ options: options, dispatch: dispatch }); | ||
reqPromise.catch(noop); | ||
@@ -116,2 +101,2 @@ | ||
exports.default = createAction; | ||
export default createAction; |
@@ -1,11 +0,7 @@ | ||
'use strict'; | ||
import { normalize, arrayOf } from 'normalizr'; | ||
exports.__esModule = true; | ||
var _normalizr = require('normalizr'); | ||
exports.default = function (body, _ref) { | ||
export default (function (body, _ref) { | ||
var collection = _ref.collection, | ||
model = _ref.model; | ||
return (0, _normalizr.normalize)(body, collection ? (0, _normalizr.arrayOf)(model) : model); | ||
}; | ||
return normalize(body, collection ? arrayOf(model) : model); | ||
}); |
@@ -1,15 +0,6 @@ | ||
'use strict'; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
exports.__esModule = true; | ||
import request from 'superagent'; | ||
import entify from './entify'; | ||
var _superagent = require('superagent'); | ||
var _superagent2 = _interopRequireDefault(_superagent); | ||
var _entify = require('./entify'); | ||
var _entify2 = _interopRequireDefault(_entify); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var prepareOptions = function prepareOptions(_ref) { | ||
@@ -41,3 +32,3 @@ var req = _ref.req, | ||
if (options.auth) { | ||
req.auth.apply(req, options.auth); | ||
req.auth.apply(req, _toConsumableArray(options.auth)); | ||
} | ||
@@ -69,3 +60,3 @@ }; | ||
var req = _superagent2.default[options.method.toLowerCase()](options.endpoint); | ||
var req = request[options.method.toLowerCase()](options.endpoint); | ||
prepareOptions({ req: req, options: options }); | ||
@@ -82,3 +73,3 @@ | ||
raw: res.body, | ||
normalized: options.model && (0, _entify2.default)(res.body, options) | ||
normalized: options.model && entify(res.body, options) | ||
} | ||
@@ -97,2 +88,2 @@ }); | ||
exports.default = sendRequest; | ||
export default sendRequest; |
@@ -1,19 +0,8 @@ | ||
'use strict'; | ||
import { handleActions } from 'redux-actions'; | ||
import { Map, Set, fromJS } from 'immutable'; | ||
import compose from 'reduce-reducers'; | ||
exports.__esModule = true; | ||
exports.api = undefined; | ||
var _reduxActions = require('redux-actions'); | ||
var _immutable = require('immutable'); | ||
var _reduceReducers = require('reduce-reducers'); | ||
var _reduceReducers2 = _interopRequireDefault(_reduceReducers); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var initialState = (0, _immutable.Map)({ | ||
subsets: (0, _immutable.Map)(), | ||
entities: (0, _immutable.Map)() | ||
var initialState = Map({ | ||
subsets: Map(), | ||
entities: Map() | ||
}); | ||
@@ -36,3 +25,3 @@ | ||
// return fromJS({ entities: normalized.entities }).mergeDeep(state) | ||
return state.mergeDeep((0, _immutable.fromJS)({ entities: normalized.entities })); | ||
return state.mergeDeep(fromJS({ entities: normalized.entities })); | ||
}; | ||
@@ -49,3 +38,3 @@ | ||
if (!fresh && state.hasIn(path)) return state; | ||
var record = (0, _immutable.Map)({ | ||
var record = Map({ | ||
id: subset, | ||
@@ -67,3 +56,3 @@ pending: true | ||
return state.updateIn(path, function (subsetState) { | ||
return subsetState.set('data', (0, _immutable.fromJS)(raw)).set('entities', normalized ? (0, _immutable.Set)(ensureArray(normalized.result)) : (0, _immutable.Set)()).set('pending', false).set('error', null); | ||
return subsetState.set('data', fromJS(raw)).set('entities', normalized ? Set(ensureArray(normalized.result)) : Set()).set('pending', false).set('error', null); | ||
}); | ||
@@ -85,6 +74,6 @@ }; | ||
// exported actions | ||
var api = exports.api = (0, _reduxActions.handleActions)({ // eslint-disable-line import/prefer-default-export | ||
export var api = handleActions({ // eslint-disable-line import/prefer-default-export | ||
'erebus.request': createSubset, | ||
'erebus.failure': setSubsetError, | ||
'erebus.success': (0, _reduceReducers2.default)(setSubsetData, addEntities) | ||
'erebus.success': compose(setSubsetData, addEntities) | ||
}, initialState); |
{ | ||
"name": "@lab009/erebus", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Dead-simple API actions for Redux", | ||
@@ -35,3 +35,3 @@ "repository": "lab009/erebus", | ||
"preversion": "yarn run clean && yarn run build", | ||
"test": "jest", | ||
"test": "cross-env BABEL_ENV=commonjs jest", | ||
"test:coverage": "yarn run test -- --coverage", | ||
@@ -50,6 +50,6 @@ "test:coverage:deploy": "yarn run test:coverage && codecov" | ||
"devDependencies": { | ||
"@lab009/babel-preset-magma": "3.0.2", | ||
"@lab009/eslint-config-magma": "3.0.3", | ||
"babel-cli": "6.23.0", | ||
"babel-core": "6.23.1", | ||
"@lab009/babel-preset-magma": "3.1.0", | ||
"@lab009/eslint-config-magma": "3.0.4", | ||
"babel-cli": "6.24.0", | ||
"babel-core": "6.24.0", | ||
"babel-jest": "19.0.0", | ||
@@ -60,3 +60,3 @@ "codecov": "1.0.1", | ||
"enzyme-to-json": "1.5.0", | ||
"eslint": "3.16.1", | ||
"eslint": "3.17.1", | ||
"eslint-plugin-import": "2.2.0", | ||
@@ -63,0 +63,0 @@ "eslint-plugin-jsx-a11y": "4.0.0", |
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
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
20807
481