@aws-amplify/core 6.0.1-console-preview.67f944e.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 (239) 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/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
  40. package/lib/providers/pinpoint/apis/updateEndpoint.js +7 -5
  41. package/lib/providers/pinpoint/types/pinpoint.d.ts +1 -0
  42. package/lib/singleton/Auth/utils/index.js +2 -1
  43. package/lib/tsconfig.tsbuildinfo +1 -1
  44. package/lib/types/core.d.ts +4 -1
  45. package/lib/utils/convert/base64/base64Decoder.d.ts +2 -0
  46. package/lib/utils/convert/base64/base64Decoder.js +11 -0
  47. package/lib/utils/convert/base64/base64Encoder.d.ts +2 -0
  48. package/lib/utils/convert/base64/base64Encoder.js +18 -0
  49. package/lib/utils/convert/base64/bytesToString.d.ts +1 -0
  50. package/lib/utils/convert/base64/bytesToString.js +9 -0
  51. package/lib/utils/convert/index.d.ts +2 -0
  52. package/lib/utils/convert/index.js +9 -0
  53. package/lib/utils/convert/types.d.ts +9 -0
  54. package/lib/utils/convert/types.js +4 -0
  55. package/lib/utils/generateRandomString.d.ts +1 -0
  56. package/lib/utils/generateRandomString.js +14 -0
  57. package/lib/utils/globalHelpers/index.d.ts +3 -0
  58. package/lib/utils/globalHelpers/index.js +50 -0
  59. package/lib/utils/globalHelpers/index.native.d.ts +5 -0
  60. package/lib/utils/globalHelpers/index.native.js +27 -0
  61. package/lib/utils/index.d.ts +6 -0
  62. package/lib/utils/index.js +21 -0
  63. package/lib/utils/isBrowser.d.ts +1 -0
  64. package/lib/utils/isBrowser.js +9 -0
  65. package/lib/utils/isWebWorker.d.ts +1 -0
  66. package/lib/utils/isWebWorker.js +14 -0
  67. package/lib/utils/retry/NonRetryableError.d.ts +4 -0
  68. package/lib/utils/retry/NonRetryableError.js +30 -0
  69. package/lib/utils/retry/constants.d.ts +1 -0
  70. package/lib/utils/retry/constants.js +6 -0
  71. package/lib/utils/retry/index.d.ts +5 -0
  72. package/lib/utils/retry/index.js +15 -0
  73. package/lib/utils/retry/isNonRetryableError.d.ts +2 -0
  74. package/lib/utils/retry/isNonRetryableError.js +10 -0
  75. package/lib/utils/retry/jitteredBackoff.d.ts +6 -0
  76. package/lib/utils/retry/jitteredBackoff.js +20 -0
  77. package/lib/utils/retry/jitteredExponentialRetry.d.ts +5 -0
  78. package/lib/utils/retry/jitteredExponentialRetry.js +17 -0
  79. package/lib/utils/retry/retry.d.ts +6 -0
  80. package/lib/{Util/Retry.js → utils/retry/retry.js} +6 -57
  81. package/lib/utils/urlSafeDecode.d.ts +1 -0
  82. package/lib/{Util/StringUtils.js → utils/urlSafeDecode.js} +2 -9
  83. package/lib/utils/urlSafeEncode.d.ts +1 -0
  84. package/lib/utils/urlSafeEncode.js +12 -0
  85. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +1 -1
  86. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +1 -1
  87. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
  88. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
  89. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +25 -0
  90. package/{lib/Util → lib-esm/BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
  91. package/lib-esm/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +4 -47
  92. package/lib-esm/BackgroundProcessManager/index.d.ts +1 -0
  93. package/lib-esm/BackgroundProcessManager/index.js +3 -0
  94. package/lib-esm/BackgroundProcessManager/types.d.ts +41 -0
  95. package/lib-esm/BackgroundProcessManager/types.js +20 -0
  96. package/lib-esm/Hub/index.js +1 -1
  97. package/lib-esm/Logger/ConsoleLogger.js +1 -1
  98. package/lib-esm/{Util → Mutex}/Mutex.d.ts +2 -15
  99. package/lib-esm/{Util → Mutex}/Mutex.js +1 -1
  100. package/lib-esm/Mutex/index.d.ts +1 -0
  101. package/lib-esm/Mutex/index.js +3 -0
  102. package/lib-esm/Mutex/types.d.ts +13 -0
  103. package/lib-esm/Mutex/types.js +3 -0
  104. package/lib-esm/Platform/version.d.ts +1 -1
  105. package/lib-esm/Platform/version.js +1 -1
  106. package/lib-esm/Reachability/Reachability.d.ts +6 -0
  107. package/lib-esm/Reachability/Reachability.js +26 -0
  108. package/lib-esm/Reachability/Reachability.native.d.ts +6 -0
  109. package/lib-esm/{Util → Reachability}/Reachability.native.js +6 -6
  110. package/lib-esm/Reachability/index.d.ts +1 -0
  111. package/lib-esm/Reachability/index.js +3 -0
  112. package/lib-esm/Reachability/types.d.ts +3 -0
  113. package/lib-esm/Reachability/types.js +3 -0
  114. package/lib-esm/ServiceWorker/ServiceWorker.js +1 -1
  115. package/lib-esm/{Signer.js → Signer/Signer.js} +2 -2
  116. package/lib-esm/Signer/index.d.ts +1 -0
  117. package/lib-esm/Signer/index.js +3 -0
  118. package/lib-esm/clients/middleware/retry/jitteredBackoff.js +1 -1
  119. package/lib-esm/{Util/Constants.d.ts → constants.d.ts} +0 -2
  120. package/lib-esm/{Util/Constants.js → constants.js} +0 -5
  121. package/lib-esm/libraryUtils.d.ts +7 -6
  122. package/lib-esm/libraryUtils.js +8 -8
  123. package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
  124. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +7 -5
  125. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +1 -0
  126. package/lib-esm/singleton/Auth/utils/index.js +2 -1
  127. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  128. package/lib-esm/types/core.d.ts +4 -1
  129. package/lib-esm/utils/convert/base64/base64Decoder.d.ts +2 -0
  130. package/lib-esm/utils/convert/base64/base64Decoder.js +8 -0
  131. package/lib-esm/utils/convert/base64/base64Encoder.d.ts +2 -0
  132. package/lib-esm/utils/convert/base64/base64Encoder.js +15 -0
  133. package/lib-esm/utils/convert/base64/bytesToString.d.ts +1 -0
  134. package/lib-esm/utils/convert/base64/bytesToString.js +5 -0
  135. package/lib-esm/utils/convert/index.d.ts +2 -0
  136. package/lib-esm/utils/convert/index.js +4 -0
  137. package/lib-esm/utils/convert/types.d.ts +9 -0
  138. package/lib-esm/utils/convert/types.js +3 -0
  139. package/lib-esm/utils/generateRandomString.d.ts +1 -0
  140. package/lib-esm/utils/generateRandomString.js +10 -0
  141. package/lib-esm/utils/globalHelpers/index.d.ts +3 -0
  142. package/lib-esm/utils/globalHelpers/index.js +44 -0
  143. package/lib-esm/utils/globalHelpers/index.native.d.ts +5 -0
  144. package/lib-esm/utils/globalHelpers/index.native.js +21 -0
  145. package/lib-esm/utils/index.d.ts +6 -0
  146. package/lib-esm/utils/index.js +8 -0
  147. package/lib-esm/utils/isBrowser.d.ts +1 -0
  148. package/lib-esm/utils/isBrowser.js +5 -0
  149. package/lib-esm/utils/isWebWorker.d.ts +1 -0
  150. package/lib-esm/utils/isWebWorker.js +10 -0
  151. package/lib-esm/utils/retry/NonRetryableError.d.ts +4 -0
  152. package/lib-esm/utils/retry/NonRetryableError.js +27 -0
  153. package/lib-esm/utils/retry/constants.d.ts +1 -0
  154. package/lib-esm/utils/retry/constants.js +3 -0
  155. package/lib-esm/utils/retry/index.d.ts +5 -0
  156. package/lib-esm/utils/retry/index.js +7 -0
  157. package/lib-esm/utils/retry/isNonRetryableError.d.ts +2 -0
  158. package/lib-esm/utils/retry/isNonRetryableError.js +6 -0
  159. package/lib-esm/utils/retry/jitteredBackoff.d.ts +6 -0
  160. package/lib-esm/utils/retry/jitteredBackoff.js +16 -0
  161. package/lib-esm/utils/retry/jitteredExponentialRetry.d.ts +5 -0
  162. package/lib-esm/utils/retry/jitteredExponentialRetry.js +13 -0
  163. package/lib-esm/utils/retry/retry.d.ts +6 -0
  164. package/lib-esm/{Util/Retry.js → utils/retry/retry.js} +4 -52
  165. package/lib-esm/{Util/StringUtils.d.ts → utils/urlSafeDecode.d.ts} +0 -1
  166. package/lib-esm/{Util/StringUtils.js → utils/urlSafeDecode.js} +0 -6
  167. package/{lib/Util/StringUtils.d.ts → lib-esm/utils/urlSafeEncode.d.ts} +0 -1
  168. package/lib-esm/utils/urlSafeEncode.js +8 -0
  169. package/package.json +7 -4
  170. package/src/BackgroundProcessManager/BackgroundManagerNotOpenError.ts +8 -0
  171. package/src/{Util → BackgroundProcessManager}/BackgroundProcessManager.ts +4 -58
  172. package/src/BackgroundProcessManager/index.ts +4 -0
  173. package/src/BackgroundProcessManager/types.ts +49 -0
  174. package/src/Hub/index.ts +1 -1
  175. package/src/Logger/ConsoleLogger.ts +1 -1
  176. package/src/{Util → Mutex}/Mutex.ts +2 -20
  177. package/src/Mutex/index.ts +4 -0
  178. package/src/Mutex/types.ts +20 -0
  179. package/src/Platform/version.ts +1 -1
  180. package/src/{Util → Reachability}/Reachability.native.ts +4 -11
  181. package/src/Reachability/Reachability.ts +35 -0
  182. package/src/Reachability/index.ts +4 -0
  183. package/src/Reachability/types.ts +6 -0
  184. package/src/ServiceWorker/ServiceWorker.ts +1 -1
  185. package/src/{Signer.ts → Signer/Signer.ts} +2 -2
  186. package/src/Signer/index.ts +4 -0
  187. package/src/clients/middleware/retry/jitteredBackoff.ts +1 -1
  188. package/src/{Util/Constants.ts → constants.ts} +0 -5
  189. package/src/libraryUtils.ts +16 -35
  190. package/src/providers/pinpoint/apis/updateEndpoint.ts +19 -3
  191. package/src/providers/pinpoint/types/pinpoint.ts +1 -0
  192. package/src/singleton/Auth/utils/index.ts +2 -1
  193. package/src/types/core.ts +4 -1
  194. package/src/utils/convert/base64/base64Decoder.ts +11 -0
  195. package/src/utils/convert/base64/base64Encoder.ts +18 -0
  196. package/src/utils/convert/base64/bytesToString.ts +6 -0
  197. package/src/utils/convert/index.ts +5 -0
  198. package/src/utils/convert/types.ts +17 -0
  199. package/src/utils/generateRandomString.ts +16 -0
  200. package/src/utils/globalHelpers/index.native.ts +28 -0
  201. package/src/utils/globalHelpers/index.ts +54 -0
  202. package/src/utils/index.ts +15 -0
  203. package/src/utils/isBrowser.ts +5 -0
  204. package/src/utils/isWebWorker.ts +13 -0
  205. package/src/utils/retry/NonRetryableError.ts +9 -0
  206. package/src/utils/retry/constants.ts +4 -0
  207. package/src/utils/retry/index.ts +8 -0
  208. package/src/utils/retry/isNonRetryableError.ts +9 -0
  209. package/src/utils/retry/jitteredBackoff.ts +21 -0
  210. package/src/utils/retry/jitteredExponentialRetry.ts +18 -0
  211. package/src/{Util/Retry.ts → utils/retry/retry.ts} +4 -44
  212. package/src/{Util/StringUtils.ts → utils/urlSafeDecode.ts} +0 -6
  213. package/src/utils/urlSafeEncode.ts +9 -0
  214. package/lib/Util/JS.d.ts +0 -29
  215. package/lib/Util/JS.js +0 -214
  216. package/lib/Util/Reachability.d.ts +0 -13
  217. package/lib/Util/Reachability.js +0 -69
  218. package/lib/Util/Reachability.native.d.ts +0 -12
  219. package/lib/Util/Retry.d.ts +0 -21
  220. package/lib/Util/index.d.ts +0 -7
  221. package/lib/Util/index.js +0 -31
  222. package/lib-esm/Util/JS.d.ts +0 -29
  223. package/lib-esm/Util/JS.js +0 -199
  224. package/lib-esm/Util/Reachability.d.ts +0 -13
  225. package/lib-esm/Util/Reachability.js +0 -64
  226. package/lib-esm/Util/Reachability.native.d.ts +0 -12
  227. package/lib-esm/Util/Retry.d.ts +0 -21
  228. package/lib-esm/Util/index.d.ts +0 -7
  229. package/lib-esm/Util/index.js +0 -9
  230. package/src/Util/JS.ts +0 -255
  231. package/src/Util/Reachability.ts +0 -58
  232. package/src/Util/index.ts +0 -23
  233. /package/lib/{Util → Signer}/DateUtils.d.ts +0 -0
  234. /package/lib/{Util → Signer}/DateUtils.js +0 -0
  235. /package/lib/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
  236. /package/lib-esm/{Util → Signer}/DateUtils.d.ts +0 -0
  237. /package/lib-esm/{Util → Signer}/DateUtils.js +0 -0
  238. /package/lib-esm/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
  239. /package/src/{Util → Signer}/DateUtils.ts +0 -0
@@ -0,0 +1,2 @@
1
+ import { Base64Decoder } from '../types';
2
+ export declare const base64Decoder: Base64Decoder;
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { getAtob } from '../../globalHelpers';
4
+ export var base64Decoder = {
5
+ convert: function (input) {
6
+ return getAtob()(input);
7
+ },
8
+ };
@@ -0,0 +1,2 @@
1
+ import { Base64Encoder } from '../types';
2
+ export declare const base64Encoder: Base64Encoder;
@@ -0,0 +1,15 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { getBtoa } from '../../globalHelpers';
4
+ import { bytesToString } from './bytesToString';
5
+ export var base64Encoder = {
6
+ convert: function (input, _a) {
7
+ var _b = _a === void 0 ? { urlSafe: false } : _a, urlSafe = _b.urlSafe;
8
+ var inputStr = typeof input === 'string' ? input : bytesToString(input);
9
+ var encodedStr = getBtoa()(inputStr);
10
+ // see details about the char replacing at https://datatracker.ietf.org/doc/html/rfc4648#section-5
11
+ return urlSafe
12
+ ? encodedStr.replace(/\+/g, '-').replace(/\//g, '_')
13
+ : encodedStr;
14
+ },
15
+ };
@@ -0,0 +1 @@
1
+ export declare function bytesToString(input: Uint8Array): string;
@@ -0,0 +1,5 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export function bytesToString(input) {
4
+ return Array.from(input, function (byte) { return String.fromCodePoint(byte); }).join('');
5
+ }
@@ -0,0 +1,2 @@
1
+ export { base64Decoder } from './base64/base64Decoder';
2
+ export { base64Encoder } from './base64/base64Encoder';
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { base64Decoder } from './base64/base64Decoder';
4
+ export { base64Encoder } from './base64/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,3 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -0,0 +1 @@
1
+ export declare const generateRandomString: (length: number) => string;
@@ -0,0 +1,10 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export var generateRandomString = function (length) {
4
+ var STATE_CHARSET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
5
+ var result = '';
6
+ for (var i = 0; i < length; i++) {
7
+ result += STATE_CHARSET.charAt(Math.floor(Math.random() * STATE_CHARSET.length));
8
+ }
9
+ return result;
10
+ };
@@ -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,44 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { AmplifyError } from '../../errors';
4
+ export var getCrypto = function () {
5
+ if (typeof window === 'object' && typeof window.crypto === 'object') {
6
+ return window.crypto;
7
+ }
8
+ // Next.js global polyfill
9
+ if (typeof crypto === 'object') {
10
+ return crypto;
11
+ }
12
+ throw new AmplifyError({
13
+ name: 'MissingPolyfill',
14
+ message: 'Cannot resolve the `crypto` function from the environment.',
15
+ });
16
+ };
17
+ export var getBtoa = function () {
18
+ // browser
19
+ if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
20
+ return window.btoa;
21
+ }
22
+ // Next.js global polyfill
23
+ if (typeof btoa === 'function') {
24
+ return btoa;
25
+ }
26
+ throw new AmplifyError({
27
+ name: 'Base64EncoderError',
28
+ message: 'Cannot resolve the `btoa` function from the environment.',
29
+ });
30
+ };
31
+ export var getAtob = function () {
32
+ // browser
33
+ if (typeof window !== 'undefined' && typeof window.atob === 'function') {
34
+ return window.atob;
35
+ }
36
+ // Next.js global polyfill
37
+ if (typeof atob === 'function') {
38
+ return atob;
39
+ }
40
+ throw new AmplifyError({
41
+ name: 'Base64EncoderError',
42
+ message: 'Cannot resolve the `atob` function from the environment.',
43
+ });
44
+ };
@@ -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,21 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import 'react-native-get-random-values';
4
+ import { encode, decode } from 'base-64';
5
+ import { AmplifyError } from '../../errors';
6
+ export var getCrypto = function () {
7
+ if (typeof crypto !== 'undefined' &&
8
+ typeof crypto.getRandomValues === 'function') {
9
+ return crypto;
10
+ }
11
+ throw new AmplifyError({
12
+ name: 'MissingPolyfill',
13
+ message: 'Cannot resolve the `crypto` function from the environment.',
14
+ });
15
+ };
16
+ export var getBtoa = function () {
17
+ return encode;
18
+ };
19
+ export var getAtob = function () {
20
+ return decode;
21
+ };
@@ -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,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { generateRandomString } from './generateRandomString';
4
+ export { isBrowser } from './isBrowser';
5
+ export { isWebWorker } from './isWebWorker';
6
+ export { NonRetryableError, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, } from './retry';
7
+ export { urlSafeDecode } from './urlSafeDecode';
8
+ export { urlSafeEncode } from './urlSafeEncode';
@@ -0,0 +1 @@
1
+ export declare const isBrowser: () => boolean;
@@ -0,0 +1,5 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export var isBrowser = function () {
4
+ return typeof window !== 'undefined' && typeof window.document !== 'undefined';
5
+ };
@@ -0,0 +1 @@
1
+ export declare const isWebWorker: () => boolean;
@@ -0,0 +1,10 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export var isWebWorker = function () {
4
+ if (typeof self === 'undefined') {
5
+ return false;
6
+ }
7
+ var selfContext = self;
8
+ return (typeof selfContext.WorkerGlobalScope !== 'undefined' &&
9
+ self instanceof selfContext.WorkerGlobalScope);
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare class NonRetryableError extends Error {
2
+ readonly nonRetryable = true;
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,27 @@
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 NonRetryableError = /** @class */ (function (_super) {
19
+ __extends(NonRetryableError, _super);
20
+ function NonRetryableError(message) {
21
+ var _this = _super.call(this, message) || this;
22
+ _this.nonRetryable = true;
23
+ return _this;
24
+ }
25
+ return NonRetryableError;
26
+ }(Error));
27
+ export { NonRetryableError };
@@ -0,0 +1 @@
1
+ export declare const MAX_DELAY_MS: number;
@@ -0,0 +1,3 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export var 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,7 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { NonRetryableError } from './NonRetryableError';
4
+ export { isNonRetryableError } from './isNonRetryableError';
5
+ export { jitteredBackoff } from './jitteredBackoff';
6
+ export { jitteredExponentialRetry } from './jitteredExponentialRetry';
7
+ export { retry } from './retry';
@@ -0,0 +1,2 @@
1
+ import { NonRetryableError } from './NonRetryableError';
2
+ export declare const isNonRetryableError: (obj: any) => obj is NonRetryableError;
@@ -0,0 +1,6 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export var isNonRetryableError = function (obj) {
4
+ var key = 'nonRetryable';
5
+ return obj && obj[key];
6
+ };
@@ -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,16 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { MAX_DELAY_MS } from './constants';
4
+ /**
5
+ * @private
6
+ * Internal use of Amplify only
7
+ */
8
+ export function jitteredBackoff(maxDelayMs) {
9
+ if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
10
+ var BASE_TIME_MS = 100;
11
+ var JITTER_FACTOR = 100;
12
+ return function (attempt) {
13
+ var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();
14
+ return delay > maxDelayMs ? false : delay;
15
+ };
16
+ }
@@ -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,13 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { MAX_DELAY_MS } from './constants';
4
+ import { jitteredBackoff } from './jitteredBackoff';
5
+ import { retry } from './retry';
6
+ /**
7
+ * @private
8
+ * Internal use of Amplify only
9
+ */
10
+ export var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs, onTerminate) {
11
+ if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
12
+ return retry(functionToRetry, args, jitteredBackoff(maxDelayMs), onTerminate);
13
+ };
@@ -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,18 +1,5 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
16
3
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
4
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
5
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -74,22 +61,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
74
61
  }
75
62
  return to.concat(ar || Array.prototype.slice.call(from));
76
63
  };
77
- import { ConsoleLogger as Logger } from '../Logger/ConsoleLogger';
64
+ import { ConsoleLogger as Logger } from '../../Logger/ConsoleLogger';
65
+ import { isNonRetryableError } from './isNonRetryableError';
78
66
  var logger = new Logger('Util');
79
- var NonRetryableError = /** @class */ (function (_super) {
80
- __extends(NonRetryableError, _super);
81
- function NonRetryableError(message) {
82
- var _this = _super.call(this, message) || this;
83
- _this.nonRetryable = true;
84
- return _this;
85
- }
86
- return NonRetryableError;
87
- }(Error));
88
- export { NonRetryableError };
89
- export var isNonRetryableError = function (obj) {
90
- var key = 'nonRetryable';
91
- return obj && obj[key];
92
- };
93
67
  /**
94
68
  * @private
95
69
  * Internal use of Amplify only
@@ -174,25 +148,3 @@ export function retry(functionToRetry, args, delayFn, onTerminate) {
174
148
  });
175
149
  });
176
150
  }
177
- var MAX_DELAY_MS = 5 * 60 * 1000;
178
- /**
179
- * @private
180
- * Internal use of Amplify only
181
- */
182
- export function jitteredBackoff(maxDelayMs) {
183
- if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
184
- var BASE_TIME_MS = 100;
185
- var JITTER_FACTOR = 100;
186
- return function (attempt) {
187
- var delay = Math.pow(2, attempt) * BASE_TIME_MS + JITTER_FACTOR * Math.random();
188
- return delay > maxDelayMs ? false : delay;
189
- };
190
- }
191
- /**
192
- * @private
193
- * Internal use of Amplify only
194
- */
195
- export var jitteredExponentialRetry = function (functionToRetry, args, maxDelayMs, onTerminate) {
196
- if (maxDelayMs === void 0) { maxDelayMs = MAX_DELAY_MS; }
197
- return retry(functionToRetry, args, jitteredBackoff(maxDelayMs), onTerminate);
198
- };
@@ -1,2 +1 @@
1
- export declare function urlSafeEncode(str: string): string;
2
1
  export declare function urlSafeDecode(hex: string): string;
@@ -1,11 +1,5 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- export function urlSafeEncode(str) {
4
- return str
5
- .split('')
6
- .map(function (char) { return char.charCodeAt(0).toString(16).padStart(2, '0'); })
7
- .join('');
8
- }
9
3
  export function urlSafeDecode(hex) {
10
4
  var matchArr = hex.match(/.{2}/g) || [];
11
5
  return matchArr.map(function (char) { return String.fromCharCode(parseInt(char, 16)); }).join('');
@@ -1,2 +1 @@
1
1
  export declare function urlSafeEncode(str: string): string;
2
- export declare function urlSafeDecode(hex: string): string;
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export function urlSafeEncode(str) {
4
+ return str
5
+ .split('')
6
+ .map(function (char) { return char.charCodeAt(0).toString(16).padStart(2, '0'); })
7
+ .join('');
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.0.1-console-preview.67f944e.0+67f944e",
3
+ "version": "6.0.1-console-preview.0bbe168.0+0bbe168",
4
4
  "description": "Core category of aws-amplify",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib-esm/index.js",
@@ -64,18 +64,21 @@
64
64
  "@aws-sdk/types": "3.398.0",
65
65
  "@smithy/util-hex-encoding": "2.0.0",
66
66
  "js-cookie": "^2.2.1",
67
+ "rxjs": "^7.8.1",
67
68
  "tslib": "^2.5.0",
68
- "uuid": "^9.0.0",
69
- "zen-observable-ts": "0.8.19"
69
+ "uuid": "^9.0.0"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@react-native-async-storage/async-storage": "^1.17.12",
73
73
  "@react-native-community/netinfo": "4.7.0",
74
+ "@types/base-64": "1.0.0",
74
75
  "@types/js-cookie": "^2.2.7",
75
76
  "@types/uuid": "^9.0.0",
77
+ "base-64": "1.0.0",
76
78
  "find": "^0.2.7",
77
79
  "genversion": "^2.2.0",
78
80
  "react-native": "^0.68.7",
81
+ "react-native-get-random-values": "1.9.0",
79
82
  "typescript": "5.0.2"
80
83
  },
81
84
  "size-limit": [
@@ -182,5 +185,5 @@
182
185
  "lib-esm"
183
186
  ]
184
187
  },
185
- "gitHead": "67f944e08acb70d5edf6743f5d23a048db1a57ae"
188
+ "gitHead": "0bbe168c66929877174b331c71f7666bb16529d6"
186
189
  }
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export class BackgroundManagerNotOpenError extends Error {
5
+ constructor(message: string) {
6
+ super(`BackgroundManagerNotOpenError: ${message}`);
7
+ }
8
+ }
@@ -1,5 +1,9 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { BackgroundManagerNotOpenError } from './BackgroundManagerNotOpenError';
5
+ import { BackgroundProcessManagerState, JobEntry } from './types';
6
+
3
7
  /**
4
8
  * @private For internal Amplify use.
5
9
  *
@@ -415,61 +419,3 @@ export class BackgroundProcessManager {
415
419
  this._state = BackgroundProcessManagerState.Open;
416
420
  }
417
421
  }
418
-
419
- /**
420
- *
421
- */
422
- export class BackgroundManagerNotOpenError extends Error {
423
- constructor(message: string) {
424
- super(`BackgroundManagerNotOpenError: ${message}`);
425
- }
426
- }
427
-
428
- /**
429
- * All possible states a `BackgroundProcessManager` instance can be in.
430
- */
431
- export enum BackgroundProcessManagerState {
432
- /**
433
- * Accepting new jobs.
434
- */
435
- Open = 'Open',
436
-
437
- /**
438
- * Not accepting new jobs. Waiting for submitted jobs to complete.
439
- */
440
- Closing = 'Closing',
441
-
442
- /**
443
- * Not accepting new jobs. All submitted jobs are complete.
444
- */
445
- Closed = 'Closed',
446
- }
447
-
448
- /**
449
- * Completely internal to `BackgroundProcessManager`, and describes the structure of
450
- * an entry in the jobs registry.
451
- */
452
- type JobEntry = {
453
- /**
454
- * The underlying promise provided by the job function to wait for.
455
- */
456
- promise: Promise<any>;
457
-
458
- /**
459
- * Request the termination of the job.
460
- */
461
- terminate: () => void;
462
-
463
- /**
464
- * An object provided by the caller that can be used to identify the description
465
- * of the job, which can otherwise be unclear from the `promise` and
466
- * `terminate` function. The `description` can be a string. (May be extended
467
- * later to also support object refs.)
468
- *
469
- * Useful for troubleshooting why a manager is waiting for long periods of time
470
- * on `close()`.
471
- */
472
- description?: string;
473
- };
474
-
475
- const process = new BackgroundProcessManager();
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export { BackgroundProcessManager } from './BackgroundProcessManager';
@@ -0,0 +1,49 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /**
5
+ * All possible states a `BackgroundProcessManager` instance can be in.
6
+ */
7
+ export enum BackgroundProcessManagerState {
8
+ /**
9
+ * Accepting new jobs.
10
+ */
11
+ Open = 'Open',
12
+
13
+ /**
14
+ * Not accepting new jobs. Waiting for submitted jobs to complete.
15
+ */
16
+ Closing = 'Closing',
17
+
18
+ /**
19
+ * Not accepting new jobs. All submitted jobs are complete.
20
+ */
21
+ Closed = 'Closed',
22
+ }
23
+
24
+ /**
25
+ * Completely internal to `BackgroundProcessManager`, and describes the structure of
26
+ * an entry in the jobs registry.
27
+ */
28
+ export type JobEntry = {
29
+ /**
30
+ * The underlying promise provided by the job function to wait for.
31
+ */
32
+ promise: Promise<any>;
33
+
34
+ /**
35
+ * Request the termination of the job.
36
+ */
37
+ terminate: () => void;
38
+
39
+ /**
40
+ * An object provided by the caller that can be used to identify the description
41
+ * of the job, which can otherwise be unclear from the `promise` and
42
+ * `terminate` function. The `description` can be a string. (May be extended
43
+ * later to also support object refs.)
44
+ *
45
+ * Useful for troubleshooting why a manager is waiting for long periods of time
46
+ * on `close()`.
47
+ */
48
+ description?: string;
49
+ };
package/src/Hub/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { ConsoleLogger as Logger } from '../Logger';
5
- import { NO_HUBCALLBACK_PROVIDED_EXCEPTION } from '../Util/Constants';
5
+ import { NO_HUBCALLBACK_PROVIDED_EXCEPTION } from '../constants';
6
6
  import { AmplifyError } from '../errors';
7
7
  import {
8
8
  AmplifyChannel,
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { LoggingProvider, InputLogEvent } from '../types';
5
- import { AWS_CLOUDWATCH_CATEGORY } from '../Util/Constants';
5
+ import { AWS_CLOUDWATCH_CATEGORY } from '../constants';
6
6
  import { Logger } from './logger-interface';
7
7
 
8
8
  const LOG_LEVELS: Record<string, number> = {