@aws-amplify/core 5.8.2 → 6.0.1-console-preview.7919075.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 (300) hide show
  1. package/README.md +3 -0
  2. package/lib/Amplify.d.ts +18 -17
  3. package/lib/Amplify.js +9 -0
  4. package/lib/AwsClients/CognitoIdentity/base.d.ts +3 -10
  5. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
  6. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
  7. package/lib/AwsClients/CognitoIdentity/getId.d.ts +3 -17
  8. package/lib/AwsClients/Pinpoint/base.d.ts +2 -10
  9. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
  10. package/lib/AwsClients/Pinpoint/getInAppMessages.js +1 -1
  11. package/lib/AwsClients/Pinpoint/putEvents.d.ts +3 -17
  12. package/lib/AwsClients/Pinpoint/putEvents.js +6 -0
  13. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
  14. package/lib/AwsClients/Pinpoint/updateEndpoint.js +2 -2
  15. package/lib/Cache/AsyncStorageCache.d.ts +154 -0
  16. package/lib/Cache/AsyncStorageCache.js +744 -0
  17. package/lib/Cache/BrowserStorageCache.d.ts +166 -0
  18. package/lib/Cache/BrowserStorageCache.js +469 -0
  19. package/lib/Cache/InMemoryCache.d.ts +129 -0
  20. package/lib/Cache/InMemoryCache.js +349 -0
  21. package/lib/Cache/StorageCache.d.ts +39 -0
  22. package/lib/Cache/StorageCache.js +121 -0
  23. package/lib/Cache/Utils/CacheList.d.ts +89 -0
  24. package/lib/Cache/Utils/CacheList.js +196 -0
  25. package/lib/Cache/Utils/CacheUtils.d.ts +25 -0
  26. package/lib/Cache/Utils/CacheUtils.js +88 -0
  27. package/lib/Cache/Utils/index.d.ts +2 -0
  28. package/lib/Cache/Utils/index.js +16 -0
  29. package/lib/Cache/reactnative.d.ts +3 -0
  30. package/lib/Cache/reactnative.js +8 -0
  31. package/lib/Cache/types/Cache.d.ts +55 -0
  32. package/lib/Cache/types/Cache.js +4 -0
  33. package/lib/Cache/types/index.d.ts +1 -0
  34. package/lib/Cache/types/index.js +19 -0
  35. package/lib/ClientDevice/android.js +3 -2
  36. package/lib/ClientDevice/ios.d.ts +2 -2
  37. package/lib/ClientDevice/ios.js +3 -2
  38. package/lib/ClientDevice/reactnative.js +3 -2
  39. package/lib/Credentials.d.ts +1 -1
  40. package/lib/Credentials.js +2 -1
  41. package/lib/Errors.d.ts +19 -0
  42. package/lib/Errors.js +50 -1
  43. package/lib/Hub.js +1 -0
  44. package/lib/I18n/I18n.d.ts +29 -9
  45. package/lib/I18n/I18n.js +30 -5
  46. package/lib/I18n/index.d.ts +18 -5
  47. package/lib/I18n/index.js +35 -5
  48. package/lib/I18n/types.d.ts +4 -1
  49. package/lib/I18n/types.js +3 -0
  50. package/lib/JS.d.ts +6 -6
  51. package/lib/Logger/ConsoleLogger.d.ts +11 -11
  52. package/lib/OAuthHelper/GoogleOAuth.js +2 -1
  53. package/lib/Platform/detectFramework.js +2 -1
  54. package/lib/Platform/detection/Next.d.ts +1 -1
  55. package/lib/Platform/detection/React.js +1 -0
  56. package/lib/Platform/version.d.ts +1 -1
  57. package/lib/Platform/version.js +1 -1
  58. package/lib/Providers/AWSCloudWatchProvider.d.ts +2 -2
  59. package/lib/Providers/AWSCloudWatchProvider.js +35 -12
  60. package/lib/RNComponents/index.d.ts +1 -1
  61. package/lib/RNComponents/reactnative.js +3 -2
  62. package/lib/ServiceWorker/ServiceWorker.d.ts +4 -4
  63. package/lib/ServiceWorker/ServiceWorker.js +37 -11
  64. package/lib/Signer.d.ts +14 -1
  65. package/lib/StorageHelper/cookieStorage.d.ts +13 -0
  66. package/lib/StorageHelper/cookieStorage.js +167 -0
  67. package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
  68. package/lib/StorageHelper/inMemoryStorage.js +82 -0
  69. package/lib/StorageHelper/index.d.ts +7 -3
  70. package/lib/StorageHelper/index.js +9 -1
  71. package/lib/StorageHelper/localStorage.d.ts +32 -0
  72. package/lib/StorageHelper/localStorage.js +114 -0
  73. package/lib/StorageHelper/reactnative.d.ts +71 -1
  74. package/lib/StorageHelper/reactnative.js +154 -10
  75. package/lib/StorageHelper/sessionStorage.d.ts +32 -0
  76. package/lib/StorageHelper/sessionStorage.js +114 -0
  77. package/lib/UniversalStorage/index.d.ts +2 -2
  78. package/lib/Util/BackgroundProcessManager.d.ts +2 -2
  79. package/lib/Util/BackgroundProcessManager.js +1 -0
  80. package/lib/Util/DateUtils.d.ts +12 -1
  81. package/lib/Util/Reachability.js +7 -5
  82. package/lib/Util/Reachability.native.d.ts +3 -2
  83. package/lib/Util/StringUtils.js +3 -10
  84. package/lib/Util/errors/AssertError.d.ts +2 -0
  85. package/lib/Util/errors/AssertError.js +11 -0
  86. package/lib/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  87. package/lib/clients/middleware/retry/defaultRetryDecider.js +17 -13
  88. package/lib/clients/middleware/retry/isClockSkewError.js +1 -1
  89. package/lib/clients/middleware/retry/middleware.d.ts +1 -1
  90. package/lib/clients/middleware/retry/middleware.js +13 -13
  91. package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
  92. package/lib/clients/serde/responseInfo.js +1 -1
  93. package/lib/clients/types/aws.d.ts +4 -0
  94. package/lib/clients/types/index.d.ts +1 -1
  95. package/lib/constants.d.ts +7 -0
  96. package/lib/constants.js +9 -1
  97. package/lib/index.d.ts +18 -4
  98. package/lib/index.js +32 -5
  99. package/lib/parseAWSExports.d.ts +1 -1
  100. package/lib/singleton/Auth/index.d.ts +30 -0
  101. package/lib/singleton/Auth/index.js +133 -0
  102. package/lib/singleton/Auth/types.d.ts +95 -0
  103. package/lib/singleton/Auth/types.js +6 -0
  104. package/lib/singleton/Auth/utils/index.d.ts +5 -0
  105. package/lib/singleton/Auth/utils/index.js +52 -0
  106. package/lib/singleton/Storage/types.d.ts +14 -0
  107. package/lib/singleton/Storage/types.js +4 -0
  108. package/lib/singleton/index.d.ts +46 -0
  109. package/lib/singleton/index.js +160 -0
  110. package/lib/singleton/types.d.ts +21 -0
  111. package/lib/singleton/types.js +4 -0
  112. package/lib/tsconfig.tsbuildinfo +1 -1
  113. package/lib/types/types.d.ts +31 -1
  114. package/lib/types/types.js +2 -0
  115. package/lib-esm/Amplify.d.ts +18 -17
  116. package/lib-esm/Amplify.js +9 -0
  117. package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +3 -10
  118. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
  119. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
  120. package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +3 -17
  121. package/lib-esm/AwsClients/Pinpoint/base.d.ts +2 -10
  122. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
  123. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +1 -1
  124. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +3 -17
  125. package/lib-esm/AwsClients/Pinpoint/putEvents.js +6 -0
  126. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
  127. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +2 -2
  128. package/lib-esm/Cache/AsyncStorageCache.d.ts +154 -0
  129. package/lib-esm/Cache/AsyncStorageCache.js +737 -0
  130. package/lib-esm/Cache/BrowserStorageCache.d.ts +166 -0
  131. package/lib-esm/Cache/BrowserStorageCache.js +466 -0
  132. package/lib-esm/Cache/InMemoryCache.d.ts +129 -0
  133. package/lib-esm/Cache/InMemoryCache.js +346 -0
  134. package/lib-esm/Cache/StorageCache.d.ts +39 -0
  135. package/lib-esm/Cache/StorageCache.js +118 -0
  136. package/lib-esm/Cache/Utils/CacheList.d.ts +89 -0
  137. package/lib-esm/Cache/Utils/CacheList.js +194 -0
  138. package/lib-esm/Cache/Utils/CacheUtils.d.ts +25 -0
  139. package/lib-esm/Cache/Utils/CacheUtils.js +81 -0
  140. package/lib-esm/Cache/Utils/index.d.ts +2 -0
  141. package/lib-esm/Cache/Utils/index.js +4 -0
  142. package/lib-esm/Cache/reactnative.d.ts +3 -0
  143. package/lib-esm/Cache/reactnative.js +6 -0
  144. package/lib-esm/Cache/types/Cache.d.ts +55 -0
  145. package/lib-esm/Cache/types/Cache.js +3 -0
  146. package/lib-esm/Cache/types/index.d.ts +1 -0
  147. package/lib-esm/Cache/types/index.js +3 -0
  148. package/lib-esm/ClientDevice/android.js +1 -0
  149. package/lib-esm/ClientDevice/ios.d.ts +2 -2
  150. package/lib-esm/ClientDevice/ios.js +1 -0
  151. package/lib-esm/ClientDevice/reactnative.js +1 -0
  152. package/lib-esm/Credentials.d.ts +1 -1
  153. package/lib-esm/Credentials.js +2 -1
  154. package/lib-esm/Errors.d.ts +19 -0
  155. package/lib-esm/Errors.js +49 -0
  156. package/lib-esm/Hub.js +1 -0
  157. package/lib-esm/I18n/I18n.d.ts +29 -9
  158. package/lib-esm/I18n/I18n.js +30 -5
  159. package/lib-esm/I18n/index.d.ts +18 -5
  160. package/lib-esm/I18n/index.js +35 -5
  161. package/lib-esm/I18n/types.d.ts +4 -1
  162. package/lib-esm/I18n/types.js +3 -0
  163. package/lib-esm/JS.d.ts +6 -6
  164. package/lib-esm/Logger/ConsoleLogger.d.ts +11 -11
  165. package/lib-esm/OAuthHelper/GoogleOAuth.js +2 -1
  166. package/lib-esm/Platform/detectFramework.js +2 -1
  167. package/lib-esm/Platform/detection/Next.d.ts +1 -1
  168. package/lib-esm/Platform/detection/React.js +1 -0
  169. package/lib-esm/Platform/version.d.ts +1 -1
  170. package/lib-esm/Platform/version.js +1 -1
  171. package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +2 -2
  172. package/lib-esm/Providers/AWSCloudWatchProvider.js +33 -10
  173. package/lib-esm/RNComponents/index.d.ts +1 -1
  174. package/lib-esm/RNComponents/reactnative.js +1 -0
  175. package/lib-esm/ServiceWorker/ServiceWorker.d.ts +4 -4
  176. package/lib-esm/ServiceWorker/ServiceWorker.js +37 -11
  177. package/lib-esm/Signer.d.ts +14 -1
  178. package/lib-esm/StorageHelper/cookieStorage.d.ts +13 -0
  179. package/lib-esm/StorageHelper/cookieStorage.js +141 -0
  180. package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
  181. package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
  182. package/lib-esm/StorageHelper/index.d.ts +7 -3
  183. package/lib-esm/StorageHelper/index.js +4 -0
  184. package/lib-esm/StorageHelper/localStorage.d.ts +32 -0
  185. package/lib-esm/StorageHelper/localStorage.js +111 -0
  186. package/lib-esm/StorageHelper/reactnative.d.ts +71 -1
  187. package/lib-esm/StorageHelper/reactnative.js +153 -9
  188. package/lib-esm/StorageHelper/sessionStorage.d.ts +32 -0
  189. package/lib-esm/StorageHelper/sessionStorage.js +111 -0
  190. package/lib-esm/UniversalStorage/index.d.ts +2 -2
  191. package/lib-esm/Util/BackgroundProcessManager.d.ts +2 -2
  192. package/lib-esm/Util/BackgroundProcessManager.js +1 -0
  193. package/lib-esm/Util/DateUtils.d.ts +12 -1
  194. package/lib-esm/Util/Reachability.js +5 -3
  195. package/lib-esm/Util/Reachability.native.d.ts +3 -2
  196. package/lib-esm/Util/StringUtils.js +3 -10
  197. package/lib-esm/Util/errors/AssertError.d.ts +2 -0
  198. package/lib-esm/Util/errors/AssertError.js +7 -0
  199. package/lib-esm/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  200. package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -13
  201. package/lib-esm/clients/middleware/retry/isClockSkewError.js +1 -1
  202. package/lib-esm/clients/middleware/retry/middleware.d.ts +1 -1
  203. package/lib-esm/clients/middleware/retry/middleware.js +13 -13
  204. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
  205. package/lib-esm/clients/serde/responseInfo.js +1 -1
  206. package/lib-esm/clients/types/aws.d.ts +4 -0
  207. package/lib-esm/clients/types/index.d.ts +1 -1
  208. package/lib-esm/constants.d.ts +7 -0
  209. package/lib-esm/constants.js +8 -0
  210. package/lib-esm/index.d.ts +18 -4
  211. package/lib-esm/index.js +15 -3
  212. package/lib-esm/parseAWSExports.d.ts +1 -1
  213. package/lib-esm/singleton/Auth/index.d.ts +30 -0
  214. package/lib-esm/singleton/Auth/index.js +129 -0
  215. package/lib-esm/singleton/Auth/types.d.ts +95 -0
  216. package/lib-esm/singleton/Auth/types.js +5 -0
  217. package/lib-esm/singleton/Auth/utils/index.d.ts +5 -0
  218. package/lib-esm/singleton/Auth/utils/index.js +45 -0
  219. package/lib-esm/singleton/Storage/types.d.ts +14 -0
  220. package/lib-esm/singleton/Storage/types.js +3 -0
  221. package/lib-esm/singleton/index.d.ts +46 -0
  222. package/lib-esm/singleton/index.js +156 -0
  223. package/lib-esm/singleton/types.d.ts +21 -0
  224. package/lib-esm/singleton/types.js +3 -0
  225. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  226. package/lib-esm/types/types.d.ts +31 -1
  227. package/lib-esm/types/types.js +2 -0
  228. package/package.json +38 -15
  229. package/src/Amplify.ts +9 -3
  230. package/src/AwsClients/CognitoIdentity/base.ts +2 -1
  231. package/src/AwsClients/CognitoIdentity/getCredentialsForIdentity.ts +13 -6
  232. package/src/AwsClients/Pinpoint/base.ts +6 -2
  233. package/src/AwsClients/Pinpoint/getInAppMessages.ts +1 -1
  234. package/src/AwsClients/Pinpoint/putEvents.ts +6 -0
  235. package/src/AwsClients/Pinpoint/updateEndpoint.ts +2 -2
  236. package/src/Cache/AsyncStorageCache.ts +500 -0
  237. package/src/Cache/BrowserStorageCache.ts +517 -0
  238. package/src/Cache/CHANGELOG.md +1227 -0
  239. package/src/Cache/InMemoryCache.ts +354 -0
  240. package/src/Cache/StorageCache.ts +157 -0
  241. package/src/Cache/Utils/CacheList.ts +198 -0
  242. package/src/Cache/Utils/CacheUtils.ts +92 -0
  243. package/src/Cache/Utils/index.ts +11 -0
  244. package/src/Cache/reactnative.ts +9 -0
  245. package/src/Cache/types/Cache.ts +75 -0
  246. package/src/Cache/types/index.ts +4 -0
  247. package/src/ClientDevice/android.ts +1 -1
  248. package/src/ClientDevice/ios.ts +2 -2
  249. package/src/ClientDevice/reactnative.ts +1 -1
  250. package/src/Credentials.ts +19 -17
  251. package/src/Errors.ts +41 -0
  252. package/src/Hub.ts +1 -0
  253. package/src/I18n/I18n.ts +40 -12
  254. package/src/I18n/index.ts +45 -12
  255. package/src/I18n/types.ts +3 -0
  256. package/src/JS.ts +24 -17
  257. package/src/Logger/ConsoleLogger.ts +10 -10
  258. package/src/OAuthHelper/FacebookOAuth.ts +2 -2
  259. package/src/OAuthHelper/GoogleOAuth.ts +9 -6
  260. package/src/Platform/detectFramework.ts +1 -1
  261. package/src/Platform/detection/React.ts +5 -3
  262. package/src/Platform/version.ts +1 -1
  263. package/src/Providers/AWSCloudWatchProvider.ts +39 -14
  264. package/src/RNComponents/index.ts +1 -1
  265. package/src/RNComponents/reactnative.ts +1 -1
  266. package/src/ServiceWorker/ServiceWorker.ts +58 -18
  267. package/src/Signer.ts +22 -3
  268. package/src/StorageHelper/cookieStorage.ts +99 -0
  269. package/src/StorageHelper/inMemoryStorage.ts +32 -0
  270. package/src/StorageHelper/index.ts +6 -1
  271. package/src/StorageHelper/localStorage.ts +60 -0
  272. package/src/StorageHelper/reactnative.ts +94 -14
  273. package/src/StorageHelper/sessionStorage.ts +60 -0
  274. package/src/Util/BackgroundProcessManager.ts +33 -9
  275. package/src/Util/DateUtils.ts +14 -5
  276. package/src/Util/Reachability.native.ts +3 -2
  277. package/src/Util/Reachability.ts +9 -7
  278. package/src/Util/Retry.ts +2 -1
  279. package/src/Util/StringUtils.ts +3 -10
  280. package/src/Util/errors/AssertError.ts +11 -0
  281. package/src/clients/handlers/fetch.ts +2 -2
  282. package/src/clients/middleware/retry/defaultRetryDecider.ts +12 -6
  283. package/src/clients/middleware/retry/isClockSkewError.ts +1 -1
  284. package/src/clients/middleware/retry/middleware.ts +9 -9
  285. package/src/clients/middleware/signing/middleware.ts +1 -1
  286. package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +1 -1
  287. package/src/clients/serde/responseInfo.ts +2 -1
  288. package/src/clients/types/aws.ts +10 -0
  289. package/src/clients/types/index.ts +1 -0
  290. package/src/constants.ts +16 -0
  291. package/src/global.d.ts +11 -0
  292. package/src/index.ts +66 -4
  293. package/src/parseAWSExports.ts +1 -1
  294. package/src/singleton/Auth/index.ts +113 -0
  295. package/src/singleton/Auth/types.ts +129 -0
  296. package/src/singleton/Auth/utils/index.ts +68 -0
  297. package/src/singleton/Storage/types.ts +21 -0
  298. package/src/singleton/index.ts +144 -0
  299. package/src/singleton/types.ts +48 -0
  300. package/src/types/types.ts +38 -1
package/lib/Hub.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
4
  // SPDX-License-Identifier: Apache-2.0
4
5
  var __assign = (this && this.__assign) || function () {
@@ -1,30 +1,42 @@
1
1
  import { I18nOptions } from './types';
2
2
  /**
3
- * Language transition class
3
+ * Language translation utility.
4
+ *
5
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
4
6
  */
5
7
  export declare class I18n {
6
8
  /**
7
9
  * @private
8
10
  */
9
- _options: I18nOptions;
11
+ _options: I18nOptions | null;
10
12
  /**
11
13
  * @private
12
14
  */
13
- _lang: any;
15
+ _lang?: string | null;
14
16
  /**
15
17
  * @private
16
18
  */
17
- _dict: {};
19
+ _dict: Record<string, any>;
18
20
  /**
19
21
  * @constructor
20
22
  * Initialize with configurations
21
23
  * @param {Object} options
24
+ *
25
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
22
26
  */
23
- constructor(options: I18nOptions);
27
+ constructor();
28
+ /**
29
+ * Sets the default language from the configuration when required.
30
+ *
31
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
32
+ */
33
+ setDefaultLanguage(): void;
24
34
  /**
25
35
  * @method
26
36
  * Explicitly setting language
27
37
  * @param {String} lang
38
+ *
39
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
28
40
  */
29
41
  setLanguage(lang: string): void;
30
42
  /**
@@ -32,28 +44,36 @@ export declare class I18n {
32
44
  * Get value
33
45
  * @param {String} key
34
46
  * @param {String} defVal - Default value
47
+ *
48
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
35
49
  */
36
- get(key: any, defVal?: any): any;
50
+ get(key: string, defVal?: string | undefined): any;
37
51
  /**
38
52
  * @method
39
53
  * Get value according to specified language
40
54
  * @param {String} key
41
55
  * @param {String} language - Specified langurage to be used
42
56
  * @param {String} defVal - Default value
57
+ *
58
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
43
59
  */
44
- getByLanguage(key: any, language: any, defVal?: any): any;
60
+ getByLanguage(key: string, language: string, defVal?: string | null): any;
45
61
  /**
46
62
  * @method
47
63
  * Add vocabularies for one language
48
64
  * @param {String} language - Language of the dictionary
49
65
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
66
+ *
67
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
50
68
  */
51
- putVocabulariesForLanguage(language: any, vocabularies: any): void;
69
+ putVocabulariesForLanguage(language: string, vocabularies: Record<string, any>): void;
52
70
  /**
53
71
  * @method
54
72
  * Add vocabularies for one language
55
73
  * @param {Object} vocabularies - Object that has language as key,
56
74
  * vocabularies of each language as value
75
+ *
76
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
57
77
  */
58
- putVocabularies(vocabularies: any): void;
78
+ putVocabularies(vocabularies: Record<string, any>): void;
59
79
  }
package/lib/I18n/I18n.js CHANGED
@@ -15,17 +15,22 @@ var __assign = (this && this.__assign) || function () {
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.I18n = void 0;
17
17
  var Logger_1 = require("../Logger");
18
+ var singleton_1 = require("../singleton");
18
19
  var logger = new Logger_1.ConsoleLogger('I18n');
19
20
  /**
20
- * Language transition class
21
+ * Language translation utility.
22
+ *
23
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
21
24
  */
22
25
  var I18n = /** @class */ (function () {
23
26
  /**
24
27
  * @constructor
25
28
  * Initialize with configurations
26
29
  * @param {Object} options
30
+ *
31
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
27
32
  */
28
- function I18n(options) {
33
+ function I18n() {
29
34
  /**
30
35
  * @private
31
36
  */
@@ -38,8 +43,18 @@ var I18n = /** @class */ (function () {
38
43
  * @private
39
44
  */
40
45
  this._dict = {};
41
- this._options = Object.assign({}, options);
42
- this._lang = this._options.language;
46
+ }
47
+ /**
48
+ * Sets the default language from the configuration when required.
49
+ *
50
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
51
+ */
52
+ I18n.prototype.setDefaultLanguage = function () {
53
+ if (!this._lang) {
54
+ var i18nConfig = singleton_1.AmplifyV6.getConfig().I18n;
55
+ this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
56
+ }
57
+ // Default to window language if not set in config
43
58
  if (!this._lang &&
44
59
  typeof window !== 'undefined' &&
45
60
  window &&
@@ -47,11 +62,13 @@ var I18n = /** @class */ (function () {
47
62
  this._lang = window.navigator.language;
48
63
  }
49
64
  logger.debug(this._lang);
50
- }
65
+ };
51
66
  /**
52
67
  * @method
53
68
  * Explicitly setting language
54
69
  * @param {String} lang
70
+ *
71
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
55
72
  */
56
73
  I18n.prototype.setLanguage = function (lang) {
57
74
  this._lang = lang;
@@ -61,6 +78,8 @@ var I18n = /** @class */ (function () {
61
78
  * Get value
62
79
  * @param {String} key
63
80
  * @param {String} defVal - Default value
81
+ *
82
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
64
83
  */
65
84
  I18n.prototype.get = function (key, defVal) {
66
85
  if (defVal === void 0) { defVal = undefined; }
@@ -86,6 +105,8 @@ var I18n = /** @class */ (function () {
86
105
  * @param {String} key
87
106
  * @param {String} language - Specified langurage to be used
88
107
  * @param {String} defVal - Default value
108
+ *
109
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
89
110
  */
90
111
  I18n.prototype.getByLanguage = function (key, language, defVal) {
91
112
  if (defVal === void 0) { defVal = null; }
@@ -103,6 +124,8 @@ var I18n = /** @class */ (function () {
103
124
  * Add vocabularies for one language
104
125
  * @param {String} language - Language of the dictionary
105
126
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
127
+ *
128
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
106
129
  */
107
130
  I18n.prototype.putVocabulariesForLanguage = function (language, vocabularies) {
108
131
  var lang_dict = this._dict[language];
@@ -116,6 +139,8 @@ var I18n = /** @class */ (function () {
116
139
  * Add vocabularies for one language
117
140
  * @param {Object} vocabularies - Object that has language as key,
118
141
  * vocabularies of each language as value
142
+ *
143
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
119
144
  */
120
145
  I18n.prototype.putVocabularies = function (vocabularies) {
121
146
  var _this = this;
@@ -1,5 +1,8 @@
1
+ import { I18nOptions } from './types';
1
2
  /**
2
3
  * Export I18n APIs
4
+ *
5
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
3
6
  */
4
7
  export declare class I18n {
5
8
  /**
@@ -8,42 +11,52 @@ export declare class I18n {
8
11
  * Configure I18n part
9
12
  * @param {Object} config - Configuration of the I18n
10
13
  */
11
- static configure(config: any): any;
14
+ static configure(config: Record<string, any>): I18nOptions;
12
15
  static getModuleName(): string;
13
16
  /**
14
17
  * @static
15
18
  * @method
16
19
  * Create an instance of I18n for the library
20
+ *
21
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
17
22
  */
18
23
  static createInstance(): void;
19
24
  /**
20
25
  * @static @method
21
26
  * Explicitly setting language
22
27
  * @param {String} lang
28
+ *
29
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
23
30
  */
24
- static setLanguage(lang: any): any;
31
+ static setLanguage(lang: string): void;
25
32
  /**
26
33
  * @static @method
27
34
  * Get value
28
35
  * @param {String} key
29
36
  * @param {String} defVal - Default value
37
+ *
38
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
30
39
  */
31
- static get(key: any, defVal?: any): any;
40
+ static get(key: string, defVal?: string): any;
32
41
  /**
33
42
  * @static
34
43
  * @method
35
44
  * Add vocabularies for one language
36
45
  * @param {String} langurage - Language of the dictionary
37
46
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
47
+ *
48
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
38
49
  */
39
- static putVocabulariesForLanguage(language: any, vocabularies: any): any;
50
+ static putVocabulariesForLanguage(language: string, vocabularies: Record<string, string>): void;
40
51
  /**
41
52
  * @static
42
53
  * @method
43
54
  * Add vocabularies for one language
44
55
  * @param {Object} vocabularies - Object that has language as key,
45
56
  * vocabularies of each language as value
57
+ *
58
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
46
59
  */
47
- static putVocabularies(vocabularies: any): any;
60
+ static putVocabularies(vocabularies: Record<string, string>): void;
48
61
  static checkConfig(): boolean;
49
62
  }
package/lib/I18n/index.js CHANGED
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.I18n = void 0;
6
6
  var I18n_1 = require("./I18n");
7
7
  var Logger_1 = require("../Logger");
8
- var Amplify_1 = require("../Amplify");
8
+ var AssertError_1 = require("../Util/errors/AssertError");
9
+ var constants_1 = require("../constants");
9
10
  var logger = new Logger_1.ConsoleLogger('I18n');
10
- var _config = null;
11
+ var _config = { language: null };
11
12
  var _i18n = null;
12
13
  /**
13
14
  * Export I18n APIs
15
+ *
16
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
14
17
  */
15
18
  var I18n = /** @class */ (function () {
16
19
  function I18n() {
@@ -37,21 +40,29 @@ var I18n = /** @class */ (function () {
37
40
  * @static
38
41
  * @method
39
42
  * Create an instance of I18n for the library
43
+ *
44
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
40
45
  */
41
46
  I18n.createInstance = function () {
42
47
  logger.debug('create I18n instance');
43
48
  if (_i18n) {
44
49
  return;
45
50
  }
46
- _i18n = new I18n_1.I18n(_config);
51
+ _i18n = new I18n_1.I18n();
47
52
  };
48
53
  /**
49
54
  * @static @method
50
55
  * Explicitly setting language
51
56
  * @param {String} lang
57
+ *
58
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
52
59
  */
53
60
  I18n.setLanguage = function (lang) {
54
61
  I18n.checkConfig();
62
+ (0, AssertError_1.asserts)(!!_i18n, {
63
+ name: constants_1.I18N_EXCEPTION,
64
+ message: 'I18N is not configured',
65
+ });
55
66
  return _i18n.setLanguage(lang);
56
67
  };
57
68
  /**
@@ -59,11 +70,17 @@ var I18n = /** @class */ (function () {
59
70
  * Get value
60
71
  * @param {String} key
61
72
  * @param {String} defVal - Default value
73
+ *
74
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
62
75
  */
63
76
  I18n.get = function (key, defVal) {
64
77
  if (!I18n.checkConfig()) {
65
78
  return typeof defVal === 'undefined' ? key : defVal;
66
79
  }
80
+ (0, AssertError_1.asserts)(!!_i18n, {
81
+ name: constants_1.I18N_EXCEPTION,
82
+ message: 'I18N is not configured',
83
+ });
67
84
  return _i18n.get(key, defVal);
68
85
  };
69
86
  /**
@@ -72,9 +89,15 @@ var I18n = /** @class */ (function () {
72
89
  * Add vocabularies for one language
73
90
  * @param {String} langurage - Language of the dictionary
74
91
  * @param {Object} vocabularies - Object that has key-value as dictionary entry
92
+ *
93
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
75
94
  */
76
95
  I18n.putVocabulariesForLanguage = function (language, vocabularies) {
77
96
  I18n.checkConfig();
97
+ (0, AssertError_1.asserts)(!!_i18n, {
98
+ name: constants_1.I18N_EXCEPTION,
99
+ message: 'I18N is not configured',
100
+ });
78
101
  return _i18n.putVocabulariesForLanguage(language, vocabularies);
79
102
  };
80
103
  /**
@@ -83,18 +106,25 @@ var I18n = /** @class */ (function () {
83
106
  * Add vocabularies for one language
84
107
  * @param {Object} vocabularies - Object that has language as key,
85
108
  * vocabularies of each language as value
109
+ *
110
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
86
111
  */
87
112
  I18n.putVocabularies = function (vocabularies) {
88
113
  I18n.checkConfig();
114
+ (0, AssertError_1.asserts)(!!_i18n, {
115
+ name: constants_1.I18N_EXCEPTION,
116
+ message: 'I18N is not configured',
117
+ });
89
118
  return _i18n.putVocabularies(vocabularies);
90
119
  };
91
120
  I18n.checkConfig = function () {
92
121
  if (!_i18n) {
93
- _i18n = new I18n_1.I18n(_config);
122
+ I18n.createInstance();
94
123
  }
95
124
  return true;
96
125
  };
97
126
  return I18n;
98
127
  }());
99
128
  exports.I18n = I18n;
100
- Amplify_1.Amplify.register(I18n);
129
+ // Create an instance of I18n in the static class
130
+ I18n.createInstance();
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
3
+ */
1
4
  export declare class I18nOptions {
2
- language: any;
5
+ language: null;
3
6
  }
package/lib/I18n/types.js CHANGED
@@ -3,6 +3,9 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.I18nOptions = void 0;
6
+ /**
7
+ * @deprecated The I18n utility is on a deprecation path and will be removed in a future version of Amplify.
8
+ */
6
9
  var I18nOptions = /** @class */ (function () {
7
10
  function I18nOptions() {
8
11
  this.language = null;
package/lib/JS.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export declare const isEmpty: (obj?: {}) => boolean;
2
- export declare const sortByField: (list: any, field: any, dir: any) => boolean;
3
- export declare const objectLessAttributes: (obj: any, less: any) => any;
4
- export declare const filenameToContentType: (filename: any, defVal?: string) => string;
5
- export declare const isTextFile: (contentType: any) => boolean;
2
+ export declare const sortByField: (list: any[], field: string | number, dir: string) => boolean;
3
+ export declare const objectLessAttributes: (obj: Record<string, any>, less: string | string[]) => Record<string, any>;
4
+ export declare const filenameToContentType: (filename: string, defVal?: string) => string;
5
+ export declare const isTextFile: (contentType: string) => boolean;
6
6
  export declare const generateRandomString: () => string;
7
7
  export declare const makeQuerablePromise: (promise: any) => any;
8
8
  export declare const isWebWorker: () => boolean;
@@ -16,14 +16,14 @@ export declare const browserOrNode: () => {
16
16
  * @param {Array} whiteListForItself - whitelist itself from being transferred
17
17
  * @param {Array} whiteListForChildren - whitelist its children keys from being transferred
18
18
  */
19
- export declare const transferKeyToLowerCase: (obj: any, whiteListForItself?: any[], whiteListForChildren?: any[]) => any;
19
+ export declare const transferKeyToLowerCase: (obj: Record<string, any>, whiteListForItself?: string[], whiteListForChildren?: string[]) => Record<string, any>;
20
20
  /**
21
21
  * transfer the first letter of the keys to lowercase
22
22
  * @param {Object} obj - the object need to be transferred
23
23
  * @param {Array} whiteListForItself - whitelist itself from being transferred
24
24
  * @param {Array} whiteListForChildren - whitelist its children keys from being transferred
25
25
  */
26
- export declare const transferKeyToUpperCase: (obj: any, whiteListForItself?: any[], whiteListForChildren?: any[]) => any;
26
+ export declare const transferKeyToUpperCase: (obj: Record<string, any>, whiteListForItself?: string[], whiteListForChildren?: string[]) => Record<string, any>;
27
27
  /**
28
28
  * Return true if the object is a strict object
29
29
  * which means it's not Array, Function, Number, String, Boolean or Null
@@ -15,16 +15,16 @@ export declare class ConsoleLogger implements Logger {
15
15
  name: string;
16
16
  level: LOG_TYPE | string;
17
17
  private _pluggables;
18
- private _config;
18
+ private _config?;
19
19
  /**
20
20
  * @constructor
21
21
  * @param {string} name - Name of the logger
22
22
  */
23
23
  constructor(name: string, level?: LOG_TYPE | string);
24
- static LOG_LEVEL: any;
25
- _padding(n: any): string;
24
+ static LOG_LEVEL: null;
25
+ _padding(n: number): string;
26
26
  _ts(): string;
27
- configure(config?: object): object;
27
+ configure(config?: object): object | undefined;
28
28
  /**
29
29
  * Write log
30
30
  * @method
@@ -32,49 +32,49 @@ export declare class ConsoleLogger implements Logger {
32
32
  * @param {LOG_TYPE|string} type - log type, default INFO
33
33
  * @param {string|object} msg - Logging message or object
34
34
  */
35
- _log(type: LOG_TYPE | string, ...msg: any[]): void;
35
+ _log(type: LOG_TYPE | string, ...msg: any): void;
36
36
  /**
37
37
  * Write General log. Default to INFO
38
38
  * @method
39
39
  * @memeberof Logger
40
40
  * @param {string|object} msg - Logging message or object
41
41
  */
42
- log(...msg: any[]): void;
42
+ log(...msg: any): void;
43
43
  /**
44
44
  * Write INFO log
45
45
  * @method
46
46
  * @memeberof Logger
47
47
  * @param {string|object} msg - Logging message or object
48
48
  */
49
- info(...msg: any[]): void;
49
+ info(...msg: any): void;
50
50
  /**
51
51
  * Write WARN log
52
52
  * @method
53
53
  * @memeberof Logger
54
54
  * @param {string|object} msg - Logging message or object
55
55
  */
56
- warn(...msg: any[]): void;
56
+ warn(...msg: any): void;
57
57
  /**
58
58
  * Write ERROR log
59
59
  * @method
60
60
  * @memeberof Logger
61
61
  * @param {string|object} msg - Logging message or object
62
62
  */
63
- error(...msg: any[]): void;
63
+ error(...msg: any): void;
64
64
  /**
65
65
  * Write DEBUG log
66
66
  * @method
67
67
  * @memeberof Logger
68
68
  * @param {string|object} msg - Logging message or object
69
69
  */
70
- debug(...msg: any[]): void;
70
+ debug(...msg: any): void;
71
71
  /**
72
72
  * Write VERBOSE log
73
73
  * @method
74
74
  * @memeberof Logger
75
75
  * @param {string|object} msg - Logging message or object
76
76
  */
77
- verbose(...msg: any[]): void;
77
+ verbose(...msg: any): void;
78
78
  addPluggable(pluggable: LoggingProvider): void;
79
79
  listPluggables(): LoggingProvider[];
80
80
  }
@@ -109,7 +109,8 @@ var GoogleOAuth = /** @class */ (function () {
109
109
  res({ token: id_token, expires_at: expires_at });
110
110
  })
111
111
  .catch(function (err) {
112
- if (err && err.error === 'network_error') {
112
+ if (err &&
113
+ err.error === 'network_error') {
113
114
  // Not using NonRetryableError so handler will be retried
114
115
  rej('Network error reloading google auth response');
115
116
  }
@@ -14,6 +14,7 @@ var SSR_RESET_TIMEOUT = 10; // ms
14
14
  var WEB_RESET_TIMEOUT = 10; // ms
15
15
  var PRIME_FRAMEWORK_DELAY = 1000; // ms
16
16
  var detectFramework = function () {
17
+ var _a;
17
18
  if (!frameworkCache) {
18
19
  frameworkCache = (0, detection_1.detect)();
19
20
  if (resetTriggered) {
@@ -22,7 +23,7 @@ var detectFramework = function () {
22
23
  // So we don't need to notify the observers again so the observer
23
24
  // can be removed after the final notice.
24
25
  while (exports.frameworkChangeObservers.length) {
25
- exports.frameworkChangeObservers.pop()();
26
+ (_a = exports.frameworkChangeObservers.pop()) === null || _a === void 0 ? void 0 : _a();
26
27
  }
27
28
  }
28
29
  else {
@@ -1,2 +1,2 @@
1
- export declare function nextWebDetect(): boolean;
1
+ export declare function nextWebDetect(): any;
2
2
  export declare function nextSSRDetect(): boolean;
@@ -22,3 +22,4 @@ function reactSSRDetect() {
22
22
  !!Object.keys(process.env).find(function (key) { return key.includes('react'); }));
23
23
  }
24
24
  exports.reactSSRDetect = reactSSRDetect;
25
+ // use the some
@@ -1 +1 @@
1
- export declare const version = "5.3.8";
1
+ export declare const version = "6.0.1-console-preview.7919075.0+7919075";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '5.3.8';
5
+ exports.version = '6.0.1-console-preview.7919075.0+7919075';
@@ -3,10 +3,10 @@ import { AWSCloudWatchProviderOptions, LoggingProvider } from '../types/types';
3
3
  declare class AWSCloudWatchProvider implements LoggingProvider {
4
4
  static readonly PROVIDER_NAME = "AWSCloudWatch";
5
5
  static readonly CATEGORY = "Logging";
6
- private _config;
6
+ private _config?;
7
7
  private _dataTracker;
8
8
  private _currentLogBatch;
9
- private _timer;
9
+ private _timer?;
10
10
  private _nextSequenceToken;
11
11
  constructor(config?: AWSCloudWatchProviderOptions);
12
12
  getProviderName(): string;