@daiso-tech/core 0.3.0 → 0.4.0

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.
Files changed (177) hide show
  1. package/dist/cjs/_module.js +2 -0
  2. package/dist/cjs/_module.js.map +1 -1
  3. package/dist/cjs/async/_module.js +29 -0
  4. package/dist/cjs/async/_module.js.map +1 -0
  5. package/dist/cjs/async/_shared.js +34 -0
  6. package/dist/cjs/async/_shared.js.map +1 -0
  7. package/dist/cjs/async/abortable/_module.js +18 -0
  8. package/dist/cjs/async/abortable/_module.js.map +1 -0
  9. package/dist/cjs/async/abortable/abortable.js +48 -0
  10. package/dist/cjs/async/abortable/abortable.js.map +1 -0
  11. package/dist/cjs/async/abortable-iterable/_module.js +18 -0
  12. package/dist/cjs/async/abortable-iterable/_module.js.map +1 -0
  13. package/dist/cjs/async/abortable-iterable/abortable-iterable.js +32 -0
  14. package/dist/cjs/async/abortable-iterable/abortable-iterable.js.map +1 -0
  15. package/dist/cjs/async/backof-policies/_module.js +21 -0
  16. package/dist/cjs/async/backof-policies/_module.js.map +1 -0
  17. package/dist/cjs/async/backof-policies/_shared.js +7 -0
  18. package/dist/cjs/async/backof-policies/_shared.js.map +1 -0
  19. package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js +18 -0
  20. package/dist/cjs/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
  21. package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +19 -0
  22. package/dist/cjs/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
  23. package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js +18 -0
  24. package/dist/cjs/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
  25. package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +23 -0
  26. package/dist/cjs/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
  27. package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js +18 -0
  28. package/dist/cjs/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
  29. package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +23 -0
  30. package/dist/cjs/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
  31. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js +18 -0
  32. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
  33. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +23 -0
  34. package/dist/cjs/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
  35. package/dist/cjs/async/delay/_module.js +18 -0
  36. package/dist/cjs/async/delay/_module.js.map +1 -0
  37. package/dist/cjs/async/delay/delay.js +24 -0
  38. package/dist/cjs/async/delay/delay.js.map +1 -0
  39. package/dist/cjs/async/delay-iterable/_module.js +18 -0
  40. package/dist/cjs/async/delay-iterable/_module.js.map +1 -0
  41. package/dist/cjs/async/delay-iterable/delay-iterable.js +36 -0
  42. package/dist/cjs/async/delay-iterable/delay-iterable.js.map +1 -0
  43. package/dist/cjs/async/lazy-promise/_module.js +18 -0
  44. package/dist/cjs/async/lazy-promise/_module.js.map +1 -0
  45. package/dist/cjs/async/lazy-promise/lazy-promise.js +22 -0
  46. package/dist/cjs/async/lazy-promise/lazy-promise.js.map +1 -0
  47. package/dist/cjs/async/retry/_module.js +18 -0
  48. package/dist/cjs/async/retry/_module.js.map +1 -0
  49. package/dist/cjs/async/retry/retry.js +43 -0
  50. package/dist/cjs/async/retry/retry.js.map +1 -0
  51. package/dist/cjs/async/retry-iterable/_module.js +18 -0
  52. package/dist/cjs/async/retry-iterable/_module.js.map +1 -0
  53. package/dist/cjs/async/retry-iterable/retry-iterable.js +32 -0
  54. package/dist/cjs/async/retry-iterable/retry-iterable.js.map +1 -0
  55. package/dist/cjs/async/timeout/_module.js +18 -0
  56. package/dist/cjs/async/timeout/_module.js.map +1 -0
  57. package/dist/cjs/async/timeout/timeout.js +28 -0
  58. package/dist/cjs/async/timeout/timeout.js.map +1 -0
  59. package/dist/cjs/async/timeout-iterable/_module.js +18 -0
  60. package/dist/cjs/async/timeout-iterable/_module.js.map +1 -0
  61. package/dist/cjs/async/timeout-iterable/timeout-iterable.js +11 -0
  62. package/dist/cjs/async/timeout-iterable/timeout-iterable.js.map +1 -0
  63. package/dist/cjs/storage/storage.js +25 -15
  64. package/dist/cjs/storage/storage.js.map +1 -1
  65. package/dist/cjs/utilities/_module.js +18 -0
  66. package/dist/cjs/utilities/_module.js.map +1 -0
  67. package/dist/cjs/utilities/time-span/_module.js +18 -0
  68. package/dist/cjs/utilities/time-span/_module.js.map +1 -0
  69. package/dist/cjs/utilities/time-span/time-span.js +103 -0
  70. package/dist/cjs/utilities/time-span/time-span.js.map +1 -0
  71. package/dist/esm/_module.js +2 -0
  72. package/dist/esm/_module.js.map +1 -1
  73. package/dist/esm/async/_module.js +11 -0
  74. package/dist/esm/async/_module.js.map +1 -0
  75. package/dist/esm/async/_shared.js +27 -0
  76. package/dist/esm/async/_shared.js.map +1 -0
  77. package/dist/esm/async/abortable/_module.js +2 -0
  78. package/dist/esm/async/abortable/_module.js.map +1 -0
  79. package/dist/esm/async/abortable/abortable.js +45 -0
  80. package/dist/esm/async/abortable/abortable.js.map +1 -0
  81. package/dist/esm/async/abortable-iterable/_module.js +2 -0
  82. package/dist/esm/async/abortable-iterable/_module.js.map +1 -0
  83. package/dist/esm/async/abortable-iterable/abortable-iterable.js +29 -0
  84. package/dist/esm/async/abortable-iterable/abortable-iterable.js.map +1 -0
  85. package/dist/esm/async/backof-policies/_module.js +5 -0
  86. package/dist/esm/async/backof-policies/_module.js.map +1 -0
  87. package/dist/esm/async/backof-policies/_shared.js +4 -0
  88. package/dist/esm/async/backof-policies/_shared.js.map +1 -0
  89. package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js +2 -0
  90. package/dist/esm/async/backof-policies/constant-backoff-policy/_module.js.map +1 -0
  91. package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js +16 -0
  92. package/dist/esm/async/backof-policies/constant-backoff-policy/constant-backoff-policy.js.map +1 -0
  93. package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js +2 -0
  94. package/dist/esm/async/backof-policies/exponential-backoff-policy/_module.js.map +1 -0
  95. package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js +20 -0
  96. package/dist/esm/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.js.map +1 -0
  97. package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js +2 -0
  98. package/dist/esm/async/backof-policies/linear-backoff-policy/_module.js.map +1 -0
  99. package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js +20 -0
  100. package/dist/esm/async/backof-policies/linear-backoff-policy/linear-backoff-policy.js.map +1 -0
  101. package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js +2 -0
  102. package/dist/esm/async/backof-policies/polynomial-backoff-policy/_module.js.map +1 -0
  103. package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js +20 -0
  104. package/dist/esm/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.js.map +1 -0
  105. package/dist/esm/async/delay/_module.js +2 -0
  106. package/dist/esm/async/delay/_module.js.map +1 -0
  107. package/dist/esm/async/delay/delay.js +21 -0
  108. package/dist/esm/async/delay/delay.js.map +1 -0
  109. package/dist/esm/async/delay-iterable/_module.js +2 -0
  110. package/dist/esm/async/delay-iterable/_module.js.map +1 -0
  111. package/dist/esm/async/delay-iterable/delay-iterable.js +33 -0
  112. package/dist/esm/async/delay-iterable/delay-iterable.js.map +1 -0
  113. package/dist/esm/async/lazy-promise/_module.js +2 -0
  114. package/dist/esm/async/lazy-promise/_module.js.map +1 -0
  115. package/dist/esm/async/lazy-promise/lazy-promise.js +17 -0
  116. package/dist/esm/async/lazy-promise/lazy-promise.js.map +1 -0
  117. package/dist/esm/async/retry/_module.js +2 -0
  118. package/dist/esm/async/retry/_module.js.map +1 -0
  119. package/dist/esm/async/retry/retry.js +40 -0
  120. package/dist/esm/async/retry/retry.js.map +1 -0
  121. package/dist/esm/async/retry-iterable/_module.js +2 -0
  122. package/dist/esm/async/retry-iterable/_module.js.map +1 -0
  123. package/dist/esm/async/retry-iterable/retry-iterable.js +29 -0
  124. package/dist/esm/async/retry-iterable/retry-iterable.js.map +1 -0
  125. package/dist/esm/async/timeout/_module.js +2 -0
  126. package/dist/esm/async/timeout/_module.js.map +1 -0
  127. package/dist/esm/async/timeout/timeout.js +25 -0
  128. package/dist/esm/async/timeout/timeout.js.map +1 -0
  129. package/dist/esm/async/timeout-iterable/_module.js +2 -0
  130. package/dist/esm/async/timeout-iterable/_module.js.map +1 -0
  131. package/dist/esm/async/timeout-iterable/timeout-iterable.js +8 -0
  132. package/dist/esm/async/timeout-iterable/timeout-iterable.js.map +1 -0
  133. package/dist/esm/storage/storage.js +25 -15
  134. package/dist/esm/storage/storage.js.map +1 -1
  135. package/dist/esm/utilities/_module.js +2 -0
  136. package/dist/esm/utilities/_module.js.map +1 -0
  137. package/dist/esm/utilities/time-span/_module.js +2 -0
  138. package/dist/esm/utilities/time-span/_module.js.map +1 -0
  139. package/dist/esm/utilities/time-span/time-span.js +99 -0
  140. package/dist/esm/utilities/time-span/time-span.js.map +1 -0
  141. package/dist/types/_module.d.ts +2 -0
  142. package/dist/types/async/_module.d.ts +10 -0
  143. package/dist/types/async/_shared.d.ts +35 -0
  144. package/dist/types/async/abortable/_module.d.ts +1 -0
  145. package/dist/types/async/abortable/abortable.d.ts +39 -0
  146. package/dist/types/async/abortable-iterable/_module.d.ts +1 -0
  147. package/dist/types/async/abortable-iterable/abortable-iterable.d.ts +36 -0
  148. package/dist/types/async/backof-policies/_module.d.ts +5 -0
  149. package/dist/types/async/backof-policies/_shared.d.ts +12 -0
  150. package/dist/types/async/backof-policies/constant-backoff-policy/_module.d.ts +1 -0
  151. package/dist/types/async/backof-policies/constant-backoff-policy/constant-backoff-policy.d.ts +28 -0
  152. package/dist/types/async/backof-policies/exponential-backoff-policy/_module.d.ts +1 -0
  153. package/dist/types/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.d.ts +36 -0
  154. package/dist/types/async/backof-policies/linear-backoff-policy/_module.d.ts +1 -0
  155. package/dist/types/async/backof-policies/linear-backoff-policy/linear-backoff-policy.d.ts +32 -0
  156. package/dist/types/async/backof-policies/polynomial-backoff-policy/_module.d.ts +1 -0
  157. package/dist/types/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.d.ts +36 -0
  158. package/dist/types/async/delay/_module.d.ts +1 -0
  159. package/dist/types/async/delay/delay.d.ts +38 -0
  160. package/dist/types/async/delay-iterable/_module.d.ts +1 -0
  161. package/dist/types/async/delay-iterable/delay-iterable.d.ts +57 -0
  162. package/dist/types/async/lazy-promise/_module.d.ts +1 -0
  163. package/dist/types/async/lazy-promise/lazy-promise.d.ts +28 -0
  164. package/dist/types/async/retry/_module.d.ts +1 -0
  165. package/dist/types/async/retry/retry.d.ts +86 -0
  166. package/dist/types/async/retry-iterable/_module.d.ts +1 -0
  167. package/dist/types/async/retry-iterable/retry-iterable.d.ts +86 -0
  168. package/dist/types/async/timeout/_module.d.ts +1 -0
  169. package/dist/types/async/timeout/timeout.d.ts +40 -0
  170. package/dist/types/async/timeout-iterable/_module.d.ts +1 -0
  171. package/dist/types/async/timeout-iterable/timeout-iterable.d.ts +64 -0
  172. package/dist/types/contracts/storage/storage.contract.d.ts +2 -1
  173. package/dist/types/storage/storage.d.ts +5 -3
  174. package/dist/types/utilities/_module.d.ts +1 -0
  175. package/dist/types/utilities/time-span/_module.d.ts +1 -0
  176. package/dist/types/utilities/time-span/time-span.d.ts +50 -0
  177. package/package.json +1 -1
@@ -14,8 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./async/_module"), exports);
17
18
  __exportStar(require("./contracts/_module"), exports);
18
19
  __exportStar(require("./collection/_module"), exports);
19
20
  __exportStar(require("./serializer/_module"), exports);
20
21
  __exportStar(require("./storage/_module"), exports);
22
+ __exportStar(require("./utilities/_module"), exports);
21
23
  //# sourceMappingURL=_module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../src/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,uDAAqC;AACrC,uDAAqC;AACrC,oDAAkC"}
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../src/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,sDAAoC;AACpC,uDAAqC;AACrC,uDAAqC;AACrC,oDAAkC;AAClC,sDAAoC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.unstable_retryIterable = void 0;
18
+ __exportStar(require("../async/abortable/_module"), exports);
19
+ __exportStar(require("../async/abortable-iterable/_module"), exports);
20
+ __exportStar(require("../async/backof-policies/_module"), exports);
21
+ __exportStar(require("../async/delay/_module"), exports);
22
+ __exportStar(require("../async/delay-iterable/_module"), exports);
23
+ __exportStar(require("../async/lazy-promise/_module"), exports);
24
+ __exportStar(require("../async/retry/_module"), exports);
25
+ var _module_1 = require("../async/retry-iterable/_module");
26
+ Object.defineProperty(exports, "unstable_retryIterable", { enumerable: true, get: function () { return _module_1.retryIterable; } });
27
+ __exportStar(require("../async/timeout/_module"), exports);
28
+ __exportStar(require("../async/timeout-iterable/_module"), exports);
29
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../src/async/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,qEAAmD;AACnD,kEAAgD;AAChD,wDAAsC;AACtC,iEAA+C;AAC/C,+DAA6C;AAC7C,wDAAsC;AACtC,0DAAyF;AAAhF,iHAAA,aAAa,OAA0B;AAChD,0DAAwC;AACxC,mEAAiD"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryAsyncError = exports.TimeoutAsyncError = exports.AbortAsyncError = exports.AsyncError = void 0;
4
+ class AsyncError extends Error {
5
+ constructor(message, cause) {
6
+ super(message, { cause });
7
+ this.name = AsyncError.name;
8
+ }
9
+ }
10
+ exports.AsyncError = AsyncError;
11
+ class AbortAsyncError extends AsyncError {
12
+ constructor(message, cause) {
13
+ super(message, cause);
14
+ this.name = AbortAsyncError.name;
15
+ }
16
+ }
17
+ exports.AbortAsyncError = AbortAsyncError;
18
+ class TimeoutAsyncError extends AsyncError {
19
+ constructor(message, cause) {
20
+ super(message, cause);
21
+ this.name = TimeoutAsyncError.name;
22
+ }
23
+ }
24
+ exports.TimeoutAsyncError = TimeoutAsyncError;
25
+ class RetryAsyncError extends AsyncError {
26
+ maxAttempts;
27
+ constructor(message, { cause, maxAttempts }) {
28
+ super(message, cause);
29
+ this.name = RetryAsyncError.name;
30
+ this.maxAttempts = maxAttempts;
31
+ }
32
+ }
33
+ exports.RetryAsyncError = RetryAsyncError;
34
+ //# sourceMappingURL=_shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/async/_shared.ts"],"names":[],"mappings":";;;AAOA,MAAa,UAAW,SAAQ,KAAK;IACjC,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAChC,CAAC;CACJ;AALD,gCAKC;AAKD,MAAa,eAAgB,SAAQ,UAAU;IAC3C,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;IACrC,CAAC;CACJ;AALD,0CAKC;AAKD,MAAa,iBAAkB,SAAQ,UAAU;IAC7C,YAAY,OAAe,EAAE,KAAe;QACxC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC;IACvC,CAAC;CACJ;AALD,8CAKC;AAaD,MAAa,eAAgB,SAAQ,UAAU;IAC3B,WAAW,CAAS;IAEpC,YAAY,OAAe,EAAE,EAAE,KAAK,EAAE,WAAW,EAAuB;QACpE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AARD,0CAQC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../async/abortable/abortable"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/abortable/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.abortable = abortable;
4
+ const _shared_1 = require("../../async/_shared");
5
+ const _module_1 = require("../../async/lazy-promise/_module");
6
+ function abortSignalToPromise(abortSignal) {
7
+ let reject_ = null;
8
+ function abort() {
9
+ if (reject_ === null) {
10
+ return;
11
+ }
12
+ reject_(new _shared_1.AbortAsyncError(`Promise was aborted with reason of "${String(abortSignal.reason)}"`, abortSignal.reason));
13
+ }
14
+ if (abortSignal.aborted) {
15
+ return {
16
+ promise: Promise.reject(new _shared_1.AbortAsyncError(`Promise was aborted with reason of "${String(abortSignal.aborted)}"`, abortSignal.reason)),
17
+ abort,
18
+ };
19
+ }
20
+ return {
21
+ promise: new Promise((_resolve, reject) => {
22
+ reject_ = reject;
23
+ if (abortSignal.aborted) {
24
+ abort();
25
+ return;
26
+ }
27
+ abortSignal.addEventListener("abort", abort, {
28
+ once: true,
29
+ });
30
+ }),
31
+ abort,
32
+ };
33
+ }
34
+ function abortable(asyncFn, abortSignal) {
35
+ return new _module_1.LazyPromise(async () => {
36
+ if (abortSignal.aborted) {
37
+ throw new _shared_1.AbortAsyncError(`Promise was aborted with reason of "${String(abortSignal.reason)}"`, abortSignal.reason);
38
+ }
39
+ const { promise: abortSignalPromise, abort } = abortSignalToPromise(abortSignal);
40
+ try {
41
+ return await Promise.race([asyncFn(), abortSignalPromise]);
42
+ }
43
+ finally {
44
+ abortSignal.removeEventListener("abort", abort);
45
+ }
46
+ });
47
+ }
48
+ //# sourceMappingURL=abortable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abortable.js","sourceRoot":"","sources":["../../../../src/async/abortable/abortable.ts"],"names":[],"mappings":";;AA8FA,8BAoBC;AA9GD,6CAIyB;AACzB,0DAA2D;AAK3D,SAAS,oBAAoB,CACzB,WAAwB;IAKxB,IAAI,OAAO,GAAsC,IAAI,CAAC;IACtD,SAAS,KAAK;QACV,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QACD,OAAO,CACH,IAAI,yBAAe,CACf,uCAAuC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EACpE,WAAW,CAAC,MAAM,CACrB,CACJ,CAAC;IACN,CAAC;IAED,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO;YACH,OAAO,EAAE,OAAO,CAAC,MAAM,CACnB,IAAI,yBAAe,CACf,uCAAuC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,EACrE,WAAW,CAAC,MAAM,CACrB,CACJ;YACD,KAAK;SACR,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,EAAE,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtC,OAAO,GAAG,MAAM,CAAC;YACjB,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACtB,KAAK,EAAE,CAAC;gBACR,OAAO;YACX,CAAC;YACD,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE;gBACzC,IAAI,EAAE,IAAI;aACb,CAAC,CAAC;QACP,CAAC,CAAC;QACF,KAAK;KACR,CAAC;AACN,CAAC;AAoCD,SAAgB,SAAS,CACrB,OAAkC,EAClC,WAAwB;IAExB,OAAO,IAAI,qBAAW,CAAC,KAAK,IAAI,EAAE;QAC9B,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACtB,MAAM,IAAI,yBAAe,CACrB,uCAAuC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,EACpE,WAAW,CAAC,MAAM,CACrB,CAAC;QACN,CAAC;QAED,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,GACxC,oBAAoB,CAAS,WAAW,CAAC,CAAC;QAC9C,IAAI,CAAC;YACD,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAC/D,CAAC;gBAAS,CAAC;YACP,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../async/abortable-iterable/abortable-iterable"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/abortable-iterable/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gFAA8D"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.abortableIterable = abortableIterable;
4
+ const _shared_1 = require("../../async/_shared");
5
+ const _module_1 = require("../../async/abortable/_module");
6
+ class AbortableIterable {
7
+ iterable;
8
+ abortSignal;
9
+ constructor(iterable, abortSignal) {
10
+ this.iterable = iterable;
11
+ this.abortSignal = abortSignal;
12
+ }
13
+ async *[Symbol.asyncIterator]() {
14
+ const iterator = this.iterable[Symbol.asyncIterator]();
15
+ let result = await (0, _module_1.abortable)(() => iterator.next(), this.abortSignal);
16
+ yield result.value;
17
+ while (!result.done) {
18
+ if (this.abortSignal.aborted) {
19
+ throw new _shared_1.AbortAsyncError(`Promise was aborted with reason of "${String(this.abortSignal.aborted)}"`, this.abortSignal.reason);
20
+ }
21
+ result = await (0, _module_1.abortable)(() => iterator.next(), this.abortSignal);
22
+ if (result.done) {
23
+ return result.value;
24
+ }
25
+ yield result.value;
26
+ }
27
+ }
28
+ }
29
+ function abortableIterable(iterable, abortSignal) {
30
+ return new AbortableIterable(iterable, abortSignal);
31
+ }
32
+ //# sourceMappingURL=abortable-iterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abortable-iterable.js","sourceRoot":"","sources":["../../../../src/async/abortable-iterable/abortable-iterable.ts"],"names":[],"mappings":";;AA0EA,8CAKC;AA3ED,6CAIyB;AACzB,uDAAsD;AAKtD,MAAM,iBAAiB;IAEE;IACA;IAFrB,YACqB,QAA+B,EAC/B,WAAwB;QADxB,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,gBAAW,GAAX,WAAW,CAAa;IAC1C,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACvD,IAAI,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACtE,MAAM,MAAM,CAAC,KAAK,CAAC;QAEnB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,yBAAe,CACrB,uCAAuC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,EAC1E,IAAI,CAAC,WAAW,CAAC,MAAM,CAC1B,CAAC;YACN,CAAC;YACD,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YAClE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAEd,OAAO,MAAM,CAAC,KAAK,CAAC;YACxB,CAAC;YACD,MAAM,MAAM,CAAC,KAAK,CAAC;QACvB,CAAC;IACL,CAAC;CACJ;AAkCD,SAAgB,iBAAiB,CAC7B,QAA+B,EAC/B,WAAwB;IAExB,OAAO,IAAI,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../async/backof-policies/constant-backoff-policy/_module"), exports);
18
+ __exportStar(require("../../async/backof-policies/exponential-backoff-policy/_module"), exports);
19
+ __exportStar(require("../../async/backof-policies/linear-backoff-policy/_module"), exports);
20
+ __exportStar(require("../../async/backof-policies/polynomial-backoff-policy/_module"), exports);
21
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/backof-policies/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,0FAAwE;AACxE,6FAA2E;AAC3E,wFAAsE;AACtE,4FAA0E"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withJitter = withJitter;
4
+ function withJitter(jitter, value, mathRandom) {
5
+ return (1 - jitter * mathRandom()) * value;
6
+ }
7
+ //# sourceMappingURL=_shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../../src/async/backof-policies/_shared.ts"],"names":[],"mappings":";;AAaA,gCAMC;AAND,SAAgB,UAAU,CACtB,MAAc,EACd,KAAa,EACb,UAAwB;IAExB,OAAO,CAAC,CAAC,GAAG,MAAM,GAAG,UAAU,EAAE,CAAC,GAAG,KAAK,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../../async/backof-policies/constant-backoff-policy/constant-backoff-policy"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/constant-backoff-policy/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0GAAwF"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.constantBackoffPolicy = constantBackoffPolicy;
4
+ const _module_1 = require("../../../utilities/_module");
5
+ const _shared_1 = require("../../../async/backof-policies/_shared");
6
+ function constantBackoffPolicy(settings = {}) {
7
+ return (_attempt, error) => {
8
+ if (typeof settings === "function") {
9
+ settings = settings(error);
10
+ }
11
+ let { delay = 1000 } = settings;
12
+ if (delay instanceof _module_1.TimeSpan) {
13
+ delay = delay.toMilliseconds();
14
+ }
15
+ const { jitter = 0.5, _mathRandom = Math.random } = settings;
16
+ return (0, _shared_1.withJitter)(jitter, delay, _mathRandom);
17
+ };
18
+ }
19
+ //# sourceMappingURL=constant-backoff-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant-backoff-policy.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/constant-backoff-policy/constant-backoff-policy.ts"],"names":[],"mappings":";;AAiCA,sDAgBC;AA7CD,iDAA+C;AAC/C,6DAGyC;AAyBzC,SAAgB,qBAAqB,CACjC,WAE4D,EAAE;IAE9D,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACvB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACjC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,QAAQ,CAAC;QAChC,IAAI,KAAK,YAAY,kBAAQ,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC;QACnC,CAAC;QACD,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC;QAC7D,OAAO,IAAA,oBAAU,EAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../../async/backof-policies/exponential-backoff-policy/exponential-backoff-policy"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/exponential-backoff-policy/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gHAA8F"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.exponentialBackoffPolicy = exponentialBackoffPolicy;
4
+ const _module_1 = require("../../../utilities/_module");
5
+ const _shared_1 = require("../../../async/backof-policies/_shared");
6
+ function exponentialBackoffPolicy(settings = {}) {
7
+ return (attempt, error) => {
8
+ if (typeof settings === "function") {
9
+ settings = settings(error);
10
+ }
11
+ let { maxDelay = 60_000, minDelay = 1_000 } = settings;
12
+ if (maxDelay instanceof _module_1.TimeSpan) {
13
+ maxDelay = maxDelay.toMilliseconds();
14
+ }
15
+ if (minDelay instanceof _module_1.TimeSpan) {
16
+ minDelay = minDelay.toMilliseconds();
17
+ }
18
+ const { multiplier = 2, jitter = 0.5, _mathRandom = Math.random, } = settings;
19
+ const exponential = Math.min(maxDelay, minDelay * Math.pow(multiplier, attempt));
20
+ return (0, _shared_1.withJitter)(jitter, exponential, _mathRandom);
21
+ };
22
+ }
23
+ //# sourceMappingURL=exponential-backoff-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exponential-backoff-policy.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/exponential-backoff-policy/exponential-backoff-policy.ts"],"names":[],"mappings":";;AAuCA,4DA2BC;AA9DD,iDAA+C;AAE/C,6DAA6D;AAiC7D,SAAgB,wBAAwB,CACpC,WAE+D,EAAE;IAEjE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACtB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACjC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC;QACvD,IAAI,QAAQ,YAAY,kBAAQ,EAAE,CAAC;YAC/B,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,QAAQ,YAAY,kBAAQ,EAAE,CAAC;YAC/B,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;QACD,MAAM,EACF,UAAU,GAAG,CAAC,EACd,MAAM,GAAG,GAAG,EACZ,WAAW,GAAG,IAAI,CAAC,MAAM,GAC5B,GAAG,QAAQ,CAAC;QACb,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CACxB,QAAQ,EACR,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAC3C,CAAC;QACF,OAAO,IAAA,oBAAU,EAAC,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../../async/backof-policies/linear-backoff-policy/linear-backoff-policy"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/linear-backoff-policy/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sGAAoF"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.linearBackoffPolicy = linearBackoffPolicy;
4
+ const _module_1 = require("../../../utilities/_module");
5
+ const _shared_1 = require("../../../async/backof-policies/_shared");
6
+ function linearBackoffPolicy(settings = {}) {
7
+ return (attempt, error) => {
8
+ if (typeof settings === "function") {
9
+ settings = settings(error);
10
+ }
11
+ let { maxDelay = 6000, minDelay = 1_000 } = settings;
12
+ if (maxDelay instanceof _module_1.TimeSpan) {
13
+ maxDelay = maxDelay.toMilliseconds();
14
+ }
15
+ if (minDelay instanceof _module_1.TimeSpan) {
16
+ minDelay = minDelay.toMilliseconds();
17
+ }
18
+ const { jitter = 0.5, _mathRandom = Math.random } = settings;
19
+ const linear = Math.min(maxDelay, minDelay * attempt);
20
+ return (0, _shared_1.withJitter)(jitter, linear, _mathRandom);
21
+ };
22
+ }
23
+ //# sourceMappingURL=linear-backoff-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear-backoff-policy.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/linear-backoff-policy/linear-backoff-policy.ts"],"names":[],"mappings":";;AAmCA,kDAoBC;AAnDD,iDAA+C;AAE/C,6DAA6D;AA6B7D,SAAgB,mBAAmB,CAC/B,WAE0D,EAAE;IAE5D,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACtB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACjC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC;QACrD,IAAI,QAAQ,YAAY,kBAAQ,EAAE,CAAC;YAC/B,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,QAAQ,YAAY,kBAAQ,EAAE,CAAC;YAC/B,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;QACD,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC;QACtD,OAAO,IAAA,oBAAU,EAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACnD,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../../async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/polynomial-backoff-policy/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8GAA4F"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.polynomialBackoffPolicy = polynomialBackoffPolicy;
4
+ const _module_1 = require("../../../utilities/_module");
5
+ const _shared_1 = require("../../../async/backof-policies/_shared");
6
+ function polynomialBackoffPolicy(settings = {}) {
7
+ return (attempt, error) => {
8
+ if (typeof settings === "function") {
9
+ settings = settings(error);
10
+ }
11
+ let { maxDelay = 6000, minDelay = 1_000 } = settings;
12
+ if (maxDelay instanceof _module_1.TimeSpan) {
13
+ maxDelay = maxDelay.toMilliseconds();
14
+ }
15
+ if (minDelay instanceof _module_1.TimeSpan) {
16
+ minDelay = minDelay.toMilliseconds();
17
+ }
18
+ const { degree = 2, jitter = 0.5, _mathRandom = Math.random, } = settings;
19
+ const polynomial = Math.min(maxDelay, minDelay * Math.pow(attempt, degree));
20
+ return (0, _shared_1.withJitter)(jitter, polynomial, _mathRandom);
21
+ };
22
+ }
23
+ //# sourceMappingURL=polynomial-backoff-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polynomial-backoff-policy.js","sourceRoot":"","sources":["../../../../../src/async/backof-policies/polynomial-backoff-policy/polynomial-backoff-policy.ts"],"names":[],"mappings":";;AAuCA,0DA2BC;AA9DD,iDAA+C;AAE/C,6DAA6D;AAiC7D,SAAgB,uBAAuB,CACnC,WAE8D,EAAE;IAEhE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;QACtB,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACjC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,QAAQ,CAAC;QACrD,IAAI,QAAQ,YAAY,kBAAQ,EAAE,CAAC;YAC/B,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,QAAQ,YAAY,kBAAQ,EAAE,CAAC;YAC/B,QAAQ,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACzC,CAAC;QACD,MAAM,EACF,MAAM,GAAG,CAAC,EACV,MAAM,GAAG,GAAG,EACZ,WAAW,GAAG,IAAI,CAAC,MAAM,GAC5B,GAAG,QAAQ,CAAC;QACb,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CACvB,QAAQ,EACR,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CACvC,CAAC;QACF,OAAO,IAAA,oBAAU,EAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../async/delay/delay"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/delay/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delay = delay;
4
+ const _module_1 = require("../../async/abortable/_module");
5
+ const _module_2 = require("../../async/lazy-promise/_module");
6
+ function delay(time, abortSignal = new AbortController().signal) {
7
+ return new _module_2.LazyPromise(async () => {
8
+ let timeoutId = null;
9
+ const delay = new Promise((resolve) => {
10
+ timeoutId = setTimeout(() => {
11
+ resolve();
12
+ }, time.toMilliseconds());
13
+ });
14
+ try {
15
+ await (0, _module_1.abortable)(() => delay, abortSignal);
16
+ }
17
+ finally {
18
+ if (timeoutId === null) {
19
+ clearTimeout(timeoutId);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //# sourceMappingURL=delay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay.js","sourceRoot":"","sources":["../../../../src/async/delay/delay.ts"],"names":[],"mappings":";;AA8CA,sBAqBC;AAxDD,uDAAsD;AACtD,0DAA2D;AAkC3D,SAAgB,KAAK,CACjB,IAAc,EACd,cAA2B,IAAI,eAAe,EAAE,CAAC,MAAM;IAEvD,OAAO,IAAI,qBAAW,CAAC,KAAK,IAAI,EAAE;QAE9B,IAAI,SAAS,GAAQ,IAAI,CAAC;QAC1B,MAAM,KAAK,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACxC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;gBACxB,OAAO,EAAE,CAAC;YACd,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC;YACD,MAAM,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QAC9C,CAAC;gBAAS,CAAC;YACP,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBAErB,YAAY,CAAC,SAAS,CAAC,CAAC;YAC5B,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../async/delay-iterable/delay-iterable"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/delay-iterable/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wEAAsD"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delayIterable = delayIterable;
4
+ const _shared_1 = require("../../async/_shared");
5
+ const _module_1 = require("../../async/abortable/_module");
6
+ const delay_1 = require("../../async/delay/delay");
7
+ class DelayIterable {
8
+ iterable;
9
+ time;
10
+ abortSignal;
11
+ constructor(iterable, time, abortSignal) {
12
+ this.iterable = iterable;
13
+ this.time = time;
14
+ this.abortSignal = abortSignal;
15
+ }
16
+ async *[Symbol.asyncIterator]() {
17
+ const iterator = this.iterable[Symbol.asyncIterator]();
18
+ let result = await (0, _module_1.abortable)(() => iterator.next(), this.abortSignal);
19
+ yield result.value;
20
+ while (!result.done) {
21
+ if (this.abortSignal.aborted) {
22
+ throw new _shared_1.AbortAsyncError(`Promise was aborted with reason of "${String(this.abortSignal.aborted)}"`, this.abortSignal.reason);
23
+ }
24
+ await (0, delay_1.delay)(this.time, this.abortSignal);
25
+ result = await (0, _module_1.abortable)(() => iterator.next(), this.abortSignal);
26
+ if (result.done) {
27
+ return result.value;
28
+ }
29
+ yield result.value;
30
+ }
31
+ }
32
+ }
33
+ function delayIterable(iterable, time, abortSignal = new AbortController().signal) {
34
+ return new DelayIterable(iterable, time, abortSignal);
35
+ }
36
+ //# sourceMappingURL=delay-iterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay-iterable.js","sourceRoot":"","sources":["../../../../src/async/delay-iterable/delay-iterable.ts"],"names":[],"mappings":";;AAgGA,sCAMC;AA/FD,6CAAkD;AAClD,uDAAsD;AACtD,+CAA4C;AAK5C,MAAM,aAAa;IAEM;IACA;IACA;IAHrB,YACqB,QAA+B,EAC/B,IAAc,EACd,WAAwB;QAFxB,aAAQ,GAAR,QAAQ,CAAuB;QAC/B,SAAI,GAAJ,IAAI,CAAU;QACd,gBAAW,GAAX,WAAW,CAAa;IAC1C,CAAC;IAEJ,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QACvD,IAAI,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACtE,MAAM,MAAM,CAAC,KAAK,CAAC;QAEnB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAClB,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,yBAAe,CACrB,uCAAuC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,EAC1E,IAAI,CAAC,WAAW,CAAC,MAAM,CAC1B,CAAC;YACN,CAAC;YACD,MAAM,IAAA,aAAK,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACzC,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YAClE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAEd,OAAO,MAAM,CAAC,KAAK,CAAC;YACxB,CAAC;YACD,MAAM,MAAM,CAAC,KAAK,CAAC;QACvB,CAAC;IACL,CAAC;CACJ;AAsDD,SAAgB,aAAa,CACzB,QAA+B,EAC/B,IAAc,EACd,cAA2B,IAAI,eAAe,EAAE,CAAC,MAAM;IAEvD,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("../../async/lazy-promise/lazy-promise"), exports);
18
+ //# sourceMappingURL=_module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../src/async/lazy-promise/_module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD"}