Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@codetanzania/emis-api-states

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codetanzania/emis-api-states - npm Package Compare versions

Comparing version 0.10.2 to 0.10.3

26

CHANGELOG.md

@@ -0,1 +1,27 @@

#### 0.10.3 (2019-04-08)
##### Build System / Dependencies
* **rollup:** update cjs rollup configs ([93c9e5e7](https://github.com/CodeTanzania/emis-api-states/commit/93c9e5e7779e9495a11a53cb98bea05c3ba6ba01))
##### Chores
* **build:**
* bundle library for v0.10.3 ([75b83b51](https://github.com/CodeTanzania/emis-api-states/commit/75b83b51730e08e87229d3e558aa326cb5c6e26b))
* update bundled lib/es to use latest js features ([c08f6323](https://github.com/CodeTanzania/emis-api-states/commit/c08f6323a1c92db6021fba94a563b61f9c10929d))
* **package.json:** update package version to 0.10.3 ([853ed7de](https://github.com/CodeTanzania/emis-api-states/commit/853ed7decbb169f2d9327a68117a763ee32df9aa))
##### Documentation Changes
* update jsdoc params types ([1e3af387](https://github.com/CodeTanzania/emis-api-states/commit/1e3af38757d8fa890c13058023e4fdce863bfd99))
##### New Features
* **thunks:** normalize error message and supply error arg onError ([da715db8](https://github.com/CodeTanzania/emis-api-states/commit/da715db8fcb114f071491c28f9096a9c536fa5f1))
##### Refactors
* **slice factory:** update exported factory method name ([74c8dec3](https://github.com/CodeTanzania/emis-api-states/commit/74c8dec3f319db399743e7eb8afbfa9d1b9798ad))
* **store:** remove unused method argument ([61d14d93](https://github.com/CodeTanzania/emis-api-states/commit/61d14d93e660b14bbe9b83ee125484f666f74e84))
#### 0.10.2 (2019-03-19)

@@ -2,0 +28,0 @@

2

package.json
{
"name": "@codetanzania/emis-api-states",
"version": "0.10.2",
"version": "0.10.3",
"description": "EMIS Redux state management library",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -121,3 +121,3 @@ import { pluralize, singularize } from 'inflection';

*/
export default function sliceFactory(
export default function createSliceFor(
sliceName,

@@ -124,0 +124,0 @@ initialState = null,

@@ -9,3 +9,3 @@ import { httpActions as client } from '@codetanzania/emis-api-client';

import { actions } from '../store';
import { camelize } from '../utils';
import { camelize, normalizeError } from '../utils';

@@ -46,3 +46,3 @@ /**

*
* @version 0.1.0
* @version 0.2.0
* @since 0.1.0

@@ -68,4 +68,7 @@ */

.catch(error => {
const normalizedError = normalizeError(error);
dispatch(
actions[resourceName][camelize('get', pluralName, 'failure')](error)
actions[resourceName][camelize('get', pluralName, 'failure')](
normalizedError
)
);

@@ -75,3 +78,3 @@

if (isFunction(onError)) {
onError();
onError(error);
}

@@ -94,3 +97,3 @@ });

*
* @version 0.1.0
* @version 0.2.0
* @since 0.1.0

@@ -116,4 +119,7 @@ */

.catch(error => {
const normalizedError = normalizeError(error);
dispatch(
actions[resourceName][camelize('get', singularName, 'failure')](error)
actions[resourceName][camelize('get', singularName, 'failure')](
normalizedError
)
);

@@ -123,3 +129,3 @@

if (isFunction(onError)) {
onError();
onError(error);
}

@@ -142,3 +148,3 @@ });

*
* @version 0.1.0
* @version 0.2.0
* @since 0.1.0

@@ -177,5 +183,6 @@ */

.catch(error => {
const normalizedError = normalizeError(error);
dispatch(
actions[resourceName][camelize('post', singularName, 'failure')](
error
normalizedError
)

@@ -186,3 +193,3 @@ );

if (isFunction(onError)) {
onError();
onError(error);
}

@@ -205,3 +212,3 @@ });

*
* @version 0.1.0
* @version 0.2.0
* @since 0.1.0

@@ -238,4 +245,7 @@ */

.catch(error => {
const normalizedError = normalizeError(error);
dispatch(
actions[resourceName][camelize('put', singularName, 'failure')](error)
actions[resourceName][camelize('put', singularName, 'failure')](
normalizedError
)
);

@@ -245,3 +255,3 @@

if (isFunction(onError)) {
onError();
onError(error);
}

@@ -264,3 +274,3 @@ });

*
* @version 0.1.0
* @version 0.2.0
* @since 0.1.0

@@ -294,5 +304,6 @@ */

.catch(error => {
const normalizedError = normalizeError(error);
dispatch(
actions[resourceName][camelize('delete', singularName, 'failure')](
error
normalizedError
)

@@ -303,3 +314,3 @@ );

if (isFunction(onError)) {
onError();
onError(error);
}

@@ -306,0 +317,0 @@ });

import forIn from 'lodash/forIn';
import get from 'lodash/get';

@@ -4,0 +3,0 @@ import isFunction from 'lodash/isFunction';

import merge from 'lodash/merge';
import { combineReducers } from 'redux';
import { configureStore } from 'redux-starter-kit';
import createResourceFor from './factories/slice';
import createSliceFor from './factories/slice';
import { extractActions, extractReducers } from './utils';

@@ -17,3 +17,3 @@

*
* @param {Array<string>} resources list of api resources
* @param {string[]} resources list of api resources
* @returns {Object} slices resources slice

@@ -29,3 +29,3 @@ *

resources.forEach(resource => {
slices[resource] = createResourceFor(resource);
slices[resource] = createSliceFor(resource);
});

@@ -103,4 +103,4 @@

export const actions = extractActions(resources, slices, store.dispatch);
export const actions = extractActions(resources, slices);
export const { dispatch } = store;
import camelCase from 'lodash/camelCase';
import forIn from 'lodash/forIn';
import get from 'lodash/get';
import cloneDeep from 'lodash/cloneDeep';
import { pluralize } from 'inflection';

@@ -87,1 +89,28 @@

}
/**
* @function
* @name normalizedError
* @description normalize error object from the client to be stored in redux
* store
*
* @param {Object} error error object from the client
* @returns {Object} normalizedError Error object with normalized messages
*
* @version 0.1.0
* @since 0.10.2
*/
export function normalizeError(error) {
const normalizedError = cloneDeep(error);
const errors = get(normalizedError, 'errors', null);
if (errors) {
forIn(errors, (value, key) => {
errors[key] = `${value.name} : ${value.message}`;
});
normalizedError.errors = errors;
}
return normalizedError;
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc