async-deco
Advanced tools
Comparing version 9.1.6 to 9.1.7
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = addLogger; | ||
exports["default"] = addLogger; | ||
exports.getLogger = getLogger; | ||
@@ -30,5 +30,7 @@ | ||
require("core-js/modules/es6.object.to-string"); | ||
var _funcRenamer = _interopRequireDefault(require("./utils/func-renamer")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -47,3 +49,3 @@ var generateId = function generateId() { | ||
if (typeof func !== 'function') throw new Error('addLogger: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)(func.name || 'anonymous'); | ||
var renamer = (0, _funcRenamer["default"])(func.name || 'anonymous'); | ||
return renamer(function () { | ||
@@ -50,0 +52,0 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = getAtomicDecorator; | ||
exports["default"] = getAtomicDecorator; | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.function.name"); | ||
@@ -21,3 +23,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -31,7 +33,7 @@ var returnDefault = function returnDefault() { | ||
var getKey = opts.getKey || returnDefault; | ||
var lockObj = opts.lock || new _lock.default(); | ||
var lockObj = opts.lock || new _lock["default"](); | ||
var ttl = opts.ttl || 1000; | ||
return function atomic(func) { | ||
if (typeof func !== 'function') throw new Error('atomic: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("atomic(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("atomic(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _atomic() { | ||
@@ -63,3 +65,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
resolve(res); | ||
}).catch(function (e) { | ||
})["catch"](function (e) { | ||
lock.unlock(logError); | ||
@@ -66,0 +68,0 @@ reject(e); |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getBalanceDecorator; | ||
exports["default"] = getBalanceDecorator; | ||
@@ -23,3 +23,3 @@ require("core-js/modules/es6.function.name"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -34,3 +34,3 @@ function getBalanceDecorator() { | ||
}); | ||
var renamer = (0, _funcRenamer.default)("balance(".concat(funcs.map(function (func) { | ||
var renamer = (0, _funcRenamer["default"])("balance(".concat(funcs.map(function (func) { | ||
return func.name || 'anonymous'; | ||
@@ -56,3 +56,3 @@ }).join(','), ")")); | ||
return res; | ||
}).catch(function (err) { | ||
})["catch"](function (err) { | ||
loads[selected]--; | ||
@@ -59,0 +59,0 @@ throw err; |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = getCacheDecorator; | ||
exports["default"] = getCacheDecorator; | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.function.name"); | ||
@@ -21,3 +23,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -34,3 +36,3 @@ var always = function always() { | ||
if (typeof func !== 'function') throw new Error('cache: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("cache(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("cache(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _cache() { | ||
@@ -49,3 +51,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
}); | ||
func.apply(context, args).then(resolve).catch(reject); | ||
func.apply(context, args).then(resolve)["catch"](reject); | ||
} else if (cacheQuery.cached === true && !cacheQuery.stale) { | ||
@@ -59,3 +61,3 @@ logger('cache-hit', { | ||
// no cache | ||
func.apply(context, args).then(resolve).catch(reject); | ||
func.apply(context, args).then(resolve)["catch"](reject); | ||
} else { | ||
@@ -82,3 +84,3 @@ logger('cache-miss', { | ||
resolve(res); | ||
}).catch(reject); | ||
})["catch"](reject); | ||
} | ||
@@ -85,0 +87,0 @@ }); |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = getDedupeDecorator; | ||
exports["default"] = getDedupeDecorator; | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.function.name"); | ||
@@ -23,3 +25,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -33,8 +35,8 @@ var returnDefault = function returnDefault() { | ||
var getKey = opts.getKey || returnDefault; | ||
var lockObj = opts.lock || new _lock.default(); | ||
var functionBus = opts.functionBus || new _functionBus.default(); | ||
var lockObj = opts.lock || new _lock["default"](); | ||
var functionBus = opts.functionBus || new _functionBus["default"](); | ||
var ttl = opts.ttl || 1000; | ||
return function dedupe(func) { | ||
if (typeof func !== 'function') throw new Error('dedupe: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("dedupe(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("dedupe(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _dedupe() { | ||
@@ -66,3 +68,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
lock.unlock(); | ||
}).catch(function (err) { | ||
})["catch"](function (err) { | ||
functionBus.execute(cacheKey, err); | ||
@@ -69,0 +71,0 @@ lock.unlock(); |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
require("core-js/modules/es6.object.create"); | ||
require("core-js/modules/es6.function.name"); | ||
function LimitError(message) { | ||
@@ -22,3 +24,3 @@ this.name = 'LimitError'; | ||
var _default = LimitError; | ||
exports.default = _default; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
require("core-js/modules/es6.object.create"); | ||
require("core-js/modules/es6.function.name"); | ||
function TimeoutError(message) { | ||
@@ -22,3 +24,3 @@ this.name = 'TimeoutError'; | ||
var _default = TimeoutError; | ||
exports.default = _default; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = getFallbackCacheDecorator; | ||
exports["default"] = getFallbackCacheDecorator; | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.function.name"); | ||
@@ -21,3 +23,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -36,3 +38,3 @@ var always = function always() { | ||
if (typeof func !== 'function') throw new Error('fallbackCache: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("fallbackCache(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("fallbackCache(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _fallbackCache() { | ||
@@ -59,3 +61,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
return res; | ||
}).catch(function (err) { | ||
})["catch"](function (err) { | ||
return new Promise(function (resolve, reject) { | ||
@@ -62,0 +64,0 @@ cache.query(args, function (e, cacheQuery) { |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getFallbackDecorator; | ||
exports["default"] = getFallbackDecorator; | ||
@@ -17,3 +17,3 @@ require("core-js/modules/es6.function.name"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -36,3 +36,3 @@ function getFallbackDecorator() { | ||
if (typeof func !== 'function') throw new Error('fallback: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("fallback(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("fallback(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _fallback() { | ||
@@ -45,3 +45,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
var logger = (0, _addLogger.getLogger)(context); | ||
return func.apply(context, args).catch(function (err) { | ||
return func.apply(context, args)["catch"](function (err) { | ||
logger('fallback', { | ||
@@ -48,0 +48,0 @@ err: err |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = getGuardDecorator; | ||
exports["default"] = getGuardDecorator; | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.function.name"); | ||
@@ -19,3 +21,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -28,3 +30,3 @@ function getGuardDecorator() { | ||
if (typeof func !== 'function') throw new Error('guard: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("guard(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("guard(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _guard() { | ||
@@ -39,3 +41,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
return check.apply(context, args); | ||
}).catch(function (err) { | ||
})["catch"](function (err) { | ||
logger('guard-denied', { | ||
@@ -42,0 +44,0 @@ err: err |
@@ -11,3 +11,3 @@ "use strict"; | ||
get: function get() { | ||
return _addLogger.default; | ||
return _addLogger["default"]; | ||
} | ||
@@ -24,3 +24,3 @@ }); | ||
get: function get() { | ||
return _atomic.default; | ||
return _atomic["default"]; | ||
} | ||
@@ -31,3 +31,3 @@ }); | ||
get: function get() { | ||
return _balance.default; | ||
return _balance["default"]; | ||
} | ||
@@ -38,3 +38,3 @@ }); | ||
get: function get() { | ||
return _cache.default; | ||
return _cache["default"]; | ||
} | ||
@@ -45,3 +45,3 @@ }); | ||
get: function get() { | ||
return _dedupe.default; | ||
return _dedupe["default"]; | ||
} | ||
@@ -52,3 +52,3 @@ }); | ||
get: function get() { | ||
return _fallbackCache.default; | ||
return _fallbackCache["default"]; | ||
} | ||
@@ -59,3 +59,3 @@ }); | ||
get: function get() { | ||
return _fallback.default; | ||
return _fallback["default"]; | ||
} | ||
@@ -66,3 +66,3 @@ }); | ||
get: function get() { | ||
return _limit.default; | ||
return _limit["default"]; | ||
} | ||
@@ -73,3 +73,3 @@ }); | ||
get: function get() { | ||
return _log.default; | ||
return _log["default"]; | ||
} | ||
@@ -80,3 +80,3 @@ }); | ||
get: function get() { | ||
return _memoize.default; | ||
return _memoize["default"]; | ||
} | ||
@@ -87,3 +87,3 @@ }); | ||
get: function get() { | ||
return _guard.default; | ||
return _guard["default"]; | ||
} | ||
@@ -94,3 +94,3 @@ }); | ||
get: function get() { | ||
return _purgeCache.default; | ||
return _purgeCache["default"]; | ||
} | ||
@@ -101,3 +101,3 @@ }); | ||
get: function get() { | ||
return _retry.default; | ||
return _retry["default"]; | ||
} | ||
@@ -108,3 +108,3 @@ }); | ||
get: function get() { | ||
return _timeout.default; | ||
return _timeout["default"]; | ||
} | ||
@@ -115,3 +115,3 @@ }); | ||
get: function get() { | ||
return _limitError.default; | ||
return _limitError["default"]; | ||
} | ||
@@ -122,3 +122,3 @@ }); | ||
get: function get() { | ||
return _timeoutError.default; | ||
return _timeoutError["default"]; | ||
} | ||
@@ -147,3 +147,3 @@ }); | ||
get: function get() { | ||
return _compose.default; | ||
return _compose["default"]; | ||
} | ||
@@ -154,3 +154,3 @@ }); | ||
get: function get() { | ||
return _functionBus.default; | ||
return _functionBus["default"]; | ||
} | ||
@@ -161,3 +161,3 @@ }); | ||
get: function get() { | ||
return _lock.default; | ||
return _lock["default"]; | ||
} | ||
@@ -206,2 +206,2 @@ }); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getLimitDecorator; | ||
exports["default"] = getLimitDecorator; | ||
@@ -19,2 +19,4 @@ require("core-js/modules/es6.function.bind"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.string.iterator"); | ||
@@ -32,3 +34,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -49,3 +51,3 @@ var returnDefault = function returnDefault() { | ||
if (typeof func !== 'function') throw new Error('limit: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("limit(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("limit(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _limit() { | ||
@@ -65,3 +67,3 @@ var context = this; | ||
if (!queues.has(cacheKey)) queues.set(cacheKey, new _funqueue.default({ | ||
if (!queues.has(cacheKey)) queues.set(cacheKey, new _funqueue["default"]({ | ||
concurrency: concurrency, | ||
@@ -74,4 +76,4 @@ queueSize: queueSize, | ||
}); | ||
return queues.get(cacheKey).exec(func.bind(context), args).catch(function (e) { | ||
if (e instanceof _limitError.default) { | ||
return queues.get(cacheKey).exec(func.bind(context), args)["catch"](function (e) { | ||
if (e instanceof _limitError["default"]) { | ||
logger('limit-drop', { | ||
@@ -78,0 +80,0 @@ key: cacheKey |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getLogDecorator; | ||
exports["default"] = getLogDecorator; | ||
@@ -17,3 +17,3 @@ require("core-js/modules/es6.function.name"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -25,3 +25,3 @@ function getLogDecorator() { | ||
if (typeof func !== 'function') throw new Error('log: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("log".concat(prefix, "(").concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("log".concat(prefix, "(").concat(func.name || 'anonymous', ")")); | ||
return renamer(function _log() { | ||
@@ -41,3 +41,3 @@ var context = this; | ||
return res; | ||
}).catch(function (err) { | ||
})["catch"](function (err) { | ||
logger(prefix + 'log-error', { | ||
@@ -44,0 +44,0 @@ err: err |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getMemoizeDecorator; | ||
exports["default"] = getMemoizeDecorator; | ||
@@ -19,3 +19,3 @@ require("core-js/modules/es6.function.name"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -27,4 +27,4 @@ function getMemoizeDecorator() { | ||
return function memoize(func) { | ||
var renamer = (0, _funcRenamer.default)("memoize(".concat(func.name || 'anonymous', ")")); | ||
var cache = new _lruCache.default({ | ||
var renamer = (0, _funcRenamer["default"])("memoize(".concat(func.name || 'anonymous', ")")); | ||
var cache = new _lruCache["default"]({ | ||
maxLen: len, | ||
@@ -38,3 +38,3 @@ defaultTTL: ttl | ||
var key = _objId.default.getIdFromValues(deps); | ||
var key = _objId["default"].getIdFromValues(deps); | ||
@@ -41,0 +41,0 @@ if (cache.has(key)) { |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getOnFulfilled; | ||
exports["default"] = getOnFulfilled; | ||
@@ -15,3 +15,3 @@ require("core-js/modules/es6.function.name"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -22,3 +22,3 @@ function getOnFulfilled(fallback) { | ||
if (typeof func !== 'function') throw new Error('onFulfilled: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("".concat(fallback.name || '_', "(").concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("".concat(fallback.name || '_', "(").concat(func.name || 'anonymous', ")")); | ||
return renamer(function _onFulfilled() { | ||
@@ -25,0 +25,0 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getOnRejected; | ||
exports["default"] = getOnRejected; | ||
@@ -15,3 +15,3 @@ require("core-js/modules/es6.function.name"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -22,3 +22,3 @@ function getOnRejected(fallback) { | ||
if (typeof func !== 'function') throw new Error('onRejected: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("".concat(fallback.name || '_', "(").concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("".concat(fallback.name || '_', "(").concat(func.name || 'anonymous', ")")); | ||
return renamer(function _onRejected() { | ||
@@ -29,3 +29,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
return func.apply(this, args).catch(function (err) { | ||
return func.apply(this, args)["catch"](function (err) { | ||
return fallback(err); | ||
@@ -32,0 +32,0 @@ }); |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getPurgeCacheDecorator; | ||
exports["default"] = getPurgeCacheDecorator; | ||
@@ -19,3 +19,3 @@ require("core-js/modules/es6.array.is-array"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -39,3 +39,3 @@ var returnEmpty = function returnEmpty() { | ||
if (typeof func !== 'function') throw new Error('purgeCache: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("purgeCache(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("purgeCache(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _purgeCache() { | ||
@@ -42,0 +42,0 @@ var context = this; |
@@ -8,6 +8,8 @@ "use strict"; | ||
}); | ||
exports.default = getRetryDecorator; | ||
exports["default"] = getRetryDecorator; | ||
require("core-js/modules/es6.promise"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.function.name"); | ||
@@ -19,3 +21,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -40,3 +42,3 @@ var customSetTimeout = function customSetTimeout(func, interval) { | ||
if (typeof func !== 'function') throw new Error('retry: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("retry(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("retry(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _retry() { | ||
@@ -55,3 +57,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
customSetTimeout(function () { | ||
return func.apply(context, args).then(resolve).catch(function (err) { | ||
return func.apply(context, args).then(resolve)["catch"](function (err) { | ||
if (!doRetryIf(err) || counter >= times) { | ||
@@ -58,0 +60,0 @@ return reject(err); |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = getTimeoutDecorator; | ||
exports["default"] = getTimeoutDecorator; | ||
@@ -25,2 +25,4 @@ require("core-js/modules/web.dom.iterable"); | ||
require("core-js/modules/es6.object.to-string"); | ||
var _addLogger = require("./add-logger"); | ||
@@ -32,3 +34,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -38,3 +40,3 @@ function throwOnTimeout(ms) { | ||
return setTimeout(function () { | ||
return reject(new _timeoutError.default("TimeoutError: Service timed out after ".concat(ms.toString(), " ms"))); | ||
return reject(new _timeoutError["default"]("TimeoutError: Service timed out after ".concat(ms.toString(), " ms"))); | ||
}, ms); | ||
@@ -50,3 +52,3 @@ }); | ||
if (typeof func !== 'function') throw new Error('timeout: should decorate a function'); | ||
var renamer = (0, _funcRenamer.default)("timeout(".concat(func.name || 'anonymous', ")")); | ||
var renamer = (0, _funcRenamer["default"])("timeout(".concat(func.name || 'anonymous', ")")); | ||
return renamer(function _timeout() { | ||
@@ -60,4 +62,4 @@ var context = this; | ||
return Promise.race([func.apply(context, args), throwOnTimeout(ms)]).catch(function (err) { | ||
if (err instanceof _timeoutError.default) { | ||
return Promise.race([func.apply(context, args), throwOnTimeout(ms)])["catch"](function (err) { | ||
if (err instanceof _timeoutError["default"]) { | ||
logger('timeout', { | ||
@@ -64,0 +66,0 @@ ms: ms |
@@ -20,2 +20,4 @@ "use strict"; | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es7.symbol.async-iterator"); | ||
@@ -22,0 +24,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = compose; | ||
exports["default"] = compose; | ||
@@ -11,0 +11,0 @@ require("core-js/modules/es6.array.reduce"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -19,2 +19,4 @@ require("core-js/modules/es6.object.define-property"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.string.iterator"); | ||
@@ -74,3 +76,3 @@ | ||
value: function _removeFunc(key) { | ||
this.callback_queues.delete(key); | ||
this.callback_queues["delete"](key); | ||
} | ||
@@ -106,3 +108,3 @@ }, { | ||
exports.default = FunctionBus; | ||
exports["default"] = FunctionBus; | ||
module.exports = exports.default; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -13,2 +13,4 @@ require("core-js/modules/es6.object.define-property"); | ||
require("core-js/modules/es6.object.to-string"); | ||
var _queues = _interopRequireDefault(require("./queues")); | ||
@@ -18,3 +20,3 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -38,3 +40,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
this.numberRunning = 0; | ||
this.queue = (0, _queues.default)(opts.comparator, opts.queueSize); | ||
this.queue = (0, _queues["default"])(opts.comparator, opts.queueSize); | ||
} | ||
@@ -61,3 +63,3 @@ | ||
_this._execNext(); | ||
}).catch(function (err) { | ||
})["catch"](function (err) { | ||
_this.numberRunning--; | ||
@@ -86,3 +88,3 @@ reject(err); | ||
var rejectFunc = data.reject; | ||
return rejectFunc(new _limitError.default('Queue full')); | ||
return rejectFunc(new _limitError["default"]('Queue full')); | ||
} | ||
@@ -112,3 +114,3 @@ | ||
exports.default = FunQueue; | ||
exports["default"] = FunQueue; | ||
module.exports = exports.default; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -17,2 +17,4 @@ require("core-js/modules/es6.object.define-property"); | ||
require("core-js/modules/es6.object.to-string"); | ||
require("core-js/modules/es6.string.iterator"); | ||
@@ -73,5 +75,5 @@ | ||
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {}; | ||
this.locked.delete(resource); | ||
this.locked["delete"](resource); | ||
clearTimeout(this.timers.get(resource)); | ||
this.timers.delete(resource); | ||
this.timers["delete"](resource); | ||
var item = (this.queues.get(resource) || []).shift(); | ||
@@ -84,3 +86,3 @@ | ||
} else { | ||
this.queues.delete(resource); | ||
this.queues["delete"](resource); | ||
callback(null); | ||
@@ -94,3 +96,3 @@ } | ||
exports.default = Lock; | ||
exports["default"] = Lock; | ||
module.exports = exports.default; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -21,2 +21,6 @@ require("core-js/modules/es7.symbol.async-iterator"); | ||
require("core-js/modules/es6.string.iterator"); | ||
require("core-js/modules/es6.weak-map"); | ||
require("core-js/modules/web.dom.iterable"); | ||
@@ -26,6 +30,2 @@ | ||
require("core-js/modules/es6.string.iterator"); | ||
require("core-js/modules/es6.weak-map"); | ||
require("core-js/modules/es6.regexp.to-string"); | ||
@@ -35,2 +35,4 @@ | ||
require("core-js/modules/es6.object.to-string"); | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -143,3 +145,3 @@ | ||
exports.default = _default; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = queueFactory; | ||
exports["default"] = queueFactory; | ||
@@ -17,3 +17,3 @@ require("core-js/modules/es6.object.define-property"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
@@ -32,3 +32,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
this.queue = new _dequeue.default(); | ||
this.queue = new _dequeue["default"](); | ||
} | ||
@@ -67,3 +67,3 @@ | ||
this.heap = new _heap.default(comparator); | ||
this.heap = new _heap["default"](comparator); | ||
} | ||
@@ -102,3 +102,3 @@ | ||
this.heap = new _minMaxHeap.default(comparator); | ||
this.heap = new _minMaxHeap["default"](comparator); | ||
this.queueSize = queueSize; | ||
@@ -105,0 +105,0 @@ } |
{ | ||
"name": "async-deco", | ||
"version": "9.1.6", | ||
"version": "9.1.7", | ||
"description": "A collection of decorators for adding features to asynchronous functions", | ||
@@ -5,0 +5,0 @@ "main": "es5/index", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
221465
5511