@aws-amplify/core 6.0.1-console-preview.431c340.0 → 6.0.1-console-preview.0bbe168.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 (228) hide show
  1. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
  2. package/lib/AwsClients/Pinpoint/putEvents.d.ts +1 -1
  3. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
  4. package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
  5. package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +28 -0
  6. package/{lib-esm/Util → lib/BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
  7. package/lib/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +13 -56
  8. package/lib/BackgroundProcessManager/index.d.ts +1 -0
  9. package/lib/BackgroundProcessManager/index.js +7 -0
  10. package/lib/BackgroundProcessManager/types.d.ts +41 -0
  11. package/lib/BackgroundProcessManager/types.js +23 -0
  12. package/lib/Hub/index.js +2 -2
  13. package/lib/Logger/ConsoleLogger.js +2 -2
  14. package/lib/{Util → Mutex}/Mutex.d.ts +2 -15
  15. package/lib/{Util → Mutex}/Mutex.js +2 -1
  16. package/lib/Mutex/index.d.ts +1 -0
  17. package/lib/Mutex/index.js +7 -0
  18. package/lib/Mutex/types.d.ts +13 -0
  19. package/lib/Mutex/types.js +4 -0
  20. package/lib/Platform/version.d.ts +1 -1
  21. package/lib/Platform/version.js +1 -1
  22. package/lib/Reachability/Reachability.d.ts +6 -0
  23. package/lib/Reachability/Reachability.js +29 -0
  24. package/lib/Reachability/Reachability.native.d.ts +6 -0
  25. package/lib/{Util → Reachability}/Reachability.native.js +8 -10
  26. package/lib/Reachability/index.d.ts +1 -0
  27. package/lib/Reachability/index.js +7 -0
  28. package/lib/Reachability/types.d.ts +3 -0
  29. package/lib/Reachability/types.js +4 -0
  30. package/lib/ServiceWorker/ServiceWorker.js +2 -2
  31. package/lib/{Signer.js → Signer/Signer.js} +3 -3
  32. package/lib/Signer/index.d.ts +1 -0
  33. package/lib/Signer/index.js +7 -0
  34. package/lib/clients/middleware/retry/jitteredBackoff.js +2 -2
  35. package/lib/{Util/Constants.d.ts → constants.d.ts} +0 -2
  36. package/lib/{Util/Constants.js → constants.js} +1 -6
  37. package/lib/libraryUtils.d.ts +7 -6
  38. package/lib/libraryUtils.js +37 -49
  39. package/lib/singleton/Auth/utils/index.js +2 -1
  40. package/lib/tsconfig.tsbuildinfo +1 -1
  41. package/lib/utils/convert/base64/base64Decoder.d.ts +2 -0
  42. package/lib/utils/convert/base64/base64Decoder.js +11 -0
  43. package/lib/utils/convert/base64/base64Encoder.d.ts +2 -0
  44. package/lib/utils/convert/base64/base64Encoder.js +18 -0
  45. package/lib/utils/convert/base64/bytesToString.d.ts +1 -0
  46. package/lib/utils/convert/base64/bytesToString.js +9 -0
  47. package/lib/utils/convert/index.d.ts +2 -0
  48. package/lib/utils/convert/index.js +9 -0
  49. package/lib/utils/convert/types.d.ts +9 -0
  50. package/lib/utils/convert/types.js +4 -0
  51. package/lib/utils/generateRandomString.d.ts +1 -0
  52. package/lib/utils/generateRandomString.js +14 -0
  53. package/lib/utils/globalHelpers/index.d.ts +3 -0
  54. package/lib/utils/globalHelpers/index.js +50 -0
  55. package/lib/utils/globalHelpers/index.native.d.ts +5 -0
  56. package/lib/utils/globalHelpers/index.native.js +27 -0
  57. package/lib/utils/index.d.ts +6 -0
  58. package/lib/utils/index.js +21 -0
  59. package/lib/utils/isBrowser.d.ts +1 -0
  60. package/lib/utils/isBrowser.js +9 -0
  61. package/lib/utils/isWebWorker.d.ts +1 -0
  62. package/lib/utils/isWebWorker.js +14 -0
  63. package/lib/utils/retry/NonRetryableError.d.ts +4 -0
  64. package/lib/utils/retry/NonRetryableError.js +30 -0
  65. package/lib/utils/retry/constants.d.ts +1 -0
  66. package/lib/utils/retry/constants.js +6 -0
  67. package/lib/utils/retry/index.d.ts +5 -0
  68. package/lib/utils/retry/index.js +15 -0
  69. package/lib/utils/retry/isNonRetryableError.d.ts +2 -0
  70. package/lib/utils/retry/isNonRetryableError.js +10 -0
  71. package/lib/utils/retry/jitteredBackoff.d.ts +6 -0
  72. package/lib/utils/retry/jitteredBackoff.js +20 -0
  73. package/lib/utils/retry/jitteredExponentialRetry.d.ts +5 -0
  74. package/lib/utils/retry/jitteredExponentialRetry.js +17 -0
  75. package/lib/utils/retry/retry.d.ts +6 -0
  76. package/lib/{Util/Retry.js → utils/retry/retry.js} +6 -57
  77. package/lib/utils/urlSafeDecode.d.ts +1 -0
  78. package/lib/{Util/StringUtils.js → utils/urlSafeDecode.js} +2 -9
  79. package/lib/utils/urlSafeEncode.d.ts +1 -0
  80. package/lib/utils/urlSafeEncode.js +12 -0
  81. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
  82. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +1 -1
  83. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
  84. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
  85. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +25 -0
  86. package/{lib/Util → lib-esm/BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
  87. package/lib-esm/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +4 -47
  88. package/lib-esm/BackgroundProcessManager/index.d.ts +1 -0
  89. package/lib-esm/BackgroundProcessManager/index.js +3 -0
  90. package/lib-esm/BackgroundProcessManager/types.d.ts +41 -0
  91. package/lib-esm/BackgroundProcessManager/types.js +20 -0
  92. package/lib-esm/Hub/index.js +1 -1
  93. package/lib-esm/Logger/ConsoleLogger.js +1 -1
  94. package/lib-esm/{Util → Mutex}/Mutex.d.ts +2 -15
  95. package/lib-esm/{Util → Mutex}/Mutex.js +1 -1
  96. package/lib-esm/Mutex/index.d.ts +1 -0
  97. package/lib-esm/Mutex/index.js +3 -0
  98. package/lib-esm/Mutex/types.d.ts +13 -0
  99. package/lib-esm/Mutex/types.js +3 -0
  100. package/lib-esm/Platform/version.d.ts +1 -1
  101. package/lib-esm/Platform/version.js +1 -1
  102. package/lib-esm/Reachability/Reachability.d.ts +6 -0
  103. package/lib-esm/Reachability/Reachability.js +26 -0
  104. package/lib-esm/Reachability/Reachability.native.d.ts +6 -0
  105. package/lib-esm/{Util → Reachability}/Reachability.native.js +6 -6
  106. package/lib-esm/Reachability/index.d.ts +1 -0
  107. package/lib-esm/Reachability/index.js +3 -0
  108. package/lib-esm/Reachability/types.d.ts +3 -0
  109. package/lib-esm/Reachability/types.js +3 -0
  110. package/lib-esm/ServiceWorker/ServiceWorker.js +1 -1
  111. package/lib-esm/{Signer.js → Signer/Signer.js} +2 -2
  112. package/lib-esm/Signer/index.d.ts +1 -0
  113. package/lib-esm/Signer/index.js +3 -0
  114. package/lib-esm/clients/middleware/retry/jitteredBackoff.js +1 -1
  115. package/lib-esm/{Util/Constants.d.ts → constants.d.ts} +0 -2
  116. package/lib-esm/{Util/Constants.js → constants.js} +0 -5
  117. package/lib-esm/libraryUtils.d.ts +7 -6
  118. package/lib-esm/libraryUtils.js +8 -8
  119. package/lib-esm/singleton/Auth/utils/index.js +2 -1
  120. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  121. package/lib-esm/utils/convert/base64/base64Decoder.d.ts +2 -0
  122. package/lib-esm/utils/convert/base64/base64Decoder.js +8 -0
  123. package/lib-esm/utils/convert/base64/base64Encoder.d.ts +2 -0
  124. package/lib-esm/utils/convert/base64/base64Encoder.js +15 -0
  125. package/lib-esm/utils/convert/base64/bytesToString.d.ts +1 -0
  126. package/lib-esm/utils/convert/base64/bytesToString.js +5 -0
  127. package/lib-esm/utils/convert/index.d.ts +2 -0
  128. package/lib-esm/utils/convert/index.js +4 -0
  129. package/lib-esm/utils/convert/types.d.ts +9 -0
  130. package/lib-esm/utils/convert/types.js +3 -0
  131. package/lib-esm/utils/generateRandomString.d.ts +1 -0
  132. package/lib-esm/utils/generateRandomString.js +10 -0
  133. package/lib-esm/utils/globalHelpers/index.d.ts +3 -0
  134. package/lib-esm/utils/globalHelpers/index.js +44 -0
  135. package/lib-esm/utils/globalHelpers/index.native.d.ts +5 -0
  136. package/lib-esm/utils/globalHelpers/index.native.js +21 -0
  137. package/lib-esm/utils/index.d.ts +6 -0
  138. package/lib-esm/utils/index.js +8 -0
  139. package/lib-esm/utils/isBrowser.d.ts +1 -0
  140. package/lib-esm/utils/isBrowser.js +5 -0
  141. package/lib-esm/utils/isWebWorker.d.ts +1 -0
  142. package/lib-esm/utils/isWebWorker.js +10 -0
  143. package/lib-esm/utils/retry/NonRetryableError.d.ts +4 -0
  144. package/lib-esm/utils/retry/NonRetryableError.js +27 -0
  145. package/lib-esm/utils/retry/constants.d.ts +1 -0
  146. package/lib-esm/utils/retry/constants.js +3 -0
  147. package/lib-esm/utils/retry/index.d.ts +5 -0
  148. package/lib-esm/utils/retry/index.js +7 -0
  149. package/lib-esm/utils/retry/isNonRetryableError.d.ts +2 -0
  150. package/lib-esm/utils/retry/isNonRetryableError.js +6 -0
  151. package/lib-esm/utils/retry/jitteredBackoff.d.ts +6 -0
  152. package/lib-esm/utils/retry/jitteredBackoff.js +16 -0
  153. package/lib-esm/utils/retry/jitteredExponentialRetry.d.ts +5 -0
  154. package/lib-esm/utils/retry/jitteredExponentialRetry.js +13 -0
  155. package/lib-esm/utils/retry/retry.d.ts +6 -0
  156. package/lib-esm/{Util/Retry.js → utils/retry/retry.js} +4 -52
  157. package/lib-esm/{Util/StringUtils.d.ts → utils/urlSafeDecode.d.ts} +0 -1
  158. package/lib-esm/{Util/StringUtils.js → utils/urlSafeDecode.js} +0 -6
  159. package/{lib/Util/StringUtils.d.ts → lib-esm/utils/urlSafeEncode.d.ts} +0 -1
  160. package/lib-esm/utils/urlSafeEncode.js +8 -0
  161. package/package.json +7 -4
  162. package/src/BackgroundProcessManager/BackgroundManagerNotOpenError.ts +8 -0
  163. package/src/{Util → BackgroundProcessManager}/BackgroundProcessManager.ts +4 -58
  164. package/src/BackgroundProcessManager/index.ts +4 -0
  165. package/src/BackgroundProcessManager/types.ts +49 -0
  166. package/src/Hub/index.ts +1 -1
  167. package/src/Logger/ConsoleLogger.ts +1 -1
  168. package/src/{Util → Mutex}/Mutex.ts +2 -20
  169. package/src/Mutex/index.ts +4 -0
  170. package/src/Mutex/types.ts +20 -0
  171. package/src/Platform/version.ts +1 -1
  172. package/src/{Util → Reachability}/Reachability.native.ts +4 -11
  173. package/src/Reachability/Reachability.ts +35 -0
  174. package/src/Reachability/index.ts +4 -0
  175. package/src/Reachability/types.ts +6 -0
  176. package/src/ServiceWorker/ServiceWorker.ts +1 -1
  177. package/src/{Signer.ts → Signer/Signer.ts} +2 -2
  178. package/src/Signer/index.ts +4 -0
  179. package/src/clients/middleware/retry/jitteredBackoff.ts +1 -1
  180. package/src/{Util/Constants.ts → constants.ts} +0 -5
  181. package/src/libraryUtils.ts +16 -35
  182. package/src/singleton/Auth/utils/index.ts +2 -1
  183. package/src/utils/convert/base64/base64Decoder.ts +11 -0
  184. package/src/utils/convert/base64/base64Encoder.ts +18 -0
  185. package/src/utils/convert/base64/bytesToString.ts +6 -0
  186. package/src/utils/convert/index.ts +5 -0
  187. package/src/utils/convert/types.ts +17 -0
  188. package/src/utils/generateRandomString.ts +16 -0
  189. package/src/utils/globalHelpers/index.native.ts +28 -0
  190. package/src/utils/globalHelpers/index.ts +54 -0
  191. package/src/utils/index.ts +15 -0
  192. package/src/utils/isBrowser.ts +5 -0
  193. package/src/utils/isWebWorker.ts +13 -0
  194. package/src/utils/retry/NonRetryableError.ts +9 -0
  195. package/src/utils/retry/constants.ts +4 -0
  196. package/src/utils/retry/index.ts +8 -0
  197. package/src/utils/retry/isNonRetryableError.ts +9 -0
  198. package/src/utils/retry/jitteredBackoff.ts +21 -0
  199. package/src/utils/retry/jitteredExponentialRetry.ts +18 -0
  200. package/src/{Util/Retry.ts → utils/retry/retry.ts} +4 -44
  201. package/src/{Util/StringUtils.ts → utils/urlSafeDecode.ts} +0 -6
  202. package/src/utils/urlSafeEncode.ts +9 -0
  203. package/lib/Util/JS.d.ts +0 -29
  204. package/lib/Util/JS.js +0 -214
  205. package/lib/Util/Reachability.d.ts +0 -13
  206. package/lib/Util/Reachability.js +0 -69
  207. package/lib/Util/Reachability.native.d.ts +0 -12
  208. package/lib/Util/Retry.d.ts +0 -21
  209. package/lib/Util/index.d.ts +0 -7
  210. package/lib/Util/index.js +0 -31
  211. package/lib-esm/Util/JS.d.ts +0 -29
  212. package/lib-esm/Util/JS.js +0 -199
  213. package/lib-esm/Util/Reachability.d.ts +0 -13
  214. package/lib-esm/Util/Reachability.js +0 -64
  215. package/lib-esm/Util/Reachability.native.d.ts +0 -12
  216. package/lib-esm/Util/Retry.d.ts +0 -21
  217. package/lib-esm/Util/index.d.ts +0 -7
  218. package/lib-esm/Util/index.js +0 -9
  219. package/src/Util/JS.ts +0 -255
  220. package/src/Util/Reachability.ts +0 -58
  221. package/src/Util/index.ts +0 -23
  222. /package/lib/{Util → Signer}/DateUtils.d.ts +0 -0
  223. /package/lib/{Util → Signer}/DateUtils.js +0 -0
  224. /package/lib/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
  225. /package/lib-esm/{Util → Signer}/DateUtils.d.ts +0 -0
  226. /package/lib-esm/{Util → Signer}/DateUtils.js +0 -0
  227. /package/lib-esm/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
  228. /package/src/{Util → Signer}/DateUtils.ts +0 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.base64Encoder = void 0;
6
+ var globalHelpers_1 = require("../../globalHelpers");
7
+ var bytesToString_1 = require("./bytesToString");
8
+ exports.base64Encoder = {
9
+ convert: function (input, _a) {
10
+ var _b = _a === void 0 ? { urlSafe: false } : _a, urlSafe = _b.urlSafe;
11
+ var inputStr = typeof input === 'string' ? input : (0, bytesToString_1.bytesToString)(input);
12
+ var encodedStr = (0, globalHelpers_1.getBtoa)()(inputStr);
13
+ // see details about the char replacing at https://datatracker.ietf.org/doc/html/rfc4648#section-5
14
+ return urlSafe
15
+ ? encodedStr.replace(/\+/g, '-').replace(/\//g, '_')
16
+ : encodedStr;
17
+ },
18
+ };
@@ -0,0 +1 @@
1
+ export declare function bytesToString(input: Uint8Array): string;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.bytesToString = void 0;
6
+ function bytesToString(input) {
7
+ return Array.from(input, function (byte) { return String.fromCodePoint(byte); }).join('');
8
+ }
9
+ exports.bytesToString = bytesToString;
@@ -0,0 +1,2 @@
1
+ export { base64Decoder } from './base64/base64Decoder';
2
+ export { base64Encoder } from './base64/base64Encoder';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.base64Encoder = exports.base64Decoder = void 0;
6
+ var base64Decoder_1 = require("./base64/base64Decoder");
7
+ Object.defineProperty(exports, "base64Decoder", { enumerable: true, get: function () { return base64Decoder_1.base64Decoder; } });
8
+ var base64Encoder_1 = require("./base64/base64Encoder");
9
+ Object.defineProperty(exports, "base64Encoder", { enumerable: true, get: function () { return base64Encoder_1.base64Encoder; } });
@@ -0,0 +1,9 @@
1
+ export interface Base64EncoderConvertOptions {
2
+ urlSafe: boolean;
3
+ }
4
+ export interface Base64Encoder {
5
+ convert(input: Uint8Array | string, options?: Base64EncoderConvertOptions): string;
6
+ }
7
+ export interface Base64Decoder {
8
+ convert(input: string): string;
9
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export declare const generateRandomString: (length: number) => string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.generateRandomString = void 0;
6
+ var generateRandomString = function (length) {
7
+ var STATE_CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
8
+ var result = '';
9
+ for (var i = 0; i < length; i++) {
10
+ result += STATE_CHARSET.charAt(Math.floor(Math.random() * STATE_CHARSET.length));
11
+ }
12
+ return result;
13
+ };
14
+ exports.generateRandomString = generateRandomString;
@@ -0,0 +1,3 @@
1
+ export declare const getCrypto: () => Crypto;
2
+ export declare const getBtoa: () => typeof btoa;
3
+ export declare const getAtob: () => typeof atob;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getAtob = exports.getBtoa = exports.getCrypto = void 0;
6
+ var errors_1 = require("../../errors");
7
+ var getCrypto = function () {
8
+ if (typeof window === 'object' && typeof window.crypto === 'object') {
9
+ return window.crypto;
10
+ }
11
+ // Next.js global polyfill
12
+ if (typeof crypto === 'object') {
13
+ return crypto;
14
+ }
15
+ throw new errors_1.AmplifyError({
16
+ name: 'MissingPolyfill',
17
+ message: 'Cannot resolve the `crypto` function from the environment.',
18
+ });
19
+ };
20
+ exports.getCrypto = getCrypto;
21
+ var getBtoa = function () {
22
+ // browser
23
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
24
+ return window.btoa;
25
+ }
26
+ // Next.js global polyfill
27
+ if (typeof btoa === 'function') {
28
+ return btoa;
29
+ }
30
+ throw new errors_1.AmplifyError({
31
+ name: 'Base64EncoderError',
32
+ message: 'Cannot resolve the `btoa` function from the environment.',
33
+ });
34
+ };
35
+ exports.getBtoa = getBtoa;
36
+ var getAtob = function () {
37
+ // browser
38
+ if (typeof window !== 'undefined' && typeof window.atob === 'function') {
39
+ return window.atob;
40
+ }
41
+ // Next.js global polyfill
42
+ if (typeof atob === 'function') {
43
+ return atob;
44
+ }
45
+ throw new errors_1.AmplifyError({
46
+ name: 'Base64EncoderError',
47
+ message: 'Cannot resolve the `atob` function from the environment.',
48
+ });
49
+ };
50
+ exports.getAtob = getAtob;
@@ -0,0 +1,5 @@
1
+ import 'react-native-get-random-values';
2
+ import { encode, decode } from 'base-64';
3
+ export declare const getCrypto: () => Crypto;
4
+ export declare const getBtoa: () => typeof encode;
5
+ export declare const getAtob: () => typeof decode;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getAtob = exports.getBtoa = exports.getCrypto = void 0;
6
+ require("react-native-get-random-values");
7
+ var base_64_1 = require("base-64");
8
+ var errors_1 = require("../../errors");
9
+ var getCrypto = function () {
10
+ if (typeof crypto !== 'undefined' &&
11
+ typeof crypto.getRandomValues === 'function') {
12
+ return crypto;
13
+ }
14
+ throw new errors_1.AmplifyError({
15
+ name: 'MissingPolyfill',
16
+ message: 'Cannot resolve the `crypto` function from the environment.',
17
+ });
18
+ };
19
+ exports.getCrypto = getCrypto;
20
+ var getBtoa = function () {
21
+ return base_64_1.encode;
22
+ };
23
+ exports.getBtoa = getBtoa;
24
+ var getAtob = function () {
25
+ return base_64_1.decode;
26
+ };
27
+ exports.getAtob = getAtob;
@@ -0,0 +1,6 @@
1
+ export { generateRandomString } from './generateRandomString';
2
+ export { isBrowser } from './isBrowser';
3
+ export { isWebWorker } from './isWebWorker';
4
+ export { NonRetryableError, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, } from './retry';
5
+ export { urlSafeDecode } from './urlSafeDecode';
6
+ export { urlSafeEncode } from './urlSafeEncode';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isNonRetryableError = exports.NonRetryableError = exports.isWebWorker = exports.isBrowser = exports.generateRandomString = void 0;
6
+ var generateRandomString_1 = require("./generateRandomString");
7
+ Object.defineProperty(exports, "generateRandomString", { enumerable: true, get: function () { return generateRandomString_1.generateRandomString; } });
8
+ var isBrowser_1 = require("./isBrowser");
9
+ Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return isBrowser_1.isBrowser; } });
10
+ var isWebWorker_1 = require("./isWebWorker");
11
+ Object.defineProperty(exports, "isWebWorker", { enumerable: true, get: function () { return isWebWorker_1.isWebWorker; } });
12
+ var retry_1 = require("./retry");
13
+ Object.defineProperty(exports, "NonRetryableError", { enumerable: true, get: function () { return retry_1.NonRetryableError; } });
14
+ Object.defineProperty(exports, "isNonRetryableError", { enumerable: true, get: function () { return retry_1.isNonRetryableError; } });
15
+ Object.defineProperty(exports, "jitteredBackoff", { enumerable: true, get: function () { return retry_1.jitteredBackoff; } });
16
+ Object.defineProperty(exports, "jitteredExponentialRetry", { enumerable: true, get: function () { return retry_1.jitteredExponentialRetry; } });
17
+ Object.defineProperty(exports, "retry", { enumerable: true, get: function () { return retry_1.retry; } });
18
+ var urlSafeDecode_1 = require("./urlSafeDecode");
19
+ Object.defineProperty(exports, "urlSafeDecode", { enumerable: true, get: function () { return urlSafeDecode_1.urlSafeDecode; } });
20
+ var urlSafeEncode_1 = require("./urlSafeEncode");
21
+ Object.defineProperty(exports, "urlSafeEncode", { enumerable: true, get: function () { return urlSafeEncode_1.urlSafeEncode; } });
@@ -0,0 +1 @@
1
+ export declare const isBrowser: () => boolean;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.isBrowser = void 0;
6
+ var isBrowser = function () {
7
+ return typeof window !== 'undefined' && typeof window.document !== 'undefined';
8
+ };
9
+ exports.isBrowser = isBrowser;
@@ -0,0 +1 @@
1
+ export declare const isWebWorker: () => boolean;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.isWebWorker = void 0;
6
+ var isWebWorker = function () {
7
+ if (typeof self === 'undefined') {
8
+ return false;
9
+ }
10
+ var selfContext = self;
11
+ return (typeof selfContext.WorkerGlobalScope !== 'undefined' &&
12
+ self instanceof selfContext.WorkerGlobalScope);
13
+ };
14
+ exports.isWebWorker = isWebWorker;
@@ -0,0 +1,4 @@
1
+ export declare class NonRetryableError extends Error {
2
+ readonly nonRetryable = true;
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __extends = (this && this.__extends) || (function () {
5
+ var extendStatics = function (d, b) {
6
+ extendStatics = Object.setPrototypeOf ||
7
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
9
+ return extendStatics(d, b);
10
+ };
11
+ return function (d, b) {
12
+ if (typeof b !== "function" && b !== null)
13
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
+ extendStatics(d, b);
15
+ function __() { this.constructor = d; }
16
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
+ };
18
+ })();
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.NonRetryableError = void 0;
21
+ var NonRetryableError = /** @class */ (function (_super) {
22
+ __extends(NonRetryableError, _super);
23
+ function NonRetryableError(message) {
24
+ var _this = _super.call(this, message) || this;
25
+ _this.nonRetryable = true;
26
+ return _this;
27
+ }
28
+ return NonRetryableError;
29
+ }(Error));
30
+ exports.NonRetryableError = NonRetryableError;
@@ -0,0 +1 @@
1
+ export declare const MAX_DELAY_MS: number;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.MAX_DELAY_MS = void 0;
6
+ exports.MAX_DELAY_MS = 5 * 60 * 1000;
@@ -0,0 +1,5 @@
1
+ export { NonRetryableError } from './NonRetryableError';
2
+ export { isNonRetryableError } from './isNonRetryableError';
3
+ export { jitteredBackoff } from './jitteredBackoff';
4
+ export { jitteredExponentialRetry } from './jitteredExponentialRetry';
5
+ export { retry } from './retry';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isNonRetryableError = exports.NonRetryableError = void 0;
6
+ var NonRetryableError_1 = require("./NonRetryableError");
7
+ Object.defineProperty(exports, "NonRetryableError", { enumerable: true, get: function () { return NonRetryableError_1.NonRetryableError; } });
8
+ var isNonRetryableError_1 = require("./isNonRetryableError");
9
+ Object.defineProperty(exports, "isNonRetryableError", { enumerable: true, get: function () { return isNonRetryableError_1.isNonRetryableError; } });
10
+ var jitteredBackoff_1 = require("./jitteredBackoff");
11
+ Object.defineProperty(exports, "jitteredBackoff", { enumerable: true, get: function () { return jitteredBackoff_1.jitteredBackoff; } });
12
+ var jitteredExponentialRetry_1 = require("./jitteredExponentialRetry");
13
+ Object.defineProperty(exports, "jitteredExponentialRetry", { enumerable: true, get: function () { return jitteredExponentialRetry_1.jitteredExponentialRetry; } });
14
+ var retry_1 = require("./retry");
15
+ Object.defineProperty(exports, "retry", { enumerable: true, get: function () { return retry_1.retry; } });
@@ -0,0 +1,2 @@
1
+ import { NonRetryableError } from './NonRetryableError';
2
+ export declare const isNonRetryableError: (obj: any) => obj is NonRetryableError;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.isNonRetryableError = void 0;
6
+ var isNonRetryableError = function (obj) {
7
+ var key = 'nonRetryable';
8
+ return obj && obj[key];
9
+ };
10
+ exports.isNonRetryableError = isNonRetryableError;
@@ -0,0 +1,6 @@
1
+ import { DelayFunction } from '../../types';
2
+ /**
3
+ * @private
4
+ * Internal use of Amplify only
5
+ */
6
+ export declare function jitteredBackoff(maxDelayMs?: number): DelayFunction;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.jitteredBackoff = void 0;
6
+ var constants_1 = require("./constants");
7
+ /**
8
+ * @private
9
+ * Internal use of Amplify only
10
+ */
11
+ function jitteredBackoff(maxDelayMs) {
12
+ if (maxDelayMs === void 0) { maxDelayMs = constants_1.MAX_DELAY_MS; }
13
+ var BASE_TIME_MS = 100;
14
+ var JITTER_FACTOR = 100;
15
+ return function (attempt) {
16
+ var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();
17
+ return delay > maxDelayMs ? false : delay;
18
+ };
19
+ }
20
+ exports.jitteredBackoff = jitteredBackoff;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @private
3
+ * Internal use of Amplify only
4
+ */
5
+ export declare const jitteredExponentialRetry: <T>(functionToRetry: (...args: any[]) => T, args: any[], maxDelayMs?: number, onTerminate?: Promise<void>) => Promise<T>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.jitteredExponentialRetry = void 0;
6
+ var constants_1 = require("./constants");
7
+ var jitteredBackoff_1 = require("./jitteredBackoff");
8
+ var retry_1 = require("./retry");
9
+ /**
10
+ * @private
11
+ * Internal use of Amplify only
12
+ */
13
+ var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs, onTerminate) {
14
+ if (maxDelayMs === void 0) { maxDelayMs = constants_1.MAX_DELAY_MS; }
15
+ return (0, retry_1.retry)(functionToRetry, args, (0, jitteredBackoff_1.jitteredBackoff)(maxDelayMs), onTerminate);
16
+ };
17
+ exports.jitteredExponentialRetry = jitteredExponentialRetry;
@@ -0,0 +1,6 @@
1
+ import { DelayFunction } from '../../types';
2
+ /**
3
+ * @private
4
+ * Internal use of Amplify only
5
+ */
6
+ export declare function retry<T>(functionToRetry: (...args: any[]) => T, args: any[], delayFn: DelayFunction, onTerminate?: Promise<void>): Promise<T>;
@@ -1,19 +1,6 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
17
4
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
5
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
6
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -76,24 +63,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
76
63
  return to.concat(ar || Array.prototype.slice.call(from));
77
64
  };
78
65
  Object.defineProperty(exports, "__esModule", { value: true });
79
- exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.retry = exports.isNonRetryableError = exports.NonRetryableError = void 0;
80
- var ConsoleLogger_1 = require("../Logger/ConsoleLogger");
66
+ exports.retry = void 0;
67
+ var ConsoleLogger_1 = require("../../Logger/ConsoleLogger");
68
+ var isNonRetryableError_1 = require("./isNonRetryableError");
81
69
  var logger = new ConsoleLogger_1.ConsoleLogger('Util');
82
- var NonRetryableError = /** @class */ (function (_super) {
83
- __extends(NonRetryableError, _super);
84
- function NonRetryableError(message) {
85
- var _this = _super.call(this, message) || this;
86
- _this.nonRetryable = true;
87
- return _this;
88
- }
89
- return NonRetryableError;
90
- }(Error));
91
- exports.NonRetryableError = NonRetryableError;
92
- var isNonRetryableError = function (obj) {
93
- var key = 'nonRetryable';
94
- return obj && obj[key];
95
- };
96
- exports.isNonRetryableError = isNonRetryableError;
97
70
  /**
98
71
  * @private
99
72
  * Internal use of Amplify only
@@ -139,7 +112,7 @@ function retry(functionToRetry, args, delayFn, onTerminate) {
139
112
  err_1 = _d.sent();
140
113
  lastError = err_1;
141
114
  logger.debug("error on ".concat(functionToRetry.name), err_1);
142
- if ((0, exports.isNonRetryableError)(err_1)) {
115
+ if ((0, isNonRetryableError_1.isNonRetryableError)(err_1)) {
143
116
  logger.debug("".concat(functionToRetry.name, " non retryable error"), err_1);
144
117
  return [2 /*return*/, { value: reject(err_1) }];
145
118
  }
@@ -179,27 +152,3 @@ function retry(functionToRetry, args, delayFn, onTerminate) {
179
152
  });
180
153
  }
181
154
  exports.retry = retry;
182
- var MAX_DELAY_MS = 5 * 60 * 1000;
183
- /**
184
- * @private
185
- * Internal use of Amplify only
186
- */
187
- function jitteredBackoff(maxDelayMs) {
188
- if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
189
- var BASE_TIME_MS = 100;
190
- var JITTER_FACTOR = 100;
191
- return function (attempt) {
192
- var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();
193
- return delay > maxDelayMs ? false : delay;
194
- };
195
- }
196
- exports.jitteredBackoff = jitteredBackoff;
197
- /**
198
- * @private
199
- * Internal use of Amplify only
200
- */
201
- var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs, onTerminate) {
202
- if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
203
- return retry(functionToRetry, args, jitteredBackoff(maxDelayMs), onTerminate);
204
- };
205
- exports.jitteredExponentialRetry = jitteredExponentialRetry;
@@ -0,0 +1 @@
1
+ export declare function urlSafeDecode(hex: string): string;
@@ -1,15 +1,8 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.urlSafeDecode = exports.urlSafeEncode = void 0;
4
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
3
  // SPDX-License-Identifier: Apache-2.0
6
- function urlSafeEncode(str) {
7
- return str
8
- .split('')
9
- .map(function (char) { return char.charCodeAt(0).toString(16).padStart(2, '0'); })
10
- .join('');
11
- }
12
- exports.urlSafeEncode = urlSafeEncode;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.urlSafeDecode = void 0;
13
6
  function urlSafeDecode(hex) {
14
7
  var matchArr = hex.match(/.{2}/g) || [];
15
8
  return matchArr.map(function (char) { return String.fromCharCode(parseInt(char, 16)); }).join('');
@@ -0,0 +1 @@
1
+ export declare function urlSafeEncode(str: string): string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.urlSafeEncode = void 0;
6
+ function urlSafeEncode(str) {
7
+ return str
8
+ .split('')
9
+ .map(function (char) { return char.charCodeAt(0).toString(16).padStart(2, '0'); })
10
+ .join('');
11
+ }
12
+ exports.urlSafeEncode = urlSafeEncode;
@@ -13,11 +13,11 @@ export declare const getInAppMessages: (config: {
13
13
  computeDelay?: ((attempt: number) => number) | undefined;
14
14
  userAgentValue?: string | undefined;
15
15
  } & {
16
- uriEscapePath?: boolean | undefined;
17
16
  credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
18
17
  region: string;
19
18
  abortSignal?: AbortSignal | undefined;
20
19
  cache?: RequestCache | undefined;
21
20
  maxAttempts?: number | undefined;
22
21
  userAgentHeader?: string | undefined;
22
+ uriEscapePath?: boolean | undefined;
23
23
  }, input: GetInAppMessagesInput) => Promise<GetInAppMessagesOutput>;
@@ -13,11 +13,11 @@ export declare const putEvents: (config: {
13
13
  computeDelay?: ((attempt: number) => number) | undefined;
14
14
  userAgentValue?: string | undefined;
15
15
  } & {
16
- uriEscapePath?: boolean | undefined;
17
16
  credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
18
17
  region: string;
19
18
  abortSignal?: AbortSignal | undefined;
20
19
  cache?: RequestCache | undefined;
21
20
  maxAttempts?: number | undefined;
22
21
  userAgentHeader?: string | undefined;
22
+ uriEscapePath?: boolean | undefined;
23
23
  }, input: PutEventsInput) => Promise<PutEventsOutput>;
@@ -13,11 +13,11 @@ export declare const updateEndpoint: (config: {
13
13
  computeDelay?: ((attempt: number) => number) | undefined;
14
14
  userAgentValue?: string | undefined;
15
15
  } & {
16
- uriEscapePath?: boolean | undefined;
17
16
  credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
18
17
  region: string;
19
18
  abortSignal?: AbortSignal | undefined;
20
19
  cache?: RequestCache | undefined;
21
20
  maxAttempts?: number | undefined;
22
21
  userAgentHeader?: string | undefined;
22
+ uriEscapePath?: boolean | undefined;
23
23
  }, input: UpdateEndpointInput) => Promise<UpdateEndpointOutput>;
@@ -0,0 +1,3 @@
1
+ export declare class BackgroundManagerNotOpenError extends Error {
2
+ constructor(message: string);
3
+ }
@@ -0,0 +1,25 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var __extends = (this && this.__extends) || (function () {
4
+ var extendStatics = function (d, b) {
5
+ extendStatics = Object.setPrototypeOf ||
6
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
+ return extendStatics(d, b);
9
+ };
10
+ return function (d, b) {
11
+ if (typeof b !== "function" && b !== null)
12
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
+ extendStatics(d, b);
14
+ function __() { this.constructor = d; }
15
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
+ };
17
+ })();
18
+ var BackgroundManagerNotOpenError = /** @class */ (function (_super) {
19
+ __extends(BackgroundManagerNotOpenError, _super);
20
+ function BackgroundManagerNotOpenError(message) {
21
+ return _super.call(this, "BackgroundManagerNotOpenError: ".concat(message)) || this;
22
+ }
23
+ return BackgroundManagerNotOpenError;
24
+ }(Error));
25
+ export { BackgroundManagerNotOpenError };
@@ -1,3 +1,4 @@
1
+ import { BackgroundProcessManagerState } from './types';
1
2
  /**
2
3
  * @private For internal Amplify use.
3
4
  *
@@ -179,26 +180,3 @@ export declare class BackgroundProcessManager {
179
180
  */
180
181
  open(): Promise<void>;
181
182
  }
182
- /**
183
- *
184
- */
185
- export declare class BackgroundManagerNotOpenError extends Error {
186
- constructor(message: string);
187
- }
188
- /**
189
- * All possible states a `BackgroundProcessManager` instance can be in.
190
- */
191
- export declare enum BackgroundProcessManagerState {
192
- /**
193
- * Accepting new jobs.
194
- */
195
- Open = "Open",
196
- /**
197
- * Not accepting new jobs. Waiting for submitted jobs to complete.
198
- */
199
- Closing = "Closing",
200
- /**
201
- * Not accepting new jobs. All submitted jobs are complete.
202
- */
203
- Closed = "Closed"
204
- }