ackee-http-client
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -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")); |
{ | ||
"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
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
779624
3390
201
0
30
+ Addedackee-redux-token-auth@2.2.10(transitive)
+ Addedhoist-non-react-statics@3.3.2(transitive)
+ Addedimmediate@3.0.6(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedlie@3.1.1(transitive)
+ Addedlocalforage@1.10.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedreact-lifecycles-compat@3.0.4(transitive)
+ Addedreact-redux@5.1.2(transitive)
+ Addedredux@4.2.1(transitive)
- Removedackee-redux-token-auth@1.1.3(transitive)
- Removedredux-saga@0.15.6(transitive)
Updatedackee-redux-token-auth@2.x.x
Updatedaxios@0.18.x
Updatedredux-saga@0.16.x