@aws-amplify/core 6.0.1-preview-testing.034e780.0 → 6.0.1-server-generate-client.1e317a1.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 (799) hide show
  1. package/internals/aws-clients/pinpoint/package.json +4 -4
  2. package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
  3. package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +28 -0
  4. package/lib/{Util → BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
  5. package/lib/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +13 -56
  6. package/lib/BackgroundProcessManager/index.d.ts +1 -0
  7. package/lib/BackgroundProcessManager/index.js +7 -0
  8. package/lib/BackgroundProcessManager/types.d.ts +41 -0
  9. package/lib/BackgroundProcessManager/types.js +23 -0
  10. package/lib/Cache/StorageCache.d.ts +14 -31
  11. package/lib/Cache/StorageCache.js +97 -102
  12. package/lib/Cache/StorageCache.native.d.ts +19 -0
  13. package/lib/Cache/StorageCache.native.js +164 -0
  14. package/lib/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
  15. package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +494 -441
  16. package/lib/Cache/constants.d.ts +6 -0
  17. package/lib/Cache/constants.js +17 -0
  18. package/lib/Cache/index.d.ts +2 -0
  19. package/lib/Cache/index.js +7 -0
  20. package/lib/Cache/types/cache.d.ts +38 -0
  21. package/lib/Cache/types/index.d.ts +1 -1
  22. package/lib/Cache/types/index.js +1 -1
  23. package/lib/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  24. package/lib/Cache/{Utils → utils}/CacheList.js +7 -19
  25. package/lib/Cache/utils/cacheHelpers.d.ts +14 -0
  26. package/lib/Cache/utils/cacheHelpers.js +51 -0
  27. package/lib/Cache/utils/errorHelpers.d.ts +7 -0
  28. package/lib/Cache/utils/errorHelpers.js +25 -0
  29. package/lib/Cache/utils/index.d.ts +2 -0
  30. package/lib/Cache/utils/index.js +12 -0
  31. package/lib/Hub/index.d.ts +7 -0
  32. package/lib/Hub/index.js +12 -5
  33. package/lib/Hub/types/AuthTypes.d.ts +19 -0
  34. package/lib/I18n/I18n.d.ts +3 -19
  35. package/lib/I18n/I18n.js +1 -21
  36. package/lib/I18n/errorHelpers.d.ts +5 -0
  37. package/lib/I18n/errorHelpers.js +17 -0
  38. package/lib/I18n/index.d.ts +3 -15
  39. package/lib/I18n/index.js +5 -30
  40. package/lib/I18n/types.d.ts +1 -4
  41. package/lib/I18n/types.js +5 -8
  42. package/lib/Logger/ConsoleLogger.js +2 -2
  43. package/{lib-esm/Util → lib/Mutex}/Mutex.d.ts +2 -15
  44. package/lib/{Util → Mutex}/Mutex.js +2 -1
  45. package/lib/Mutex/index.d.ts +1 -0
  46. package/lib/Mutex/index.js +7 -0
  47. package/lib/Mutex/types.d.ts +13 -0
  48. package/lib/Platform/customUserAgent.d.ts +16 -0
  49. package/lib/Platform/customUserAgent.js +70 -0
  50. package/lib/Platform/index.js +10 -1
  51. package/lib/Platform/types.d.ts +75 -8
  52. package/lib/Platform/types.js +40 -39
  53. package/lib/Platform/version.d.ts +1 -1
  54. package/lib/Platform/version.js +1 -1
  55. package/lib/Reachability/Reachability.d.ts +7 -0
  56. package/lib/{Util → Reachability}/Reachability.js +24 -23
  57. package/lib/Reachability/Reachability.native.d.ts +6 -0
  58. package/lib/{Util → Reachability}/Reachability.native.js +8 -10
  59. package/lib/Reachability/index.d.ts +1 -0
  60. package/lib/Reachability/index.js +7 -0
  61. package/lib/Reachability/types.d.ts +3 -0
  62. package/lib/Reachability/types.js +4 -0
  63. package/lib/ServiceWorker/ServiceWorker.js +84 -54
  64. package/lib/ServiceWorker/errorHelpers.d.ts +7 -0
  65. package/lib/ServiceWorker/errorHelpers.js +25 -0
  66. package/lib/ServiceWorker/index.d.ts +0 -12
  67. package/lib/ServiceWorker/index.js +0 -12
  68. package/lib/{Signer.js → Signer/Signer.js} +6 -5
  69. package/lib/Signer/index.d.ts +1 -0
  70. package/lib/Signer/index.js +7 -0
  71. package/lib/adapterCore/error/AmplifyServerContextError.d.ts +1 -1
  72. package/lib/adapterCore/error/AmplifyServerContextError.js +2 -2
  73. package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.js +2 -1
  74. package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +2 -1
  75. package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +2 -1
  76. package/lib/awsClients/cognitoIdentity/types.js +4 -0
  77. package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +2 -1
  78. package/lib/awsClients/pinpoint/errorHelpers.d.ts +5 -0
  79. package/lib/awsClients/pinpoint/errorHelpers.js +17 -0
  80. package/{lib-esm/AwsClients/Pinpoint → lib/awsClients/pinpoint}/getInAppMessages.d.ts +4 -3
  81. package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.js +2 -1
  82. package/{lib-esm/AwsClients/Pinpoint → lib/awsClients/pinpoint}/putEvents.d.ts +4 -3
  83. package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.js +4 -7
  84. package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +4 -3
  85. package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.js +2 -1
  86. package/lib/clients/handlers/fetch.js +2 -1
  87. package/lib/clients/middleware/retry/jitteredBackoff.js +2 -2
  88. package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  89. package/lib/clients/types/http.d.ts +17 -1
  90. package/lib/constants.d.ts +4 -0
  91. package/lib/constants.js +18 -0
  92. package/lib/{Util/Errors.d.ts → errors/AmplifyError.d.ts} +2 -9
  93. package/lib/{Util/Errors.js → errors/AmplifyError.js} +1 -18
  94. package/lib/errors/PlatformNotSupportedError.d.ts +4 -0
  95. package/lib/errors/PlatformNotSupportedError.js +33 -0
  96. package/lib/errors/createAssertionFunction.d.ts +3 -0
  97. package/lib/errors/createAssertionFunction.js +22 -0
  98. package/lib/errors/errorHelpers.d.ts +2 -0
  99. package/lib/errors/errorHelpers.js +20 -0
  100. package/lib/errors/index.d.ts +4 -0
  101. package/lib/errors/index.js +13 -0
  102. package/lib/index.d.ts +7 -7
  103. package/lib/index.js +17 -16
  104. package/lib/libraryUtils.d.ts +19 -16
  105. package/lib/libraryUtils.js +57 -69
  106. package/lib/parseAWSExports.js +144 -13
  107. package/lib/providers/kinesis/types/index.d.ts +1 -0
  108. package/lib/providers/kinesis/types/index.js +19 -0
  109. package/lib/providers/kinesis/types/kinesis.d.ts +9 -0
  110. package/lib/providers/kinesis/types/kinesis.js +4 -0
  111. package/lib/providers/kinesis-firehose/types/index.d.ts +1 -0
  112. package/lib/providers/kinesis-firehose/types/index.js +4 -0
  113. package/lib/providers/kinesis-firehose/types/kinesis-firehose.d.ts +9 -0
  114. package/lib/providers/kinesis-firehose/types/kinesis-firehose.js +4 -0
  115. package/lib/providers/personalize/types/index.d.ts +1 -0
  116. package/lib/providers/personalize/types/index.js +4 -0
  117. package/lib/providers/personalize/types/personalize.d.ts +8 -0
  118. package/lib/providers/personalize/types/personalize.js +4 -0
  119. package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -0
  120. package/lib/providers/pinpoint/apis/flushEvents.js +21 -0
  121. package/lib/providers/pinpoint/apis/index.d.ts +1 -0
  122. package/lib/providers/pinpoint/apis/index.js +3 -1
  123. package/lib/providers/pinpoint/apis/record.d.ts +1 -1
  124. package/lib/providers/pinpoint/apis/record.js +8 -24
  125. package/lib/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
  126. package/lib/providers/pinpoint/apis/updateEndpoint.js +15 -13
  127. package/lib/providers/pinpoint/index.d.ts +2 -1
  128. package/lib/providers/pinpoint/index.js +5 -0
  129. package/lib/providers/pinpoint/types/errors.d.ts +9 -0
  130. package/lib/providers/pinpoint/types/errors.js +15 -0
  131. package/lib/providers/pinpoint/types/index.d.ts +1 -0
  132. package/lib/providers/pinpoint/types/index.js +3 -0
  133. package/lib/providers/pinpoint/types/pinpoint.d.ts +5 -4
  134. package/lib/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -0
  135. package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +12 -7
  136. package/lib/providers/pinpoint/utils/index.d.ts +1 -0
  137. package/lib/providers/pinpoint/utils/index.js +3 -1
  138. package/lib/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
  139. package/lib/{RNComponents → providers/pinpoint/utils}/isAppInForeground.js +1 -4
  140. package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +1 -0
  141. package/lib/providers/pinpoint/utils/isAppInForeground.native.js +9 -0
  142. package/lib/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  143. package/lib/{StorageHelper/inMemoryStorage.js → providers/pinpoint/utils/resolveEndpointId.js} +44 -41
  144. package/lib/singleton/API/types.d.ts +165 -0
  145. package/lib/singleton/API/types.js +12 -0
  146. package/lib/singleton/Amplify.d.ts +2 -2
  147. package/lib/singleton/Amplify.js +6 -5
  148. package/lib/singleton/Analytics/types.d.ts +4 -1
  149. package/lib/singleton/Auth/types.d.ts +29 -2
  150. package/lib/singleton/Auth/utils/errorHelpers.d.ts +8 -0
  151. package/lib/singleton/Auth/utils/errorHelpers.js +33 -0
  152. package/lib/singleton/Auth/utils/index.d.ts +1 -1
  153. package/lib/singleton/Auth/utils/index.js +21 -36
  154. package/lib/singleton/Cache/types.d.ts +18 -0
  155. package/lib/singleton/Cache/types.js +4 -0
  156. package/lib/singleton/Geo/types.d.ts +17 -0
  157. package/lib/singleton/Geo/types.js +4 -0
  158. package/lib/singleton/Interactions/types.d.ts +21 -0
  159. package/lib/singleton/Interactions/types.js +4 -0
  160. package/lib/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
  161. package/lib/singleton/Notifications/InAppMessaging/types.js +4 -0
  162. package/lib/singleton/Notifications/PushNotification/types.d.ts +2 -0
  163. package/lib/singleton/Notifications/PushNotification/types.js +4 -0
  164. package/lib/singleton/Notifications/types.d.ts +6 -0
  165. package/lib/singleton/Notifications/types.js +4 -0
  166. package/lib/singleton/types.d.ts +10 -1
  167. package/{lib-esm/StorageHelper/cookieStorage.d.ts → lib/storage/CookieStorage.d.ts} +4 -3
  168. package/lib/{StorageHelper/cookieStorage.js → storage/CookieStorage.js} +38 -83
  169. package/lib/storage/CookieStorage.native.d.ts +7 -0
  170. package/lib/storage/CookieStorage.native.js +32 -0
  171. package/lib/storage/DefaultStorage.d.ts +7 -0
  172. package/lib/storage/DefaultStorage.js +33 -0
  173. package/{lib-esm/StorageHelper/localStorage.d.ts → lib/storage/DefaultStorage.native.d.ts} +6 -5
  174. package/lib/{StorageHelper/localStorage.js → storage/DefaultStorage.native.js} +25 -43
  175. package/lib/storage/InMemoryStorage.d.ts +12 -0
  176. package/lib/storage/InMemoryStorage.js +41 -0
  177. package/lib/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
  178. package/{lib-esm/StorageHelper/sessionStorage.js → lib/storage/KeyValueStorage.js} +20 -19
  179. package/lib/storage/SessionStorage.d.ts +7 -0
  180. package/lib/storage/SessionStorage.js +33 -0
  181. package/lib/storage/index.d.ts +7 -0
  182. package/lib/storage/index.js +14 -0
  183. package/lib/storage/utils.d.ts +10 -0
  184. package/lib/storage/utils.js +26 -0
  185. package/lib/tsconfig.tsbuildinfo +1 -1
  186. package/lib/types/core.d.ts +4 -1
  187. package/lib/types/errors.d.ts +9 -3
  188. package/lib/types/errors.js +7 -0
  189. package/lib/types/storage.d.ts +3 -0
  190. package/lib/utils/amplifyUrl/index.d.ts +13 -0
  191. package/lib/utils/amplifyUrl/index.js +10 -0
  192. package/lib/utils/amplifyUrl/polyfill.d.ts +0 -0
  193. package/lib/utils/amplifyUrl/polyfill.js +4 -0
  194. package/lib/utils/amplifyUrl/polyfill.native.d.ts +1 -0
  195. package/lib/utils/amplifyUrl/polyfill.native.js +6 -0
  196. package/lib/utils/amplifyUuid/index.d.ts +3 -0
  197. package/lib/utils/amplifyUuid/index.js +9 -0
  198. package/lib/utils/amplifyUuid/polyfill.d.ts +0 -0
  199. package/lib/utils/amplifyUuid/polyfill.js +4 -0
  200. package/lib/utils/amplifyUuid/polyfill.native.d.ts +1 -0
  201. package/lib/utils/amplifyUuid/polyfill.native.js +6 -0
  202. package/lib/utils/convert/base64/base64Decoder.d.ts +2 -0
  203. package/lib/utils/convert/base64/base64Decoder.js +11 -0
  204. package/lib/utils/convert/base64/base64Encoder.d.ts +2 -0
  205. package/lib/utils/convert/base64/base64Encoder.js +18 -0
  206. package/lib/utils/convert/base64/bytesToString.d.ts +1 -0
  207. package/lib/utils/convert/base64/bytesToString.js +9 -0
  208. package/lib/utils/convert/index.d.ts +2 -0
  209. package/lib/utils/convert/index.js +9 -0
  210. package/lib/utils/convert/types.d.ts +9 -0
  211. package/lib/utils/convert/types.js +4 -0
  212. package/lib/utils/deepFreeze.d.ts +1 -0
  213. package/lib/utils/deepFreeze.js +38 -0
  214. package/lib/utils/generateRandomString.d.ts +1 -0
  215. package/lib/utils/generateRandomString.js +14 -0
  216. package/lib/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  217. package/lib/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +4 -4
  218. package/{lib-esm/ClientDevice/browser.d.ts → lib/utils/getClientInfo/getClientInfo.d.ts} +1 -9
  219. package/lib/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  220. package/lib/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +4 -4
  221. package/lib/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +6 -18
  222. package/lib/utils/getClientInfo/index.d.ts +1 -0
  223. package/lib/utils/getClientInfo/index.js +7 -0
  224. package/lib/utils/globalHelpers/index.d.ts +3 -0
  225. package/lib/utils/globalHelpers/index.js +50 -0
  226. package/lib/utils/globalHelpers/index.native.d.ts +3 -0
  227. package/lib/utils/globalHelpers/index.native.js +28 -0
  228. package/lib/utils/index.d.ts +8 -0
  229. package/lib/utils/index.js +25 -0
  230. package/lib/utils/isBrowser.d.ts +1 -0
  231. package/lib/utils/isBrowser.js +9 -0
  232. package/lib/utils/isWebWorker.d.ts +1 -0
  233. package/lib/utils/isWebWorker.js +14 -0
  234. package/lib/utils/retry/NonRetryableError.d.ts +4 -0
  235. package/lib/utils/retry/NonRetryableError.js +30 -0
  236. package/lib/utils/retry/constants.d.ts +1 -0
  237. package/lib/utils/retry/constants.js +6 -0
  238. package/lib/utils/retry/index.d.ts +5 -0
  239. package/lib/utils/retry/index.js +15 -0
  240. package/lib/utils/retry/isNonRetryableError.d.ts +2 -0
  241. package/lib/utils/retry/isNonRetryableError.js +10 -0
  242. package/lib/utils/retry/jitteredBackoff.d.ts +6 -0
  243. package/lib/utils/retry/jitteredBackoff.js +20 -0
  244. package/lib/utils/retry/jitteredExponentialRetry.d.ts +5 -0
  245. package/lib/utils/retry/jitteredExponentialRetry.js +17 -0
  246. package/lib/utils/retry/retry.d.ts +6 -0
  247. package/lib/{Util/Retry.js → utils/retry/retry.js} +6 -57
  248. package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
  249. package/lib/utils/sessionListener/SessionListener.js +55 -0
  250. package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
  251. package/lib/utils/sessionListener/SessionListener.native.js +54 -0
  252. package/lib/utils/sessionListener/index.d.ts +2 -0
  253. package/lib/utils/sessionListener/index.js +7 -0
  254. package/lib/utils/sessionListener/types.d.ts +6 -0
  255. package/lib/utils/sessionListener/types.js +4 -0
  256. package/lib/utils/urlSafeDecode.d.ts +1 -0
  257. package/lib/{Util/StringUtils.js → utils/urlSafeDecode.js} +2 -9
  258. package/lib/utils/urlSafeEncode.d.ts +1 -0
  259. package/lib/utils/urlSafeEncode.js +12 -0
  260. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.d.ts +3 -0
  261. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +25 -0
  262. package/lib-esm/{Util → BackgroundProcessManager}/BackgroundProcessManager.d.ts +1 -23
  263. package/lib-esm/{Util → BackgroundProcessManager}/BackgroundProcessManager.js +4 -47
  264. package/lib-esm/BackgroundProcessManager/index.d.ts +1 -0
  265. package/lib-esm/BackgroundProcessManager/index.js +3 -0
  266. package/lib-esm/BackgroundProcessManager/types.d.ts +41 -0
  267. package/lib-esm/BackgroundProcessManager/types.js +20 -0
  268. package/lib-esm/Cache/StorageCache.d.ts +14 -31
  269. package/lib-esm/Cache/StorageCache.js +97 -102
  270. package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
  271. package/lib-esm/Cache/StorageCache.native.js +161 -0
  272. package/lib-esm/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
  273. package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +494 -437
  274. package/lib-esm/Cache/constants.d.ts +6 -0
  275. package/lib-esm/Cache/constants.js +14 -0
  276. package/lib-esm/Cache/index.d.ts +2 -0
  277. package/lib-esm/Cache/index.js +4 -0
  278. package/lib-esm/Cache/types/cache.d.ts +38 -0
  279. package/lib-esm/Cache/types/index.d.ts +1 -1
  280. package/lib-esm/Cache/types/index.js +1 -1
  281. package/lib-esm/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  282. package/lib-esm/Cache/{Utils → utils}/CacheList.js +6 -19
  283. package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
  284. package/lib-esm/Cache/utils/cacheHelpers.js +44 -0
  285. package/lib-esm/Cache/utils/errorHelpers.d.ts +7 -0
  286. package/lib-esm/Cache/utils/errorHelpers.js +22 -0
  287. package/lib-esm/Cache/utils/index.d.ts +2 -0
  288. package/lib-esm/Cache/utils/index.js +4 -0
  289. package/lib-esm/Hub/index.d.ts +7 -0
  290. package/lib-esm/Hub/index.js +9 -2
  291. package/lib-esm/Hub/types/AuthTypes.d.ts +19 -0
  292. package/lib-esm/I18n/I18n.d.ts +3 -19
  293. package/lib-esm/I18n/I18n.js +1 -21
  294. package/lib-esm/I18n/errorHelpers.d.ts +5 -0
  295. package/lib-esm/I18n/errorHelpers.js +14 -0
  296. package/lib-esm/I18n/index.d.ts +3 -15
  297. package/lib-esm/I18n/index.js +5 -30
  298. package/lib-esm/I18n/types.d.ts +1 -4
  299. package/lib-esm/I18n/types.js +4 -7
  300. package/lib-esm/Logger/ConsoleLogger.js +1 -1
  301. package/{lib/Util → lib-esm/Mutex}/Mutex.d.ts +2 -15
  302. package/lib-esm/{Util → Mutex}/Mutex.js +1 -1
  303. package/lib-esm/Mutex/index.d.ts +1 -0
  304. package/lib-esm/Mutex/index.js +3 -0
  305. package/lib-esm/Mutex/types.d.ts +13 -0
  306. package/lib-esm/Platform/customUserAgent.d.ts +16 -0
  307. package/lib-esm/Platform/customUserAgent.js +65 -0
  308. package/lib-esm/Platform/index.js +10 -1
  309. package/lib-esm/Platform/types.d.ts +75 -8
  310. package/lib-esm/Platform/types.js +40 -39
  311. package/lib-esm/Platform/version.d.ts +1 -1
  312. package/lib-esm/Platform/version.js +1 -1
  313. package/lib-esm/Reachability/Reachability.d.ts +7 -0
  314. package/lib-esm/{Util → Reachability}/Reachability.js +22 -19
  315. package/lib-esm/Reachability/Reachability.native.d.ts +6 -0
  316. package/lib-esm/{Util → Reachability}/Reachability.native.js +6 -6
  317. package/lib-esm/Reachability/index.d.ts +1 -0
  318. package/lib-esm/Reachability/index.js +3 -0
  319. package/lib-esm/Reachability/types.d.ts +3 -0
  320. package/lib-esm/Reachability/types.js +3 -0
  321. package/lib-esm/ServiceWorker/ServiceWorker.js +78 -48
  322. package/lib-esm/ServiceWorker/errorHelpers.d.ts +7 -0
  323. package/lib-esm/ServiceWorker/errorHelpers.js +22 -0
  324. package/lib-esm/ServiceWorker/index.d.ts +0 -12
  325. package/lib-esm/ServiceWorker/index.js +0 -12
  326. package/lib-esm/{Signer.js → Signer/Signer.js} +5 -4
  327. package/lib-esm/Signer/index.d.ts +1 -0
  328. package/lib-esm/Signer/index.js +3 -0
  329. package/lib-esm/adapterCore/error/AmplifyServerContextError.d.ts +1 -1
  330. package/lib-esm/adapterCore/error/AmplifyServerContextError.js +1 -1
  331. package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.js +2 -1
  332. package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.d.ts +2 -1
  333. package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.d.ts +2 -1
  334. package/lib-esm/awsClients/cognitoIdentity/types.js +3 -0
  335. package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/base.js +2 -1
  336. package/lib-esm/awsClients/pinpoint/errorHelpers.d.ts +5 -0
  337. package/lib-esm/awsClients/pinpoint/errorHelpers.js +14 -0
  338. package/{lib/AwsClients/Pinpoint → lib-esm/awsClients/pinpoint}/getInAppMessages.d.ts +4 -3
  339. package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.js +2 -1
  340. package/{lib/AwsClients/Pinpoint → lib-esm/awsClients/pinpoint}/putEvents.d.ts +4 -3
  341. package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.js +4 -7
  342. package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.d.ts +4 -3
  343. package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.js +2 -1
  344. package/lib-esm/clients/handlers/fetch.js +2 -1
  345. package/lib-esm/clients/middleware/retry/jitteredBackoff.js +1 -1
  346. package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  347. package/lib-esm/clients/types/http.d.ts +17 -1
  348. package/lib-esm/constants.d.ts +4 -0
  349. package/lib-esm/{Util/Constants.js → constants.js} +0 -11
  350. package/lib-esm/{Util/Errors.d.ts → errors/AmplifyError.d.ts} +2 -9
  351. package/lib-esm/{Util/Errors.js → errors/AmplifyError.js} +0 -15
  352. package/lib-esm/errors/PlatformNotSupportedError.d.ts +4 -0
  353. package/lib-esm/errors/PlatformNotSupportedError.js +30 -0
  354. package/lib-esm/errors/createAssertionFunction.d.ts +3 -0
  355. package/lib-esm/errors/createAssertionFunction.js +18 -0
  356. package/lib-esm/errors/errorHelpers.d.ts +2 -0
  357. package/lib-esm/errors/errorHelpers.js +17 -0
  358. package/lib-esm/errors/index.d.ts +4 -0
  359. package/lib-esm/errors/index.js +6 -0
  360. package/lib-esm/index.d.ts +7 -7
  361. package/lib-esm/index.js +7 -6
  362. package/lib-esm/libraryUtils.d.ts +19 -16
  363. package/lib-esm/libraryUtils.js +20 -18
  364. package/lib-esm/parseAWSExports.js +144 -13
  365. package/lib-esm/providers/kinesis/types/index.d.ts +1 -0
  366. package/lib-esm/providers/kinesis/types/index.js +3 -0
  367. package/lib-esm/providers/kinesis/types/kinesis.d.ts +9 -0
  368. package/lib-esm/providers/kinesis/types/kinesis.js +3 -0
  369. package/lib-esm/providers/kinesis-firehose/types/index.d.ts +1 -0
  370. package/lib-esm/providers/kinesis-firehose/types/index.js +3 -0
  371. package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.d.ts +9 -0
  372. package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.js +3 -0
  373. package/lib-esm/providers/personalize/types/index.d.ts +1 -0
  374. package/lib-esm/providers/personalize/types/index.js +3 -0
  375. package/lib-esm/providers/personalize/types/personalize.d.ts +8 -0
  376. package/lib-esm/providers/personalize/types/personalize.js +3 -0
  377. package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -0
  378. package/lib-esm/providers/pinpoint/apis/flushEvents.js +17 -0
  379. package/lib-esm/providers/pinpoint/apis/index.d.ts +1 -0
  380. package/lib-esm/providers/pinpoint/apis/index.js +1 -0
  381. package/lib-esm/providers/pinpoint/apis/record.d.ts +1 -1
  382. package/lib-esm/providers/pinpoint/apis/record.js +9 -25
  383. package/lib-esm/providers/pinpoint/apis/updateEndpoint.d.ts +1 -1
  384. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +14 -12
  385. package/lib-esm/providers/pinpoint/index.d.ts +2 -1
  386. package/lib-esm/providers/pinpoint/index.js +2 -0
  387. package/lib-esm/providers/pinpoint/types/errors.d.ts +9 -0
  388. package/lib-esm/providers/pinpoint/types/errors.js +12 -0
  389. package/lib-esm/providers/pinpoint/types/index.d.ts +1 -0
  390. package/lib-esm/providers/pinpoint/types/index.js +1 -0
  391. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +5 -4
  392. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -0
  393. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +11 -6
  394. package/lib-esm/providers/pinpoint/utils/index.d.ts +1 -0
  395. package/lib-esm/providers/pinpoint/utils/index.js +1 -0
  396. package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +3 -0
  397. package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +5 -0
  398. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.d.ts +8 -0
  399. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +81 -0
  400. package/lib-esm/singleton/API/types.d.ts +165 -0
  401. package/lib-esm/singleton/API/types.js +9 -0
  402. package/lib-esm/singleton/Amplify.d.ts +2 -2
  403. package/lib-esm/singleton/Amplify.js +6 -5
  404. package/lib-esm/singleton/Analytics/types.d.ts +4 -1
  405. package/lib-esm/singleton/Auth/types.d.ts +29 -2
  406. package/lib-esm/singleton/Auth/utils/errorHelpers.d.ts +8 -0
  407. package/lib-esm/singleton/Auth/utils/errorHelpers.js +30 -0
  408. package/lib-esm/singleton/Auth/utils/index.d.ts +1 -1
  409. package/lib-esm/singleton/Auth/utils/index.js +19 -34
  410. package/lib-esm/singleton/Cache/types.d.ts +18 -0
  411. package/lib-esm/singleton/Cache/types.js +3 -0
  412. package/lib-esm/singleton/Geo/types.d.ts +17 -0
  413. package/lib-esm/singleton/Geo/types.js +3 -0
  414. package/lib-esm/singleton/Interactions/types.d.ts +21 -0
  415. package/lib-esm/singleton/Interactions/types.js +3 -0
  416. package/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
  417. package/lib-esm/singleton/Notifications/InAppMessaging/types.js +3 -0
  418. package/lib-esm/singleton/Notifications/PushNotification/types.d.ts +2 -0
  419. package/lib-esm/singleton/Notifications/PushNotification/types.js +3 -0
  420. package/lib-esm/singleton/Notifications/types.d.ts +6 -0
  421. package/lib-esm/singleton/Notifications/types.js +3 -0
  422. package/lib-esm/singleton/types.d.ts +10 -1
  423. package/{lib/StorageHelper/cookieStorage.d.ts → lib-esm/storage/CookieStorage.d.ts} +4 -3
  424. package/lib-esm/{StorageHelper/cookieStorage.js → storage/CookieStorage.js} +36 -61
  425. package/lib-esm/storage/CookieStorage.native.d.ts +7 -0
  426. package/lib-esm/storage/CookieStorage.native.js +29 -0
  427. package/lib-esm/storage/DefaultStorage.d.ts +7 -0
  428. package/lib-esm/storage/DefaultStorage.js +30 -0
  429. package/{lib/StorageHelper/localStorage.d.ts → lib-esm/storage/DefaultStorage.native.d.ts} +6 -5
  430. package/{lib/StorageHelper/sessionStorage.js → lib-esm/storage/DefaultStorage.native.js} +24 -45
  431. package/lib-esm/storage/InMemoryStorage.d.ts +12 -0
  432. package/lib-esm/storage/InMemoryStorage.js +38 -0
  433. package/lib-esm/{StorageHelper/sessionStorage.d.ts → storage/KeyValueStorage.d.ts} +5 -4
  434. package/lib-esm/{StorageHelper/localStorage.js → storage/KeyValueStorage.js} +17 -19
  435. package/lib-esm/storage/SessionStorage.d.ts +7 -0
  436. package/lib-esm/storage/SessionStorage.js +30 -0
  437. package/lib-esm/storage/index.d.ts +7 -0
  438. package/lib-esm/storage/index.js +10 -0
  439. package/lib-esm/storage/utils.d.ts +10 -0
  440. package/lib-esm/storage/utils.js +21 -0
  441. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  442. package/lib-esm/types/core.d.ts +4 -1
  443. package/lib-esm/types/errors.d.ts +9 -3
  444. package/lib-esm/types/errors.js +6 -1
  445. package/lib-esm/types/storage.d.ts +3 -0
  446. package/lib-esm/utils/amplifyUrl/index.d.ts +13 -0
  447. package/lib-esm/utils/amplifyUrl/index.js +6 -0
  448. package/lib-esm/utils/amplifyUrl/polyfill.d.ts +0 -0
  449. package/lib-esm/utils/amplifyUrl/polyfill.js +4 -0
  450. package/lib-esm/utils/amplifyUrl/polyfill.native.d.ts +1 -0
  451. package/lib-esm/utils/amplifyUrl/polyfill.native.js +4 -0
  452. package/lib-esm/utils/amplifyUuid/index.d.ts +3 -0
  453. package/lib-esm/utils/amplifyUuid/index.js +6 -0
  454. package/lib-esm/utils/amplifyUuid/polyfill.d.ts +0 -0
  455. package/lib-esm/utils/amplifyUuid/polyfill.js +4 -0
  456. package/lib-esm/utils/amplifyUuid/polyfill.native.d.ts +1 -0
  457. package/lib-esm/utils/amplifyUuid/polyfill.native.js +4 -0
  458. package/lib-esm/utils/convert/base64/base64Decoder.d.ts +2 -0
  459. package/lib-esm/utils/convert/base64/base64Decoder.js +8 -0
  460. package/lib-esm/utils/convert/base64/base64Encoder.d.ts +2 -0
  461. package/lib-esm/utils/convert/base64/base64Encoder.js +15 -0
  462. package/lib-esm/utils/convert/base64/bytesToString.d.ts +1 -0
  463. package/lib-esm/utils/convert/base64/bytesToString.js +5 -0
  464. package/lib-esm/utils/convert/index.d.ts +2 -0
  465. package/lib-esm/utils/convert/index.js +4 -0
  466. package/lib-esm/utils/convert/types.d.ts +9 -0
  467. package/lib-esm/utils/convert/types.js +3 -0
  468. package/lib-esm/utils/deepFreeze.d.ts +1 -0
  469. package/lib-esm/utils/deepFreeze.js +34 -0
  470. package/lib-esm/utils/generateRandomString.d.ts +1 -0
  471. package/lib-esm/utils/generateRandomString.js +10 -0
  472. package/lib-esm/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  473. package/lib-esm/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +2 -2
  474. package/{lib/ClientDevice/browser.d.ts → lib-esm/utils/getClientInfo/getClientInfo.d.ts} +1 -9
  475. package/lib-esm/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  476. package/lib-esm/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +2 -2
  477. package/lib-esm/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +4 -14
  478. package/lib-esm/utils/getClientInfo/index.d.ts +1 -0
  479. package/lib-esm/utils/getClientInfo/index.js +3 -0
  480. package/lib-esm/utils/globalHelpers/index.d.ts +3 -0
  481. package/lib-esm/utils/globalHelpers/index.js +44 -0
  482. package/lib-esm/utils/globalHelpers/index.native.d.ts +3 -0
  483. package/lib-esm/utils/globalHelpers/index.native.js +22 -0
  484. package/lib-esm/utils/index.d.ts +8 -0
  485. package/lib-esm/utils/index.js +10 -0
  486. package/lib-esm/utils/isBrowser.d.ts +1 -0
  487. package/lib-esm/utils/isBrowser.js +5 -0
  488. package/lib-esm/utils/isWebWorker.d.ts +1 -0
  489. package/lib-esm/utils/isWebWorker.js +10 -0
  490. package/lib-esm/utils/retry/NonRetryableError.d.ts +4 -0
  491. package/lib-esm/utils/retry/NonRetryableError.js +27 -0
  492. package/lib-esm/utils/retry/constants.d.ts +1 -0
  493. package/lib-esm/utils/retry/constants.js +3 -0
  494. package/lib-esm/utils/retry/index.d.ts +5 -0
  495. package/lib-esm/utils/retry/index.js +7 -0
  496. package/lib-esm/utils/retry/isNonRetryableError.d.ts +2 -0
  497. package/lib-esm/utils/retry/isNonRetryableError.js +6 -0
  498. package/lib-esm/utils/retry/jitteredBackoff.d.ts +6 -0
  499. package/lib-esm/utils/retry/jitteredBackoff.js +16 -0
  500. package/lib-esm/utils/retry/jitteredExponentialRetry.d.ts +5 -0
  501. package/lib-esm/utils/retry/jitteredExponentialRetry.js +13 -0
  502. package/lib-esm/utils/retry/retry.d.ts +6 -0
  503. package/lib-esm/{Util/Retry.js → utils/retry/retry.js} +4 -52
  504. package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
  505. package/lib-esm/utils/sessionListener/SessionListener.js +52 -0
  506. package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
  507. package/lib-esm/utils/sessionListener/SessionListener.native.js +51 -0
  508. package/lib-esm/utils/sessionListener/index.d.ts +2 -0
  509. package/lib-esm/utils/sessionListener/index.js +4 -0
  510. package/lib-esm/utils/sessionListener/types.d.ts +6 -0
  511. package/lib-esm/utils/sessionListener/types.js +3 -0
  512. package/lib-esm/{Util/StringUtils.d.ts → utils/urlSafeDecode.d.ts} +0 -1
  513. package/lib-esm/{Util/StringUtils.js → utils/urlSafeDecode.js} +0 -6
  514. package/{lib/Util/StringUtils.d.ts → lib-esm/utils/urlSafeEncode.d.ts} +0 -1
  515. package/lib-esm/utils/urlSafeEncode.js +8 -0
  516. package/package.json +12 -26
  517. package/src/BackgroundProcessManager/BackgroundManagerNotOpenError.ts +8 -0
  518. package/src/{Util → BackgroundProcessManager}/BackgroundProcessManager.ts +4 -58
  519. package/src/BackgroundProcessManager/index.ts +4 -0
  520. package/src/BackgroundProcessManager/types.ts +49 -0
  521. package/src/Cache/StorageCache.native.ts +65 -0
  522. package/src/Cache/StorageCache.ts +61 -158
  523. package/src/Cache/StorageCacheCommon.ts +577 -0
  524. package/src/Cache/constants.ts +18 -0
  525. package/src/Cache/index.ts +6 -0
  526. package/src/Cache/types/cache.ts +51 -0
  527. package/src/Cache/types/index.ts +4 -4
  528. package/src/Cache/{Utils → utils}/CacheList.ts +185 -198
  529. package/src/Cache/utils/cacheHelpers.ts +52 -0
  530. package/src/Cache/utils/errorHelpers.ts +26 -0
  531. package/src/Cache/{Utils → utils}/index.ts +4 -5
  532. package/src/Hub/index.ts +11 -2
  533. package/src/Hub/types/AuthTypes.ts +12 -1
  534. package/src/I18n/I18n.ts +4 -25
  535. package/src/I18n/errorHelpers.ts +18 -0
  536. package/src/I18n/index.ts +9 -33
  537. package/src/I18n/types.ts +1 -4
  538. package/src/Logger/ConsoleLogger.ts +1 -1
  539. package/src/{Util → Mutex}/Mutex.ts +2 -20
  540. package/src/Mutex/index.ts +4 -0
  541. package/src/Mutex/types.ts +20 -0
  542. package/src/Platform/customUserAgent.ts +75 -0
  543. package/src/Platform/index.ts +14 -1
  544. package/src/Platform/types.ts +84 -39
  545. package/src/Platform/version.ts +1 -1
  546. package/src/{Util → Reachability}/Reachability.native.ts +7 -12
  547. package/src/Reachability/Reachability.ts +55 -0
  548. package/src/Reachability/index.ts +4 -0
  549. package/src/Reachability/types.ts +6 -0
  550. package/src/ServiceWorker/ServiceWorker.ts +39 -48
  551. package/src/ServiceWorker/errorHelpers.ts +26 -0
  552. package/src/ServiceWorker/index.ts +0 -12
  553. package/src/{Util → Signer}/DateUtils.ts +1 -1
  554. package/src/{Signer.ts → Signer/Signer.ts} +5 -4
  555. package/src/Signer/index.ts +4 -0
  556. package/src/adapterCore/error/AmplifyServerContextError.ts +1 -1
  557. package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.ts +4 -1
  558. package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/base.ts +2 -1
  559. package/src/awsClients/pinpoint/errorHelpers.ts +19 -0
  560. package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/getInAppMessages.ts +2 -1
  561. package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/putEvents.ts +4 -7
  562. package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/updateEndpoint.ts +2 -1
  563. package/src/clients/handlers/fetch.ts +5 -1
  564. package/src/clients/middleware/retry/jitteredBackoff.ts +1 -1
  565. package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
  566. package/src/clients/types/http.ts +19 -1
  567. package/src/{Util/Constants.ts → constants.ts} +0 -11
  568. package/src/{Util/Errors.ts → errors/AmplifyError.ts} +2 -18
  569. package/src/errors/PlatformNotSupportedError.ts +14 -0
  570. package/src/errors/createAssertionFunction.ts +23 -0
  571. package/src/errors/errorHelpers.ts +20 -0
  572. package/src/errors/index.ts +7 -0
  573. package/src/index.ts +15 -11
  574. package/src/libraryUtils.ts +57 -57
  575. package/src/parseAWSExports.ts +179 -14
  576. package/src/providers/kinesis/types/index.ts +4 -0
  577. package/src/providers/kinesis/types/kinesis.ts +12 -0
  578. package/src/providers/kinesis-firehose/types/index.ts +4 -0
  579. package/src/providers/kinesis-firehose/types/kinesis-firehose.ts +12 -0
  580. package/src/providers/personalize/types/index.ts +4 -0
  581. package/src/providers/personalize/types/personalize.ts +11 -0
  582. package/src/providers/pinpoint/apis/flushEvents.ts +31 -0
  583. package/src/providers/pinpoint/apis/index.ts +1 -0
  584. package/src/providers/pinpoint/apis/record.ts +14 -28
  585. package/src/providers/pinpoint/apis/updateEndpoint.ts +26 -10
  586. package/src/providers/pinpoint/index.ts +6 -1
  587. package/src/providers/pinpoint/types/errors.ts +12 -0
  588. package/src/providers/pinpoint/types/index.ts +1 -0
  589. package/src/providers/pinpoint/types/pinpoint.ts +5 -3
  590. package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +21 -13
  591. package/src/providers/pinpoint/utils/index.ts +1 -0
  592. package/src/providers/pinpoint/utils/isAppInForeground.native.ts +7 -0
  593. package/src/providers/pinpoint/utils/isAppInForeground.ts +4 -0
  594. package/src/providers/pinpoint/utils/resolveEndpointId.ts +46 -0
  595. package/src/singleton/API/types.ts +203 -0
  596. package/src/singleton/Amplify.ts +10 -8
  597. package/src/singleton/Analytics/types.ts +7 -1
  598. package/src/singleton/Auth/types.ts +51 -2
  599. package/src/singleton/Auth/utils/errorHelpers.ts +37 -0
  600. package/src/singleton/Auth/utils/index.ts +35 -38
  601. package/src/singleton/Cache/types.ts +27 -0
  602. package/src/singleton/Geo/types.ts +20 -0
  603. package/src/singleton/Interactions/types.ts +29 -0
  604. package/src/singleton/Notifications/InAppMessaging/types.ts +6 -0
  605. package/src/singleton/Notifications/PushNotification/types.ts +6 -0
  606. package/src/singleton/Notifications/types.ts +10 -0
  607. package/src/singleton/types.ts +12 -6
  608. package/src/storage/CookieStorage.native.ts +13 -0
  609. package/src/storage/CookieStorage.ts +68 -0
  610. package/src/storage/DefaultStorage.native.ts +58 -0
  611. package/src/storage/DefaultStorage.ts +14 -0
  612. package/src/storage/InMemoryStorage.ts +36 -0
  613. package/src/{StorageHelper/sessionStorage.ts → storage/KeyValueStorage.ts} +15 -18
  614. package/src/storage/SessionStorage.ts +14 -0
  615. package/src/storage/index.ts +13 -0
  616. package/src/storage/utils.ts +22 -0
  617. package/src/types/core.ts +4 -1
  618. package/src/types/errors.ts +15 -3
  619. package/src/types/storage.ts +4 -0
  620. package/src/utils/amplifyUrl/index.ts +9 -0
  621. package/src/utils/amplifyUrl/polyfill.native.ts +6 -0
  622. package/src/utils/amplifyUrl/polyfill.ts +4 -0
  623. package/src/utils/amplifyUuid/index.ts +9 -0
  624. package/src/utils/amplifyUuid/polyfill.native.ts +6 -0
  625. package/src/utils/amplifyUuid/polyfill.ts +4 -0
  626. package/src/utils/convert/base64/base64Decoder.ts +11 -0
  627. package/src/utils/convert/base64/base64Encoder.ts +18 -0
  628. package/src/utils/convert/base64/bytesToString.ts +6 -0
  629. package/src/utils/convert/index.ts +5 -0
  630. package/src/utils/convert/types.ts +17 -0
  631. package/src/utils/deepFreeze.ts +16 -0
  632. package/src/utils/generateRandomString.ts +16 -0
  633. package/src/{ClientDevice/android.ts → utils/getClientInfo/getClientInfo.android.ts} +2 -2
  634. package/src/{ClientDevice/ios.ts → utils/getClientInfo/getClientInfo.ios.ts} +3 -3
  635. package/src/{ClientDevice/browser.ts → utils/getClientInfo/getClientInfo.ts} +4 -16
  636. package/src/utils/getClientInfo/index.ts +4 -0
  637. package/src/utils/globalHelpers/index.native.ts +30 -0
  638. package/src/utils/globalHelpers/index.ts +54 -0
  639. package/src/utils/index.ts +17 -0
  640. package/src/utils/isBrowser.ts +5 -0
  641. package/src/utils/isWebWorker.ts +13 -0
  642. package/src/utils/retry/NonRetryableError.ts +9 -0
  643. package/src/utils/retry/constants.ts +4 -0
  644. package/src/utils/retry/index.ts +8 -0
  645. package/src/utils/retry/isNonRetryableError.ts +9 -0
  646. package/src/utils/retry/jitteredBackoff.ts +21 -0
  647. package/src/utils/retry/jitteredExponentialRetry.ts +18 -0
  648. package/src/{Util/Retry.ts → utils/retry/retry.ts} +4 -44
  649. package/src/utils/sessionListener/SessionListener.native.ts +70 -0
  650. package/src/utils/sessionListener/SessionListener.ts +74 -0
  651. package/src/utils/sessionListener/index.ts +6 -0
  652. package/src/utils/sessionListener/types.ts +11 -0
  653. package/src/{Util/StringUtils.ts → utils/urlSafeDecode.ts} +0 -6
  654. package/src/utils/urlSafeEncode.ts +9 -0
  655. package/lib/Amplify.d.ts +0 -29
  656. package/lib/Amplify.js +0 -118
  657. package/lib/Cache/BrowserStorageCache.d.ts +0 -166
  658. package/lib/Cache/BrowserStorageCache.js +0 -469
  659. package/lib/Cache/InMemoryCache.d.ts +0 -129
  660. package/lib/Cache/InMemoryCache.js +0 -349
  661. package/lib/Cache/Utils/CacheUtils.d.ts +0 -25
  662. package/lib/Cache/Utils/CacheUtils.js +0 -88
  663. package/lib/Cache/Utils/index.d.ts +0 -2
  664. package/lib/Cache/Utils/index.js +0 -16
  665. package/lib/Cache/reactnative.d.ts +0 -3
  666. package/lib/Cache/reactnative.js +0 -8
  667. package/lib/Cache/types/Cache.d.ts +0 -55
  668. package/lib/ClientDevice/index.d.ts +0 -23
  669. package/lib/ClientDevice/index.js +0 -18
  670. package/lib/ClientDevice/reactnative.d.ts +0 -7
  671. package/lib/ClientDevice/reactnative.js +0 -24
  672. package/lib/RNComponents/index.d.ts +0 -6
  673. package/lib/RNComponents/index.js +0 -16
  674. package/lib/RNComponents/reactnative.d.ts +0 -3
  675. package/lib/RNComponents/reactnative.js +0 -14
  676. package/lib/StorageHelper/inMemoryStorage.d.ts +0 -10
  677. package/lib/StorageHelper/index.d.ts +0 -45
  678. package/lib/StorageHelper/index.js +0 -83
  679. package/lib/StorageHelper/reactnative.d.ts +0 -83
  680. package/lib/StorageHelper/reactnative.js +0 -250
  681. package/lib/Util/Constants.d.ts +0 -12
  682. package/lib/Util/Constants.js +0 -29
  683. package/lib/Util/JS.d.ts +0 -29
  684. package/lib/Util/JS.js +0 -214
  685. package/lib/Util/Reachability.d.ts +0 -13
  686. package/lib/Util/Reachability.native.d.ts +0 -12
  687. package/lib/Util/Retry.d.ts +0 -21
  688. package/lib/Util/errors/AssertError.d.ts +0 -2
  689. package/lib/Util/errors/AssertError.js +0 -11
  690. package/lib/Util/index.d.ts +0 -7
  691. package/lib/Util/index.js +0 -31
  692. package/lib/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -5
  693. package/lib/clients/middleware/signing/signer/signatureV4/index.native.js +0 -15
  694. package/lib-esm/Amplify.d.ts +0 -29
  695. package/lib-esm/Amplify.js +0 -115
  696. package/lib-esm/Cache/BrowserStorageCache.d.ts +0 -166
  697. package/lib-esm/Cache/BrowserStorageCache.js +0 -466
  698. package/lib-esm/Cache/InMemoryCache.d.ts +0 -129
  699. package/lib-esm/Cache/InMemoryCache.js +0 -346
  700. package/lib-esm/Cache/Utils/CacheUtils.d.ts +0 -25
  701. package/lib-esm/Cache/Utils/CacheUtils.js +0 -81
  702. package/lib-esm/Cache/Utils/index.d.ts +0 -2
  703. package/lib-esm/Cache/Utils/index.js +0 -4
  704. package/lib-esm/Cache/reactnative.d.ts +0 -3
  705. package/lib-esm/Cache/reactnative.js +0 -6
  706. package/lib-esm/Cache/types/Cache.d.ts +0 -55
  707. package/lib-esm/ClientDevice/index.d.ts +0 -23
  708. package/lib-esm/ClientDevice/index.js +0 -15
  709. package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
  710. package/lib-esm/ClientDevice/reactnative.js +0 -21
  711. package/lib-esm/RNComponents/index.d.ts +0 -6
  712. package/lib-esm/RNComponents/index.js +0 -13
  713. package/lib-esm/RNComponents/isAppInForeground.js +0 -6
  714. package/lib-esm/RNComponents/reactnative.d.ts +0 -3
  715. package/lib-esm/RNComponents/reactnative.js +0 -6
  716. package/lib-esm/StorageHelper/inMemoryStorage.d.ts +0 -10
  717. package/lib-esm/StorageHelper/inMemoryStorage.js +0 -79
  718. package/lib-esm/StorageHelper/index.d.ts +0 -45
  719. package/lib-esm/StorageHelper/index.js +0 -76
  720. package/lib-esm/StorageHelper/reactnative.d.ts +0 -83
  721. package/lib-esm/StorageHelper/reactnative.js +0 -244
  722. package/lib-esm/Util/Constants.d.ts +0 -12
  723. package/lib-esm/Util/JS.d.ts +0 -29
  724. package/lib-esm/Util/JS.js +0 -199
  725. package/lib-esm/Util/Reachability.d.ts +0 -13
  726. package/lib-esm/Util/Reachability.native.d.ts +0 -12
  727. package/lib-esm/Util/Retry.d.ts +0 -21
  728. package/lib-esm/Util/errors/AssertError.d.ts +0 -2
  729. package/lib-esm/Util/errors/AssertError.js +0 -7
  730. package/lib-esm/Util/index.d.ts +0 -7
  731. package/lib-esm/Util/index.js +0 -9
  732. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -5
  733. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.js +0 -8
  734. package/polyfills/URL/index.ts +0 -14
  735. package/polyfills/URL/tsconfig.json +0 -10
  736. package/polyfills/URL/webpack.config.js +0 -43
  737. package/src/Amplify.ts +0 -106
  738. package/src/Cache/AsyncStorageCache.ts +0 -500
  739. package/src/Cache/BrowserStorageCache.ts +0 -517
  740. package/src/Cache/CHANGELOG.md +0 -1239
  741. package/src/Cache/InMemoryCache.ts +0 -354
  742. package/src/Cache/Utils/CacheUtils.ts +0 -92
  743. package/src/Cache/reactnative.ts +0 -9
  744. package/src/Cache/types/Cache.ts +0 -75
  745. package/src/ClientDevice/index.ts +0 -14
  746. package/src/ClientDevice/reactnative.ts +0 -18
  747. package/src/RNComponents/index.ts +0 -16
  748. package/src/RNComponents/isAppInForeground.ts +0 -8
  749. package/src/RNComponents/reactnative.ts +0 -6
  750. package/src/StorageHelper/cookieStorage.ts +0 -99
  751. package/src/StorageHelper/inMemoryStorage.ts +0 -32
  752. package/src/StorageHelper/index.ts +0 -78
  753. package/src/StorageHelper/localStorage.ts +0 -60
  754. package/src/StorageHelper/reactnative.ts +0 -182
  755. package/src/Util/JS.ts +0 -255
  756. package/src/Util/Reachability.ts +0 -58
  757. package/src/Util/errors/AssertError.ts +0 -11
  758. package/src/Util/index.ts +0 -23
  759. package/src/clients/middleware/signing/signer/signatureV4/index.native.ts +0 -10
  760. /package/lib/{AwsClients/CognitoIdentity/types.js → Cache/types/cache.js} +0 -0
  761. /package/lib/{Cache/types/Cache.js → Mutex/types.js} +0 -0
  762. /package/lib/{Util → Signer}/DateUtils.d.ts +0 -0
  763. /package/lib/{Util → Signer}/DateUtils.js +0 -0
  764. /package/lib/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
  765. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.d.ts +0 -0
  766. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.js +0 -0
  767. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.js +0 -0
  768. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.d.ts +0 -0
  769. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.js +0 -0
  770. /package/lib/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.d.ts +0 -0
  771. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/base.d.ts +0 -0
  772. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/index.d.ts +0 -0
  773. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/index.js +0 -0
  774. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/types.d.ts +0 -0
  775. /package/lib/{AwsClients/Pinpoint → awsClients/pinpoint}/types.js +0 -0
  776. /package/lib-esm/{AwsClients/CognitoIdentity/types.js → Cache/types/cache.js} +0 -0
  777. /package/lib-esm/{Cache/types/Cache.js → Mutex/types.js} +0 -0
  778. /package/lib-esm/{Util → Signer}/DateUtils.d.ts +0 -0
  779. /package/lib-esm/{Util → Signer}/DateUtils.js +0 -0
  780. /package/lib-esm/{Signer.d.ts → Signer/Signer.d.ts} +0 -0
  781. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/base.d.ts +0 -0
  782. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.js +0 -0
  783. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.js +0 -0
  784. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.d.ts +0 -0
  785. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.js +0 -0
  786. /package/lib-esm/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.d.ts +0 -0
  787. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/base.d.ts +0 -0
  788. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/index.d.ts +0 -0
  789. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/index.js +0 -0
  790. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/types.d.ts +0 -0
  791. /package/lib-esm/{AwsClients/Pinpoint → awsClients/pinpoint}/types.js +0 -0
  792. /package/lib-esm/{RNComponents → providers/pinpoint/utils}/isAppInForeground.d.ts +0 -0
  793. /package/{lib/RNComponents/isAppInForeground.d.ts → lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts} +0 -0
  794. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getCredentialsForIdentity.ts +0 -0
  795. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/getId.ts +0 -0
  796. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/index.ts +0 -0
  797. /package/src/{AwsClients/CognitoIdentity → awsClients/cognitoIdentity}/types.ts +0 -0
  798. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/index.ts +0 -0
  799. /package/src/{AwsClients/Pinpoint → awsClients/pinpoint}/types.ts +0 -0
@@ -1,32 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { KeyValueStorageInterface } from '../types';
5
-
6
- class MemoryKeyValueStorageClass implements KeyValueStorageInterface {
7
- myStorage: Record<string, string> = {};
8
-
9
- async setItem(key: string, value: string): Promise<void> {
10
- this.myStorage[key] = value;
11
- return;
12
- }
13
-
14
- async getItem(key: string): Promise<string | null> {
15
- return this.myStorage[key];
16
- }
17
-
18
- async removeItem(key: string): Promise<void> {
19
- delete this.myStorage[key];
20
- return;
21
- }
22
-
23
- async clear(): Promise<void> {
24
- Object.keys(this.myStorage).forEach(key => {
25
- delete this.myStorage[key];
26
- });
27
-
28
- return;
29
- }
30
- }
31
-
32
- export const MemoryKeyValueStorage = new MemoryKeyValueStorageClass();
@@ -1,78 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- let dataMemory: Record<string, string> = {};
5
-
6
- /** @class */
7
- export class MemoryStorage {
8
- /**
9
- * This is used to set a specific item in storage
10
- * @param {string} key - the key for the item
11
- * @param {object} value - the value
12
- * @returns {string} value that was set
13
- */
14
- static setItem(key: string, value: any) {
15
- dataMemory[key] = value;
16
- return dataMemory[key];
17
- }
18
-
19
- /**
20
- * This is used to get a specific key from storage
21
- * @param {string} key - the key for the item
22
- * This is used to clear the storage
23
- * @returns {string} the data item
24
- */
25
- static getItem(key: string) {
26
- return Object.prototype.hasOwnProperty.call(dataMemory, key)
27
- ? dataMemory[key]
28
- : undefined;
29
- }
30
-
31
- /**
32
- * This is used to remove an item from storage
33
- * @param {string} key - the key being set
34
- * @returns {string} value - value that was deleted
35
- */
36
- static removeItem(key: string) {
37
- return delete dataMemory[key];
38
- }
39
-
40
- /**
41
- * This is used to clear the storage
42
- * @returns {string} nothing
43
- */
44
- static clear() {
45
- dataMemory = {};
46
- return dataMemory;
47
- }
48
- }
49
-
50
- export class StorageHelper {
51
- private storageWindow: any;
52
- /**
53
- * This is used to get a storage object
54
- * @returns {object} the storage
55
- */
56
- constructor() {
57
- try {
58
- this.storageWindow = window.localStorage;
59
- this.storageWindow.setItem('aws.amplify.test-ls', 1);
60
- this.storageWindow.removeItem('aws.amplify.test-ls');
61
- } catch (exception) {
62
- this.storageWindow = MemoryStorage;
63
- }
64
- }
65
-
66
- /**
67
- * This is used to return the storage
68
- * @returns {object} the storage
69
- */
70
- getStorage(): any {
71
- return this.storageWindow;
72
- }
73
- }
74
-
75
- export { SessionStorage } from './sessionStorage';
76
- export { LocalStorage } from './localStorage';
77
- export { MemoryKeyValueStorage } from './inMemoryStorage';
78
- export { CookieStorage } from './cookieStorage';
@@ -1,60 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { KeyValueStorageInterface } from "../types";
5
- import { PlatformNotSupportedError } from '../Util/Errors';
6
-
7
- class LocalStorageClass implements KeyValueStorageInterface {
8
- storage?: Storage;
9
-
10
- constructor() {
11
- if (typeof window !== undefined) {
12
- try {
13
- this.storage = window?.localStorage;
14
- } catch (error) {}
15
- }
16
- }
17
-
18
- /**
19
- * This is used to set a specific item in storage
20
- * @param {string} key - the key for the item
21
- * @param {object} value - the value
22
- * @returns {string} value that was set
23
- */
24
- async setItem(key: string, value: string): Promise<void> {
25
- if (!this.storage) throw PlatformNotSupportedError;
26
- this.storage.setItem(key, value);
27
- }
28
-
29
- /**
30
- * This is used to get a specific key from storage
31
- * @param {string} key - the key for the item
32
- * This is used to clear the storage
33
- * @returns {string} the data item
34
- */
35
- async getItem(key: string): Promise<string | null> {
36
- if (!this.storage) throw PlatformNotSupportedError;
37
- return this.storage.getItem(key);
38
- }
39
-
40
- /**
41
- * This is used to remove an item from storage
42
- * @param {string} key - the key being set
43
- * @returns {string} value - value that was deleted
44
- */
45
- async removeItem(key: string): Promise<void> {
46
- if (!this.storage) throw PlatformNotSupportedError;
47
- this.storage.removeItem(key);
48
- }
49
-
50
- /**
51
- * This is used to clear the storage
52
- * @returns {string} nothing
53
- */
54
- async clear(): Promise<void> {
55
- if (!this.storage) throw PlatformNotSupportedError;
56
- this.storage.clear();
57
- }
58
- }
59
-
60
- export const LocalStorage = new LocalStorageClass();
@@ -1,182 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import AsyncStorage from '@react-native-async-storage/async-storage';
4
- import { KeyValueStorageInterface } from '../types';
5
-
6
- const MEMORY_KEY_PREFIX = '@MemoryStorage:';
7
- let dataMemory: Record<string, string | null> = {};
8
-
9
- /** @class */
10
- class MemoryStorage {
11
- static syncPromise: Promise<void> | null = null;
12
- /**
13
- * This is used to set a specific item in storage
14
- * @param {string} key - the key for the item
15
- * @param {object} value - the value
16
- * @returns {string} value that was set
17
- */
18
- static setItem(key: string, value: string) {
19
- if (value) {
20
- AsyncStorage.setItem(MEMORY_KEY_PREFIX + key, value);
21
- dataMemory[key] = value;
22
- return dataMemory[key];
23
- }
24
- }
25
-
26
- /**
27
- * This is used to get a specific key from storage
28
- * @param {string} key - the key for the item
29
- * This is used to clear the storage
30
- * @returns {string} the data item
31
- */
32
- static getItem(key: string) {
33
- return Object.prototype.hasOwnProperty.call(dataMemory, key)
34
- ? dataMemory[key]
35
- : undefined;
36
- }
37
-
38
- /**
39
- * This is used to remove an item from storage
40
- * @param {string} key - the key being set
41
- * @returns {string} value - value that was deleted
42
- */
43
- static removeItem(key: string) {
44
- AsyncStorage.removeItem(MEMORY_KEY_PREFIX + key);
45
- return delete dataMemory[key];
46
- }
47
-
48
- /**
49
- * This is used to clear the storage
50
- * @returns {string} nothing
51
- */
52
- static clear() {
53
- dataMemory = {};
54
- return dataMemory;
55
- }
56
-
57
- /**
58
- * Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage
59
- * @returns {void}
60
- */
61
- static sync() {
62
- if (!MemoryStorage.syncPromise) {
63
- MemoryStorage.syncPromise = new Promise<void>((res, rej) => {
64
- AsyncStorage.getAllKeys((errKeys, keys) => {
65
- if (errKeys) rej(errKeys);
66
-
67
- const memoryKeys =
68
- keys?.filter(key => key.startsWith(MEMORY_KEY_PREFIX)) ?? [];
69
-
70
- AsyncStorage.multiGet(memoryKeys, (err, stores) => {
71
- if (err) rej(err);
72
- stores &&
73
- stores.map((result, index, store) => {
74
- const key = store[index][0];
75
- const value = store[index][1];
76
- const memoryKey = key.replace(MEMORY_KEY_PREFIX, '');
77
- dataMemory[memoryKey] = value;
78
- });
79
- res();
80
- });
81
- });
82
- });
83
- }
84
- return MemoryStorage.syncPromise;
85
- }
86
- }
87
-
88
- export class StorageHelper {
89
- private storageWindow;
90
- /**
91
- * This is used to get a storage object
92
- * @returns {object} the storage
93
- */
94
- constructor() {
95
- this.storageWindow = MemoryStorage;
96
- }
97
-
98
- /**
99
- * This is used to return the storage
100
- * @returns {object} the storage
101
- */
102
- getStorage() {
103
- return this.storageWindow;
104
- }
105
- }
106
-
107
- class AsyncStorageClass implements KeyValueStorageInterface {
108
- syncPromise: Promise<void> | null = null;
109
- /**
110
- * This is used to set a specific item in storage
111
- * @param {string} key - the key for the item
112
- * @param {object} value - the value
113
- * @returns {string} value that was set
114
- */
115
- async setItem(key: string, value: string): Promise<void> {
116
- if (value) {
117
- await AsyncStorage.setItem(MEMORY_KEY_PREFIX + key, value);
118
- dataMemory[key] = value;
119
- }
120
- }
121
-
122
- /**
123
- * This is used to get a specific key from storage
124
- * @param {string} key - the key for the item
125
- * This is used to clear the storage
126
- * @returns {string} the data item
127
- */
128
- async getItem(key: string): Promise<string | null> {
129
- return Object.prototype.hasOwnProperty.call(dataMemory, key)
130
- ? dataMemory[key]
131
- : null;
132
- }
133
-
134
- /**
135
- * This is used to remove an item from storage
136
- * @param {string} key - the key being set
137
- * @returns {string} value - value that was deleted
138
- */
139
- async removeItem(key: string): Promise<void> {
140
- await AsyncStorage.removeItem(MEMORY_KEY_PREFIX + key);
141
- delete dataMemory[key];
142
- }
143
-
144
- /**
145
- * This is used to clear the storage
146
- * @returns {string} nothing
147
- */
148
- async clear(): Promise<void> {
149
- dataMemory = {};
150
- }
151
-
152
- /**
153
- * Will sync the MemoryStorage data from AsyncStorage to storageWindow MemoryStorage
154
- * @returns {void}
155
- */
156
- async sync() {
157
- if (!this.syncPromise) {
158
- this.syncPromise = new Promise<void>((res, rej) => {
159
- AsyncStorage.getAllKeys((errKeys, keys) => {
160
- if (errKeys) rej(errKeys);
161
- const memoryKeys =
162
- keys?.filter(key => key.startsWith(MEMORY_KEY_PREFIX)) ?? [];
163
-
164
- AsyncStorage.multiGet(memoryKeys, (err, stores) => {
165
- if (err) rej(err);
166
- stores &&
167
- stores.map((result, index, store) => {
168
- const key = store[index][0];
169
- const value = store[index][1];
170
- const memoryKey = key.replace(MEMORY_KEY_PREFIX, '');
171
- dataMemory[memoryKey] = value;
172
- });
173
- res();
174
- });
175
- });
176
- });
177
- }
178
- }
179
- }
180
-
181
- // TODO: Add this to the react-native Amplify package.
182
- export const AsyncStorageKeyValue = new AsyncStorageClass();
package/src/Util/JS.ts DELETED
@@ -1,255 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- const MIME_MAP = [
5
- { type: 'text/plain', ext: 'txt' },
6
- { type: 'text/html', ext: 'html' },
7
- { type: 'text/javascript', ext: 'js' },
8
- { type: 'text/css', ext: 'css' },
9
- { type: 'text/csv', ext: 'csv' },
10
- { type: 'text/yaml', ext: 'yml' },
11
- { type: 'text/yaml', ext: 'yaml' },
12
- { type: 'text/calendar', ext: 'ics' },
13
- { type: 'text/calendar', ext: 'ical' },
14
-
15
- { type: 'image/apng', ext: 'apng' },
16
- { type: 'image/bmp', ext: 'bmp' },
17
- { type: 'image/gif', ext: 'gif' },
18
- { type: 'image/x-icon', ext: 'ico' },
19
- { type: 'image/x-icon', ext: 'cur' },
20
- { type: 'image/jpeg', ext: 'jpg' },
21
- { type: 'image/jpeg', ext: 'jpeg' },
22
- { type: 'image/jpeg', ext: 'jfif' },
23
- { type: 'image/jpeg', ext: 'pjp' },
24
- { type: 'image/jpeg', ext: 'pjpeg' },
25
- { type: 'image/png', ext: 'png' },
26
- { type: 'image/svg+xml', ext: 'svg' },
27
- { type: 'image/tiff', ext: 'tif' },
28
- { type: 'image/tiff', ext: 'tiff' },
29
- { type: 'image/webp', ext: 'webp' },
30
-
31
- { type: 'application/json', ext: 'json' },
32
- { type: 'application/xml', ext: 'xml' },
33
- { type: 'application/x-sh', ext: 'sh' },
34
- { type: 'application/zip', ext: 'zip' },
35
- { type: 'application/x-rar-compressed', ext: 'rar' },
36
- { type: 'application/x-tar', ext: 'tar' },
37
- { type: 'application/x-bzip', ext: 'bz' },
38
- { type: 'application/x-bzip2', ext: 'bz2' },
39
- { type: 'application/pdf', ext: 'pdf' },
40
- { type: 'application/java-archive', ext: 'jar' },
41
- { type: 'application/msword', ext: 'doc' },
42
- { type: 'application/vnd.ms-excel', ext: 'xls' },
43
- { type: 'application/vnd.ms-excel', ext: 'xlsx' },
44
-
45
- { type: 'message/rfc822', ext: 'eml' },
46
- ];
47
-
48
- export const isEmpty = (obj = {}) => Object.keys(obj).length === 0;
49
-
50
- export const sortByField = (
51
- list: any[],
52
- field: string | number,
53
- dir: string
54
- ) => {
55
- if (!list || !list.sort) {
56
- return false;
57
- }
58
-
59
- const dirX = dir && dir === 'desc' ? -1 : 1;
60
- list.sort(function(a, b) {
61
- const a_val = a[field];
62
- const b_val = b[field];
63
-
64
- if (typeof b_val === 'undefined') {
65
- return typeof a_val === 'undefined' ? 0 : 1 * dirX;
66
- }
67
-
68
- if (typeof a_val === 'undefined') {
69
- return -1 * dirX;
70
- }
71
-
72
- if (a_val < b_val) {
73
- return -1 * dirX;
74
- }
75
- if (a_val > b_val) {
76
- return 1 * dirX;
77
- }
78
-
79
- return 0;
80
- });
81
-
82
- return true;
83
- };
84
-
85
- export const objectLessAttributes = (
86
- obj: Record<string, any>,
87
- less: string | string[]
88
- ) => {
89
- const ret = Object.assign({}, obj);
90
- if (less) {
91
- if (typeof less === 'string') {
92
- delete ret[less];
93
- } else {
94
- less.forEach(attr => {
95
- delete ret[attr];
96
- });
97
- }
98
- }
99
-
100
- return ret;
101
- };
102
-
103
- export const filenameToContentType = (
104
- filename: string,
105
- defVal = 'application/octet-stream'
106
- ) => {
107
- const name = filename.toLowerCase();
108
-
109
- const filtered = MIME_MAP.filter(mime => name.endsWith('.' + mime.ext));
110
- return filtered.length > 0 ? filtered[0].type : defVal;
111
- };
112
-
113
- export const isTextFile = (contentType: string) => {
114
- const type = contentType.toLowerCase();
115
- if (type.startsWith('text/')) {
116
- return true;
117
- }
118
- return (
119
- 'application/json' === type ||
120
- 'application/xml' === type ||
121
- 'application/sh' === type
122
- );
123
- };
124
-
125
- export const generateRandomString = () => {
126
- let result = '';
127
- const chars =
128
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
129
- for (let i = 32; i > 0; i -= 1) {
130
- result += chars[Math.floor(Math.random() * chars.length)];
131
- }
132
- return result;
133
- };
134
-
135
- export const makeQuerablePromise = (promise: any) => {
136
- if (promise.isResolved) return promise;
137
-
138
- let isPending = true;
139
- let isRejected = false;
140
- let isFullfilled = false;
141
-
142
- const result = promise.then(
143
- (data: unknown) => {
144
- isFullfilled = true;
145
- isPending = false;
146
- return data;
147
- },
148
- (e: unknown) => {
149
- isRejected = true;
150
- isPending = false;
151
- throw e;
152
- }
153
- );
154
-
155
- result.isFullfilled = () => isFullfilled;
156
- result.isPending = () => isPending;
157
- result.isRejected = () => isRejected;
158
-
159
- return result;
160
- };
161
-
162
- export const isWebWorker = () => {
163
- if (typeof self === 'undefined') {
164
- return false;
165
- }
166
- const selfContext = self as { WorkerGlobalScope?: any };
167
- return (
168
- typeof selfContext.WorkerGlobalScope !== 'undefined' &&
169
- self instanceof selfContext.WorkerGlobalScope
170
- );
171
- };
172
-
173
- export const isBrowser = () =>
174
- typeof window !== 'undefined' && typeof window.document !== 'undefined';
175
-
176
- /**
177
- * transfer the first letter of the keys to lowercase
178
- * @param {Object} obj - the object need to be transferred
179
- * @param {Array} whiteListForItself - whitelist itself from being transferred
180
- * @param {Array} whiteListForChildren - whitelist its children keys from being transferred
181
- */
182
- export const transferKeyToLowerCase = (
183
- obj: Record<string, any>,
184
- whiteListForItself: string[] = [],
185
- whiteListForChildren: string[] = []
186
- ) => {
187
- if (!isStrictObject(obj)) return obj;
188
- const ret: Record<string, any> = {};
189
-
190
- for (const key in obj) {
191
- if (obj.hasOwnProperty(key)) {
192
- const transferedKey = whiteListForItself.includes(key)
193
- ? key
194
- : key[0].toLowerCase() + key.slice(1);
195
-
196
- ret[transferedKey] = whiteListForChildren.includes(key)
197
- ? obj[key]
198
- : transferKeyToLowerCase(
199
- obj[key],
200
- whiteListForItself,
201
- whiteListForChildren
202
- );
203
- }
204
- }
205
-
206
- return ret;
207
- };
208
-
209
- /**
210
- * transfer the first letter of the keys to lowercase
211
- * @param {Object} obj - the object need to be transferred
212
- * @param {Array} whiteListForItself - whitelist itself from being transferred
213
- * @param {Array} whiteListForChildren - whitelist its children keys from being transferred
214
- */
215
- export const transferKeyToUpperCase = (
216
- obj: Record<string, any>,
217
- whiteListForItself: string[] = [],
218
- whiteListForChildren: string[] = []
219
- ) => {
220
- if (!isStrictObject(obj)) return obj;
221
- const ret: Record<string, any> = {};
222
-
223
- for (const key in obj) {
224
- if (obj.hasOwnProperty(key)) {
225
- const transferredKey = whiteListForItself.includes(key)
226
- ? key
227
- : key[0].toUpperCase() + key.slice(1);
228
-
229
- ret[transferredKey] = whiteListForChildren.includes(key)
230
- ? obj[key]
231
- : transferKeyToUpperCase(
232
- obj[key],
233
- whiteListForItself,
234
- whiteListForChildren
235
- );
236
- }
237
- }
238
- return ret;
239
- };
240
-
241
- /**
242
- * Return true if the object is a strict object
243
- * which means it's not Array, Function, Number, String, Boolean or Null
244
- * @param obj the Object
245
- */
246
- export const isStrictObject = (obj: any) => {
247
- return (
248
- obj instanceof Object &&
249
- !(obj instanceof Array) &&
250
- !(obj instanceof Function) &&
251
- !(obj instanceof Number) &&
252
- !(obj instanceof String) &&
253
- !(obj instanceof Boolean)
254
- );
255
- };
@@ -1,58 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import Observable, { ZenObservable } from 'zen-observable-ts';
4
- import { isWebWorker } from './JS';
5
-
6
- type NetworkStatus = {
7
- online: boolean;
8
- };
9
-
10
- export default class ReachabilityNavigator implements Reachability {
11
- private static _observers: Array<
12
- ZenObservable.SubscriptionObserver<NetworkStatus>
13
- > = [];
14
-
15
- networkMonitor(netInfo?: any): Observable<NetworkStatus> {
16
- const globalObj = isWebWorker() ? self : window;
17
-
18
- return new Observable(observer => {
19
- observer.next({ online: globalObj.navigator.onLine });
20
-
21
- const notifyOnline = () => observer.next({ online: true });
22
- const notifyOffline = () => observer.next({ online: false });
23
-
24
- globalObj.addEventListener('online', notifyOnline);
25
- globalObj.addEventListener('offline', notifyOffline);
26
-
27
- ReachabilityNavigator._observers.push(observer);
28
-
29
- return () => {
30
- globalObj.removeEventListener('online', notifyOnline);
31
- globalObj.removeEventListener('offline', notifyOffline);
32
-
33
- ReachabilityNavigator._observers =
34
- ReachabilityNavigator._observers.filter(
35
- _observer => _observer !== observer
36
- );
37
- };
38
- });
39
- }
40
-
41
- // expose observers to simulate offline mode for integration testing
42
- private static _observerOverride(status: NetworkStatus): void {
43
- for (const observer of ReachabilityNavigator._observers) {
44
- if (observer.closed) {
45
- ReachabilityNavigator._observers =
46
- ReachabilityNavigator._observers.filter(
47
- _observer => _observer !== observer
48
- );
49
- continue;
50
- }
51
- observer.next(status);
52
- }
53
- }
54
- }
55
-
56
- interface Reachability {
57
- networkMonitor(netInfo?: any): Observable<NetworkStatus>;
58
- }
@@ -1,11 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { AmplifyError } from '../Errors';
4
- import { ErrorParams } from '../../types';
5
-
6
- export function asserts(
7
- assertion: boolean,
8
- errorParams: ErrorParams
9
- ): asserts assertion {
10
- if (!assertion) throw new AmplifyError(errorParams);
11
- }
package/src/Util/index.ts DELETED
@@ -1,23 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- export {
4
- NonRetryableError,
5
- isNonRetryableError,
6
- jitteredBackoff,
7
- jitteredExponentialRetry,
8
- retry,
9
- } from './Retry';
10
- export { default as Mutex } from './Mutex';
11
- export { default as Reachability } from './Reachability';
12
- export { DateUtils } from './DateUtils';
13
- export { urlSafeDecode, urlSafeEncode } from './StringUtils';
14
- export {
15
- AWS_CLOUDWATCH_CATEGORY,
16
- NO_CREDS_ERROR_STRING,
17
- RETRY_ERROR_CODES,
18
- } from './Constants';
19
- export {
20
- BackgroundProcessManager,
21
- BackgroundManagerNotOpenError,
22
- BackgroundProcessManagerState,
23
- } from './BackgroundProcessManager';