@webex/common 3.0.0-beta.2 → 3.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base64.js +4 -18
- package/dist/base64.js.map +1 -1
- package/dist/browser-detection.js +0 -21
- package/dist/browser-detection.js.map +1 -1
- package/dist/capped-debounce.js +6 -16
- package/dist/capped-debounce.js.map +1 -1
- package/dist/check-required.js +0 -3
- package/dist/check-required.js.map +1 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/defer.js +0 -7
- package/dist/defer.js.map +1 -1
- package/dist/deprecated.js +0 -5
- package/dist/deprecated.js.map +1 -1
- package/dist/event-envelope.js +16 -31
- package/dist/event-envelope.js.map +1 -1
- package/dist/events.js +3 -14
- package/dist/events.js.map +1 -1
- package/dist/exception.js +1 -28
- package/dist/exception.js.map +1 -1
- package/dist/in-browser/browser.js +0 -3
- package/dist/in-browser/browser.js.map +1 -1
- package/dist/in-browser/index.js +0 -4
- package/dist/in-browser/index.js.map +1 -1
- package/dist/in-browser/node.js +0 -3
- package/dist/in-browser/node.js.map +1 -1
- package/dist/index.js +1 -60
- package/dist/index.js.map +1 -1
- package/dist/isBuffer.js +0 -4
- package/dist/isBuffer.js.map +1 -1
- package/dist/make-state-datatype.js +4 -9
- package/dist/make-state-datatype.js.map +1 -1
- package/dist/one-flight.js +8 -30
- package/dist/one-flight.js.map +1 -1
- package/dist/patterns.js +0 -8
- package/dist/patterns.js.map +1 -1
- package/dist/resolve-with.js +0 -5
- package/dist/resolve-with.js.map +1 -1
- package/dist/retry.js +13 -39
- package/dist/retry.js.map +1 -1
- package/dist/tap.js +0 -5
- package/dist/tap.js.map +1 -1
- package/dist/template-container.js +10 -54
- package/dist/template-container.js.map +1 -1
- package/dist/uuid-utils.js +12 -37
- package/dist/uuid-utils.js.map +1 -1
- package/dist/while-in-flight.js +0 -10
- package/dist/while-in-flight.js.map +1 -1
- package/package.json +3 -3
- package/src/base64.js +1 -1
- package/src/browser-detection.js +7 -6
- package/src/capped-debounce.js +2 -1
- package/src/constants.js +14 -14
- package/src/deprecated.js +3 -1
- package/src/event-envelope.js +25 -21
- package/src/events.js +1 -4
- package/src/exception.js +1 -2
- package/src/index.js +5 -7
- package/src/make-state-datatype.js +10 -6
- package/src/one-flight.js +1 -5
- package/src/patterns.js +5 -3
- package/src/retry.js +5 -6
- package/src/tap.js +6 -5
- package/src/template-container.js +3 -1
- package/src/uuid-utils.js +16 -16
- package/src/while-in-flight.js +12 -8
- package/test/unit/spec/capped-debounce.js +4 -1
- package/test/unit/spec/exception.js +1 -3
- package/test/unit/spec/one-flight.js +38 -55
- package/test/unit/spec/template-container.js +0 -1
- package/test/unit/spec/while-in-flight.js +8 -10
package/dist/one-flight.js
CHANGED
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = oneFlight;
|
|
12
|
-
|
|
13
9
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
14
|
-
|
|
15
10
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/map"));
|
|
16
|
-
|
|
17
11
|
var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
|
|
18
|
-
|
|
19
12
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
20
|
-
|
|
21
13
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
|
|
22
|
-
|
|
23
14
|
var _wrap2 = _interopRequireDefault(require("lodash/wrap"));
|
|
24
|
-
|
|
25
15
|
var _templateContainer = _interopRequireDefault(require("./template-container"));
|
|
26
|
-
|
|
27
16
|
// Alias Map and WeakMap to get around a babel compiler bug
|
|
28
17
|
var W = _weakMap.default;
|
|
29
18
|
var M = _map.default;
|
|
30
19
|
var WeakMappedMappedMap = (0, _templateContainer.default)(W, M, M);
|
|
31
20
|
var flights = new WeakMappedMappedMap();
|
|
21
|
+
|
|
32
22
|
/**
|
|
33
23
|
* @memberof Util
|
|
34
24
|
* @param {Object} options
|
|
@@ -37,21 +27,19 @@ var flights = new WeakMappedMappedMap();
|
|
|
37
27
|
* @param {boolean} options.cacheSuccesses
|
|
38
28
|
* @returns {Function}
|
|
39
29
|
*/
|
|
40
|
-
|
|
41
30
|
function oneFlight() {
|
|
42
31
|
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
32
|
params[_key] = arguments[_key];
|
|
44
33
|
}
|
|
45
|
-
|
|
46
34
|
if (params.length === 3) {
|
|
47
35
|
return (0, _apply.default)(oneFlightDecorator, null, params);
|
|
48
36
|
}
|
|
49
|
-
|
|
50
37
|
var options = params[0] || {};
|
|
51
38
|
var cacheFailures = options.cacheFailures,
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
cacheSuccesses = options.cacheSuccesses,
|
|
40
|
+
keyFactory = options.keyFactory;
|
|
54
41
|
return oneFlightDecorator;
|
|
42
|
+
|
|
55
43
|
/**
|
|
56
44
|
* @param {Object} target
|
|
57
45
|
* @param {string} prop
|
|
@@ -59,55 +47,45 @@ function oneFlight() {
|
|
|
59
47
|
* @private
|
|
60
48
|
* @returns {Object}
|
|
61
49
|
*/
|
|
62
|
-
|
|
63
50
|
function oneFlightDecorator(target, prop, descriptor) {
|
|
64
51
|
var key = prop;
|
|
65
52
|
descriptor.value = (0, _wrap2.default)(descriptor.value, function oneFlightExecutor(fn) {
|
|
66
53
|
var _this = this;
|
|
67
|
-
|
|
68
54
|
var innerKey = key;
|
|
69
|
-
|
|
70
55
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
71
56
|
args[_key2 - 1] = arguments[_key2];
|
|
72
57
|
}
|
|
73
|
-
|
|
74
58
|
if (keyFactory) {
|
|
75
59
|
innerKey = "".concat(innerKey, "_").concat(keyFactory.apply(void 0, args));
|
|
76
60
|
}
|
|
77
|
-
/* eslint no-invalid-this: [0] */
|
|
78
|
-
|
|
79
61
|
|
|
62
|
+
/* eslint no-invalid-this: [0] */
|
|
80
63
|
var flight = flights.get(this, target, innerKey);
|
|
81
|
-
|
|
82
64
|
if (flight) {
|
|
83
65
|
return flight;
|
|
84
66
|
}
|
|
85
|
-
|
|
86
67
|
flight = (0, _apply.default)(fn, this, args);
|
|
87
|
-
|
|
88
68
|
if (!cacheFailures && flight && flight.catch) {
|
|
89
69
|
flight = flight.catch(function (reason) {
|
|
90
70
|
flights.delete(_this, target, innerKey);
|
|
91
71
|
return _promise.default.reject(reason);
|
|
92
72
|
});
|
|
93
73
|
}
|
|
94
|
-
|
|
95
74
|
if (!cacheSuccesses && flight && flight.then) {
|
|
96
75
|
flight = flight.then(function (result) {
|
|
97
76
|
flights.delete(_this, target, innerKey);
|
|
98
77
|
return result;
|
|
99
78
|
});
|
|
100
79
|
}
|
|
101
|
-
|
|
102
80
|
flights.set(this, target, innerKey, flight);
|
|
103
81
|
return flight;
|
|
104
|
-
});
|
|
105
|
-
// definitions
|
|
82
|
+
});
|
|
106
83
|
|
|
84
|
+
// This *should* make decorators compatible with AmpersandState class
|
|
85
|
+
// definitions
|
|
107
86
|
if ((0, _typeof2.default)(target) === 'object' && !target.prototype) {
|
|
108
87
|
target[prop] = descriptor.value;
|
|
109
88
|
}
|
|
110
|
-
|
|
111
89
|
return descriptor;
|
|
112
90
|
}
|
|
113
91
|
}
|
package/dist/one-flight.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["W","M","WeakMappedMappedMap","make","flights","oneFlight","params","length","oneFlightDecorator","options","cacheFailures","cacheSuccesses","keyFactory","target","prop","descriptor","key","value","oneFlightExecutor","fn","innerKey","args","flight","get","catch","reason","delete","reject","then","result","set","prototype"],"sources":["one-flight.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {wrap} from 'lodash';\n\nimport make from './template-container';\n\n// Alias Map and WeakMap to get around a babel compiler bug\nconst W = WeakMap;\nconst M = Map;\nconst WeakMappedMappedMap = make(W, M, M);\n\nconst flights = new WeakMappedMappedMap();\n\n/**\n * @memberof Util\n * @param {Object} options\n * @param {Function} options.keyFactory\n * @param {boolean} options.cacheFailures\n * @param {boolean} options.cacheSuccesses\n * @returns {Function}\n */\nexport default function oneFlight(...params) {\n if (params.length === 3) {\n return Reflect.apply(oneFlightDecorator, null, params);\n }\n\n const options = params[0] || {};\n\n const {
|
|
1
|
+
{"version":3,"names":["W","M","WeakMappedMappedMap","make","flights","oneFlight","params","length","oneFlightDecorator","options","cacheFailures","cacheSuccesses","keyFactory","target","prop","descriptor","key","value","oneFlightExecutor","fn","innerKey","args","flight","get","catch","reason","delete","reject","then","result","set","prototype"],"sources":["one-flight.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {wrap} from 'lodash';\n\nimport make from './template-container';\n\n// Alias Map and WeakMap to get around a babel compiler bug\nconst W = WeakMap;\nconst M = Map;\nconst WeakMappedMappedMap = make(W, M, M);\n\nconst flights = new WeakMappedMappedMap();\n\n/**\n * @memberof Util\n * @param {Object} options\n * @param {Function} options.keyFactory\n * @param {boolean} options.cacheFailures\n * @param {boolean} options.cacheSuccesses\n * @returns {Function}\n */\nexport default function oneFlight(...params) {\n if (params.length === 3) {\n return Reflect.apply(oneFlightDecorator, null, params);\n }\n\n const options = params[0] || {};\n\n const {cacheFailures, cacheSuccesses, keyFactory} = options;\n\n return oneFlightDecorator;\n\n /**\n * @param {Object} target\n * @param {string} prop\n * @param {Object} descriptor\n * @private\n * @returns {Object}\n */\n function oneFlightDecorator(target, prop, descriptor) {\n const key = prop;\n\n descriptor.value = wrap(descriptor.value, function oneFlightExecutor(fn, ...args) {\n let innerKey = key;\n\n if (keyFactory) {\n innerKey = `${innerKey}_${keyFactory(...args)}`;\n }\n\n /* eslint no-invalid-this: [0] */\n let flight = flights.get(this, target, innerKey);\n\n if (flight) {\n return flight;\n }\n\n flight = Reflect.apply(fn, this, args);\n if (!cacheFailures && flight && flight.catch) {\n flight = flight.catch((reason) => {\n flights.delete(this, target, innerKey);\n\n return Promise.reject(reason);\n });\n }\n\n if (!cacheSuccesses && flight && flight.then) {\n flight = flight.then((result) => {\n flights.delete(this, target, innerKey);\n\n return result;\n });\n }\n\n flights.set(this, target, innerKey, flight);\n\n return flight;\n });\n\n // This *should* make decorators compatible with AmpersandState class\n // definitions\n if (typeof target === 'object' && !target.prototype) {\n target[prop] = descriptor.value;\n }\n\n return descriptor;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAMA;AAEA;AACA,IAAMA,CAAC,mBAAU;AACjB,IAAMC,CAAC,eAAM;AACb,IAAMC,mBAAmB,GAAG,IAAAC,0BAAI,EAACH,CAAC,EAAEC,CAAC,EAAEA,CAAC,CAAC;AAEzC,IAAMG,OAAO,GAAG,IAAIF,mBAAmB,EAAE;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,SAAS,GAAY;EAAA,kCAARC,MAAM;IAANA,MAAM;EAAA;EACzC,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;IACvB,OAAO,oBAAcC,kBAAkB,EAAE,IAAI,EAAEF,MAAM,CAAC;EACxD;EAEA,IAAMG,OAAO,GAAGH,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE/B,IAAOI,aAAa,GAAgCD,OAAO,CAApDC,aAAa;IAAEC,cAAc,GAAgBF,OAAO,CAArCE,cAAc;IAAEC,UA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G,CAAC,IAAI,EAAEjB,MAAM,EAAEO,QAAQ,EAAEE,MAAM,CAAC;MAE3C,OAAOA,MAAM;IACf,CAAC,CAAC;;IAEF;IACA;IACA,IAAI,sBAAOT,MAAM,MAAK,QAAQ,IAAI,CAACA,MAAM,CAACkB,SAAS,EAAE;MACnDlB,MAAM,CAACC,IAAI,CAAC,GAAGC,UAAU,CAACE,KAAK;IACjC;IAEA,OAAOF,UAAU;EACnB;AACF"}
|
package/dist/patterns.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.default = void 0;
|
|
10
|
-
|
|
11
8
|
/*!
|
|
12
9
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
13
10
|
*/
|
|
14
|
-
|
|
15
11
|
/**
|
|
16
12
|
* @description Set of regex patterns to compile once and use throughout the
|
|
17
13
|
* app. All non-prefixed patterns have start/end characters to ensure exact
|
|
@@ -29,7 +25,6 @@ var _default = {
|
|
|
29
25
|
* @type {RegExp}
|
|
30
26
|
*/
|
|
31
27
|
email: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
32
|
-
|
|
33
28
|
/**
|
|
34
29
|
* Regular expression that validates an ambiguous string contains emails
|
|
35
30
|
* (one or more) within.
|
|
@@ -38,19 +33,16 @@ var _default = {
|
|
|
38
33
|
* @type {RegExp}
|
|
39
34
|
*/
|
|
40
35
|
containsEmails: /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/g,
|
|
41
|
-
|
|
42
36
|
/**
|
|
43
37
|
* Matches a UUID
|
|
44
38
|
* @type {RegExp}
|
|
45
39
|
*/
|
|
46
40
|
uuid: /^[a-f\d]{8}(?:-[a-f\d]{4}){3}-[a-f\d]{12}$/,
|
|
47
|
-
|
|
48
41
|
/**
|
|
49
42
|
* Same as this.email, but allows for surrounding characters
|
|
50
43
|
* @type {RegExp}
|
|
51
44
|
*/
|
|
52
45
|
execEmail: /[^\s]+?@[^\s]+?/,
|
|
53
|
-
|
|
54
46
|
/**
|
|
55
47
|
* Same as this.uuid but allows for surrounding characters
|
|
56
48
|
* @type {RegExp}
|
package/dist/patterns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["email","containsEmails","uuid","execEmail","execUuid"],"sources":["patterns.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * @description Set of regex patterns to compile once and use throughout the\n * app. All non-prefixed patterns have start/end characters to ensure exact\n * matches. Patterns prefixed with \"exec\" are the same as their non-prefixed\n * counterparts but without the start/end characters so they can be used with\n * methods like `RegExp#exec`.\n */\nexport default {\n /**\n * Regular express that validates a string is strictly an email.\n * Allows for validation of emails within services such as conversation\n * activities or user details.\n * See [RegEx information here]{@link https://ihateregex.io/expr/email-2}.\n *\n * @type {RegExp}\n */\n email
|
|
1
|
+
{"version":3,"names":["email","containsEmails","uuid","execEmail","execUuid"],"sources":["patterns.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * @description Set of regex patterns to compile once and use throughout the\n * app. All non-prefixed patterns have start/end characters to ensure exact\n * matches. Patterns prefixed with \"exec\" are the same as their non-prefixed\n * counterparts but without the start/end characters so they can be used with\n * methods like `RegExp#exec`.\n */\nexport default {\n /**\n * Regular express that validates a string is strictly an email.\n * Allows for validation of emails within services such as conversation\n * activities or user details.\n * See [RegEx information here]{@link https://ihateregex.io/expr/email-2}.\n *\n * @type {RegExp}\n */\n email:\n /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/,\n\n /**\n * Regular expression that validates an ambiguous string contains emails\n * (one or more) within.\n * See [RegEx information here]{@link https://ihateregex.io/expr/email-2}.\n *\n * @type {RegExp}\n */\n containsEmails:\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))/g,\n\n /**\n * Matches a UUID\n * @type {RegExp}\n */\n uuid: /^[a-f\\d]{8}(?:-[a-f\\d]{4}){3}-[a-f\\d]{12}$/,\n\n /**\n * Same as this.email, but allows for surrounding characters\n * @type {RegExp}\n */\n execEmail: /[^\\s]+?@[^\\s]+?/,\n\n /**\n * Same as this.uuid but allows for surrounding characters\n * @type {RegExp}\n */\n execUuid: /[a-f\\d]{8}(?:-[a-f\\d]{4}){3}-[a-f\\d]{12}/,\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,eAOe;EACb;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,KAAK,EACH,sJAAsJ;EAExJ;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,cAAc,EACZ,qJAAqJ;EAEvJ;AACF;AACA;AACA;EACEC,IAAI,EAAE,4CAA4C;EAElD;AACF;AACA;AACA;EACEC,SAAS,EAAE,iBAAiB;EAE5B;AACF;AACA;AACA;EACEC,QAAQ,EAAE;AACZ,CAAC;AAAA"}
|
package/dist/resolve-with.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = resolveWith;
|
|
12
|
-
|
|
13
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
|
-
|
|
15
10
|
/*!
|
|
16
11
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
17
12
|
*/
|
package/dist/resolve-with.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["resolveWith","object","resolver","resolve"],"sources":["resolve-with.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Sugar method for returning the desired object at the end of a promise chain\n * @param {any} object the item with which to resolve the promise chain\n * @returns {function}\n * @example\n * var item = {\n * prop: 2\n * };\n * Promise\n * .resolve(item.prop)\n * .then(resolveWith(item))\n * .then(function(res) {\n * require('assert').deepEqual(res, {prop:2});\n * return 'success'\n * })\n * // => success\n *\n */\nexport default function resolveWith(object) {\n return function resolver() {\n return Promise.resolve(object);\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["resolveWith","object","resolver","resolve"],"sources":["resolve-with.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Sugar method for returning the desired object at the end of a promise chain\n * @param {any} object the item with which to resolve the promise chain\n * @returns {function}\n * @example\n * var item = {\n * prop: 2\n * };\n * Promise\n * .resolve(item.prop)\n * .then(resolveWith(item))\n * .then(function(res) {\n * require('assert').deepEqual(res, {prop:2});\n * return 'success'\n * })\n * // => success\n *\n */\nexport default function resolveWith(object) {\n return function resolver() {\n return Promise.resolve(object);\n };\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,WAAW,CAACC,MAAM,EAAE;EAC1C,OAAO,SAASC,QAAQ,GAAG;IACzB,OAAO,iBAAQC,OAAO,CAACF,MAAM,CAAC;EAChC,CAAC;AACH"}
|
package/dist/retry.js
CHANGED
|
@@ -1,37 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
4
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
5
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
6
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
7
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
3
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
9
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
10
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
11
|
value: true
|
|
9
12
|
});
|
|
10
|
-
|
|
11
13
|
exports.default = retry;
|
|
12
|
-
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/assign"));
|
|
14
|
-
|
|
15
14
|
var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
|
|
16
|
-
|
|
17
15
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
18
|
-
|
|
19
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
|
|
20
|
-
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
21
18
|
var _wrap2 = _interopRequireDefault(require("lodash/wrap"));
|
|
22
|
-
|
|
23
19
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
24
|
-
|
|
25
20
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
26
|
-
|
|
27
21
|
var _events = require("events");
|
|
28
|
-
|
|
29
22
|
var _backoff = _interopRequireDefault(require("backoff"));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
33
|
-
*/
|
|
34
|
-
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
35
25
|
/* eslint max-nested-callbacks: [0] */
|
|
36
26
|
|
|
37
27
|
/**
|
|
@@ -50,16 +40,14 @@ function retry() {
|
|
|
50
40
|
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
41
|
params[_key] = arguments[_key];
|
|
52
42
|
}
|
|
53
|
-
|
|
54
43
|
var options = params[0] || {};
|
|
55
|
-
options = (
|
|
44
|
+
options = _objectSpread({}, options);
|
|
56
45
|
(0, _defaults2.default)(options, {
|
|
57
46
|
backoff: true,
|
|
58
47
|
delay: 1,
|
|
59
48
|
maxAttempts: 3
|
|
60
49
|
});
|
|
61
50
|
var strategyOptions;
|
|
62
|
-
|
|
63
51
|
if (options.backoff) {
|
|
64
52
|
strategyOptions = {
|
|
65
53
|
initialDelay: options.delay,
|
|
@@ -71,12 +59,11 @@ function retry() {
|
|
|
71
59
|
maxDelay: 1
|
|
72
60
|
};
|
|
73
61
|
}
|
|
74
|
-
|
|
75
62
|
if (params.length === 3) {
|
|
76
63
|
return (0, _apply.default)(retryDecorator, null, params);
|
|
77
64
|
}
|
|
78
|
-
|
|
79
65
|
return retryDecorator;
|
|
66
|
+
|
|
80
67
|
/**
|
|
81
68
|
* @param {Object} target
|
|
82
69
|
* @param {string} prop
|
|
@@ -84,70 +71,57 @@ function retry() {
|
|
|
84
71
|
* @private
|
|
85
72
|
* @returns {Object}
|
|
86
73
|
*/
|
|
87
|
-
|
|
88
74
|
function retryDecorator(target, prop, descriptor) {
|
|
89
75
|
descriptor.value = (0, _wrap2.default)(descriptor.value, function retryExecutor(fn) {
|
|
90
76
|
var _this = this;
|
|
91
|
-
|
|
92
77
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
93
78
|
args[_key2 - 1] = arguments[_key2];
|
|
94
79
|
}
|
|
95
|
-
|
|
96
80
|
var emitter = new _events.EventEmitter();
|
|
97
81
|
var promise = new _promise.default(function (resolve, reject) {
|
|
98
82
|
// backoff.call is not Function.prototype.call; it's an unfortunate naming
|
|
99
83
|
// collision.
|
|
100
|
-
|
|
101
84
|
/* eslint prefer-reflect: [0] */
|
|
102
85
|
var call = _backoff.default.call(function (cb) {
|
|
103
86
|
/* eslint no-invalid-this: [0] */
|
|
104
87
|
var innerPromise = (0, _apply.default)(fn, _this, args);
|
|
105
|
-
|
|
106
88
|
if ((0, _isFunction2.default)(innerPromise.on)) {
|
|
107
89
|
innerPromise.on('progress', emitter.emit.bind(emitter, 'progress'));
|
|
108
90
|
innerPromise.on('upload-progress', emitter.emit.bind(emitter, 'upload-progress'));
|
|
109
91
|
innerPromise.on('download-progress', emitter.emit.bind(emitter, 'download-progress'));
|
|
110
92
|
}
|
|
111
|
-
|
|
112
93
|
return innerPromise.then(function (res) {
|
|
113
94
|
cb(null, res);
|
|
114
95
|
}).catch(function (reason) {
|
|
115
96
|
if (!reason) {
|
|
116
97
|
reason = new Error('retryable method failed without providing an error object');
|
|
117
98
|
}
|
|
118
|
-
|
|
119
99
|
cb(reason);
|
|
120
100
|
});
|
|
121
101
|
}, function (err, res) {
|
|
122
102
|
if (err) {
|
|
123
103
|
return reject(err);
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
return resolve(res);
|
|
127
106
|
});
|
|
128
|
-
|
|
129
107
|
call.setStrategy(new _backoff.default.ExponentialStrategy(strategyOptions));
|
|
130
|
-
|
|
131
108
|
if (options.maxAttempts) {
|
|
132
109
|
call.failAfter(options.maxAttempts - 1);
|
|
133
110
|
}
|
|
134
|
-
|
|
135
111
|
call.start();
|
|
136
112
|
});
|
|
137
|
-
|
|
138
113
|
promise.on = function on(key, callback) {
|
|
139
114
|
emitter.on(key, callback);
|
|
140
115
|
return promise;
|
|
141
116
|
};
|
|
142
|
-
|
|
143
117
|
return promise;
|
|
144
|
-
});
|
|
145
|
-
// definitions
|
|
118
|
+
});
|
|
146
119
|
|
|
120
|
+
// This *should* make decorators compatible with AmpersandState class
|
|
121
|
+
// definitions
|
|
147
122
|
if ((0, _typeof2.default)(target) === 'object' && !target.prototype) {
|
|
148
123
|
target[prop] = descriptor.value;
|
|
149
124
|
}
|
|
150
|
-
|
|
151
125
|
return descriptor;
|
|
152
126
|
}
|
|
153
127
|
}
|
package/dist/retry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["retry","params","options","backoff","delay","maxAttempts","strategyOptions","initialDelay","maxDelay","length","retryDecorator","target","prop","descriptor","value","retryExecutor","fn","args","emitter","EventEmitter","promise","resolve","reject","call","cb","innerPromise","on","emit","bind","then","res","catch","reason","Error","err","setStrategy","ExponentialStrategy","failAfter","start","key","callback","prototype"],"sources":["retry.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {EventEmitter} from 'events';\n\nimport {defaults, isFunction, wrap} from 'lodash';\nimport backoff from 'backoff';\n\n/* eslint max-nested-callbacks: [0] */\n\n/**\n * Makes a promise-returning method retryable according to the specified backoff\n * pattern\n * @param {Object} options\n * @param {boolean} options.backoff\n * @param {number} options.delay\n * @param {number} options.initialDelay\n * @param {number} options.maxAttempts\n * @param {number} options.maxDelay\n *\n * @returns {Function}\n */\nexport default function retry(...params) {\n let options = params[0] || {};\n\n options =
|
|
1
|
+
{"version":3,"names":["retry","params","options","backoff","delay","maxAttempts","strategyOptions","initialDelay","maxDelay","length","retryDecorator","target","prop","descriptor","value","retryExecutor","fn","args","emitter","EventEmitter","promise","resolve","reject","call","cb","innerPromise","on","emit","bind","then","res","catch","reason","Error","err","setStrategy","ExponentialStrategy","failAfter","start","key","callback","prototype"],"sources":["retry.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {EventEmitter} from 'events';\n\nimport {defaults, isFunction, wrap} from 'lodash';\nimport backoff from 'backoff';\n\n/* eslint max-nested-callbacks: [0] */\n\n/**\n * Makes a promise-returning method retryable according to the specified backoff\n * pattern\n * @param {Object} options\n * @param {boolean} options.backoff\n * @param {number} options.delay\n * @param {number} options.initialDelay\n * @param {number} options.maxAttempts\n * @param {number} options.maxDelay\n *\n * @returns {Function}\n */\nexport default function retry(...params) {\n let options = params[0] || {};\n\n options = {...options};\n defaults(options, {\n backoff: true,\n delay: 1,\n maxAttempts: 3,\n });\n\n let strategyOptions;\n\n if (options.backoff) {\n strategyOptions = {\n initialDelay: options.delay,\n maxDelay: options.maxDelay,\n };\n } else {\n strategyOptions = {\n initialDelay: 1,\n maxDelay: 1,\n };\n }\n\n if (params.length === 3) {\n return Reflect.apply(retryDecorator, null, params);\n }\n\n return retryDecorator;\n\n /**\n * @param {Object} target\n * @param {string} prop\n * @param {Object} descriptor\n * @private\n * @returns {Object}\n */\n function retryDecorator(target, prop, descriptor) {\n descriptor.value = wrap(descriptor.value, function retryExecutor(fn, ...args) {\n const emitter = new EventEmitter();\n const promise = new Promise((resolve, reject) => {\n // backoff.call is not Function.prototype.call; it's an unfortunate naming\n // collision.\n /* eslint prefer-reflect: [0] */\n const call = backoff.call(\n (cb) => {\n /* eslint no-invalid-this: [0] */\n const innerPromise = Reflect.apply(fn, this, args);\n\n if (isFunction(innerPromise.on)) {\n innerPromise.on('progress', emitter.emit.bind(emitter, 'progress'));\n innerPromise.on('upload-progress', emitter.emit.bind(emitter, 'upload-progress'));\n innerPromise.on('download-progress', emitter.emit.bind(emitter, 'download-progress'));\n }\n\n return innerPromise\n .then((res) => {\n cb(null, res);\n })\n .catch((reason) => {\n if (!reason) {\n reason = new Error('retryable method failed without providing an error object');\n }\n cb(reason);\n });\n },\n (err, res) => {\n if (err) {\n return reject(err);\n }\n\n return resolve(res);\n }\n );\n\n call.setStrategy(new backoff.ExponentialStrategy(strategyOptions));\n if (options.maxAttempts) {\n call.failAfter(options.maxAttempts - 1);\n }\n\n call.start();\n });\n\n promise.on = function on(key, callback) {\n emitter.on(key, callback);\n\n return promise;\n };\n\n return promise;\n });\n\n // This *should* make decorators compatible with AmpersandState class\n // definitions\n if (typeof target === 'object' && !target.prototype) {\n target[prop] = descriptor.value;\n }\n\n return descriptor;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAI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CAACQ,EAAE,CAACa,GAAG,EAAEC,QAAQ,CAAC;QAEzB,OAAOpB,OAAO;MAChB,CAAC;MAED,OAAOA,OAAO;IAChB,CAAC,CAAC;;IAEF;IACA;IACA,IAAI,sBAAOT,MAAM,MAAK,QAAQ,IAAI,CAACA,MAAM,CAAC8B,SAAS,EAAE;MACnD9B,MAAM,CAACC,IAAI,CAAC,GAAGC,UAAU,CAACC,KAAK;IACjC;IAEA,OAAOD,UAAU;EACnB;AACF"}
|
package/dist/tap.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = tap;
|
|
12
|
-
|
|
13
9
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
14
|
-
|
|
15
10
|
/*!
|
|
16
11
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
17
12
|
*/
|
package/dist/tap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["tap","fn","r","resolve","then","catch"],"sources":["tap.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Injects code into a promise chain without modifying the promise chain's result\n * @param {Function} fn\n * @returns {Promise}\n * @example\n * function f() {\n * return Promise.resolve(5);\n * }\n *\n * f()\n * .then(tap(() => 12))\n * // => 5\n */\nexport default function tap(fn) {\n return (r)
|
|
1
|
+
{"version":3,"names":["tap","fn","r","resolve","then","catch"],"sources":["tap.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/**\n * Injects code into a promise chain without modifying the promise chain's result\n * @param {Function} fn\n * @returns {Promise}\n * @example\n * function f() {\n * return Promise.resolve(5);\n * }\n *\n * f()\n * .then(tap(() => 12))\n * // => 5\n */\nexport default function tap(fn) {\n return (r) =>\n new Promise((resolve) => {\n resolve(fn(r));\n })\n .then(() => r)\n .catch(() => r);\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,GAAG,CAACC,EAAE,EAAE;EAC9B,OAAO,UAACC,CAAC;IAAA,OACP,qBAAY,UAACC,OAAO,EAAK;MACvBA,OAAO,CAACF,EAAE,CAACC,CAAC,CAAC,CAAC;IAChB,CAAC,CAAC,CACCE,IAAI,CAAC;MAAA,OAAMF,CAAC;IAAA,EAAC,CACbG,KAAK,CAAC;MAAA,OAAMH,CAAC;IAAA,EAAC;EAAA;AACrB"}
|