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

redux-nl

Package Overview
Dependencies
Maintainers
5
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-nl - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

1

lib/abstract-network-saga.d.ts

@@ -19,2 +19,3 @@ /**

payload: any;
replaceType: any;
meta: any;

@@ -21,0 +22,0 @@ error: boolean;

15

lib/abstract-network-saga.js

@@ -23,8 +23,9 @@ "use strict";

function* AbstractNetworkSaga(action, baseUrl, api, type, key = "requestTimestamp") {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
const payloadChain = (_b = (_a = action.payload) === null || _a === void 0 ? void 0 : _a.chain) !== null && _b !== void 0 ? _b : {};
const metaChain = (_d = (_c = action.meta) === null || _c === void 0 ? void 0 : _c.chain) !== null && _d !== void 0 ? _d : {};
const replaceType = (_e = action.replaceType) !== null && _e !== void 0 ? _e : {};
try {
const payload = (_e = action.payload) !== null && _e !== void 0 ? _e : {};
const meta = (_f = action.meta) !== null && _f !== void 0 ? _f : {};
const payload = (_f = action.payload) !== null && _f !== void 0 ? _f : {};
const meta = (_g = action.meta) !== null && _g !== void 0 ? _g : {};
// In development we can add a delay to successful network requests

@@ -38,2 +39,3 @@ if (config_1.config.isDev)

payload: Object.assign({ data, [key]: new Date().toISOString() }, payloadChain),
replaceType: replaceType,
meta: Object.assign({}, metaChain),

@@ -46,8 +48,9 @@ error: false

console.warn(e); // eslint-disable-line no-console
const status = (_g = e === null || e === void 0 ? void 0 : e.response) === null || _g === void 0 ? void 0 : _g.status;
const data = (_j = (_h = e === null || e === void 0 ? void 0 : e.response) === null || _h === void 0 ? void 0 : _h.data) !== null && _j !== void 0 ? _j : {};
const message = (_k = data === null || data === void 0 ? void 0 : data.message) !== null && _k !== void 0 ? _k : config_1.config.errorMessage;
const status = (_h = e === null || e === void 0 ? void 0 : e.response) === null || _h === void 0 ? void 0 : _h.status;
const data = (_k = (_j = e === null || e === void 0 ? void 0 : e.response) === null || _j === void 0 ? void 0 : _j.data) !== null && _k !== void 0 ? _k : {};
const message = (_l = data === null || data === void 0 ? void 0 : data.message) !== null && _l !== void 0 ? _l : config_1.config.errorMessage;
yield effects_1.put({
type,
payload: Object.assign(Object.assign({ status, message }, data), payloadChain),
replaceType: replaceType,
meta: Object.assign({}, metaChain),

@@ -54,0 +57,0 @@ error: true

@@ -24,4 +24,5 @@ "use strict";

*/
exports.ActionReducer = (state = initialState, action) => {
const ActionReducer = (state = initialState, action) => {
return Object.assign(Object.assign({}, state), action);
};
exports.ActionReducer = ActionReducer;

@@ -25,3 +25,3 @@ "use strict";

const requestPath = action.payload[ReduxNLPath];
const responseAction = get_response_type_1.getResponseType(requestVerb, requestPath);
const responseAction = !action.replaceType ? get_response_type_1.getResponseType(requestVerb, requestPath) : get_response_type_1.getResponseType(requestVerb, action.replaceType);
const requestPromise = (baseUrl, payload = {}, meta = {}) => {

@@ -28,0 +28,0 @@ return new Promise((resolve, reject) => {

@@ -35,4 +35,5 @@ /**

*/
post: (path: string, { payload, meta, onSuccess, onFailure, onFinal }: {
post: (path: string, { payload, replaceType, meta, onSuccess, onFailure, onFinal }: {
payload: object;
replaceType?: string | undefined;
meta: object;

@@ -50,4 +51,5 @@ onSuccess?: ((action: object) => void) | undefined;

*/
patch: (path: string, { payload, meta, onSuccess, onFailure, onFinal }: {
patch: (path: string, { payload, replaceType, meta, onSuccess, onFailure, onFinal }: {
payload: object;
replaceType?: string | undefined;
meta: object;

@@ -65,4 +67,5 @@ onSuccess?: ((action: object) => void) | undefined;

*/
put: (path: string, { payload, meta, onSuccess, onFailure, onFinal }: {
put: (path: string, { payload, replaceType, meta, onSuccess, onFailure, onFinal }: {
payload: object;
replaceType?: string | undefined;
meta: object;

@@ -80,4 +83,5 @@ onSuccess?: ((action: object) => void) | undefined;

*/
get: (path: string, { payload, meta, onSuccess, onFailure, onFinal }: {
get: (path: string, { payload, replaceType, meta, onSuccess, onFailure, onFinal }: {
payload: object;
replaceType?: string | undefined;
meta: object;

@@ -95,4 +99,5 @@ onSuccess?: ((action: object) => void) | undefined;

*/
delete: (path: string, { payload, meta, onSuccess, onFailure, onFinal }: {
delete: (path: string, { payload, replaceType, meta, onSuccess, onFailure, onFinal }: {
payload: object;
replaceType?: string | undefined;
meta: object;

@@ -103,3 +108,3 @@ onSuccess?: ((action: object) => void) | undefined;

}) => void;
dispatch: ({ verb, path, payload, meta, onSuccess, onFailure, onFinal }: {
dispatch: ({ verb, path, payload, replaceType, meta, onSuccess, onFailure, onFinal }: {
verb: RestVerbType;

@@ -109,2 +114,3 @@ path: string;

meta: object;
replaceType?: string | undefined;
onSuccess?: ((action: object) => void) | undefined;

@@ -115,20 +121,25 @@ onFailure?: ((action: object) => void) | undefined;

promise: {
post: (path: string, { payload, meta }: {
post: (path: string, { payload, replaceType, meta }: {
payload: object;
replaceType: string;
meta: object;
}) => Promise<unknown>;
put: (path: string, { payload, meta }: {
put: (path: string, { payload, replaceType, meta }: {
payload: object;
replaceType: string;
meta: object;
}) => Promise<unknown>;
get: (path: string, { payload, meta }: {
get: (path: string, { payload, replaceType, meta }: {
payload: object;
replaceType: string;
meta: object;
}) => Promise<unknown>;
patch: (path: string, { payload, meta }: {
patch: (path: string, { payload, replaceType, meta }: {
payload: object;
replaceType: string;
meta: object;
}) => Promise<unknown>;
delete: (path: string, { payload, meta }: {
delete: (path: string, { payload, replaceType, meta }: {
payload: object;
replaceType: string;
meta: object;

@@ -135,0 +146,0 @@ }) => Promise<unknown>;

@@ -48,3 +48,3 @@ "use strict";

*/
post: (path, { payload, meta, onSuccess, onFailure, onFinal }) => {
post: (path, { payload, replaceType, meta, onSuccess, onFailure, onFinal }) => {
exports.ReduxNL.dispatch({

@@ -54,2 +54,3 @@ verb: rest_verbs_1.RestVerbs.Post,

payload,
replaceType,
meta,

@@ -68,3 +69,3 @@ onSuccess,

*/
patch: (path, { payload, meta, onSuccess, onFailure, onFinal }) => {
patch: (path, { payload, replaceType, meta, onSuccess, onFailure, onFinal }) => {
exports.ReduxNL.dispatch({

@@ -74,2 +75,3 @@ verb: rest_verbs_1.RestVerbs.Patch,

payload,
replaceType,
meta,

@@ -88,3 +90,3 @@ onSuccess,

*/
put: (path, { payload, meta, onSuccess, onFailure, onFinal }) => {
put: (path, { payload, replaceType, meta, onSuccess, onFailure, onFinal }) => {
exports.ReduxNL.dispatch({

@@ -94,2 +96,3 @@ verb: rest_verbs_1.RestVerbs.Put,

payload,
replaceType,
meta,

@@ -108,3 +111,3 @@ onSuccess,

*/
get: (path, { payload, meta, onSuccess, onFailure, onFinal }) => {
get: (path, { payload, replaceType, meta, onSuccess, onFailure, onFinal }) => {
exports.ReduxNL.dispatch({

@@ -114,2 +117,3 @@ verb: rest_verbs_1.RestVerbs.Get,

payload,
replaceType,
meta,

@@ -128,3 +132,3 @@ onSuccess,

*/
delete: (path, { payload, meta, onSuccess, onFailure, onFinal }) => {
delete: (path, { payload, replaceType, meta, onSuccess, onFailure, onFinal }) => {
exports.ReduxNL.dispatch({

@@ -134,2 +138,3 @@ verb: rest_verbs_1.RestVerbs.Delete,

payload,
replaceType,
meta,

@@ -141,5 +146,5 @@ onSuccess,

},
dispatch: ({ verb, path, payload, meta, onSuccess, onFailure, onFinal }) => {
const requestAction = get_request_type_1.getRequestType(verb, path);
const responseAction = get_response_type_1.getResponseType(verb, path);
dispatch: ({ verb, path, payload, replaceType, meta, onSuccess, onFailure, onFinal }) => {
const requestAction = !replaceType ? get_request_type_1.getRequestType(verb, path) : get_request_type_1.getRequestType(verb, replaceType);
const responseAction = !replaceType ? get_response_type_1.getResponseType(verb, path) : get_response_type_1.getResponseType(verb, replaceType);
let currentValue;

@@ -171,2 +176,3 @@ let unsubscribe;

payload: Object.assign(Object.assign({}, payload), { [ReduxNLVerb]: verb, [ReduxNLPath]: path }),
replaceType,
meta

@@ -178,6 +184,7 @@ });

promise: {
post: (path, { payload, meta }) => {
post: (path, { payload, replaceType, meta }) => {
return new Promise((resolve, reject) => {
exports.ReduxNL.post(path, {
payload,
replaceType,
meta,

@@ -193,6 +200,7 @@ onSuccess: action => {

},
put: (path, { payload, meta }) => {
put: (path, { payload, replaceType, meta }) => {
return new Promise((resolve, reject) => {
exports.ReduxNL.put(path, {
payload,
replaceType,
meta,

@@ -208,6 +216,7 @@ onSuccess: action => {

},
get: (path, { payload, meta }) => {
get: (path, { payload, replaceType, meta }) => {
return new Promise((resolve, reject) => {
exports.ReduxNL.get(path, {
payload,
replaceType,
meta,

@@ -223,6 +232,7 @@ onSuccess: action => {

},
patch: (path, { payload, meta }) => {
patch: (path, { payload, replaceType, meta }) => {
return new Promise((resolve, reject) => {
exports.ReduxNL.get(path, {
payload,
replaceType,
meta,

@@ -238,6 +248,7 @@ onSuccess: action => {

},
delete: (path, { payload, meta }) => {
delete: (path, { payload, replaceType, meta }) => {
return new Promise((resolve, reject) => {
exports.ReduxNL.get(path, {
payload,
replaceType,
meta,

@@ -244,0 +255,0 @@ onSuccess: action => {

@@ -73,3 +73,3 @@ {

},
"version": "1.4.0",
"version": "1.4.1",
"devDependencies": {

@@ -76,0 +76,0 @@ "@redux-saga/types": "^1.1.0",

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