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

ackee-http-client

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ackee-http-client - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

es/saga-effects/cancelableTask.js

2

es/index.js

@@ -11,2 +11,4 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

export { default as create } from './create';
import * as _sagaEffects from './saga-effects';
export { _sagaEffects as sagaEffects };
export function saga() {

@@ -13,0 +15,0 @@ var sagas, tasks;

@@ -17,2 +17,3 @@ "use strict";

});
exports.sagaEffects = void 0;

@@ -29,2 +30,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var _sagaEffects = _interopRequireWildcard(require("./saga-effects"));
exports.sagaEffects = _sagaEffects;
var _marked =

@@ -31,0 +36,0 @@ /*#__PURE__*/

@@ -1,1 +0,23 @@

"use strict";
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "takeLatestRequest", {
enumerable: true,
get: function get() {
return _takeLatestRequest.default;
}
});
Object.defineProperty(exports, "takeRequest", {
enumerable: true,
get: function get() {
return _takeRequest.default;
}
});
var _takeLatestRequest = _interopRequireDefault(require("./takeLatestRequest"));
var _takeRequest = _interopRequireDefault(require("./takeRequest"));

@@ -1,1 +0,76 @@

"use strict";
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = takeLatestRequest;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _effects = require("redux-saga/effects");
var _cancelableTask = _interopRequireDefault(require("../cancelableTask"));
var _marked =
/*#__PURE__*/
_regenerator.default.mark(takeLatestRequest);
/**
* @param {{ REQUEST: String, cancelTask: Function }} params
* @param {Function} task
*/
function takeLatestRequest(_ref, task) {
var REQUEST, cancelTask, runningTask;
return _regenerator.default.wrap(function takeLatestRequest$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
REQUEST = _ref.REQUEST, cancelTask = _ref.cancelTask;
runningTask = null;
_context2.next = 4;
return (0, _effects.takeEvery)(REQUEST,
/*#__PURE__*/
_regenerator.default.mark(function _callee(action) {
return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!runningTask) {
_context.next = 4;
break;
}
_context.next = 3;
return (0, _effects.put)(cancelTask(action));
case 3:
runningTask = null;
case 4:
_context.next = 6;
return (0, _effects.fork)(_cancelableTask.default, {
task: task,
taskArg: action,
CANCEL: cancelTask(action).type
});
case 6:
runningTask = _context.sent;
case 7:
case "end":
return _context.stop();
}
}
}, _callee, this);
}));
case 4:
case "end":
return _context2.stop();
}
}
}, _marked, this);
}

@@ -1,1 +0,65 @@

"use strict";
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = takeRequest;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _effects = require("redux-saga/effects");
var _cancelableTask = _interopRequireDefault(require("../cancelableTask"));
var _marked =
/*#__PURE__*/
_regenerator.default.mark(takeRequest);
/**
* Blocking custom saga effect that can actually cancel the API request
* @param {{ REQUEST: String, CANCEL: String }} actionTypes
* @param {Function} task
*/
function takeRequest() {
var actionTypes,
task,
action,
_args = arguments;
return _regenerator.default.wrap(function takeRequest$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
actionTypes = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
task = _args.length > 1 ? _args[1] : undefined;
case 2:
if (!true) {
_context.next = 10;
break;
}
_context.next = 5;
return (0, _effects.take)(actionTypes.REQUEST);
case 5:
action = _context.sent;
_context.next = 8;
return (0, _cancelableTask.default)({
task: task,
taskArg: action,
CANCEL: actionTypes.CANCEL
});
case 8:
_context.next = 2;
break;
case 10:
case "end":
return _context.stop();
}
}
}, _marked, this);
}

@@ -1,1 +0,31 @@

"use strict";
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
cancelableTask: true
};
Object.defineProperty(exports, "cancelableTask", {
enumerable: true,
get: function get() {
return _cancelableTask.default;
}
});
var _effects = require("./effects");
Object.keys(_effects).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _effects[key];
}
});
});
var _cancelableTask = _interopRequireDefault(require("./cancelableTask"));

12

package.json
{
"name": "ackee-http-client",
"version": "1.0.0",
"version": "1.1.0",
"description": "",

@@ -18,2 +18,6 @@ "main": "lib/index.js",

"license": "MIT",
"repository": {
"type": "git",
"url": "https://gitlab.ack.ee/Web/http-client"
},
"devDependencies": {

@@ -40,6 +44,6 @@ "@babel/cli": "^7.0.0",

"@babel/runtime": "^7.1.5",
"ackee-redux-token-auth": "^1.0.1",
"axios": "^0.18.0",
"redux-saga": "^0.16.2"
"ackee-redux-token-auth": "2.x.x",
"axios": "0.18.x",
"redux-saga": "0.16.x"
}
}

@@ -12,2 +12,3 @@ # ackee-http-client

- [saga](#api-saga)
- [Saga Effects](#api-saga-effects)

@@ -197,1 +198,5 @@ ---

```
### <a name="api-saga-effects"></a> Saga Effects
Custom Saga effects with built-in cancelation of API requests, [see the docs](https://gitlab.ack.ee/Web/token-auth/blob/master/src/saga-effects/saga-effects.md).

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